Set initialized variable values in a binary
tos-set-symbols [--objcopy=OBJCOPY] [--objdump=OBJDUMP]
[--target=TARGET] INPUTFILE OUTPUTFILE [SYMBOL=]VALUE...
tos-set-symbols --srec [--objcopy=OBJCOPY] [--objdump=OBJDUMP]
[--target=TARGET] INPUTFILE OUTPUTFILE [SYMBOL=]VALUE...
tos-set-symbols --exe [--objcopy=OBJCOPY] [--objdump=OBJDUMP]
INPUTFILE OUTPUTFILE [SYMBOL=]VALUE...
tos-set-symbols --read [--objdump=...] INPUTFILE SYMBOL...
tos-set-symbols is a tool to inspect and modify the initial values of variables in a binary. It is used by the TinyOS build system to set a node's ID and AM address, for example, when using install.X or reinstall.X.
tos-set-symbols takes an optional first argument that specifies the format of the binary being modified or whether it is only being read. By default, it acts as if --srec was passed. Instead of passing --srec, --exe, the --target option can be used to specify a target format. This option is passed to objcopy. The --objdump and --objcopy options allow you to specify which binary tools to use. By default, tos-set-symbols uses avr-objcopy and avr-objdump.
The SYMBOL parameter refers to a variable in the image to modify or print. If the variable is in a component, its name is of the form component$variable. If the SYMBOL is omitted, it defaults to TOS_LOCAL_ADDRESS, for compatibility with the TinyOS 1.x set-mode-id tool.
This reads in a micaZ .srec file, changes the value of TOS_NODE_ID to 4, and writes out a new binary to main.srec.out-4.
tos-set-symbols build/micaz/main.srec build/micaz/main.srec.out-4 \ TOS_NODE_ID=4
This reads in a Telos .srec file, changes the value of TOS_NODE_ID and ActiveMessageAddressC$addr to 3, and writes out a new binary to main.srec.out-3. It uses the msp430, rather than the avr, binary tools, and outputs an ihex format executable.
tos-set-symbols --objcopy=msp430-objcopy --objdump=msp430-objdump \ --target=ihex build/telosa/main.ihex build/telosa/main.ihex.out-3 \ TOS_NODE_ID=3 ActiveMessageAddressC$addr=3