Give semaphore before starting kernel?

Is it permitted to give a semaphore before starting the FreeRTOS kernel?

I have some C++ classes that utilize FreeRTOS objects and there is one that wraps a binary semaphore and creates it with xSemaphoreCreateBinaryStatic. I’d like it start in the available state so ideally it would give the semaphore in the constructor, but since I statically allocate most things that would mean the constructor would run during global static object initialization, before the kernel has started.

I’ve tried this out and it seems to work without triggering any assertions, but is this normally allowable or just working by coincidence?

Yes, you can give (or take) a semaphore before the scheduler starts, you just can’t specify a non-zero block time, since you can’t block without the scheduler.

I do it all the time.

Minor correction: giving a semaphore doesn’t block