Hello All, the following code is generating a HardFault. I'm sure I've missed something stupid:
void Thread_Debug2(void const *argument) { // locals Debug_Struct * pDbgStrct = 0; osStatus Status = osOK; uint32_t Placements2 = 0; // Start while(1) { // disable irq __disable_irq(); // get message, here the hardfault occurs pDbgStrct = (Debug_Struct *)osMessageGet(MsgQueue_Debug1, 0).value.v; // enable irq __enable_irq(); // free memory Status = osPoolFree(MemPool_Debug1, pDbgStrct); // check status if(Status == osOK) { Placements2++; } } }
In my opinion, the osMessageGet should be able to get a message from a message queue even when no interrupt is activated...
Well in my case (speaking of the mailbox overflow) I think that it's really a RTX Problem. Are you able to reproduce the error?
I mean you setup 4 Timers, having a Timer Queue length of 1, normally you would expect a Timer Queue Overflow, but that doesn't happen. What happens is a Mailbox Overflow and then you search all your mailboxes about some alloc/put/get errors and handle them (handle every return values too) but find nothing...
And then with some luck, you find the faulty line in the code and it isn't in your code?
How can you react to something that should handled in the RTX librarys, or at least, giving you the correct error case.
Anyway, thanks to all replies to solve this problem!