File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -836,6 +836,12 @@ int __attribute__((used)) main(void) {
836836 // Start the debug serial
837837 serial_early_init ();
838838
839+ #if CIRCUITPY_EXTERNAL_FLASH_SETUP
840+ // Set up anything that might need to get done before we try to use SPI flash
841+ // This is needed for some boards where flash relies on GPIO setup to work
842+ external_flash_setup ();
843+ #endif
844+
839845 // Create a new filesystem only if we're not in a safe mode.
840846 // A power brownout here could make it appear as if there's
841847 // no SPI flash filesystem, and we might erase the existing one.
Original file line number Diff line number Diff line change @@ -49,6 +49,9 @@ CFLAGS += -DMICROPY_PY_USELECT=$(MICROPY_PY_USELECT)
4949MICROPY_PY_USELECT_SELECT ?= $(MICROPY_PY_USELECT )
5050CFLAGS += -DMICROPY_PY_USELECT_SELECT=$(MICROPY_PY_USELECT_SELECT )
5151
52+ # enable pre-flash GPIO setup
53+ CIRCUITPY_EXTERNAL_FLASH_SETUP ?= 0
54+ CFLAGS += -DCIRCUITPY_EXTERNAL_FLASH_SETUP=$(CIRCUITPY_EXTERNAL_FLASH_SETUP )
5255
5356CIRCUITPY_AESIO ?= $(CIRCUITPY_FULL_BUILD )
5457CFLAGS += -DCIRCUITPY_AESIO=$(CIRCUITPY_AESIO )
Original file line number Diff line number Diff line change @@ -47,5 +47,9 @@ void reset_board(void);
4747// disabling USB, BLE or flash) because CircuitPython may continue to run.
4848void board_deinit (void );
4949
50+ // Configure anything that needs to get set up before the external flash
51+ // is init'ed. For example, if GPIO needs to be configured to enable the
52+ // flash chip, as is the case on some boards.
53+ void external_flash_setup (void );
5054
5155#endif // MICROPY_INCLUDED_SUPERVISOR_BOARD_H
You can’t perform that action at this time.
0 commit comments