diff options
author | Jacques Comeaux <jacquesrcomeaux@protonmail.com> | 2024-06-04 19:11:20 -0500 |
---|---|---|
committer | Jacques Comeaux <jacquesrcomeaux@protonmail.com> | 2024-06-04 19:11:20 -0500 |
commit | b38a844ed9f6ad17d58db3e143ebc0c858762ec6 (patch) | |
tree | 89d87405750455c7f00785647370a6a87d8b0f53 | |
parent | 86b72b11d6abcc602a93aa480f27644cc0b34373 (diff) |
Add checksum to boot sector
-rw-r--r-- | hexedit/Makefile | 3 | ||||
-rw-r--r-- | hexedit/hexedit.s | 1 | ||||
-rw-r--r-- | hexedit/main.s | 3 | ||||
-rw-r--r-- | hexedit/pico_persist.ld | 8 |
4 files changed, 10 insertions, 5 deletions
diff --git a/hexedit/Makefile b/hexedit/Makefile index d862c25..dd70409 100644 --- a/hexedit/Makefile +++ b/hexedit/Makefile @@ -5,10 +5,11 @@ build: hexedit.uf2 hexedit.uf2: hexedit.elf ../elf/elf2uf2 hexedit.elf hexedit.uf2 -objects = main.o uart.o hexedit.o +objects = uart.o main.o hexedit.o hexedit.elf: $(objects) arm-none-eabi-ld -T pico_persist.ld -o hexedit.elf $(objects) ../setup/setup.so + ./checksum_pico_elf.py hexedit.elf $(objects): %.o: %.s arm-none-eabi-as -o $@ $< diff --git a/hexedit/hexedit.s b/hexedit/hexedit.s index 26bc84b..0800a3a 100644 --- a/hexedit/hexedit.s +++ b/hexedit/hexedit.s @@ -24,7 +24,6 @@ hexedit: adds r4, r0 b 20b 30: - movs r0, '\r bl uart_send movs r0, '\n bl uart_send diff --git a/hexedit/main.s b/hexedit/main.s index f2f6126..a12b4b3 100644 --- a/hexedit/main.s +++ b/hexedit/main.s @@ -13,3 +13,6 @@ main: bl setup_gpio bl setup_uart b hexedit + +.section .stage_2_crc +.word 0x00000000 diff --git a/hexedit/pico_persist.ld b/hexedit/pico_persist.ld index 32cc42f..9c37aba 100644 --- a/hexedit/pico_persist.ld +++ b/hexedit/pico_persist.ld @@ -1,11 +1,13 @@ MEMORY { FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 2M - SRAM(rx) : ORIGIN = 0x20041f00, LENGTH = 252 + SRAM(rx) : ORIGIN = 0x20041f00, LENGTH = 256 } SECTIONS { .text : { - *(.entry) - *(.text) + *(.entry); + *(.text); + . = 252; + *(.stage_2_crc); } >SRAM AT>FLASH } |