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.

TMS320F28069: Custom bootloader program jumping issue

Part Number: TMS320F28069


Hi team,

Here's an issue from the customer may need your help:

To customize the bootloader program in FLASHA, refer to the example f28069_flash_kernel and use the Exit_Boot.asm file in this example. The bootloader does not currently have an app update and send a set of strings via SCI only after startup and return the entry address where the app is located in main.

Bootloader compile with additional parameters-- Asm_extension = S.

Bootloader link with additional parameters-- Entry_point=_InitBoot.

In FLASHCDE is the app program, entry address 0x3E4000.

The bootloader can jump to the app for execution when online debug is downloaded with an emulator or when directly loaded. But when the JTAG is removed and the target board is powered back on, the bootloader can normally output information at SCI, but the app is not executing.

Bootloader CMD file definition is as follows:

MEMORY
{
PAGE 0 :   /* Program Memory */
   progRam     : origin = 0x008000, length = 0x002000    /* RAML8      : 8K,用于程序*/
   dataRam     : origin = 0x00A000, length = 0x00A000    /* RAML0~RAML7: 40K,用于数据*/
   stkRam      : origin = 0x000050, length = 0x0007B0    /* M0~M1      : 2K,用于堆栈*/

   APP_FLAG   : origin = 0x3F4000, length = 0x000010     /* bootloader flag,ast-boot-28069*/
   APP_VER    : origin = 0x3F4010, length = 0x000010     /* bootloader version,1.0.0.1*/
   FLASHA      : origin = 0x3F4020, length = 0x003F60     /* bootloader */

   CSM_RSVD    : origin = 0x3F7F80, length = 0x000076     /* Part of FLASHA.  Program with all 0x0000 when CSM is in use. */
   BEGIN       : origin = 0x3F7FF6, length = 0x000002     /* Part of FLASHA.  Used for "boot to Flash" bootloader mode. */
   CSM_PWL_P0  : origin = 0x3F7FF8, length = 0x000008     /* Part of FLASHA.  CSM password locations in FLASHA */

   ROM         : origin = 0x3FF3B0, length = 0x000C10     /* Boot ROM */
   RESET       : origin = 0x3FFFC0, length = 0x000002     /* part of boot ROM  */
   VECTORS     : origin = 0x3FFFC2, length = 0x00003E     /* part of boot ROM  */

   BOOT_RSVD   : origin = 0x000000, length = 0x000050     /* Part of M0, BOOT rom will use this for stack */
   USB_RAM     : origin = 0x040000, length = 0x000800     /* USB RAM		  */
}

/* Allocate sections to memory blocks.
   Note:
         codestart user defined section in DSP28_CodeStartBranch.asm used to redirect code
                   execution when booting to flash
         ramfuncs  user defined section to store functions that will be copied from Flash into RAM
*/


SECTIONS
{
   /* Allocate program areas: */
   AppFlag             : > APP_FLAG,      PAGE = 0  
   AppVer              : > APP_VER,       PAGE = 0  
   
   .cinit              : > FLASHA,      PAGE = 0
   .pinit              : > FLASHA,      PAGE = 0
   .text               : > FLASHA,      PAGE = 0
   codestart           : > BEGIN,         PAGE = 0

   csmpasswds          : > CSM_PWL_P0,    PAGE = 0
   csm_rsvd            : > CSM_RSVD,      PAGE = 0

   ramfuncs            : LOAD = FLASHA,
                         RUN = progRam,
                         LOAD_START(_RamfuncsLoadStart),
                         LOAD_END(_RamfuncsLoadEnd),
                         RUN_START(_RamfuncsRunStart),
						       LOAD_SIZE(_RamfuncsLoadSize),
                         PAGE = 0

   .stack              : > dataRam,      PAGE = 0
   .cio                : > dataRam,      PAGE = 0
   .sysmem             : > dataRam,      PAGE = 0
   .ebss               : > dataRam,      PAGE = 0
   .esysmem            : > dataRam,      PAGE = 0

   .econst             : > FLASHA,      PAGE = 0
   .switch             : > FLASHA,      PAGE = 0

   .reset              : > RESET,      PAGE = 0, TYPE = DSECT
   vectors             : > VECTORS,    PAGE = 0, TYPE = DSECT

}

bootloader main function is as follows:

#define FLASH_ENTRY_POINT 0X3E4000

const unsigned char ucWelcome[] = "bootloader 1.0.0.1";
Uint32 main(void)
{
	/** 将需要在RAM中运行的代码从Flash拷贝到RAM中*/
	memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (Uint32)&RamfuncsLoadSize);

	/* 系统初始化 */
	DisableDog();
	XtalOscSel();
	InitPll(DSP28_PLLCR,DSP28_DIVSEL);

	DELAY_US(100);
	/** 初始化对外接口 */
	EST_Initialize();
	
	SCIB_Init();
	
	SCIB_TxByte(ucWelcome,sizeof(ucWelcome) - 1);
	/** app接收程序 */
	return 0X3E4000;
}

