Commit e205062a authored by Reto Da Forno's avatar Reto Da Forno

by default, symbol FLOCKLAB_NODE_ID will be used to set the node ID

parent 53bb0c76
......@@ -77,7 +77,7 @@ default_sampling_divider = 2 ;Default sampling divider for power pro
archiver_waittime = 10 ;Wait time between calls to the archiver if the maximum number of archiver instances is reached
binutils_arm = /home/flocklab/binutils/binutils-arm ;Path to ARM binutils
binutils_msp430 = /home/flocklab/binutils/binutils-msp430/usr/bin ;Path to MSP430 binutils
tos_set_symbols = /home/flocklab/binutils ;Path to tos-set-symbols script
setsymbolsscript = /home/flocklab/binutils/tos-set-symbols ;Path to script used to set symbols (e.g. node ID)
; XML test configuration file settings
......
......@@ -344,22 +344,26 @@ def start_test(testid, cur, cn, obsdict_key, obsdict_id):
# Convert image to binary format and, depending on operating system and platform architecture, write the node ID (if specified) to the image:
logger.debug("Found %s target platform architecture with %s operating system on platform %s for observer ID %s (node ID to be used: %s)." %(arch, osname, platname, str(obs_id), str(node_id)))
tos_set_symbols_path = config.get('dispatcher', 'tos_set_symbols')
set_symbols_tool = config.get('dispatcher', 'setsymbolsscript')
symbol_node_id = "FLOCKLAB_NODE_ID"
# keep <os> tag for backwards compatibility
if ((node_id != None) and (osname == 'tinyos')):
symbol_node_id = "TOS_NODE_ID"
if (arch == 'msp430'):
binutils_path = config.get('dispatcher', 'binutils_msp430')
binpath = "%s.ihex"%binpath
if ((node_id != None) and (osname == 'tinyos')):
cmd = ['%s/tos-set-symbols'%(tos_set_symbols_path), '--objcopy', '%s/msp430-objcopy'%(binutils_path), '--objdump', '%s/msp430-objdump'%(binutils_path), '--target', 'ihex', imagepath, binpath, 'TOS_NODE_ID=%s'%(node_id), 'ActiveMessageAddressC$addr=%s'%(node_id), 'ActiveMessageAddressC__addr=%s'%(node_id)]
if symbol_node_id:
cmd = ['%s'%(set_symbols_tool), '--objcopy', '%s/msp430-objcopy'%(binutils_path), '--objdump', '%s/msp430-objdump'%(binutils_path), '--target', 'ihex', imagepath, binpath, '%s=%s'%(symbol_node_id, node_id), 'ActiveMessageAddressC$addr=%s'%(node_id), 'ActiveMessageAddressC__addr=%s'%(node_id)]
try:
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
rs = p.wait()
if rs != 0:
logger.error("Error %d returned from tos-set-symbols" %rs)
logger.error("Error %d returned from %s" % (rs, set_symbols_tool))
logger.error("Tried to execute %s"%str(cmd))
errors.append("Could not set node ID %s for target image %s" %(str(node_id), str(tgimage_key)))
else:
logger.debug("Set symbols and converted file to ihex.")
# Remove the temporary exe file produced by tos-set-symbols
# Remove the temporary exe file
os.remove("%s.exe"%imagepath)
#logger.debug("Removed intermediate image %s.exe"%(str(imagepath)))
except OSError as err:
......@@ -396,13 +400,13 @@ def start_test(testid, cur, cn, obsdict_key, obsdict_id):
if 'LD_LIBRARY_PATH' not in arm_env:
arm_env['LD_LIBRARY_PATH'] = ''
arm_env['LD_LIBRARY_PATH'] += ':%s/%s'%(arm_binutils_path, "usr/x86_64-linux-gnu/arm-linux-gnu/lib")
if ((node_id != None) and (osname == 'tinyos')):
cmd = ['%s/tos-set-symbols'%(tos_set_symbols_path), '--objcopy', '%s/%s'%(arm_binutils_path, "usr/bin/arm-linux-gnu-objcopy"), '--objdump', '%s/%s'%(arm_binutils_path, "usr/bin/arm-linux-gnu-objdump"), '--target', imgformat, imagepath, binpath, 'TOS_NODE_ID=%s'%(node_id), 'ActiveMessageAddressC$addr=%s'%(node_id), 'ActiveMessageAddressC__addr=%s'%(node_id)]
if symbol_node_id:
cmd = ['%s'%(set_symbols_tool), '--objcopy', '%s/%s'%(arm_binutils_path, "usr/bin/arm-linux-gnu-objcopy"), '--objdump', '%s/%s'%(arm_binutils_path, "usr/bin/arm-linux-gnu-objdump"), '--target', imgformat, imagepath, binpath, '%s=%s'%(symbol_node_id, node_id), 'ActiveMessageAddressC$addr=%s'%(node_id), 'ActiveMessageAddressC__addr=%s'%(node_id)]
try:
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=arm_env)
rs = p.wait()
if rs != 0:
logger.error("Error %d returned from tos-set-symbols" %rs)
logger.error("Error %d returned from %s" % (rs, set_symbols_tool))
logger.error("Tried to execute %s"%str(cmd))
errors.append("Could not set node ID %s for target image %s" %(str(node_id), str(tgimage_key)))
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment