Advertisement
happycactus

MergeHex.sh

Mar 14th, 2022
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #! /bin/sh
  2. #
  3. # Combines the Nordic s120 stack and app hex files and generate a
  4. # combined binary.
  5. # Stack at 0k, app at 96k
  6. set -e -x
  7.  
  8. STACK_HEX=s120.hex
  9. STACK_BIN=s120.bin
  10. APP_HEX=app.hex
  11. APP_BIN=app.bin
  12. COMBINED_BIN=app.bin
  13. objcopy -O binary -I ihex $STACK_HEX $STACK_BIN
  14. objcopy -O binary -I ihex $APP_HEX $APP_BIN
  15. dd if=/dev/zero ibs=1024 count=128 | tr "\000" "\377" > $COMBINED_BIN
  16. dd if=$STACK_BIN of=$COMBINED_BIN bs=1024 seek=0 conv=notrunc
  17. dd if=$APP_BIN of=$COMBINED_BIN bs=1024 seek=96 conv=notrunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement