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): ...@@ -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: # 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))) 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'): if (arch == 'msp430'):
binutils_path = config.get('dispatcher', 'binutils_msp430') binutils_path = config.get('dispatcher', 'binutils_msp430')
binpath = "%s.ihex"%binpath binpath = "%s.ihex"%binpath
if ((node_id != None) and (osname == 'tinyos')): if symbol_node_id:
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)] 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: try:
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
rs = p.wait() rs = p.wait()
if rs != 0: 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)) 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))) errors.append("Could not set node ID %s for target image %s" %(str(node_id), str(tgimage_key)))
else: else:
logger.debug("Set symbols and converted file to ihex.") 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) os.remove("%s.exe"%imagepath)
#logger.debug("Removed intermediate image %s.exe"%(str(imagepath))) #logger.debug("Removed intermediate image %s.exe"%(str(imagepath)))
except OSError, err: except OSError, err:
...@@ -408,13 +413,13 @@ def start_test(testid, cur, cn, obsdict_key, obsdict_id): ...@@ -408,13 +413,13 @@ def start_test(testid, cur, cn, obsdict_key, obsdict_id):
if not arm_env.has_key('LD_LIBRARY_PATH'): if not arm_env.has_key('LD_LIBRARY_PATH'):
arm_env['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") 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')): if symbol_node_id:
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)] 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: try:
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=arm_env) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=arm_env)
rs = p.wait() rs = p.wait()
if rs != 0: 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)) 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))) errors.append("Could not set node ID %s for target image %s" %(str(node_id), str(tgimage_key)))
else: 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