Skip to content

Commit 8066bee

Browse files
authored
give user more control over embedded_start_block.S contents (earlephilhower#2470)
1 parent 66540fe commit 8066bee

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/rp2_common/pico_crt0/embedded_start_block.inc.S

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@
55
#endif
66
#endif
77

8+
#ifndef PICO_CRT0_INCLUDE_PICOBIN_VECTOR_TABLE_ITEM
9+
// If no_flash bin, then include a vector table item
10+
#if PICO_NO_FLASH && !PICO_RP2040
11+
#define PICO_CRT0_INCLUDE_PICOBIN_VECTOR_TABLE_ITEM 1
12+
#endif
13+
#endif
14+
15+
#ifndef PICO_CRT0_INCLUDE_PICOBIN_ENTRY_POINT_ITEM
16+
// On RISC-V the default entry point from bootrom is the start of the binary, but
17+
// we have our vtable at the start, so we must include an entry point
18+
#ifdef __riscv
19+
#define PICO_CRT0_INCLUDE_PICOBIN_ENTRY_POINT_ITEM 1
20+
#endif
21+
#endif
22+
823
#ifndef PICO_CRT0_INCLUDE_PICOBIN_BLOCK
924
#define PICO_CRT0_INCLUDE_PICOBIN_BLOCK PICO_CRT0_INCLUDE_PICOBIN_IMAGE_TYPE_ITEM
1025
#endif
@@ -73,9 +88,7 @@ embedded_block:
7388
.hword PICO_CRT0_VERSION_MAJOR
7489
#endif
7590

76-
#ifdef __riscv
77-
// On RISC-V the default entry point from bootrom is the start of the binary, but
78-
// we have our vtable at the start, so we must include an entry point
91+
#if PICO_CRT0_INCLUDE_PICOBIN_ENTRY_POINT_ITEM
7992
.byte PICOBIN_BLOCK_ITEM_1BS_ENTRY_POINT
8093
.byte 0x3 // word size to next item
8194
.byte 0 // pad
@@ -84,15 +97,12 @@ embedded_block:
8497
.word SRAM_END // stack pointer
8598
#endif
8699

87-
#if !PICO_RP2040
88-
#if PICO_NO_FLASH
89-
// If no_flash bin, then include a vector table item
100+
#if PICO_CRT0_INCLUDE_PICOBIN_VECTOR_TABLE_ITEM
90101
.byte PICOBIN_BLOCK_ITEM_1BS_VECTOR_TABLE
91102
.byte 0x2
92103
.hword 0
93104
.word __vectors
94105
#endif
95-
#endif
96106

97107
.byte PICOBIN_BLOCK_ITEM_2BS_LAST
98108
.hword (embedded_block_end - embedded_block - 16 ) / 4 // total size of all
@@ -106,4 +116,4 @@ embedded_block:
106116
#endif
107117
.word PICOBIN_BLOCK_MARKER_END
108118
embedded_block_end:
109-
#endif
119+
#endif

0 commit comments

Comments
 (0)