Being this a C inline function defined on a C macro may contribute to what I’m experiencing…
If I try to single-step the debugger instead runs, and if I pause it again it shows as being at the same line. No matter what I do, it seems the debugger is incapable of proceeding.
I bet it just SEEMS like the program is stuck there because vPortRaiseBASEPRI can’t hang (normally).
Is it possible that the application has stopped itself in a configASSERT (forever loop) ?
Do you have compiler optimization OFF (-O0) and configASSERT along with the other FreeRTOS debug utilities enabled (as recommended) ?
What’s the call stack when halting the target ?
This code is part of CSP a CubeSat Space Protocol.
I’m intrigued with the way of calling vSemaphoreCreateBinary…
Passing not an address like &sem (or in this case just sem) but instead passing *sem!!!
I’m not familiar with CSP, but the wrapper API has a handle pointer argument and vSemaphoreCreateBinary (macro) wants a handle (which in fact is a pointer). That’s not the problem.
I guess csp_bin_sem_handle_t just an alias for SemaphoreHandle_t.
Did you verify that the provided sem pointer is valid when calling csp_bin_sem_create ?
Again: Do you have configASSERT defined ? That’s incredibly helpful for development !
It catches quite a number of application code bugs like in this case.
You see, for an unknown reason creating a binary semaphore fails badly. You can be very sure that the FreeRTOS code creating a binary semaphore is not buggy.
So the problem is most likely caused by calling application code.
All the configASSERTs in FreeRTOS code ensure as good as possible, that the API contracts are not violated.
Here we go: taskDISABLE_INTERRUPTS finally calls vPortRaiseBASEPRI…
Seems a configASSERT failed and it just looks like the program hangs in vPortRaiseBASEPRI. In fact it’s just looping forever in for (;;).
So I’d step into csp_bin_sem_create to find the exact configASSERT statement which fails and you hopefully get an idea what the root cause problem in your code is.
Edit: The csp_bin_sem_create wrapper and the provided handle seem to be ok.
A corrupted pxQueue->uxItemSize was often an indicator for stack overflows here in the forum (search: pxQueue->uxItemSize).
Besides defining configASSERT do you have also stack overflow checking enabled (for development/debugging) ?