To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

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

new option to set node ID for target images

symbol FLOCKLAB_NODE_ID is now set by Flocklab (binary patching)
parent 330b2f16
......@@ -357,21 +357,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)))
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 = ['/usr/sepp/bin/tos-set-symbols', '--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, err:
......@@ -408,13 +413,13 @@ def start_test(testid, cur, cn, obsdict_key, obsdict_id):
if not arm_env.has_key('LD_LIBRARY_PATH'):
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 = ['/usr/sepp/bin/tos-set-symbols', '--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