The app program cmd is defined as follows:

MEMORY
{
PAGE 0 :   /* Program Memory */
           /* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE1 for data allocation */
   OTP         : origin = 0x3D7800, length = 0x000400     /* on-chip OTP */
   progRAM     : origin = 0x008000, length = 0x00C000     /* RAML1~RAML8,48K*/
   // FLASHH      : origin = 0x3D8000, length = 0x004000     /* on-chip FLASH */
   // FLASHG      : origin = 0x3DC000, length = 0x004000     /* on-chip FLASH */
   // FLASHF      : origin = 0x3E0000, length = 0x004000     /* on-chip FLASH */
   //FLASHE      : origin = 0x3E4000, length = 0x004000     /* on-chip FLASH */   
   //FLASHD      : origin = 0x3E8000, length = 0x004000     /* on-chip FLASH */
   //FLASHC      : origin = 0x3EC000, length = 0x004000     /* on-chip FLASH */
   progRom     : origin = 0x3E4002, length = (0x00C000 - 0x2)     /* FLASHC|FLASHD|FLASHE */   

   CSM_RSVD    : origin = 0x3F7F80, length = 0x000076     /* Part of FLASHA.  Program with all 0x0000 when CSM is in use. */
 
   BEGIN       : origin = 0x3E4000, length = 0x000002    /* BEGIN,part of FLASHE*/
   CSM_PWL_P0  : origin = 0x3F7FF8, length = 0x000008     /* Part of FLASHA.  CSM password locations in FLASHA */

   FPUTABLES   : origin = 0x3FD860, length = 0x0006A0	  /* FPU Tables in Boot ROM */
   IQTABLES    : origin = 0x3FDF00, length = 0x000B50     /* IQ Math Tables in Boot ROM */
   IQTABLES2   : origin = 0x3FEA50, length = 0x00008C     /* IQ Math Tables in Boot ROM */
   IQTABLES3   : origin = 0x3FEADC, length = 0x0000AA	  /* IQ Math Tables in Boot ROM */

   ROM         : origin = 0x3FF3B0, length = 0x000C10     /* Boot ROM */
   RESET       : origin = 0x3FFFC0, length = 0x000002     /* part of boot ROM  */
   VECTORS     : origin = 0x3FFFC2, length = 0x00003E     /* part of boot ROM  */
                                              */

   BOOT_RSVD   : origin = 0x000000, length = 0x000050     /* Part of M0, BOOT rom will use this for stack */
   RAMM0       : origin = 0x000050, length = 0x0003B0     /* on-chip RAM block M0 */
   RAMM1       : origin = 0x000400, length = 0x000400     /* on-chip RAM block M1 */
}



SECTIONS
{

   /* Allocate program areas: */
   .cinit              : > progRom,     PAGE = 0
   .pinit              : > progRom,     PAGE = 0
   .text               : > progRom,     PAGE = 0
   codestart           : > BEGIN,      PAGE = 0
   ramfuncs            : LOAD = progRom,
                         RUN = progRAM,
                         LOAD_START(_RamfuncsLoadStart),
                         LOAD_END(_RamfuncsLoadEnd),
                         RUN_START(_RamfuncsRunStart),
						 LOAD_SIZE(_RamfuncsLoadSize),
                         PAGE = 0

   csmpasswds          : > CSM_PWL_P0, PAGE = 0
   csm_rsvd            : > CSM_RSVD,   PAGE = 0

   /* Allocate uninitalized data sections: */
   .stack              : > progRAM,      PAGE = 0
   .ebss               : > progRAM,      PAGE = 0
   .esysmem            : > progRAM,      PAGE = 0

   /* Initalized sections to go in Flash */
   /* For SDFlash to program these, they must be allocated to page 0 */
   .econst             : > progRom,     PAGE = 0
   .switch             : > progRom,     PAGE = 0

   /* Allocate IQ math areas: */
   IQmath              : > progRom,     PAGE = 0            /* Math Code */
   IQmathTables        : > IQTABLES,   PAGE = 0, TYPE = NOLOAD
   
   /* Allocate FPU math areas: */
   FPUmathTables       : > FPUTABLES,  PAGE = 0, TYPE = NOLOAD
   .reset              : > RESET,      PAGE = 0, TYPE = DSECT
   vectors             : > VECTORS,    PAGE = 0, TYPE = DSECT

}

Could you help check this case? Thanks.

Best Regards,

Cherry