cancel
Showing results for 
Search instead for 
Did you mean: 

questions about FreeRTOS and interrupts

mohamed-amine
Associate II
Posted on August 18, 2014 at 23:20

Hello,

First of all, In a PIC32 environment, I usually fix a value for the heap somewhere in the IDE project settings, do I have to consider this while working with Atollic and STM32F4 ?

I am new to STM32 MCU's and I want to know if there's a clean port of FreeRTOS to run under the STM32F4Discovery (STM32F407VGT6 - Cortex M-4)

I want to know briefly how ISR's are handled under that MCU.

Did you know that in order to work with interrupts that uses FreeRTOS API's functions under that RTOS and PIC32 we must use assembly wrappers (a single .S file for each ISR inside we must put the name of the C written ISR) ? does this exist also with the STM32 ? I started working with the STM32F4 and I don't know how ISR's are managed under this ARM based mcu and its FreeRTOS port, I hope that you can give a fast answer to my question.

Thank you in advance.
4 REPLIES 4
enrico239955_st
Associate II
Posted on August 19, 2014 at 01:08

You can use the interrupts without assembly wrappers. Just write your ISR like you ever did with an STM32. But you have to take care about the Interrupt priorities if you use FreeRTOS api calls inside the ISR. Thats all.

Barry.Richard
Associate III
Posted on August 19, 2014 at 05:42

Interrupts work completely differently on the Cortex-M compared to the MIPS M4K (PIC32).

On the STM32 you have to:

1) Install the interrupt handler in the vector table.

2) If the interrupt uses the FreeRTOS safe API then ensure the interrupt priority is set equal to or below configMAX_SYSCALL_INTERRUPT_PRIORITY (this is also the case on the PIC32 but note, unlike the PIC32, on a Cortex-M numerically higher interrupt priorities represent logically lower interrupt priorities).

3) Ensure all the priority bits are assigned to be pre-emption priority rather than sub priority bits (look up 'binary point' in the ARM hardware manuals).

As always with FreeRTOS, the easiest thing to do it start with one of the many many pre-configured demo applications, which will show you how to implement interrupts.  Also see the following links:

http://www.freertos.org/FreeRTOS-quick-start-guide.html

http://www.freertos.org/RTOS-Cortex-M3-M4.html [the deep end]

http://www.freertos.org/FreeRTOS_Support_Forum_Archive/freertos_support_forum_archive_index.html

http://www.freertos.org/a00110.html#configASSERT [helps trap interrupt priority errors if using a recent versio of FreeRTOS]

Barry.Richard
Associate III
Posted on August 19, 2014 at 05:43

... forgot to say the interrupt handlers themselves are just C function - no need for an assembly wrapper, pragma, or attribute qualification on the function.

mohamed-amine
Associate II
Posted on August 19, 2014 at 11:54

Thank you very much for your answers, for the heap question as I work now under an open source solution (Eclipse, GNU ARM plugin etc...) I found where to fix heap size : in a file called sections.ld