STM32 and FreeRTOS

kittbennts wrote on Sunday, March 10, 2013:


I have a problem with the CORTEX_STM32F103_IAR Demo example of FreeRTOS.
The OS works well , however the low level packages are dirrerent from the samples that ST Semiconductor has published.
For example, the file stm32f10x_can is different in the FreeRTOS example from the Original ST examples.
The problem is that I can’t add to the free RTOS project the periphery level files from ST examples(the functions are different).

Is it possible to get a Demo CORTEX_STM32F103_IAR  that based on the last ST template?
Can you please advice?


kittbennts wrote on Sunday, March 10, 2013:

The  CORTEX_STM32F103_IAR Demo ST BSP files is from 2006, the new ST BSP files is from 2011.


rtel wrote on Sunday, March 10, 2013:

Originally library files were stored in a ‘common’ area so demo projects referenced a core set of files that could be easily updated - however as the number of demos grew that soon proved unworkable.  Now a fix baseline of drivers is included directly in the demo directory so a demo is guaranteed to work as provided.

The FreeRTOS files can be used with any STM32 project though - the core files do not make use of any library functions (and in fact work on all Cortex-M devices, be they STM32 or not).  Only the demos use the driver libraries.


kittbennts wrote on Sunday, March 10, 2013:

The Demo works fine, but if I want to look forward, to build a project with more peripheries (ADC,CAN,UARTS,INT,IIC,SPI etc), I will have problems avery time I will try to use the new ST examples.

Is it possible to add the FREERTOS files to an old project? I tried but it didn’t work :slight_smile:

jdurand wrote on Sunday, March 10, 2013:

I do that all the time.  You have to be careful to update EVERYTHING having to do with FreeRTOS. 

I’m using Code Red tools (gcc based) and in my case that’s everything in my FreeRTOS folder under SRC as well as the FreeRTOSConfig.h and cr_startup_lpc… that are in with the main files.

I copy the new FreeRTOSConfig.h file over and then change the settings to match the old one.

I leave the old cr_startup file there but compare it to the new one to see if there’s anything I need to change.  I do this because the demo files are normally for an older version of the tools than I use and they may also have things defined like interrupt vectors that are for a specific demo but I need them at the default handler or something else.

kittbennts wrote on Monday, March 11, 2013:

Thank you very much.

I tried to add the FreeRTOS files to the STM32 old project, but when it runs it generates a reset when it goes to the assembler function:

/* Use the NVIC offset register to locate the stack. */
ldr r0, =0xE000ED08
ldr r0,
ldr r0,
/* Set the msp back to the start of the stack. */
msr msp, r0
/* Call SVC to start the first task. */
cpsie i
svc 0


Can you please advice?

rtel wrote on Monday, March 11, 2013:

See item 1 here: