Skip to main content

Posts

Showing posts with the label newlib

FreeRTOS + newlib (gcc toolchain) on the STM32F103 (Cortex-M3)

Here are some of the steps to get FreeRTOS and newlib (gcc) to work correctly on the STM32F10x, a Cortex-M3 ARM processor. Configure the priority bits Per  the FreeRTOS page about the Cortex M3 and M4 , the priority bits should be assigned to be preempt priority by calling NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );  If you or any start up related code you are using isn't doing this you may end up with odd behavior or bus faults. Map FreeRTOS tasking functions to CMSIS vector handlers Per this post  you'll want to map the FreeRTOS handlers for vPortSVCHandler, xPortPendSVHandler and xPortSysTickHandler to the CMSIS handlers. A readelf of the elf file of my example application was showing the default interrupt handler was being used for those interrupts, which meant FreeRTOS wasn't handling the interrupts it needed to function correctly. The CMSIS default handlers are weakly bound so having other definitions with the same names will override these, causing th...