Breaking News
Home / How To / Setting FreeRTOS from scraper on STM32F407 Discovery Kit: 14 steps

Setting FreeRTOS from scraper on STM32F407 Discovery Kit: 14 steps



Choosing FreeRTOS as a real-time operating system for your embedded project is a good choice. FreeRTOS is truly free and provides many simple and effective RTOS features. But it can be difficult to set up freeRTOS from the start or I can say a bit confusing because it requires some customization like adding specific files for Microcontroller, setting page file paths, etc. ] FreeRTOS on your STM32F407 Discovery kit in detail with the Kiel uVision IDE.

Accessories:

Teacher's Notes

Teacher! Did you use this instructively in your classroom?
Add a teacher's note to share how you incorporated it into your lesson.

Step 1: Open Keil UVision IDE

Open Keil uVision IDE. Click on a project select New uVision project … Then select your work directory and give your desired project name.

Step 2: Select device

After you have named the project, you must add device in the next step. Here we add STM32F407VG Micron controller from STMicroelectronics. Select STM32F407VG, and then click OK .

Step 3: Manage runtime environment

Step 4: Copy FreeRTOS to your project folder

Now you have to copy the entire FreeRTOS- folder to your project folder .

Step 5: Add FreeRTOS files to project

After copying FreeRTOS files folder in your project folder, you need to add all the necessary FreeRTOS files to your project.

  1. In Keil, select Target1, right-click and then select Add new group . Rename this group as FreeRTOS.
  2. Now click on the FreeRTOS group, right click on select Add existing files to the group "FreeRTOS …"
  3. Add all the FreeRTOS files shown in the image above.

The path to finding these files in the FreeRTOS folder is:

  • Files: croutine, event_groups, list, queue, stream_buffer, tasks and timers . Path: (…. FreeRTOSv10.2.1 FreeRTOS Source)
  • Files: heap_4 (There are four memory management files added to one) . Path: (…. FreeRTOSv10.2.1 FreeRTOS Source portable MemMang)
  • Files: port.c (This is an MCU specific file) . Path: (… FreeRTOSv10.2.1 FreeRTOS Source portable RVDS ARM_CM4F)

Note: The FreeRTOS version is subject to change. Use only the latest version available.

Step 6: Configure the Path for FreeRTOS Master Files

Step 7: Add "FreeRTOSConfig.h" file to project

FreeRTOS has an important main file called FreeRTOSConfig.h . This file contains application-specific (in our case specific to Cortex M4F MCU) customization. For simplicity's sake, I've copied our MCU-specific FreeRTOSConfig.h file into the RVDS directory. And even in step 6, we have already added the RVDS route. If you are adding it yourself, you must add this file to your project and also make sure you include the path for this file explained in step 6.

Incase to add FreeRTOSConfig.h file of yourself in your desired directory, I have included this file below.

For more information Click here FreeRTOSConfig.h

Attachments

Step 8: Add to the "main.c" file with the master template

  • Now create a new User group (I renamed it to " User Application ").
  • Add a new C file to this group (I have added a file named main.c ).
  • This is the file where the main () function is located. I have included all the necessary functions and headings in this file so that the project can be compiled.

You will find the file main.c with basic template below.

Attachments

Step 9: Connect your STM32F407 Discovery Kit to your PC / Laptop [19659011] Picture of Connect your STM32F407 Discovery Kit to your PC / Laptop "src =" https://content.instructables.com/FJ6/X1WL/K2CGD2PG/FJ6X1WLK2CGD2PG.LARGE.jpg?auto=webp&&frame=1&width=1024&fit 5644 "height =" 3689 “/>

Step 10: Select ST-Link Debugger in Compiler Configuration

Right-click Target1 then click on Target Options "Target1 ..", then navigate to Debug Tab and Select ST-Link-Debugger shown in the image above

Step 11: Configure ST-Link Debugger

After selecting ST-Link Debugger in step 10, click Settings then select Track and check all the fields shown in the image above.

Step 12: Build and Upload the Code

After completing all steps build project [19459] make sure there are no errors in the code. After successful compilation upload the code to your Discovery Kit.

Step 13: Go to troubleshooting window and open serial monitor

After upload, go to troubleshooting window – -> view -> Serial Windows -> Debug (printf) Viewer shown in the image above.

Step 14: Run the code to see the Ouput on Debug Printf window

is to run the code shown in the image to see the output in the printf window. Here main.c I have implemented two simple tasks called task1 and task2 . Both tasks have the same priority and they only print the name of the task. Because of the same priorities, you can see both running and printing the name.

Be the first to share

Recommendations

  • Made with Math Contest

      Made with Math Contest

  • Multi-Discipline Contest

      Multi-Discipline Contest

  • Robotics Contest [RoboticsContest”/>


Source link