How to update the FreeRTOSConfig.h from an old demo to the latest FreeRTOS version?

Hi all,

I’m a FreeRTOS starter.
I’d like to run the latest FreeRTOS (V10.3.1) on my TIVA Launchpad (TM4C123GH6PM).
I’m using the TI CCS (V10.0.0.00010) with the TI compiler (TI v20.2.1.LTS).
I’m reading the guide Mastering the FreeRTOS… and I understood the basic directory structure for a project using FreeRTOS.
I understood that the configuration file (FreeRTOSConfig.h) needs to be fetch from the demo.
I think that the closest demo to my platform is the CORTEX_LM3Sxxxx_Eclipse, then I get the FreeRTOS V8.2.3 and its demo.

Since this is a quite old demo I was wondering if this configuration file needs to be “modernized” to be 10.3.x compliant.
For sure I have to update the configCPU_CLOCK_HZ to be aligned with the mine. I thought to replace that line as:

#define configCPU_CLOCK_HZ (SysCtlClockGet())

What are the next steps to optimize the configuration?

I think that the stack size should be sized accordingly with the application. What is the procedure to find out this? Is the value provided by the demo fine to make a simple demo on my board?

#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 80 )

What about the HEAP?
The guide reports: Projects that use a FreeRTOS version older than V9.0.0 must include a heap memory manager. From FreeRTOS V9.0.0 a heap memory manager is only required if configSUPPORT_DYNAMIC_ALLOCATION is set to 1 in FreeRTOSConfig.h, or if configSUPPORT_DYNAMIC_ALLOCATION is left undefined.

Of course I’d like to benefit of this “automatic mechanism”, so how should I updated the configuration?

Something more to suggest me?

For completeness:
Because the demo project is very different from the board that I have, I decided to make a project “ex-novo”:

  1. I made a new CCS project;
  2. then I added the FreeRTOS files following the structure explained in the guide using the links instead of copying the files into the project directory (under the FreeRTOS folder) - I followed this guide;
  3. finally I added the FreeRTOSConfig.h in the root project directory.
    Of course I added the FreeRTOS and TIVAWARE paths to the compiler project and I’ve been able to compile it.

The image below shows the final project structure.
FreeRTOSProjectStructure

Regards,
AGA

Any configuration items added since FreeRTOS V8.2.3 will default to a value that maintains backward compatibility, so I don’t think you will have to add anything to the file manually. There is a FreeRTOSConfig.h for another TI Cortex-M4 chip that builds with CCS here: https://github.com/FreeRTOS/FreeRTOS/blob/master/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/FreeRTOSConfig.h

This sets the size of the stack used by the Idle task - but the constant is also used by many of the demo applications (to make them portable across devices). You may want to increase the size to start with. Also turn on stack overflow checking to be sure. That is done using the setting shown here: https://github.com/FreeRTOS/FreeRTOS/blob/master/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/FreeRTOSConfig.h#L100

To get up and running I should just stick to using dynamic memory allocation as it is simpler. You can include FreeRTOS/Source/portable/heap_4.c in your build and just use whatever value configTOTAL_HEAP_SIZE is set to in your FreeRTOSConfig.h file. Defining a malloc failed hook will let you know if you run out of heap. You can convert to using static memory allocation later by setting configSUPPORT_STATIC_ALLOCATION to 1 in FreeRTOSConfig.h (if it is not defined it will default to 0).

Hi Richard,

first of all, I’m honoured that I’ve been answered by the FreeRTOS’s creator! :blush:

Thanks for your answers.
I did as you suggested and yes I can compile and start the scheduler, although I end-up stuck into the HardFault handler.
I’ll search for this issue into the forum and eventually I’ll open a new topic.

Kind regards,
AGA