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:自定义引导加载程序跳转问题

Guru**** 2546020 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1106143/tms320f28069-custom-bootloader-program-jumping-issue

器件型号:TMS320F28069

大家好、

以下是客户提出的问题、可能需要您的帮助:

要在 FLASHA 中自定义引导加载程序、请参阅示例 f28069_flash_kernel、并在此示例中使用 Exit_Boot.asm 文件。 引导加载程序当前没有应用程序更新、仅在启动后通过 SCI 发送一组字符串、并返回应用程序位于 main 中的入口地址。

引导加载程序使用其他参数进行编译- ASM_EXTENSION = S

引导加载程序链接、包含其他参数- entry_point=_InitBoot。

FLAHCODE 中的是应用程序、入口地址为0x3E4000。

当使用仿真器下载在线调试或直接加载时、引导加载程序可以跳转到应用程序以执行。 但是、当移除 JTAG 并重新为目标板加电时、引导加载程序通常可以在 SCI 输出信息、但应用程序不会执行。

引导加载程序 CMD 文件定义如下:

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

}

引导加载程序主函数如下:

#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;
}

应用程序 cmd 定义如下:

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

}

您可以帮助检查此案例吗? 谢谢。

此致、

樱桃

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    [~ userid="496057" url="支持/微控制器/C2000-micro-group/C2000/f/C2000-micro-forume/1106143/tms320f28069-custom-bootloader-program-jug-issue]]当使用仿真器下载在线调试或直接加载时、引导加载程序可以跳转到应用程序以执行。 但是、当移除 JTAG 并重新为目标板加电时、引导加载程序通常可以在 SCI 输出信息、但应用程序未执行。[/quot]

    樱桃

    检查我的理解:

    其工作原理为:  

    • 已连接 Code Composer (CCS)--> 重置-->通过引导 ROM 运行-->自定义引导加载程序-->应用程序    

    这不起作用:

    • CCS 未连接-->打开设备-->通过引导 ROM 运行--> ???
      • 接下来会发生什么情况?  
      • 他们能否判断自定义引导加载程序是否正在运行?

    这是一个用于调试在未连接 CCS 的情况下不执行的代码的检查清单。  您可以让客户进行检查吗?

    https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/757590/faq-f05-flash-how-can-i-debug-code-that-does-not-run-standalone-without-code-composer-studio-attached

    -洛里

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Lori、

    感谢您的支持、我刚刚从客户那里听说此问题已得到解决。  

    从工程中删除 Exit_Boot.asm 文件

    将项目条目地址设置为空(最初设置为_InitBoot)

    程序直接跳转、而不是使用 main 返回应用地址:

    #define JumpToApp (void (*)(void) 0x3E4000

    (*JumpToAPP)();

    通过上述修改、程序可在 JTAG 之外正常运行。

    谢谢、此致、

    樱桃