Skip to content
Merged
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
26 changes: 18 additions & 8 deletions src/rp2_common/pico_crt0/embedded_start_block.inc.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -106,4 +116,4 @@ embedded_block:
#endif
.word PICOBIN_BLOCK_MARKER_END
embedded_block_end:
#endif
#endif
Loading