Macros
PRE_STARTUP()
Since 6.4.0:
In Device OS 6.4.0 a new PRE_STARTUP() function was added. If you need specific execution order guarantees and can deal with tighter limitations than STARTUP(), it is an option.
If you have existing code that uses STARTUP(), it is not necessary to change it as both will continue to be supported.
PRE_STARTUP() is guaranteed to run first before any STARTUP() or global object constructors.
Additionally, PRE_STARTUP() is an optional C function, not a macro. The code goes in the body of the function, not as an argument to the macro as with STARTUP().
void PRE_STARTUP() {
Serial1.begin(115200);
Serial1.println("PRE_STARTUP called");
}
Because PRE_STARTUP() runs before the system thread is started, your code will essentially behave as if single-threaded.
For more information on startup behavior, see Startup behavior.