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.

User Sections and the linker

Part Number: CC3235MODASF
Other Parts Discussed in Thread: CC3220SF

Hello,

I use the CC3220MODASF module, the CCS 12.0.0.00009, the simplelink_cc32xx_sdk_6_10_00_05 and the compilers TI v20.2.7 LTS and TI Clang v2.1.0.LTS.
I want to create my own data section for holding apllication specific values.
The section should be placed inside the flash.

I modified the uart2echo example in the following way:

  •  add the source file baudrate.c that includes the constant variable cfgbaud marked for the section .usersec
    • I know that the keyword __attribute__ isn't the best one for the TI and the TICLANG compilers, but it leads to the result wanted ;)
    • I also checked it with the TI compiler pragma direction. It also results in the described behavior

      #include <stdint.h>
      #if 0
        #pragma DATA_SECTION(cfgbaud, ".usersec")
        const uint32_t cfgbaud = 115200;
      #else
        const uint32_t cfgbaud __attribute__((section(".usersec"))) = 115200;
      #endif

  • the baudrate is set in the file uart2echo.c using the variable located in the section .usersec

    // uartParams.baudRate = 115200;
    uartParams.baudRate = cfgbaud;

  • the section .usersec is added to the link file cc32xxsf_tirtos.cmd

    SECTIONS
    {
        .dbghdr     : > FLASH_HDR
        .resetVecs  : > 0x01000800
        .text       : > FLASH
        .TI.ramfunc : {} load=FLASH, run=SRAM, table(BINIT)
        .const      : > FLASH
        .rodata     : > FLASH
        .cinit      : > FLASH
        .pinit      : > FLASH
        .init_array : > FLASH
        .usersec    : > FLASH

        .vecs       : > 0x20000000
        .data       : > SRAM
        .bss        : > SRAM
        .sysmem     : > SRAM

        /* Heap buffer used by HeapMem */
        .priheap   : {
            __primary_heap_start__ = .;
            . += HEAPSIZE;
            __primary_heap_end__ = .;
        } > SRAM align 8

        .stack      : > SRAM(HIGH)
        .log_data       :   > LOG_DATA, type = COPY
    }


The map file shows that the section .usersec is created and the variable cfgbaud is inside that section.
In the debugger environment the program runs as aexpected. That is valid for both variants, the TI C and the TI Clang compiler toolchain.

But, running from flash doesn't work.
The variable cfgbaud is set to zero and not initialized to 115200 as expected.


Any ideas what's going wrong?

Best regards,
Roman