Bootloader for CC1310

0

I have LAUNCHXL-CC1310 devboard and I want to make automatic updates of the software from FLASH memory through SPI interface, in other words I need to make bootloader. The program itself runs on Contiki-ng. I can't find out how to make memory mapping and switch from bootloader to application. Has anyone done something similar? I will be grateful for hints.

/* Entry Point */
ENTRY(ResetISR)

MEMORY
{
    /* Flash Size 128 KB minus the CCA area below (88 bytes) */
    FLASH (RX) : ORIGIN = 0x00001000, LENGTH = 0x0001DFA8

    /*
     * Customer Configuration Area and Bootloader Backdoor configuration
     * in flash, up to 88 bytes
     */
    FLASH_CCFG (RX) : ORIGIN = 0x0001DFA8, LENGTH = 88

    /* RAM Size 20KB */
    SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00005000

    /* Application can use GPRAM region as RAM if cache is disabled in CCFG */
    GPRAM (RWX) : ORIGIN = 0x11000000, LENGTH = 0x00002000
}

/*. Highest address of the stack. Used in startup file .*/
_estack = ORIGIN(SRAM) + LENGTH(SRAM); /* End of SRAM */

/*. Generate a link error if heap and stack don’t fit into RAM .*/
_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 = .;  /* End of the .bss segment. */

    /* These symbols are used by the stack check library. */
    _stack = .;
    _stack_origin = ORIGIN(SRAM) + LENGTH(SRAM);
    _heap = _stack;
    _eheap = _stack_origin;

    .ccfg :
    {
        KEEP(*(.ccfg))
    } > FLASH_CCFG

    /* User_heap_stack section, used to check that there is enough RAM left */
    ._user_heap_stack :
    {
      . = ALIGN(4);
      . = . + _Min_Heap_Size;
      . = . + _Min_Stack_Size;
      . = ALIGN(4);
    } > SRAM

    .gpram :
    { 
    } > GPRAM

}

Liker script Application:

--retain=g_pfnVectors

--diag_suppress=10063,16011,16012

#define FLASH_PAGE0_START       0x00000000
#define FLASH_PAGE31_START      0x0001F000
#define PAGE_SIZE               0x1000
#define RAM_BASE                0x20000000
#define RAM_SIZE                0x5000

/* Flash Range of BIM */
#if defined(KEEP_INTVECS)
  #define FLASH_RANGE           FLASH_PAGE0 | FLASH_PAGE31
#else /* !KEEP_INTVECS */
  #define FLASH_RANGE           FLASH_PAGE31
#endif /* KEEP_INTVECS */


/* System memory map */

MEMORY
{
#if defined(KEEP_INTVECS)
    FLASH_PAGE0 (RX)  : origin = FLASH_PAGE0_START, length = PAGE_SIZE
#endif /* KEEP_INTVECS */

    /* BIM stored in and executes from internal flash */
    /* Flash Size 4 KB */
    FLASH_PAGE31 (RX) : origin = FLASH_PAGE31_START, length = PAGE_SIZE

    /* Application uses internal RAM for data */
    /* RAM Size 16 KB */
    SRAM (RWX) : origin = RAM_BASE, length = 0x00002CFF
}

/* Section allocation in memory */

SECTIONS
{
  /*
   * Editor's note: any additional application obj files for BIM should be placed here.
   */
  output_APP
  {
    bim_main.obj(.text)
    bls_bsp.obj(.text)
    ext_flash.obj(.text)
  } > FLASH_PAGE31

  /*
   * Editor's note:  this section is nearly full.
   */
  output_DRIVERS
  {
    bsp_spi.obj(.text)
    --library=driverlib.lib(.text)
  } > FLASH_PAGE0

#if defined(KEEP_INTVECS)
    .intvecs        :  > FLASH_PAGE0_START
#endif //KEEP_INTVECS

    LoaderEntry     :   > FLASH_PAGE31_START
    .text           :   > FLASH_RANGE
    .const          :   > FLASH_RANGE
    .constdata      :   > FLASH_RANGE
    .rodata         :   > FLASH_RANGE
    .cinit          :   > FLASH_RANGE
    .pinit          :   > FLASH_RANGE
    .init_array     :   > FLASH_RANGE
    .emb_text       :   > FLASH_RANGE
    .ccfg           :   > FLASH_PAGE31 (HIGH)

    .vtable         :   > SRAM
    .vtable_ram     :   > SRAM
     vtable_ram     :   > SRAM
    .data           :   > SRAM
    .bss            :   > SRAM
    .sysmem         :   > SRAM
    .stack          :   > SRAM (HIGH)
    .nonretenvar    :   > SRAM
}

/* Create global constant that points to top of stack */
/* CCS: Change stack size under Project Properties    */
__STACK_TOP = __stack + __STACK_SIZE;

/* Allow main() to take args */
/*--args 0x8*/

c
ld
bootloader
armasm
asked on Stack Overflow Jul 16, 2019 by NXT Labs

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0