diff --git a/src/rp2_common/pico_crt0/crt0.S b/src/rp2_common/pico_crt0/crt0.S index 502c4fdba..d95795cf5 100644 --- a/src/rp2_common/pico_crt0/crt0.S +++ b/src/rp2_common/pico_crt0/crt0.S @@ -360,7 +360,7 @@ binary_info_header: _entry_point: #if PICO_NO_FLASH - // on the NO_FLASH case, we do not do a rest thru bootrom below, so the RCP may or may not have been initialized: + // on the NO_FLASH case, we do not do a reset thru bootrom below, so the RCP may or may not have been initialized: // // in the normal (e.g. UF2 download etc. case) we will have passed thru bootrom initialization, but if // a NO_FLASH binary is loaded by the debugger, and run directly after a reset, then we won't have. @@ -388,6 +388,9 @@ _entry_point: msr msplim, r0 #endif + // note that theoretically we should also call bootrom_state_reset here too, however + // we expect it to have been called by the debugger + ldr r0, =__vectors // Vector through our own table (SP, VTOR will not have been set up at // this point). Same path for debugger entry and bootloader entry. diff --git a/src/rp2_common/pico_runtime/include/pico/runtime.h b/src/rp2_common/pico_runtime/include/pico/runtime.h index 35d871d92..22fa6f576 100644 --- a/src/rp2_common/pico_runtime/include/pico/runtime.h +++ b/src/rp2_common/pico_runtime/include/pico/runtime.h @@ -49,13 +49,26 @@ void runtime_init(void); void runtime_run_initializers(void); void runtime_run_per_core_initializers(void); +// PICO_CONFIG: PICO_RUNTIME_SKIP_INIT_ALL, Skip calling of `runtime_init_` functions during runtime init, type=bool, default=0, group=pico_runtime_init +#if !PICO_RUNTIME_SKIP_INIT_ALL +#define PICO_RUNTIME_SKIP_INIT_ALL 0 +#endif #ifndef PICO_RUNTIME_INIT_FUNC +#if !PICO_RUNTIME_SKIP_INIT_ALL #define PICO_RUNTIME_INIT_FUNC(func, priority_string) uintptr_t __used __attribute__((section(".preinit_array." priority_string))) __pre_init_ ## func = (uintptr_t)(void (*)(void)) (func) +#else +// define the variable in case it is referenced, but do not stick it in the preinit_array +#define PICO_RUNTIME_INIT_FUNC(func, priority_string) uintptr_t __pre_init_ ## func; +#endif #endif #else #ifndef PICO_RUNTIME_INIT_FUNC +#if !PICO_RUNTIME_INIT_SKIP_INIT_ALL #define PICO_RUNTIME_INIT_FUNC(func, priority_string) __pre_init func, priority_string +#else +#define PICO_RUNTIME_INIT_FUNC(func, priority_string) +#endif #endif #endif #define PICO_RUNTIME_INIT_FUNC_HW(func, priority_string) PICO_RUNTIME_INIT_FUNC(func, priority_string) diff --git a/src/rp2_common/pico_runtime_init/include/pico/runtime_init.h b/src/rp2_common/pico_runtime_init/include/pico/runtime_init.h index c6ed4cf8e..76bf509a1 100644 --- a/src/rp2_common/pico_runtime_init/include/pico/runtime_init.h +++ b/src/rp2_common/pico_runtime_init/include/pico/runtime_init.h @@ -80,7 +80,7 @@ void runtime_init_bootrom_reset(void); #endif // --------------------------------------------------------------------------------------- -// Non-boot core eset of bootrom state, not needed if only using core 0 not used on RP2040 +// Non-boot core reset of bootrom state, not needed if only using core 0 not used on RP2040 // --------------------------------------------------------------------------------------- #ifndef PICO_RUNTIME_INIT_PER_CORE_BOOTROM_RESET #define PICO_RUNTIME_INIT_PER_CORE_BOOTROM_RESET "00051"