nix: simplify
This commit is contained in:
parent
5fd7f36c65
commit
7e09318919
15
shell.nix
15
shell.nix
|
@ -21,27 +21,16 @@ let
|
|||
'';
|
||||
|
||||
openOCDFlashCustomised = writeShellScriptBin "openocd-flash-customised" ''
|
||||
IFS='.|/' read -r a b c d e <<< $1
|
||||
((ip = (a << 32) + (b << 24) + (c << 16) + (d << 8) + e))
|
||||
IFS=':' read -r a b c d e f <<< $2
|
||||
((mac = (16#$a << 40) + (16#$b << 32) + (16#$c << 24) + (16#$d << 16) + (16#$e << 8) + 16#$f))
|
||||
IFS='.' read -r a b c d <<< $3
|
||||
((broker_ip = (a << 24) + (b << 16) + (c << 8) + d))
|
||||
touch temp_name
|
||||
printf "%s\x04" "$4" > temp_name
|
||||
python3 flash.py $1 $2 $3 $4
|
||||
openocd -f openocd/openocd.cfg \
|
||||
-c "init
|
||||
reset init
|
||||
halt
|
||||
stm32h7x mass_erase 1
|
||||
flash write_image erase target/thumbv7em-none-eabihf/release/humpback-dds
|
||||
flash filld 0x08100000 $ip 1
|
||||
flash filld 0x08100020 $mac 1
|
||||
flash fillw 0x08100040 $broker_ip 1
|
||||
flash write_image temp_name 0x08100060 bin
|
||||
flash write_image flash_config.bin 0x08100000 bin
|
||||
reset run
|
||||
shutdown"
|
||||
rm temp_name
|
||||
'';
|
||||
|
||||
in
|
||||
|
|
Loading…
Reference in New Issue