From 9ef9994a923a693c1c6988b16ccada49e2cd7b2e Mon Sep 17 00:00:00 2001 From: graham sanderson Date: Fri, 16 May 2025 15:43:38 -0500 Subject: [PATCH 1/2] give user more control over embedded_start_block.S contents --- .../pico_crt0/embedded_start_block.inc.S | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/rp2_common/pico_crt0/embedded_start_block.inc.S b/src/rp2_common/pico_crt0/embedded_start_block.inc.S index e4632255b..edb48a018 100644 --- a/src/rp2_common/pico_crt0/embedded_start_block.inc.S +++ b/src/rp2_common/pico_crt0/embedded_start_block.inc.S @@ -5,6 +5,21 @@ #endif #endif +#ifndef PICO_CRT0_INCLUDE_PICOBIN_VECTOR_TABLE_ITEM +// If no_flash bin, then include a vector table item +#if PICO_NO_FLASH && !PICO_RP2040 +#define PICO_CRT0_INCLUDE_PICOBIN_VECTOR_TABLE_ITEM 1 +#endif +#endif + +#ifndef PICO_CRT0_INCLUDE_PICOBIN_ENTRY_POINT_ITEM +// On RISC-V the default entry point from bootrom is the start of the binary, but +// we have our vtable at the start, so we must include an entry point +#if !defined(PICO_CRT0_INCLUDE_PICOBIN_ENTRY_POINT_ITEM) && defined(__riscv) +#define PICO_CRT0_INCLUDE_PICOBIN_ENTRY_POINT_ITEM 1 +#endif +#endif + #ifndef PICO_CRT0_INCLUDE_PICOBIN_BLOCK #define PICO_CRT0_INCLUDE_PICOBIN_BLOCK PICO_CRT0_INCLUDE_PICOBIN_IMAGE_TYPE_ITEM #endif @@ -73,9 +88,7 @@ embedded_block: .hword PICO_CRT0_VERSION_MAJOR #endif -#ifdef __riscv -// On RISC-V the default entry point from bootrom is the start of the binary, but -// we have our vtable at the start, so we must include an entry point +#if PICO_CRT0_INCLUDE_PICOBIN_ENTRY_POINT_ITEM .byte PICOBIN_BLOCK_ITEM_1BS_ENTRY_POINT .byte 0x3 // word size to next item .byte 0 // pad @@ -84,15 +97,12 @@ embedded_block: .word SRAM_END // stack pointer #endif -#if !PICO_RP2040 -#if PICO_NO_FLASH -// If no_flash bin, then include a vector table item +#if PICO_CRT0_INCLUDE_PICOBIN_VECTOR_TABLE_ITEM .byte PICOBIN_BLOCK_ITEM_1BS_VECTOR_TABLE .byte 0x2 .hword 0 .word __vectors #endif -#endif .byte PICOBIN_BLOCK_ITEM_2BS_LAST .hword (embedded_block_end - embedded_block - 16 ) / 4 // total size of all From 8fa6d75241789f3328459c1f738a50a5b17b9331 Mon Sep 17 00:00:00 2001 From: Graham Sanderson Date: Fri, 16 May 2025 15:45:19 -0500 Subject: [PATCH 2/2] oops --- src/rp2_common/pico_crt0/embedded_start_block.inc.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rp2_common/pico_crt0/embedded_start_block.inc.S b/src/rp2_common/pico_crt0/embedded_start_block.inc.S index edb48a018..4618a3a94 100644 --- a/src/rp2_common/pico_crt0/embedded_start_block.inc.S +++ b/src/rp2_common/pico_crt0/embedded_start_block.inc.S @@ -15,7 +15,7 @@ #ifndef PICO_CRT0_INCLUDE_PICOBIN_ENTRY_POINT_ITEM // On RISC-V the default entry point from bootrom is the start of the binary, but // we have our vtable at the start, so we must include an entry point -#if !defined(PICO_CRT0_INCLUDE_PICOBIN_ENTRY_POINT_ITEM) && defined(__riscv) +#ifdef __riscv #define PICO_CRT0_INCLUDE_PICOBIN_ENTRY_POINT_ITEM 1 #endif #endif @@ -116,4 +116,4 @@ embedded_block: #endif .word PICOBIN_BLOCK_MARKER_END embedded_block_end: -#endif \ No newline at end of file +#endif