Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootloaders/riotboot: don't change CPU/pin state #21097

Merged
merged 3 commits into from
Jan 21, 2025
Merged
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
4 changes: 4 additions & 0 deletions bootloaders/riotboot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ APPLICATION = riotboot
# Include riotboot flash partition functionality
USEMODULE += riotboot_slot

# We don't want to re-configure any hardware
CFLAGS += -DDISABLE_BOARD_INIT=1
CFLAGS += -DDISABLE_CPU_INIT=1

include ../riotboot_common.mk
7 changes: 5 additions & 2 deletions cpu/cortexm_common/vectors_cortexm.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
/**
* @brief Allocation of the interrupt stack
*/
__attribute__((used,section(".isr_stack"))) uint8_t isr_stack[ISR_STACKSIZE];

Check warning on line 81 in cpu/cortexm_common/vectors_cortexm.c

View workflow job for this annotation

GitHub Actions / static-tests

comma should be followed by whitespace

/**
* @brief Pre-start routine for CPU-specific settings
Expand Down Expand Up @@ -197,12 +197,15 @@
dbgpin_init();
#endif

#if !DISABLE_CPU_INIT
/* initialize the CPU */
extern void cpu_init(void);
cpu_init();

/* initialize the board (which also initiates CPU initialization) */
#endif
#if !DISABLE_BOARD_INIT
/* initialize the board */
board_init();
#endif

#if MODULE_NEWLIB || MODULE_PICOLIBC
/* initialize std-c library (this must be done after board_init) */
Expand Down
24 changes: 24 additions & 0 deletions cpu/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,27 @@
* @ingroup config
* @brief Compile time configurations for different kinds of CPU.
*/

/**
* @brief Skip calling `board_init()`
*
* Don't call `board_init()`, leave all pins in their default state.
*
* This is intended to be used with basic riotboot_slot which does not interact
* with any external hardware.
*
* @experimental Only use this if you know what you are doing
*/
#define DISABLE_BOARD_INIT 0

/**
* @brief Skip calling `cpu_init()`
*
* Don't call `cpu_init()`, leave all CPU configuration in boot-up state.
*
* This is intended to be used with basic riotboot_slot which does not interact
* with any CPU peripherals.
*
* @experimental Only use this if you know what you are doing
*/
#define DISABLE_CPU_INIT 0
Loading