rtel wrote on Friday, January 21, 2011:
when using the nvic set priority function ? whats the matter with negative values ?
This is ARM provided code, nothing to do with FreeRTOS, but the answer to your question is “nothing is the matter with negative values”. Read the Cortex-M technical reference manual and the CMSIS manual.
and another question : in portmacro.h of freertos I found
#define portSET_INTERRUPT_MASK_FROM_ISR() 0;portSET_INTERRUPT_MASK() // test
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) portCLEAR_INTERRUPT_MASK();(void)x
whats the matter with the 0; ?
Again, the answer is “nothing is the matter with 0”. If you try removing it you will find your code won’t compile. It is there to tailor a generic macro to a specific chip in the most efficient manner possible while maintaining common kernel core code across all architectures.
These crashes while using queue functions in interrupts in Cortex-M3 ports are nearly always due to the mistakes made configuring the interrupt controller, due in part to the strange nature of setting interrupt priorities (priority 0 being the highest, not the lowest, and the fact that the most significant bits are used not the least). it is understandable why people get it wrong. People often say “I have read your FAQ, followed it and it still crashes”, but when you drill deeper you find that is not the case. Case in point: https://sourceforge.net/projects/freertos/forums/forum/382005/topic/4059693 .
I would go as far as to say, I have never come across a case where the issue is caused by either just a standard everyday bug in the application C code, or a misconfiguration of the interrupt controller and/or the kernel configuration constants that relate to the interrupt controller.
I’m not saying there are no issues in the kernel code, nothing can ever give that guarantee, but I would say I am yet to have anybody provide evidence of a problem.