This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2650: Over the Air firmware update for Contiki-NG

Part Number: CC2650
Other Parts Discussed in Thread: CC1350,

Hello,

I'm trying to implement OTA on my wireless network which is based on Contiki-NG running on cc26x0/cc13x0 launchpads (now I'm more focused on the cc2650, however everything should be the same on the cc1350).

I've started with this very nice and well explained tutorial (other details here) which is based on Contiki 3 and uses COAP for the firmware transmission over the network. For my use, I want it on Contiki-NG (4.2) and using generic UDP packets for the dissemination of the OTA firmware.

As first thing I'm trying to port the bootloader to the new Contiki-NG (version 4.2). I took the Mark's one and I added basic UART support with some verbosity through a very quick-and-dirty implementation of a printf-like function. This is to help the debug process. Then I took a version of my Contiki code (which is working fine without OTA) and I changed the makefiles to use the OTA linker script (given by Mark in the tutorial) properly adapted for Contiki-NG (the adapted script is attached).

After a while I managed to have the bootloader more or less working. More or less in the sense that it properly reads both the internal and external memory and verifies the images' CRC. It also properly jumps to the Contiki's main(), but after plotting some of the initial lines (see below) it get stuck. It doesn't reboot, it simply doesn't do anything till I manually reset it.

Moreover, if I change something in the Contiki code (like commenting the lines that turn on the LEDs during boot) I see more lines arriving from the UART. It looks like it get stuck after a given time interval, therefore if I comment some part of code it goes on a bit more (I remind that the same exact contiki code works properly without the OTA linker script).

I though the problem was in the Bootloader, however since Contiki plots few lines it means that the bootloader works, and also the linker script looks working. On the other hand the Contiki code works properly when compiled without the OTA linker script.

Then what can be the cause? Any idea on how to debug it?

Thank you,

Davide.

Here's the UART output (the first part is related to the bootloader and from [INFO: Main    ] it is Contiki's main() printing stuff).

Bootloader started!
Installed firmware (on internal flash) metadata:
crc: 0xB3BA
size: 0x0001264C
uuid: 0xABCD1234
version: 0x0001
verifying it...
firmware_address: 0x00002100
firmware_end_address: 0x0001474C
CRC Calculated: 0xB3BA

Newest OTA firmware (in the external flash) is at slot: 0x00
Newest OTA firmware metadata:
crc: 0x6652
size: 0x00012D7C
uuid: 0xABCD1234
version: 0x0000

Internal image is valid, and there's nothing newer, then boot the firmware..

[INFO: Main      ] Starting Contiki-NG-release/v4.2-222-g2be86ab-dirty
[INFO: Main      ] - Routing: RPL Lite
[INFO: Main      ] - Net: sicslowpan
[INFO: Main      ] - MAC: TSCH
[INFO: Main      ] - 802.15.4 PANID: 0xabcd
[INFO: Main      ] - 802.15.4 TSCH default hopping sequence length: 4
[INFO: Main      ] Node ID: 56711
[INFO: Main      ] Link-layer address: 0012.4b00.0f24.dd87
[INFO: Main      ] Tentative link-local


Here the OTA linker script (I changed the file extension from .ld to .config, otherwise the forum doesn't allow to publish it).

ENTRY(ResetISR)
MEMORY
{
    FLASH (RX) : ORIGIN = (0x2000 +0x100), LENGTH = 0x19000
    SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00005000
    GPRAM (RWX) : ORIGIN = 0x11000000, LENGTH = 0x00002000
}
_estack = ORIGIN(SRAM) + LENGTH(SRAM);
_Min_Heap_Size = 0;
_Min_Stack_Size = 0x400;
SECTIONS
{
    .text :
    {
        _text = .;
        KEEP(*(.vectors))
        *(.text*)
        *(.rodata*)
        _etext = .;
    } > FLASH = 0
    .data :
    {
        _data = .;
        *(vtable)
        *(.data*)
        _edata = .;
    } > SRAM AT > FLASH
    _ldata = LOADADDR(.data);
    .ARM.exidx :
    {
        *(.ARM.exidx*)
    } > FLASH
    .bss :
    {
        _bss = .;
        *(.bss*)
        *(COMMON)
        _ebss = .;
    } > SRAM
    _end = .;
    _stack = .;
    _stack_origin = ORIGIN(SRAM) + LENGTH(SRAM);
    _heap = _stack;
    _eheap = _stack_origin;
    ._user_heap_stack :
    {
      . = ALIGN(4);
      . = . + _Min_Heap_Size;
      . = . + _Min_Stack_Size;
      . = ALIGN(4);
    } > SRAM
    .gpram :
    {
    } > GPRAM
}