Safe Mode is a feature of CircuitPython designed to stop devices from hurting themselves. Prior to the addition of the safemode.py safe mode entry point, there was no way to automatically recover. For Sapling Giganteum, we removed this mode from CircuitPython by stubbing out a couple of functions to make CircuitPython boot into regular mode instead of safe mode.

While we tested these changes in orbit, we can't really recommend using this over a safemode.py (which additionally enables logging of issues). We made changes to two files:

  1. In main.c, call port_init but capture its output in a fake variable. Then set safe mode to NO_SAFE_MODE:
// we haven't looked too closely at side
// side effects of this
safe_mode_t _safe_mode = port_init(); 
(void) _safe_mode;
safe_mode_t safe_mode = NO_SAFE_MODE;
  1. In safe_mode.c, stub out all the functions.
safe_mode_t wait_for_safe_mode_reset(void) {
    return NO_SAFE_MODE;
}

void reset_into_safe_mode(safe_mode_t reason) {
    (void)reason;
    reset_cpu();
}

void safe_mode_on_next_reset(safe_mode_t reason) {
    (void)reason;
}

void print_safe_mode_message(safe_mode_t reason) {
    (void)reason;
}