Example #1
0
class NodeSamr30(NodeDapLinkBase):
    """ Open node SAMR30 implementation """

    TYPE = 'samr30'
    OPENOCD_CFG_FILE = static_path('iot-lab-samr30.cfg')
    FW_IDLE = static_path('samr30_idle.elf')
    FW_AUTOTEST = static_path('samr30_autotest.elf')
Example #2
0
class ControlNodeIotlabm3(ControlNodeIotlab):
    """ Implementation of a Control Node with a Standalone M3 """
    TYPE = 'iotlabm3'
    FEATURES = ['leds',
                'radio']
    OPENOCD_PATH = '/opt/openocd-dev/bin/openocd'
    OPENOCD_CFG_FILE = static_path('iot-lab.cfg')
    OPENOCD_OPTS = (static_path('iot-lab-cn-m3.cfg'),)

    @logger_call("Control node : profile configuration")
    def configure_profile(self, profile=None):
        """ Configure the given profile on the control node """
        LOGGER.info('Configure profile on Control Node')
        self.profile = profile or self.default_profile
        ret_val = 0

        # Monitoring : Radio only, ignore other fields
        ret_val += self.protocol.config_radio(self.profile.radio)
        return ret_val

    @logger_call("Control node : start power of open node - Ignored")
    def open_start(self, power=None):
        """ Start open node with 'power' source """
        return 0

    @logger_call("Control node : stop power of open node - Ignored")
    def open_stop(self, power=None):
        """ Stop open node with 'power' source """
        return 0

    def status(self):
        """ Check Control node status """
        return gateway_code.utils.ftdi_check.ftdi_check('controlNode', '2232')
Example #3
0
class NodeNrf52840Dk(NodeJLinkBase):
    """ Open node NRF52840DK implementation """

    TYPE = 'nrf52840dk'
    OPENOCD_CFG_FILE = static_path('iot-lab-nrf52xxxdk.cfg')
    FW_IDLE = static_path('nrf52840dk_idle.elf')
    FW_AUTOTEST = static_path('nrf52840dk_autotest.elf')
Example #4
0
class NodeM3(NodeOpenOCDBase):
    """ Open node M3 implementation """

    TYPE = 'm3'
    TTY = '/dev/iotlab/ttyON_M3'
    BAUDRATE = 500000
    ROM_START_ADDR = 0x08000000
    OPENOCD_CFG_FILE = static_path('iot-lab.cfg')
    OPENOCD_OPTS = (static_path('iot-lab-m3.cfg'), )
    FW_IDLE = static_path('m3_idle.elf')
    FW_AUTOTEST = static_path('m3_autotest.elf')
    ALIM = '3.3V'
    AUTOTEST_AVAILABLE = [
        'echo',
        'get_time',  # mandatory
        'get_uid',
        'get_pressure',
        'get_light',
        'test_flash',
        'get_accelero',
        'get_gyro',
        'get_magneto',
        'test_gpio',
        'test_i2c',
        'radio_pkt',
        'radio_ping_pong',
        'leds_consumption',
        'leds_on',
        'leds_off',
        'leds_blink',
    ]

    def status(self):
        """ Check M3 node status """
        return gateway_code.utils.ftdi_check.ftdi_check('m3', '2232')
class NodeSamr21(NodeEdbgBase):
    """ Open node SAMR21 implementation """

    TYPE = 'samr21'
    OPENOCD_CFG_FILE = static_path('iot-lab-samr21.cfg')
    FW_IDLE = static_path('samr21_idle.elf')
    FW_AUTOTEST = static_path('samr21_autotest.elf')
Example #6
0
class NodeFox(NodeOpenOCDBase):
    """ Open node FOX implementation """

    # Contrary to m3 node, fox node need some time to be visible.
    # Also flash/reset may fail after a node start_dc but don't care
    TYPE = 'fox'
    TTY = '/dev/iotlab/ttyON_FOX'
    BAUDRATE = 500000
    ROM_START_ADDR = 0x08000000
    OPENOCD_CFG_FILE = static_path('iot-lab.cfg')
    OPENOCD_OPTS = (static_path('iot-lab-fox.cfg'), )
    FW_IDLE = static_path('fox_idle.elf')
    FW_AUTOTEST = static_path('fox_autotest.elf')

    AUTOTEST_AVAILABLE = [
        'echo',
        'get_time',  # mandatory
        'get_uid',
        'get_accelero',
        'get_gyro',
        'get_magneto',
        'radio_pkt',
        'radio_ping_pong',
        'leds_on',
        'leds_off',
        'leds_blink',
        # 'leds_consumption', not precise enough
        # (0.886405, [0.886405, 0.886405, 0.886405, 0.887015])
    ]
