diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index d05c9c6014..e4fbf31a27 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -875,6 +875,19 @@ void stop() { */ void setup() { + #if ENABLED(MARLIN_DEV_MODE) + auto log_current_ms = [&](PGM_P const msg) { + SERIAL_ECHO_START(); + SERIAL_CHAR('['); SERIAL_ECHO(millis()); SERIAL_ECHO("] "); + serialprintPGM(msg); + SERIAL_EOL(); + }; + #define SETUP_LOG(M) log_current_ms(PSTR(M)) + #else + #define SETUP_LOG(...) NOOP + #endif + #define SETUP_RUN(C) do{ SETUP_LOG(STRINGIFY(C)); C; }while(0) + HAL_init(); #if HAS_L64XX @@ -939,12 +952,13 @@ void setup() { #if HAS_TMC_SPI #if DISABLED(TMC_USE_SW_SPI) - SPI.begin(); + SETUP_RUN(SPI.begin()); #endif - tmc_init_cs_pins(); + SETUP_RUN(tmc_init_cs_pins()); #endif #ifdef BOARD_INIT + SETUP_LOG("BOARD_INIT"); BOARD_INIT(); #endif @@ -977,19 +991,6 @@ void setup() { // UI must be initialized before EEPROM // (because EEPROM code calls the UI). - #if ENABLED(MARLIN_DEV_MODE) - auto log_current_ms = [&](PGM_P const msg) { - SERIAL_ECHO_START(); - SERIAL_CHAR('['); SERIAL_ECHO(millis()); SERIAL_ECHO("] "); - serialprintPGM(msg); - SERIAL_EOL(); - }; - #define SETUP_LOG(M) log_current_ms(PSTR(M)) - #else - #define SETUP_LOG(...) NOOP - #endif - #define SETUP_RUN(C) do{ SETUP_LOG(STRINGIFY(C)); C; }while(0) - // Set up LEDs early #if HAS_COLOR_LEDS SETUP_RUN(leds.setup());