FreeRTOS Lecture 18-Creating FreeRTOS based project for STM32 MCUs Part-4

 

Creating FreeRTOS based project for STM32 MCUs Part-4 

 

 

Now let’s integrate the 3rd party code into the project in the IDE.

Steps:

1. Right-click over your project and click refresh (Figure 1).

Refreshing the project
Figure 1. Refreshing the project.

 

Now in Figure 2, you can see that the Third-Party folder that you created in your workspace is appearing in the project also.

Third-Party folder added into the project
Figure 2. Third-Party folder added into the project.

 

2. Browse that Third-Party folder (Figure 3). You can see the FreeRTOS that you created, org, source and license. In source, you have include and portable. In portable, you have GCC, which contains ARM_CM4F, port.c, macro.h, and you also have Mem management containing heap_4.c.

Contents of Third-Party folder
Figure 3. Contents of Third-Party folder.

 

3. Select the Third-Party and go to the properties, as shown in Figure 4.

Checking properties for Third-Party
Figure 4. Checking properties for Third-Party.

 

This is a very important step you should follow. Go to C and C++ build, uncheck exclude resource from build option shown in Figure 5. After that, apply the changes and click ok.

Unchecking exclude resource from build option
Figure 5. Unchecking exclude resource from build option.

 

4. Now you have successfully included the FreeRTOS codes into your project. But only this much is not sufficient because if you try to build your project (Figure 6), there will be lots of errors (Figure 7).

Creating FreeRTOS based project for STM32 MCUs Part-4
Figure 6. Building the project.

 

Creating FreeRTOS based project for STM32 MCUs Part-4
Figure 7. Errors occurred while building the project.

 

5. Now let’s analyze the errors one by one. It actually tried to compile the FreeRTOS related codes like port.c. But it met with an error like FreeRTOS.h is not found, i.e., no such file or directory error. Then it tried to compile various others. Basically, the eclipse is not able to find out the FreeRTOS related header files. Now you have to tell FreeRTOS where exactly our FreeRTOS related header files are present. The FreeRTOS related header files are present in the source include. So, you have to tell this path to the eclipse. To do this, right-click over the project and then click on properties. After that, expand the C/C++ build, go to settings. Figure 8 shows your project settings. That means the settings related to the compiler, linker, other things like assembler, etc.

Creating FreeRTOS based project for STM32 MCUs Part-4
Figure 8. Project settings.

 

We are interested in the MCU GCC compiler. So, just click over that and then go to includes (Figure 9). Then click over the plus option marked in Figure 10 in order to include a path. After that, you will get a pop-up shown in Figure 11. Click on the workspace to select the path from the workspace. Now expand your project, go to Third-party, go to org, go to the source, and then include (Figure 12). This path you have to mention since it contains FreeRTOS header files. Click ok.

Creating FreeRTOS based project for STM32 MCUs Part-4
Figure 9. MCU GCC compiler\ includes.

 

Creating FreeRTOS based project for STM32 MCUs Part-4
Figure 10. Option to include the path.

 

Creating FreeRTOS based project for STM32 MCUs Part-4
Figure 11. Option to select the path from the workspace.

 

Creating FreeRTOS based project for STM32 MCUs Part-4
Figure 12. Path for FreeRTOS header files.

 

The selected path is added, as shown in Figure 13. Click ok. After that, click apply and then yes (Figure 14).

Creating FreeRTOS based project for STM32 MCUs Part-4
Figure 13. Selected path.

 

Creating FreeRTOS based project for STM32 MCUs Part-4
Figure 14. Applying the changes.

 

6. After that, again click add (Figure 10), workspace (Figure 11). Remember that some header files are available in include and also there is one header file in portable. So, let’s explore that. Expand portable, expand GCC, and then ARM_CM4F. There are actually two files in ARM_CM4F. One is a port.c, and another is portmacro.h. That’s why you have to include the path shown in Figure 15 as well.

Creating FreeRTOS based project for STM32 MCUs Part-4
Figure 15. Path for header file in the portable.

 

7. Now you successfully included two paths (Figure 16). After that, click apply and then click yes and ok (Figure 17).

Creating FreeRTOS based project for STM32 MCUs Part-4
Figure 16. Added paths.

 

Creating FreeRTOS based project for STM32 MCUs Part-4
Figure 17. Applying changes.

 

8. Try to build the project again. There is one more error (Figure 18). Now it’s time for us to include FreeRTOSConfig.h.

Creating FreeRTOS based project for STM32 MCUs Part-4
Figure 18. Error occurred while building the project.

 

FastBit Embedded Brain Academy Courses

Click here: https://fastbitlab.com/course1

 

FastBitLab

The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.