Example #7
0
class NodeArduinoZero(NodeDapLinkBase):
    """ Open node Arduino Zero implementation """

    TYPE = 'arduino_zero'
    OPENOCD_CFG_FILE = static_path('iot-lab-arduino-zero.cfg')
    FW_IDLE = static_path('arduino-zero_idle.elf')
    FW_AUTOTEST = static_path('arduino-zero_autotest.elf')
Example #8
0
class NodeA8M3(NodeOpenOCDBase):
    """ Open node A8-M3 implemenation """

    TYPE = 'a8_m3'
    TTY = '/dev/ttyA8_M3'
    BAUDRATE = 500000
    ROM_START_ADDR = 0x08000000
    OPENOCD_CFG_FILE = static_path('iot-lab.cfg')
    OPENOCD_OPTS = (static_path('iot-lab-a8-m3.cfg'),)
    FW_IDLE = static_path('a8-m3_idle.elf')
    FW_AUTOTEST = static_path('a8-m3_autotest.elf')
    ALIM = '3.3V'
    AUTOTEST_AVAILABLE = [
        'echo', 'get_time',  # mandatory
        'get_uid',
        'get_accelero', 'get_gyro', 'get_magneto',
        'test_gpio', 'test_i2c',
        'radio_pkt', 'radio_ping_pong',
        'test_pps_start', 'test_pps_get', 'test_pps_stop',
        'leds_on', 'leds_off', 'leds_blink',
    ]

    @staticmethod
    def status():
        """ Check A8-M3 node status """
        return gateway_code.utils.ftdi_check.ftdi_check('a8-m3', '2232')
Example #9
0
class NodeStLrwan1(NodeStLinkBase):
    """ Open node STM32 LRWAN1 implementation """

    TYPE = 'st_lrwan1'
    OPENOCD_CFG_FILE = static_path('iot-lab-st-lrwan1.cfg')
    FW_IDLE = static_path('st-lrwan1_idle.elf')
    FW_AUTOTEST = static_path('st-lrwan1_autotest.elf')
class NodeNrf52832Mdk(NodeDapLinkBase):
    """ Open node NRF52832-MDK implementation """

    TYPE = 'nrf52832mdk'
    OPENOCD_CFG_FILE = static_path('iot-lab-nrf528xxmdk.cfg')
    FW_IDLE = static_path('nrf52832mdk_idle.elf')
    FW_AUTOTEST = static_path('nrf52832mdk_autotest.elf')
Example #11
0
class NodeExample(object):
    """ Example node """

    TTY = '/dev/ttyON_EXAMPLE'
    # The tty as named in the udev rule
    BAUDRATE = 9600
    # The baudrate used to communicate with the open-node on the serial port
    FW_IDLE = static_path('example_idle.elf')
    # The name of the idle firmware
    FW_AUTOTEST = static_path('example_autotest.elf')
    # The name of the autotest firmware
    ALIM = '5V'
    # The tension of alimentation (will be 5V in most of the case)

    AUTOTEST_AVAILABLE = ['echo']

    # The list of autotest available for your node.
    # As describe in the document,
    # this list must contain at least 'echo'

    def __init__(self):
        pass
        # The initialization of your class

    @logger_call("Node Example : Setup of example")
    def setup(self, firmware_path):
        # Here you will perform all the necessary action needed
        # by your node before the start of an experiment.
        return 1

    @logger_call("Node Example : teardown of example node")
    def teardown(self):
        # Here you will perform all the necessary action to
        # properly terminate your node
        return 1

    @logger_call("Node Example : flash of example node")
    def flash(self, firmware_path=None):
        # Here
        return 1

    @logger_call("Node Example : reset of example node")
    def reset(self):
        # Not implemented
        return 1

    def debug_start(self):
        # Here you will start the debug of your node
        return 1

    def debug_stop(self):
        # Here you will stop the debug of your node
        return 1

    @staticmethod
    def status():
        # Here you will check the health of the node (for exemple with ftdi chip)
        # if you are unable to check it, just return 0
        return 0
Example #12
0
class NodeStF746gDisco(NodeStLinkBase):
    """ Open node STM32 F746G-DISCO implementation """

    TYPE = 'st_f746g_disco'
    ROM_START_ADDR = 0x08000000
    OPENOCD_CFG_FILE = static_path('iot-lab-st-f746g-disco.cfg')
    FW_IDLE = static_path('st-f746g-disco_idle.elf')
    FW_AUTOTEST = static_path('st-f746g-disco_autotest.elf')
Example #13
0
class NodeFrdmKw41z(NodeJLinkBase):
    """ Open node FRDM-KW41Z implementation """

    TYPE = 'frdm_kw41z'
    OPENOCD_CFG_FILE = static_path('iot-lab-frdm-kw41z.cfg')
    FW_IDLE = static_path('frdm-kw41z_idle.elf')
    FW_AUTOTEST = static_path('frdm-kw41z_autotest.elf')
    DIRTY_SERIAL = False
