Awesome, transplant RTOS on 51

14938403:

previous article

STC's official website is an alchemy furnace that I will never forget

There is a big guy commenting

935feab4d959410d1a5764e2e2d577e0.png

So, take this opportunity to show you the code he wrote

https://gitee.com/open-ell/freertos

The file directory is my favorite style, bsp obviously knows what it does

9dcdb7a9ced739991f0699c868b257ef.png

The following is the overall introduction of the project

FreeRTOS for MCS-251

FreeRTOS support for MCS-251 (STC32G series)

Instructions for use

The currently ported FreeRTOS version supports STC32G's larg-ROM and huge-ROM versions

To switch the configuration method of larg-ROM:

1. Configure configUSE_ROMHUGE to 0 in FreeRTOSConfig.h

2. Click the Keil project configuration button [Options for Target]

3. Click [Target] -> [Code Rom Size] -> Larg mode

4. Click [Target] -> [C251] -> [Define] and enter configSUPPORT_MCS251

5. Click [Target] -> [C251] -> [Level] to select level 4

6. Click【Target】->【C251】check Link Code

7. Click【Target】->【C251】check Generate reentrant

To switch the configuration mode of Huge-ROM:

1. Configure configUSE_ROMHUGE to 1 in FreeRTOSConfig.h

2. Click the Keil project configuration button [Options for Target]

3. Click [Target] -> [Code Rom Size] -> Huge mode

3. Click【Target】->【Exeternal Memory】->【ROM】Start address: 0xFE2000 Size: 0x1E000

4. Click [Target] -> [C251] -> [Define] and enter configSUPPORT_MCS251

5. Click [Target] -> [C251] -> [Level] to select level 4

6. Click【Target】->【C251】check Link Code

7. Click【Target】->【C251】check Generate reentrant

port.c is the porting interface, and the comments are written in English, in order to keep the font code compatible.

For the convenience of reading and learning, it is mainly written in C language, but this is not the optimal solution, and assembly can also be used for optimization.

The current scheme, at 35M speed:

The task switching speed takes about 10us. Using assembly optimization, it can reach about 5~8us.

The default system clock is 24M, you can adjust it according to your needs.

If you want to start software simulation, you need to do the following:

Click the Keil project configuration button [Options for Target] -> [Target] -> [C251] -> [Define] and enter `__SOFT_DEBUG__` (be careful not to delete configSUPPORT_MCS251)

After software emulation is enabled, it cannot run on real hardware.

Participate in contribution

1. Please join the QQ group: 1001220381

2. Fork this warehouse

3. Create a new Feat_xxx branch

4. Submit the code

5. Create a new Pull Request


Due to time constraints, I didn't interview this little friend well. It is indeed very meaningful to see what he does, whether it is for my own technical development or for learning from others.

After working for many years, I always hear people say that this is easy and that is easy. I always feel that what I do is difficult, and what others do is far behind. Embedded in each subdivision direction is Whether it is difficult to dig deeper should be left to professional people to evaluate. Being able to complete such a project is convincing enough in itself.

Guess you like

Origin blog.csdn.net/weiqifa0/article/details/129964719
51
51