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.
在FLASHA中是自定义的bootloader 程序,目前参考官方例子f28069_flash_kernel,使用该例子中的Exit_Boot.asm文件
bootloader目前不进行app更新,只在启动后,通过SCI发送一组字符串,然后main中返回app所在入口地址
bootloader编译时附加参数 --asm_extension = S
bootloader链接时附加参数 --entry_point=_InitBoot
在FLASHCDE中是app程序,入口地址0x3E4000
在用仿真器下载进行在线Debug时,或者直接Load时,bootloader 都可以跳转到app执行
但是,当拔掉JTAG,目标板重新上电后,bootloader正常在SCI输出信息,但是app没有执行
bootloader 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 }
bootloader main函数:
#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; }
是app程序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 }
删除项目中的Exit_Boot.asm文件
将项目入口地址设置为空(原来设置为_InitBoot)
不使用main返回app地址的方式,改为程序直接跳转:
#define JumpToApp (void (*)(void))0x3E4000
(*JumpToAPP)();
以上修改后,程序脱离JTAG可以正常运行