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.

CC1352P: OAD + BIM, troubleshooting jump from BIM to application

Part Number: CC1352P
Other Parts Discussed in Thread: UNIFLASH

Hi! Thanks for your help previously (e2e.ti.com/.../3622730

I've read all documentation I can find and went through the SimpleLink Academy "BLE Enhanced OAD". As seen in my previous thread I'm applying BIM + OAD to a project that lacks wireless connectivity, I will receive the OAD-image over 4G/UART. But that is another topic.

SDK: simplelink_cc13x2_26x2_sdk_4_40_04_04

BIM project: bim_offchip_CC1352P1_LAUNCHXL_nortos_ccs

I'm now following "Task 3 - Add OAD to Multi Role" (but adding it to my non-BLE-application). I will use external flash for images but is is currently empty.

Current state:

Challenge:

  • Make BIM jump to my application

This works:

  • BIM + simple_peripheral_oad_offchip_CC13X2P1_LAUNCHXL_tirtos_ccs
    I can create a production image (using SRecord) with the two above and BIM can jump to application.
    So I know BIM implementation is OK.
  • myCustomApplication: I can debug it standalone and I can flash the .out-file with UniFlash, so I know the application is working.

This happens:

  • BIM + myCustomApplication
    BIM can read the OAD header (I modified it to verify this) so It finds the header, but ends up in an faultISR when jumping.
  • I get a Linker warning that I suspect has something to do with my issues.
    #10247-D creating output section ".ccfg" without a SECTIONS specification
    While modifying myCustomApplication I used the .cmd-file cc13x2_cc26x2_app.cmd which has the .ccfg section commented out. But there is an entry in the .map file
    .ccfg      0    00015a48    00000058     
                      00015a48    00000058     ti_devices_config.obj (.ccfg:retain)
    How would I remove the ccfg from my project entirely?

If it gives you any information - Output from oad_image_tool for myCustomApplication

____________________________
       OAD IMG HDR
____________________________
Field       |    Value
imgID       |    b'CC13x2R1'
CRC         |    0x6E6C0580
bimVer      |    3
metaVer     |    1
techType    |    0xFFFE
imgCpStat   |    0xFF
crcStat     |    0xFF
imgType     |    0x7
imgNo       |    0x0
imgVld      |    0xFFFFFFFF
len         |    0x15D2C
prgEntry    |    0x8C
softVer     |    0x31303030
imgEndAddr  |    0x15D2B
hdrLen      |    0x2C
 
 
____________________________
        Segment HDR
____________________________
Field            |      Value
Segment Type     |      Contiguous Image Segment
Wireless Tech    |      [BLE]
Segment Length   |      0x15D00
Start Address    |      0x0

Output from oad_image_tool for simple_peripheral_oad_offchip_CC13X2P1_LAUNCHXL_tirtos_ccs

____________________________
       OAD IMG HDR
____________________________
Field       |    Value
imgID       |    b'CC13x2R1'
CRC         |    0x49511BFE
bimVer      |    3
metaVer     |    1
techType    |    0xFFFE
imgCpStat   |    0xFF
crcStat     |    0xFF
imgType     |    0x7
imgNo       |    0x0
imgVld      |    0xFFFFFFFF
len         |    0x1E8E4
prgEntry    |    0x90
softVer     |    0x31303030
imgEndAddr  |    0x1E8E3
hdrLen      |    0x2C
 
 
____________________________
       Segment HDR
____________________________
Field            |      Value
Segment Type     |      Security Segment
Wireless Tech    |      [BLE]
Segment Length   |      0x55
Security Version |      0x1
Timestamp        |      0x6040D495
Signer Info      |      0x8B10EC1D517D17B0
Signature        |      0xC22407C1C04A38CB2DDC844A02BB5D20F79D765D8985FADE40E5CC9B475B94E9328DD2AFC90E50107E6672C45E6AEC73B38C6BA317BD3FB27B0332EFD5137DA1
 
 
____________________________
        Segment HDR
____________________________
Field            |      Value
Segment Type     |      Contiguous Image Segment
Wireless Tech    |      [BLE]
Segment Length   |      0x1E863
Start Address    |      0x0
 

  • Hi Christian,

    Did you double-check what address the BIM is trying to jump to?

  • Hi Marie!

    Yes, I checked for both applications that it tries to jump to

    "prgEntry    |    0x90"

    or

    "prgEntry    |    0x8C"

    from above.

    I modified BIM, function "checkImagesIntFlash" as below to make sure it tries to jump. Debugged and checked that imgHdr.prgEntry is loaded with correct value from above.

            /* Check imageID bytes */
            //if(imgIDCheck(&imgHdr) == true)
            if(1)
            {
                /* Read whole image header */
                readFlash((uint32_t)startAddr, (uint8_t *)&imgHdr, OAD_IMG_HDR_LEN);
    
                //Test to bypass all tests below
                jumpToPrgEntry(imgHdr.prgEntry);  /* No return from here */

    But, I don't know how to verify that 0x8C is actually the correct jump address?

    0x90 works for simple_peripheral_oad_offchip_CC13X2P1_LAUNCHXL_tirtos_ccs. Tried hard-code 0x90 for myCustomApplication but that didn't work either.

  • Hi Christian, 

    Have you tested the advanced debugging task in the enhanced OAD lab? 

    Thanks, 
    Elin 

  • Hi Elin,

    Thanks for the tip. I made progress by examining the map-files for working/non-working jump applications.

    oad_image_tool set prgEntry to 0x8C in the header for myCustomApplication. Correct address was 0x50 as relocated in the .cfg-file

    if (compilerDefs.indexOf('SECURITY') > -1) { // Check for SECURITY compiler symbol
    	m3Hwi.resetVectorAddress = 0x90; // Image B Reset Vector Address
    }
    else {
    	m3Hwi.resetVectorAddress = 0x50; // Image A Reset Vector Address
    }

    I found in separate thread that linker .cmd-file should look like below

      GROUP > ENTRY
      {
        .resetVecs		LOAD_START(prgEntryAddr)
        .intvecs
        EntrySection  //LOAD_START(prgEntryAddr)
      }

    Moving the LOAD_START(prgEntryAddr) to .resetVecs made oad_image_tool set the prgEntry to 0x50 which works for jumping. So far so good!

    Current concern is that I haven't managed to exclude ccfg from myCustomApplication. See first post as well for details. .map-file still contains

    .ccfg      0    000159b4    00000058     
                      000159b4    00000058     ti_devices_config.obj (.ccfg:retain)

    even though ccfg is commented in .cmd file

    /*******************************************************************************
     * Section Allocation in Memory
     ******************************************************************************/
    SECTIONS
    {
     GROUP > FLASH_IMG_HDR
      {
        .image_header //align PAGE_SIZE
      }
    
      GROUP > ENTRY
      {
        .resetVecs		LOAD_START(prgEntryAddr)
        .intvecs
        EntrySection  //LOAD_START(prgEntryAddr)
      }
     // .intvecs        :   >  FLASH_START
      GROUP >>  FLASH
      {
        .text
        .const
        .constdata
        .rodata
        .emb_text
        .pinit
      }
    
      .cinit        : > FLASH LOAD_END(flashEndAddr)
    
      //.ccfg           :   >  FLASH_LAST_PAGE (HIGH)
    
    
      GROUP > SRAM
      {
        .data LOAD_START(ramStartHere)
        #ifndef CACHE_AS_RAM
        .bss
        #endif /* CACHE_AS_RAM */
        .vtable
        .vtable_ram
        vtable_ram
        .sysmem
        .nonretenvar
        /*This keeps ll.o objects out of GPRAM, if no ll.o would be placed here
          the warning #10068 is supressed.*/
        #ifdef CACHE_AS_RAM
        ll_bss
        {
          --library=*ll_*.a<ll.o> (.bss)
          --library=*ll_*.a<ll_ae.o> (.bss)
        }
        #endif /* CACHE_AS_RAM */
        .noinit
      } LOAD_END(heapStart)
    
      .stack            :   >  SRAM (HIGH) LOAD_START(heapEnd)
      .priheap   : {
            __primary_heap_start__ = .;
            . += HEAPSIZE;
            __primary_heap_end__ = .;
      } > SRAM align 8
      #ifdef CACHE_AS_RAM
    
      .bss :
      {
        *(.bss)
      } > GPRAM
      #endif /* CACHE_AS_RAM */
    }

    I attached my complete .cmd-file below (had to rename it to .txt). Could you please provide guidance of how to remove the ccfg from my application? Currently it seems to run anyway but it should be excluded I understand.

    /******************************************************************************
    
     @file  cc13x2_cc26x2_app.cmd
    
     @brief CC26X2 or CC13X2 OAD specific linker configuration file for TI-RTOS with
            Code Composer Studio.
    
            Imported Symbols
            Note: Linker defines are located in the CCS IDE project by placing them
            in
            Properties->Build->Linker->Advanced Options->Command File Preprocessing.
    
            CACHE_AS_RAM:       Disable system cache to be used as GPRAM for
                                additional volatile memory storage.
            FLASH_ROM_BUILD:	If defined, it should be set to 1 or 2 to indicate
                                the ROM version of the device being used. When using
                                Flash-only configuration, this symbol should not be
                                defined.
            ICALL_RAM0_START:   RAM start of BLE stack.
            ICALL_STACK0_START: Flash start of BLE stack.
            PAGE_AlIGN:         Align BLE stack boundary to a page boundary.
                                Aligns to Flash word boundary by default.
    
     Group: WCS, BTS
     Target Device: cc13x2_26x2
    
     ******************************************************************************
    
     Copyright (c) 2017-2021, Texas Instruments Incorporated
     All rights reserved.
    
     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions
     are met:
    
     *  Redistributions of source code must retain the above copyright
        notice, this list of conditions and the following disclaimer.
    
     *  Redistributions in binary form must reproduce the above copyright
        notice, this list of conditions and the following disclaimer in the
        documentation and/or other materials provided with the distribution.
    
     *  Neither the name of Texas Instruments Incorporated nor the names of
        its contributors may be used to endorse or promote products derived
        from this software without specific prior written permission.
    
     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    
     ******************************************************************************
    
    
     *****************************************************************************/
    
    /*******************************************************************************
     * CCS Linker configuration
     */
    
    --stack_size=1024   /* C stack is also used for ISR stack */
    
    HEAPSIZE = 0x4000;  /* Size of heap buffer used by HeapMem */
    
    /* Retain interrupt vector table variable                                    */
    --retain=g_pfnVectors
    /* Override default entry point.                                             */
    --entry_point ResetISR
    /* Suppress warnings and errors:                                             */
    /* - 10063: Warning about entry point not being _c_int00                     */
    /* - 16011, 16012: 8-byte alignment errors. Observed when linking in object  */
    /*   files compiled using Keil (ARM compiler)                                */
    --diag_suppress=10063,16011,16012
    
    /* The following command line options are set as part of the CCS project.    */
    	/* If you are building using the command line, or for some reason want to    */
    /* define them here, you can uncomment and modify these lines as needed.     */
    /* If you are using CCS for building, it is probably better to make any such */
    /* modifications in your CCS project and leave this file alone.              */
    /*                                                                           */
    /* --heap_size=0                                                             */
    /* --stack_size=256                                                          */
    /* --library=rtsv7M3_T_le_eabi.lib                                           */
    
    /* The starting address of the application.  Normally the interrupt vectors  */
    /* must be located at the beginning of the application. Flash is 128KB, with */
    /* sector length of 4KB                                                      */
    /*******************************************************************************
     * Memory Sizes
     */
    #define FLASH_BASE   0x00000000
    #define GPRAM_BASE   0x11000000
    #define RAM_BASE     0x20000000
    #define ROM_BASE     0x10000000
    
    #define FLASH_SIZE   0x00058000
    #define GPRAM_SIZE   0x00002000
    #define RAM_SIZE     0x00014000
    #define ROM_SIZE     0x00040000
    
    #define RTOS_RAM_SIZE           0x0000012C
    #define RESERVED_RAM_SIZE_ROM_1 0x00000B08
    #define RESERVED_RAM_SIZE_ROM_2 0x00000EB3
    
    /*******************************************************************************
     * Memory Definitions
     ******************************************************************************/
    
    /*******************************************************************************
     * RAM
     */
    #if defined(FLASH_ROM_BUILD)
      #if (FLASH_ROM_BUILD == 1)
        #define RESERVED_RAM_SIZE_AT_START 0
        #define RESERVED_RAM_SIZE_AT_END   RESERVED_RAM_SIZE_ROM_1
      #else // (FLASH_ROM_BUILD == 2)
        #define RESERVED_RAM_SIZE_AT_START (RTOS_RAM_SIZE + RESERVED_RAM_SIZE_ROM_2)
        #define RESERVED_RAM_SIZE_AT_END   0
      #endif
    #else /* Flash Only */
      #define RESERVED_RAM_SIZE_AT_START 0
      #define RESERVED_RAM_SIZE_AT_END   0
    #endif // FLASH_ROM_BUILD
    
    #define RAM_START      (RAM_BASE + RESERVED_RAM_SIZE_AT_START)
    #ifdef ICALL_RAM0_START
      #define RAM_END      (ICALL_RAM0_START - 1)
    #else
      #define RAM_END      (RAM_BASE + RAM_SIZE - RESERVED_RAM_SIZE_AT_END - 1)
    #endif /* ICALL_RAM0_START */
    
    /* For ROM 2 devices, the following section needs to be allocated and reserved */
    #define RTOS_RAM_START RAM_BASE
    #define RTOS_RAM_END   (RAM_BASE + RTOS_RAM_SIZE - 1)
    
    /*******************************************************************************
     * Flash
     */
    
    #define WORD_SIZE                  4
    
    #define PAGE_SIZE                  0x2000
    
    #ifdef PAGE_ALIGN
      #define FLASH_MEM_ALIGN          PAGE_SIZE
    #else
      #define FLASH_MEM_ALIGN          WORD_SIZE
    #endif /* PAGE_ALIGN */
    
    #define PAGE_MASK                  0xFFFFE000
    
    /* The last Flash page is reserved for the application. */
    #define NUM_RESERVED_FLASH_PAGES   1
    #define RESERVED_FLASH_SIZE        (NUM_RESERVED_FLASH_PAGES * PAGE_SIZE)
    
    /* Check if page alingment with the Stack image is required.  If so, do not link
     * into a page shared by the Stack.
     */
    #define  OAD_HDR_START             FLASH_BASE
    #ifdef SECURITY
      #define  OAD_HDR_SIZE            0x90
    #else
      #define  OAD_HDR_SIZE            0x50
    #endif
    #define  OAD_HDR_END               OAD_HDR_START + OAD_HDR_SIZE - 1
    
    #define ENTRY_START                OAD_HDR_END + 1
    #define ENTRY_SIZE                 0x40
    #define ENTRY_END                  ENTRY_START + ENTRY_SIZE - 1
    
    #define FLASH_START                ENTRY_END + 1
    
    #ifdef ICALL_STACK0_START
      #ifdef PAGE_ALIGN
        #define ADJ_ICALL_STACK0_START (ICALL_STACK0_START * PAGE_MASK)
      #else
        #define ADJ_ICALL_STACK0_START ICALL_STACK0_START
      #endif /* PAGE_ALIGN */
    
      #define FLASH_END                (ADJ_ICALL_STACK0_START - 1)
    #else
      #define FLASH_END                (FLASH_BASE + FLASH_SIZE - RESERVED_FLASH_SIZE - 1)
    #endif /* ICALL_STACK0_START */
    
    #define FLASH_LAST_PAGE_START      FLASH_END + 1
    
    /*******************************************************************************
     * Stack
     */
    
    /* Create global constant that points to top of stack */
    /* CCS: Change stack size under Project Properties    */
    __STACK_TOP = __stack + __STACK_SIZE;
    
    /*******************************************************************************
     * GPRAM
     */
    
    #ifdef CACHE_AS_RAM
      #define GPRAM_START GPRAM_BASE
      #define GPRAM_END   (GPRAM_START + GPRAM_SIZE - 1)
    #endif /* CACHE_AS_RAM */
    
    /*******************************************************************************
     * ROV
     * These symbols are used by ROV2 to extend the valid memory regions on device.
     * Without these defines, ROV will encounter a Java exception when using an
     * autosized heap. This is a posted workaround for a known limitation of
     * RTSC/rta. See: https://bugs.eclipse.org/bugs/show_bug.cgi?id=487894
     *
     * Note: these do not affect placement in RAM or FLASH, they are only used
     * by ROV2, see the BLE Stack User's Guide for more info on a workaround
     * for ROV Classic
     *
     */
    __UNUSED_SRAM_start__ = RAM_BASE;
    __UNUSED_SRAM_end__ = RAM_BASE + RAM_SIZE;
    
    __UNUSED_FLASH_start__ = FLASH_BASE;
    __UNUSED_FLASH_end__ = FLASH_BASE + FLASH_SIZE;
    
    /*******************************************************************************
     * Main arguments
     */
    
    /* Allow main() to take args */
    /* --args 0x8 */
    
    /*******************************************************************************
     * System Memory Map
     ******************************************************************************/
    MEMORY
    {
      /* EDITOR'S NOTE:
       * the FLASH and SRAM lengths can be changed by defining
       * ICALL_STACK0_START or ICALL_RAM0_START in
       * Properties->ARM Linker->Advanced Options->Command File Preprocessing.
       */
    
      /* Application stored in and executes from internal flash */
      FLASH (RX) : origin = FLASH_START, length = (FLASH_END - FLASH_START + 1)
    
      ENTRY (RX) : origin = ENTRY_START, length = ENTRY_SIZE
      /* CCFG Page, contains .ccfg code section and some application code. */
      FLASH_IMG_HDR (RX) : origin = OAD_HDR_START, length = OAD_HDR_SIZE
    
      /* Application uses internal RAM for data */
    #if (defined(FLASH_ROM_BUILD) && (FLASH_ROM_BUILD == 2))
      RTOS_SRAM (RWX) : origin = RTOS_RAM_START, length = (RTOS_RAM_END - RTOS_RAM_START + 1)
    #endif
      SRAM (RWX) : origin = RAM_START, length = (RAM_END - RAM_START + 1)
    
      #ifdef CACHE_AS_RAM
          GPRAM(RWX) : origin = GPRAM_START, length = GPRAM_SIZE
      #endif /* CACHE_AS_RAM */
    }
    
    /*******************************************************************************
     * Section Allocation in Memory
     ******************************************************************************/
    SECTIONS
    {
     GROUP > FLASH_IMG_HDR
      {
        .image_header //align PAGE_SIZE
      }
    
      GROUP > ENTRY
      {
        .resetVecs		LOAD_START(prgEntryAddr)
        .intvecs
        EntrySection  //LOAD_START(prgEntryAddr)
      }
     // .intvecs        :   >  FLASH_START
      GROUP >>  FLASH
      {
        .text
        .const
        .constdata
        .rodata
        .emb_text
        .pinit
      }
    
      .cinit        : > FLASH LOAD_END(flashEndAddr)
    
      //.ccfg           :   >  FLASH_LAST_PAGE (HIGH)
    
    
      GROUP > SRAM
      {
        .data LOAD_START(ramStartHere)
        #ifndef CACHE_AS_RAM
        .bss
        #endif /* CACHE_AS_RAM */
        .vtable
        .vtable_ram
        vtable_ram
        .sysmem
        .nonretenvar
        /*This keeps ll.o objects out of GPRAM, if no ll.o would be placed here
          the warning #10068 is supressed.*/
        #ifdef CACHE_AS_RAM
        ll_bss
        {
          --library=*ll_*.a<ll.o> (.bss)
          --library=*ll_*.a<ll_ae.o> (.bss)
        }
        #endif /* CACHE_AS_RAM */
        .noinit
      } LOAD_END(heapStart)
    
      .stack            :   >  SRAM (HIGH) LOAD_START(heapEnd)
      .priheap   : {
            __primary_heap_start__ = .;
            . += HEAPSIZE;
            __primary_heap_end__ = .;
      } > SRAM align 8
      #ifdef CACHE_AS_RAM
    
      .bss :
      {
        *(.bss)
      } > GPRAM
      #endif /* CACHE_AS_RAM */
    }
    

    Thanks

    Christian

  • Hi Christian, 

    The CCFG shouldn't be excluded from the project, it will be removed when generating the OAD image with the OAD image tool

    Thanks, 
    Elin 

  • Hi Elin,

    OK, I think I understand. But I still have these major differences compared to your example project (simple_peripheral_oad_offchip_CC13X2P1_LAUNCHXL_tirtos_ccs)

    • I get compiler warning 
      #10247-D creating output section ".ccfg" without a SECTIONS specification

    • .ccfg is part of my .map-file but not part of the example .map-file.

     

    So seems there is something left to fix?

  • Hi Christian, 

    Do you know when you got the warning? Because then you can revert the project back to remove it. 

    If you don't, you can always start with a new project and add your own code to it to make sure that you don't have any of the incorrect settings left in the project. 

    Thanks, 
    Elin