FreeRTOS Support Archive

The FreeRTOS support forum can be used for active support both from Amazon Web Services
and the community. In return for using our software for
free, we request you play fair and do your bit to help others! Sign up
to receive notifications of new support topics then help where you can.

This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.

Get exceptions when interrupts are nested

I am experimenting with FreeRTOS v9.0.0 on Zynq by expanding the example project. There are 3 interrupt sources and they are async. to each other, for example one interrupt is from serial port receive action and another one is generated from an input pin which occurs independently from serial channel. I also log during runtime on RAM using trace provided by FreeRTOS and analyze the results using free edition of Tracealyzer. At the beginning, I assigned different priorites to each interrupt. These priorites were appropriate such that I was able to call ..FromISR() functions inside ISRs. However the code showed up problems when it ran about 5 minutes. At some point, in order to debug problem I assigned same priorites to all interrupts. Then, I did lots of change and since it is a learning project for me I didn't use version control (!).

Now, the code runs more than 24 hours without any problem but I realized that if I configure interrupts with different priorites as in before, I get different ARM exceptions (sometimes "undefined", somtimes "data abort" and some times "prefetch abort"). I verify that problem occurs when an interrupt is nested with another one by looking trace logs with Tracealyzer.

I know that this is an general question and it may not be related with FreeRTOS directly but I want to hear suggestions if any. Can there be any misusage of FreeRTOS API functions such that there is a problem only a nested interrupt is occured? As I said, code works well if I don't use nested interrupts. Additionaly, there is no shared data between ISR functions. I am not very familiar with FreeRTOS internals and ARM itself so I can't comment by thinking what FreeRTOS does when a nested interrupt occurs. In interrupts, I either send a message to a queue or give a semaphore. Enabling/disabling trace functions on the code doesn't change the result.

I would appreciate any ideas.

Best,
Alper

Get exceptions when interrupts are nested

First thing - do you have configASSERT() defined to something that will
halt the processor?

You can cause a problem if you use an API function that does not end in
"FromISR" inside an ISR, or if you call an API function that does end in
"FromISR" but from an interrupt that has a priority above
configMAXAPICALLINTERRUPTPRIORITY (see
http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html)

Finally, depending on GCC version, you can get into problems if nested
interrupts use floating point registers, and that can happen even if you
don't explicitly perform floating point operations - for example if the
compiler's libraries are optimized to the point that floating point
registers are used (because they are wide and can move more bytes with
fewer operations) in memcpy() calls (which are used inside FreeRTOS API
functions). There are some notes on that on the same link above.

I have verified that when a FreeRTOS function is asserted, I could catch this behaviour by putting a breakpoint on line with "portNOP();". So when this problem occurs, assert() is never called.

I make sure that all API functions end in FromISR.

For priorities, if I assign a wrong priority without considering configMAXAPICALLINTERRUPTPRIORITY, vAssertCalled() is called immediately even interrupts aren't nested. Therefore, I am sure that priorites are OK.

This port defines its own memcpy() function and I compile the code with no optimization. So I think that, VFP registers aren't used but i will check the compiled code. Even if they are used, is nested intterrupt sitution the only trigger of the error. I mean that FreeRTOS API functions are called from tasks and ISRs even if interrupts aren't nested. If floating point registers are used, do they cause error only if interrupts are nested?

BTW, configUSETASKFPU_SUPPORT is 2 in my case.

Thank you.

P.S. Disassembly of memcpy() function is posted below. I am not ARM assembly expert but I don't think that there is any floating point instruction.