This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

mergehex linux

Hey, I don't find a solution to "mergehex" the softdevice with my application in linux. Is there any way to do this in Linux?

Parents
  • The reason you don't need a utility is that standard Linux tools+ scripting do this sort of thing very well.

    Try something like:

    #! /bin/sh
    #
    # Combines the Nordic s120 stack and app hex files and generate a
    # combined binary.
    # Stack at 0k, app at 96k
    set -e -x
    
    STACK_HEX=s120.hex
    STACK_BIN=s120.bin
    APP_HEX=app.hex
    APP_BIN=app.bin
    COMBINED_BIN=app.bin
    objcopy -O binary -I ihex $STACK_HEX $STACK_BIN
    objcopy -O binary -I ihex $APP_HEX $APP_BIN
    dd if=/dev/zero ibs=1024 count=128 | tr "\000" "\377" > $COMBINED_BIN
    dd if=$STACK_BIN of=$COMBINED_BIN  bs=1024 seek=0 conv=notrunc
    dd if=$APP_BIN of=$COMBINED_BIN bs=1024 seek=96 conv=notrunc
    
  • If you are on linux just use the above script provided and then use the IntelHex tools to convert the created bin to hex. Tool set provides hex2bin and bin2hex.

    FYI you could use the IntelHex tool to merge hex files as well with the hexmerge script.

    pypi.python.org/.../2.0 (note python script)

    Example: hexmerge.py applicationname.hex softdevice.hex -o outfile.hex

Reply Children
Related