Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/rp2_common/pico_crt0/crt0.S
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
13 changes: 13 additions & 0 deletions src/rp2_common/pico_runtime/include/pico/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So presumably this "overrides" e.g. PICO_RUNTIME_SKIP_INIT_POST_CLOCK_RESETS ?

#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
Comment on lines 64 to 65
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With so many #endifs and #elses all over the place, it's pretty hard to see how things line up. Maybe some judicious

#endif // PICO_RUNTIME_INIT_FUNC

style comments would make this code slightly easier to read?

#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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a comma after "core 0" here, to avoid this being misread as "core 0 not used on RP2040" ?

// ---------------------------------------------------------------------------------------
#ifndef PICO_RUNTIME_INIT_PER_CORE_BOOTROM_RESET
#define PICO_RUNTIME_INIT_PER_CORE_BOOTROM_RESET "00051"
Expand Down
Loading