{# device_type: cc3220SF #}
{% extends 'base.jinja2' %}
{% set usb_vendor_id = '0451' %}
{% set usb_product_id = 'bef3' %}
{% block body %}
board_id: '{{ board_id|default('00000000') }}'
usb_vendor_id: '{{ usb_vendor_id }}'
usb_product_id: '{{ usb_product_id }}'
usb_sleep: {{ usb_sleep|default(10) }}

actions:
  deploy:
    methods:
      image:
        parameters:

  boot:
    connections:
      serial:
    methods:
      openocd:
        board_selection_cmd: "xds110_serial {{ board_id|default('00000000') }}"
        parameters:
          command:
            # Can set 'openocd_bin_override' in device dictionary to
            # override location of OpenOCD executable to point to TI OpenOCD
            # if necessary
            {{ openocd_bin_override|default('openocd') }}
          options:
            file:
              - board/ti_cc3220sf_launchpad.cfg
            # Set 'openocd_scripts_dir_override' in device dictionary to
            # point to TI OpenOCD scripts if necessary
            search: [{{ openocd_scripts_dir_override }}]
            command:
              - gdb_port disabled
              - init
              - targets
              - 'reset halt'
              - 'flash write_image erase {BINARY}'
              - 'reset halt'
              - 'verify_image {BINARY}'
              - 'reset run'
              - shutdown
            debug: 2
      gdb:
        parameters:
          command: gdb-multiarch
          wait_before_continue: {{ wait_before_continue|default(5) }}
        openocd:
          arguments:
          - "{ZEPHYR}"
          commands:
          - target remote | openocd -c "gdb_port pipe" -f {OPENOCD_SCRIPT}
          - monitor reset halt
          - load
          - set remotetimeout 10000
          docker:
            use: {{ docker_use|default(False) }}
            container: '{{ docker_container|default('ti-openocd') }}'
            devices: {{ docker_devices|default([]) }}
{% endblock body %}

{% set device_info = device_info|default([{'board_id': board_id, 'usb_vendor_id': usb_vendor_id, 'usb_product_id': usb_product_id}]) %}