Example #14
0
class NodePhynode(NodeDapLinkBase):
    """ Open node phyNode implementation """

    TYPE = 'phynode'
    OPENOCD_CFG_FILE = static_path('iot-lab-phynode.cfg')
    FW_IDLE = static_path('phynode_idle.elf')
    FW_AUTOTEST = static_path('phynode_autotest.elf')
    TTY = '/dev/iotlab/ttyON_PHYNODE'
class NodeStCell02(NodeStLinkBase):
    """ Open node STM32 CELL02 (NB-IoT) implementation """

    TYPE = 'st_cell02'
    OPENOCD_CFG_FILE = static_path('iot-lab-st-cell02.cfg')
    OPENOCD_PATH = '/opt/openocd-dev/bin/openocd'
    FW_IDLE = static_path('st-cell02_idle.elf')
    FW_AUTOTEST = static_path('st-cell02_autotest.elf')
class NodeStIotnode(NodeStLinkBase):
    """ Open node STM32 IOTNODE implementation """

    TYPE = 'st_iotnode'
    ROM_START_ADDR = 0x08000000
    OPENOCD_CFG_FILE = static_path('iot-lab-st-iotnode.cfg')
    FW_IDLE = static_path('st-iotnode_idle.elf')
    FW_AUTOTEST = static_path('st-iotnode_autotest.elf')
Example #17
0
class NodeDwm1001(NodeJLinkBase):
    """ Open node DWM1001 implementation """

    TYPE = 'dwm1001'
    OPENOCD_CFG_FILE = static_path('iot-lab-nrf52xxxdk.cfg')
    OPENOCD_PATH = '/usr/local/bin/openocd'
    FW_IDLE = static_path('dwm1001_idle.elf')
    FW_AUTOTEST = static_path('dwm1001_autotest.elf')
Example #18
0
class NodeNucleoWb55(NodeStLinkBase):
    """ Open node STM32 P-Nucleo-WB55 implementation """

    TYPE = 'nucleo_wb55'
    ROM_START_ADDR = 0x08000000
    OPENOCD_CFG_FILE = static_path('iot-lab-nucleo-wb55.cfg')
    FW_IDLE = static_path('nucleo-wb55_idle.elf')
    FW_AUTOTEST = static_path('nucleo-wb55_autotest.elf')
Example #19
0
class NodeMicrobit(NodeDapLinkBase):
    """ Open node Micro:Bit implementation """

    TYPE = 'microbit'
    OPENOCD_CLASS = OpenOCDCustomReset
    OPENOCD_CFG_FILE = static_path('iot-lab-microbit.cfg')
    FW_IDLE = static_path('microbit_idle.elf')
    FW_AUTOTEST = static_path('microbit_autotest.elf')
Example #20
0
class NodeStCell02(NodeStLinkBase):
    """ Open node STM32 CELL02 (NB-IoT) implementation """

    TYPE = 'st_cell02'
    ROM_START_ADDR = 0x08000000
    OPENOCD_CFG_FILE = static_path('iot-lab-st-cell02.cfg')
    FW_IDLE = static_path('st-cell02_idle.elf')
    FW_AUTOTEST = static_path('st-cell02_autotest.elf')
class NodeStIotnode(NodeStLinkBase):
    """ Open node STM32 IOTNODE implementation """

    TYPE = 'st_iotnode'
    OPENOCD_CFG_FILE = static_path('iot-lab-st-iotnode.cfg')
    OPENOCD_PATH = '/opt/openocd-0.10.0/bin/openocd'
    FW_IDLE = static_path('st-iotnode_idle.elf')
    FW_AUTOTEST = static_path('st-iotnode_autotest.elf')
Example #22
0
class NodeSamr34(NodeDapLinkBase):
    """ Open node SAMR34 implementation """

    TYPE = 'samr34'
    OPENOCD_CFG_FILE = static_path('iot-lab-samr34.cfg')
    OPENOCD_PATH = '/opt/openocd-dev/bin/openocd'
    FW_IDLE = static_path('samr34_idle.elf')
    FW_AUTOTEST = static_path('samr34_autotest.elf')
Example #23
0
 def test_objdump(self):
     """ test the objdump get_elf_load_addr """
     elf = os.path.abspath(static_path('firefly_autotest.elf'))
     elf_addr = get_elf_load_addr(elf)
     self.assertEquals(0x00200000, elf_addr)
     elf = os.path.abspath(static_path('firefly_idle.elf'))
     elf_addr = get_elf_load_addr(elf)
     self.assertEquals(0x00202000, elf_addr)
