Browse Source

Shave 2 bytes from bootloader.

master
flabbergast 5 months ago
parent
commit
4ef273bd19
  1. 2
      bootloader/README.md
  2. 12
      bootloader/bootloader.hex
  3. 8
      bootloader/bootloader.s

2
bootloader/README.md

@ -8,7 +8,7 @@ _Note: please be careful with this, and of course you're using this on your own
`make flash`
Note: this will overwrite any previous bootloader you may have on the board; you may want to back that up first. It will overwrite ~106 bytes at MCU address `0x20000000`, which is the beginning of the flash chip. The official bootloader is archived [here][bldr-recover]. To make a copy of the whole region that the bootloader can occupy, use:
Note: this will overwrite any previous bootloader you may have on the board; you may want to back that up first. It will overwrite ~104 bytes at MCU address `0x20000000`, which is the beginning of the flash chip. The official bootloader is archived [here][bldr-recover]. To make a copy of the whole region that the bootloader can occupy, use:
echo -e "savebin saved-bootloader.bin, 0x20000000, 0x10000\nexit\n" | JLinkExe -device FE310 -if JTAG -speed 4000 -si JTAG -jtagconf -1,-1 -autoconnect

12
bootloader/bootloader.hex

@ -1,10 +1,10 @@
:020000042000DA
:100000007350503037CA0002B72A0110130B000298
:10001000370400108324C40B37E9FECA6384240329
:1000200023A46A0137B927D063802403232E240B2D
:1000300023A66A0111650D20232E940A23A60A0027
:1000400023A40A006FF0D07B232E040AB10A0965AD
:100050002FA06A211120EDBF83228AFF3383A200E3
:0A00600083228AFFE3EE62FE828035
:10001000370400108324C40B37E9FECA638224032B
:1000200023A46A0137B927D0638E2401232E240B21
:1000300023A66A0111653928232E940A23A40A00F5
:100040006FF0107C232E040AB10A09652FA06A21E3
:100050001120EDBF03238AFF2A9383228AFFE3EE58
:0400600062FE82803A
:0400000520000000D7
:00000001FF

8
bootloader/bootloader.s

@ -57,8 +57,8 @@ Reset: # Execution begins here
# nothing happened, so just jump to app
sw s1, AON_BACKUP15(s0) # restore the original value
sw zero, GPIO_OUTPUT_VAL(s5) # deinit GPIO
sw zero, GPIO_OUTPUT_EN(s5) # ...
sw zero, GPIO_OUTPUT_VAL(s5) # turn off LED (this is not _really_ needed...)
sw zero, GPIO_OUTPUT_EN(s5) # deinit GPIO
1:
j program_start_address
@ -83,8 +83,8 @@ double_tapped: # just blink forever
# also it is not expected to run more than 36 hours after reset
# ... so we'll use 32bit MTIME value without checking for overflow
simple_delay:
lw t0, -8(s4) # load the current value of the timer
add t1, t0, a0 # compute the final timer value into t1
lw t1, -8(s4) # load the current value of the timer
add t1, t1, a0 # compute the final timer value into t1
1:
lw t0, -8(s4) # read mtime value again
bltu t0, t1, 1b # keep looping until we reach t1

Loading…
Cancel
Save