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..4618a3a94 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 +#ifdef __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 @@ -106,4 +116,4 @@ embedded_block: #endif .word PICOBIN_BLOCK_MARKER_END embedded_block_end: -#endif \ No newline at end of file +#endif