Skip to content

Commit 31b879b

Browse files
committed
raspberrypi: allow directly specifying the original boot .S file
.. all the necessary steps to transform it into a padded, checksummed file are now done by the build system. Since it is assigned by "?=", it _should_ be the case that individual builds can override it. I did not "test" this per se, but it gives the same content and checksum (except for the identifying comment with a path) as #4302.
1 parent 4b63a8c commit 31b879b

File tree

2 files changed

+19
-25
lines changed

2 files changed

+19
-25
lines changed

ports/raspberrypi/Makefile

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,9 @@ SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE))
231231
SRC_COMMON_HAL_SHARED_MODULE_EXPANDED = $(sort $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED))
232232

233233
SRC_S = supervisor/$(CHIP_FAMILY)_cpu.s
234-
SRC_S_UPPER = bs2_default_padded_checksummed.S \
235-
sdk/src/rp2_common/hardware_divider/divider.S \
234+
BOOT2_S_UPPER ?= sdk/src/rp2_common/boot_stage2/boot2_generic_03h.S
235+
BOOT2_S_CFLAGS ?= -DPICO_FLASH_SPI_CLKDIV=2
236+
SRC_S_UPPER = sdk/src/rp2_common/hardware_divider/divider.S \
236237
sdk/src/rp2_common/hardware_irq/irq_handler_chain.S \
237238
sdk/src/rp2_common/pico_bit_ops/bit_ops_aeabi.S \
238239
sdk/src/rp2_common/pico_double/double_aeabi.S \
@@ -253,7 +254,23 @@ endif
253254
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
254255
OBJ += $(addprefix $(BUILD)/, $(SRC_S_UPPER:.S=.o))
255256
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
257+
OBJ += $(BUILD)/boot2_padded_checksummed.o
256258

259+
$(BUILD)/boot2_padded_checksummed.o: $(BUILD)/boot2_padded_checksummed.S
260+
$(STEPECHO) "CC $<"
261+
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
262+
263+
$(BUILD)/boot2_padded_checksummed.S: $(BUILD)/boot2.bin
264+
$(STEPECHO) "PAD_CHECKSUM $<"
265+
$(Q)$(PYTHON3) sdk/src/rp2_common/boot_stage2/pad_checksum -s 0xffffffff $< $@
266+
267+
$(BUILD)/boot2.bin: $(BUILD)/boot2.elf
268+
$(STEPECHO) "OBJCOPY $<"
269+
$(Q)$(OBJCOPY) -O binary $< $@
270+
271+
$(BUILD)/boot2.elf: $(BOOT2_S_UPPER) | $(BUILD)/
272+
$(STEPECHO) "BOOT $<"
273+
$(Q)$(CC) $(CFLAGS) $(BOOT2_S_CFLAGS) -Isdk/src/rp2_common/boot_stage2/asminclude --specs=nosys.specs -nostartfiles -Wl,-T,sdk/src/rp2_common/boot_stage2/boot_stage2.ld -o $@ $<
257274

258275
SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED)
259276

ports/raspberrypi/bs2_default_padded_checksummed.S

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)