This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit ba20c930f83cc04bbbe5d745a3d7c8f370f4fc9f Author: Tiago Medicci Serrano <[email protected]> AuthorDate: Tue Feb 24 15:47:28 2026 -0300 arch/risc-v/src/common: Create SoC-specific initialization routine This commits adds a function that can be implemented by any vendor to allow SoC-specific functions to be called by `up_initialize`. Please note that `up_initialize` is provided by the arch level, but it doesn't allow SoC-specific initialization. Although it could be possible to run such initialization on board-level, semantically it isn't related to the board, but with the SoC. As an example of such implementation, some SoCs require RTC subsystem initialization to occur before the OS is completely initialized. Signed-off-by: Tiago Medicci Serrano <[email protected]> --- arch/risc-v/src/common/riscv_initialize.c | 7 +++++++ arch/risc-v/src/common/riscv_internal.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/arch/risc-v/src/common/riscv_initialize.c b/arch/risc-v/src/common/riscv_initialize.c index 355fa47bdec..b3dcf4ad7ff 100644 --- a/arch/risc-v/src/common/riscv_initialize.c +++ b/arch/risc-v/src/common/riscv_initialize.c @@ -98,5 +98,12 @@ void up_initialize(void) riscv_netinitialize(); +#ifdef CONFIG_HAVE_WEAKFUNCTIONS + if (riscv_soc_initialize) +#endif + { + riscv_soc_initialize(); + } + board_autoled_on(LED_IRQSENABLED); } diff --git a/arch/risc-v/src/common/riscv_internal.h b/arch/risc-v/src/common/riscv_internal.h index ef10f57e61a..d8a1e969afd 100644 --- a/arch/risc-v/src/common/riscv_internal.h +++ b/arch/risc-v/src/common/riscv_internal.h @@ -315,6 +315,10 @@ void riscv_pminitialize(void); void weak_function riscv_dma_initialize(void); #endif +/* SoC-specific CPU initialization ******************************************/ + +void weak_function riscv_soc_initialize(void); + /* Low level serial output **************************************************/ void riscv_lowputc(char ch);
