bootloader跳转到sdram的问题

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

bootloader跳转到sdram的问题

1,373件の閲覧回数
jingyangxie
Contributor V

我有一块1170的板卡,现在想实现的功能是bootloader读取U盘中的文件,然后载入到SDRAM中,最后跳转到SDRAM的指定地址(应用的起始地址)去运行程序,现在问题如下:

bootloader能正常识别U盘并读取镜像文件,参考官方bootloader的例程,通过

static void get_user_application_entry(uint32_t *appEntry, uint32_t *appStack)
{
assert(appEntry);
assert(appStack);

*appEntry = APP_VECTOR_TABLE[kInitialPC];
*appStack = APP_VECTOR_TABLE[kInitialSP];
}

此函数能获取AppEntry和appStack,调试发现appEntry为0x8007c1e1(与应用map文件对应为Reset_Handler的地址),appStack为0x20040000 ,与应用map文件一致:

jingyangxie_1-1670212465733.png

 

jingyangxie_0-1670212443591.png

整个跳转的主体函数如下

static void jump_to_application(void)
{

uint32_t applicationAddress, stackPointer;

get_user_application_entry(&applicationAddress, &stackPointer);


__disable_irq();
// Create the function call to the user application.
// Static variables are needed since changed the stack pointer out from under the compiler
// we need to ensure the values we are using are not stored on the previous stack
static uint32_t s_stackPointer = 0;
s_stackPointer = stackPointer;
static void (*farewellBootloader)(void) = 0;
farewellBootloader = (void (*)(void))applicationAddress;

// Set the VTOR to the application vector table address.
SCB->VTOR = (uint32_t)BL_APP_VECTOR_TABLE_ADDRESS;//BL_APP_VECTOR_TABLE_ADDRESS -- 0x80040000

// Set stack pointers to the application stack pointer.
__set_MSP(s_stackPointer);
__set_PSP(s_stackPointer);

// Jump to the application.
farewellBootloader();
usb_echo("never goto here.\r\n");

}

 

0 件の賞賛
返信
3 返答(返信)

1,356件の閲覧回数
jingpan
NXP TechSupport
NXP TechSupport

Hi @jingyangxie ,

那您的问题是?

 

Regards,

Jing

0 件の賞賛
返信

1,353件の閲覧回数
jingyangxie
Contributor V

我之前的问题是跳转不成功,现在已经搞定了

0 件の賞賛
返信

1,369件の閲覧回数
jingyangxie
Contributor V

the bootloader uses ram.icf link file

0 件の賞賛
返信