Example #24
0
class NodeNucleoWL55JC(NodeStLinkBase):
    """ Open node STM32 Nucleo-WL55JC implementation """

    TYPE = 'nucleo_wl55jc'
    ROM_START_ADDR = 0x08000000
    OPENOCD_CFG_FILE = static_path('iot-lab-nucleo-wl55jc.cfg')
    FW_IDLE = static_path('nucleo-wl55jc_idle.elf')
    FW_AUTOTEST = static_path('nucleo-wl55jc_autotest.elf')
class NodeNucleof070RB(NodeStLinkBase):
    # pylint:disable=no-member
    """ Open node STM32 Nucleo F070RB St-Link based board implementation """

    TYPE = 'nucleo_f070rb'
    OPENOCD_CFG_FILE = static_path('iot-lab-nucleo-f070rb.cfg')
    FW_IDLE = static_path('nucleo-f070rb_idle.elf')
    FW_AUTOTEST = static_path('nucleo-f070rb_autotest.elf')
class NodeArduinoZero(NodeOpenOCDBase):
    """ Open node Arduino Zero implementation """

    TYPE = 'arduino_zero'
    TTY = '/dev/iotlab/ttyON_CMSIS_DAP'
    BAUDRATE = 115200
    OPENOCD_CFG_FILE = static_path('iot-lab-arduino-zero.cfg')
    FW_IDLE = static_path('arduino-zero_idle.elf')
    FW_AUTOTEST = static_path('arduino-zero_autotest.elf')
Example #27
0
class NodeStLrwan1(NodeStLinkBase):
    """ Open node STM32 LRWAN1 implementation """

    TYPE = 'st_lrwan1'
    ROM_START_ADDR = 0x08000000
    OPENOCD_CFG_FILE = static_path('iot-lab-st-lrwan1.cfg')
    OPENOCD_PATH = '/opt/openocd-dev/bin/openocd'
    FW_IDLE = static_path('st-lrwan1_idle.elf')
    FW_AUTOTEST = static_path('st-lrwan1_autotest.elf')
Example #28
0
class NodeSamr21(NodeOpenOCDBase):
    """ Open node SAMR21 implementation """

    TYPE = 'samr21'
    OPENOCD_CFG_FILE = static_path('iot-lab-samr21.cfg')
    FW_IDLE = static_path('samr21_idle.elf')
    FW_AUTOTEST = static_path('samr21_autotest.elf')
    TTY = '/dev/iotlab/ttyON_CMSIS_DAP'
    BAUDRATE = 115200
class NodeNrf52840Mdk(NodeOpenOCDBase):
    """ Open node NRF52840-MDK implementation """

    TYPE = 'nrf52840mdk'
    OPENOCD_CFG_FILE = static_path('iot-lab-nrf528xxmdk.cfg')
    FW_IDLE = static_path('nrf52840mdk_idle.elf')
    FW_AUTOTEST = static_path('nrf52840mdk_autotest.elf')
    TTY = '/dev/iotlab/ttyON_CMSIS-DAP'
    BAUDRATE = 115200
Example #30
0
class NodeDwm1001(NodeOpenOCDBase):
    """ Open node DWM1001 implementation """

    TYPE = 'dwm1001'
    OPENOCD_CFG_FILE = static_path('iot-lab-nrf52xxxdk.cfg')
    FW_IDLE = static_path('dwm1001_idle.elf')
    FW_AUTOTEST = static_path('dwm1001_autotest.elf')
    TTY = '/dev/iotlab/ttyON_DWM1001'
    BAUDRATE = 115200
# knowledge of the CeCILL license and that you accept its terms.


""" Open A8 interface """

import os
import shlex
import logging
from subprocess import check_output, check_call, STDOUT, CalledProcessError

from gateway_code.config import static_path
from gateway_code.utils.serial_expect import SerialExpectForSocket

LOGGER = logging.getLogger('gateway_code')

_SSH_OPTS = '-F {ssh_cfg}'.format(ssh_cfg=static_path('ssh_a8_config'))
SSH_CMD = 'ssh ' + _SSH_OPTS + ' {ip_addr} "source /etc/profile; {cmd}"'
SCP_CMD = 'scp ' + _SSH_OPTS + ' {path} {ip_addr}:{remote_path}'

MAC_CMD = "cat /sys/class/net/eth0/address"
IP_CMD = ("ip addr show dev eth0 " +
          r" | sed -n '/inet/ s/.*inet \([^ ]*\)\/.*/\1/p'")


class A8ConnectionError(Exception):
    """ FatalError during tests """
    def __init__(self, value, err_msg):
        super(A8ConnectionError, self).__init__()
        self.value = value
        self.err_msg = err_msg