Other Parts Discussed in Thread: Z-STACK
Tool/software: Code Composer Studio
Hi,TI team
I created the project based on BIM and set the SET_CCFG_IMAGE_VALID_CONF_IMAGE_VALID value in CCFG to 0x0,set the jump address to 0x8000.The application is then created based on Ti154stack_sensor_2_4G with the starting address of the application set to 0x8000.However, after downloading the code to Flash, BIM can jump to the application, but the application does not perform properly.If an application project is created based on an OAD project and the starting address is set to 0x8000, BIM can jump to the application and run normally.If I use a project in a routine that does not change the start address and the jump address, both applications jump and the application performs normally.Why?
This is BIM .cmd content:
#define FLASH_BASE 0x00000000
#define GPRAM_BASE 0x11000000
#define RAM_BASE 0x20000000
#define ROM_BASE 0x10000000
#define FLASH_SIZE 0x00058000
#define RAM_SIZE 0x00014000
/*******************************************************************************
* RAM
*/
/* Reserved RAM is that section of the RAM used by the ROM code.
* For Secure BIM, the ECC library from ROM uses 0x80 bytes of
* RAM space at the beginning of the RAM. Even though the ECC library
* from ROM is not used by the non-secure BIM, to keep the linker
* command file simple and uniform across the two variants, the
* reserved section is defined here commonly for both variants.
* ROM code actually uses slightly <0x300 bytes; Leaving this
* section of the RAM untouched by BIM application
*/
#define RESERVED_RAM_SIZE (0x300)
/*
* Defines for BIM variable
*/
#define RAM_START (RAM_BASE + RESERVED_RAM_SIZE)
#define RAM_END (RAM_START + RAM_SIZE - RESERVED_RAM_SIZE - 1)
/* App is given full RAM range (minus ROM reserved offset) when Stack image is not present. */
#define RAM_BIM_SIZE (RAM_END - RAM_START + 1)
/*******************************************************************************
* Flash
*/
#define FLASH_START FLASH_BASE
#define PAGE_SIZE 0x2000
/*
* Bim controls the CCFG in page 31 as well as linking it's application here.
* Any left over space could be claimed by another image.
*/
#define FLASH_BIM_START 0x0 //FLASH_SIZE - PAGE_SIZE
#define FLASH_BIM_END CERT_START - 1 //FLASH_CCFG_START - 1
#define FLASH_BIM_SIZE ((FLASH_BIM_END) - (FLASH_BIM_START) + 1)
#define FLASH_CCFG_START 0x00057FA8
#define FLASH_CCFG_END (FLASH_START + FLASH_SIZE - 1)
#define FLASH_CCFG_SIZE ((FLASH_CCFG_END) - (FLASH_CCFG_START) + 1)
#define FLASH_FNPTR_START FLASH_CCFG_START - 8 // Adding 4 bytes buffer between CCFG and function pointer 0x0001ffa0
#define FLASH_FNPTR_END FLASH_FNPTR_START + 3 // 4 bytes function pointer 0x0001ffa3
#define FLASH_FNPTR_SIZE 4 // ((FLASH_FNPTR_END) - (FLASH_FNPTR_START) + 1)
//storing cert element in fixed flash region,
//length of region is size of cert_element_t
#define CERT_END FLASH_FNPTR_START - 1
#define CERT_SIZE 0x4C // For version 1 ECDSA-P256
#define CERT_START CERT_END - CERT_SIZE + 1
/*******************************************************************************
* Stack
*/
/* Create global constant that points to top of stack */
/* CCS: Change stack size under Project Properties */
__STACK_TOP = __stack + __STACK_SIZE;
/*******************************************************************************
* Main arguments
*/
/* Allow main() to take args */
/* --args 0x8 */
/*******************************************************************************
* System Memory Map
******************************************************************************/
MEMORY
{
/* Flash */
FLASH_BIM (RX) : origin = FLASH_BIM_START, length = FLASH_BIM_SIZE
FLASH_CCFG (RX) : origin = FLASH_CCFG_START, length = FLASH_CCFG_SIZE
FLASH_FNPTR (RX) : origin = FLASH_FNPTR_START, length = FLASH_FNPTR_SIZE
FLASH_CERT (RX) : origin = CERT_START, length = CERT_SIZE
/* RAM */
SRAM (RWX) : origin = RAM_START, length = RAM_BIM_SIZE
}
/*******************************************************************************
* Section Allocation in Memory
******************************************************************************/
SECTIONS
{
.intvecs : > FLASH_BIM_START
.text : > FLASH_BIM
.const : > FLASH_BIM
.constdata : > FLASH_BIM
.rodata : > FLASH_BIM
.cinit : > FLASH_BIM
.pinit : > FLASH_BIM
.init_array : > FLASH_BIM
.emb_text : > FLASH_BIM
.cert_element : > FLASH_CERT
.fnPtr : > FLASH_FNPTR
.ccfg : > FLASH_CCFG (HIGH)
.vtable : > SRAM
.vtable_ram : > SRAM
vtable_ram : > SRAM
.data : > SRAM
.bss : > SRAM
.sysmem : > SRAM
.stack : > SRAM (HIGH)
.nonretenvar : > SRAM
}
This is application .cmd content:
#ifndef NVOCMP_NVPAGES
#define NVOCMP_NVPAGES 2
#endif
#define FLASH_BASE 0x00000000
#define FLASH_NV_BASE (0x56000 - (NVOCMP_NVPAGES * 0x2000))
#define FLASH_NV_SIZE (NVOCMP_NVPAGES * 0x2000)
#define FLASH_LAST_BASE 0x56000
#define FLASH_LAST_SIZE 0x2000
#define RAM_BASE 0x20000000
#define RAM_SIZE 0x14000
#define ENTRY_START (0x8000)
#define ENTRY_SIZE 0x40
#define ENTRY_END (ENTRY_START + ENTRY_SIZE - 1)
#define FLASH_START (ENTRY_END + 1)
#define FLASH_END (FLASH_NV_BASE)//(FLASH_BASE + FLASH_SIZE - RESERVED_FLASH_SIZE - 1)
//#define FLASH_START_BASE 0x8000
//#define FLASH_SIZE (0x56000 - (NVOCMP_NVPAGES * 0x2000) - FLASH_START_BASE)
/* System memory map */
MEMORY
{
ENTRY (RX) : origin = ENTRY_START, length = ENTRY_SIZE
/* Application stored in and executes from internal flash */
FLASH (RX) : origin = FLASH_START, length = (FLASH_END - FLASH_START)//FLASH_SIZE
/* FLASH NV */
FLASH_NV (RWX) : origin = FLASH_NV_BASE, length = FLASH_NV_SIZE
/* Last flash page */
FLASH_LAST (RX) : origin = FLASH_LAST_BASE, length = FLASH_LAST_SIZE
/* Application uses internal RAM for data */
SRAM (RWX) : origin = RAM_BASE, length = RAM_SIZE
}
/* Section allocation in memory */
SECTIONS
{
//.intvecs : > FLASH_START_BASE
GROUP > ENTRY
{
.resetVecs LOAD_START(prgEntryAddr)
.intvecs
EntrySection //LOAD_START(prgEntryAddr)
}
/*
flash_last_text
{
mac_user_config.obj(.text)
nvoctp.obj(.text)
macTask.obj(.text)
hmac_rom_init.obj (.const)
osal_port.obj (.text)
} > FLASH_LAST
*/
.text : >> FLASH_LAST | FLASH
config_const { mac_user_config.obj(.const) } > FLASH
.const : > FLASH
.constdata : > FLASH
.rodata : > FLASH
.cinit : > FLASH
.pinit : > FLASH
.init_array : > FLASH
.emb_text : > FLASH
// .ccfg : > FLASH_LAST (HIGH)
.ccfg : type=NOLOAD > FLASH_LAST (HIGH)
GROUP > SRAM
{
.data
.bss
.vtable
.vtable_ram
vtable_ram
.sysmem
.nonretenvar
} LOAD_END(heapStart)
.stack : > SRAM (HIGH) LOAD_START(heapEnd)
}
Thanks!