LPC11u34 secondary bootloader dont jump

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

LPC11u34 secondary bootloader dont jump

1,000件の閲覧回数
fernandomaesso
Contributor I

I trying to implement a secondary bootloader for LPC11U34. I save my app on a AT45DB041 and when the lpc boot I detect a new firmware on SPIFlash and copy the content for lpc flash. This is running ok. On my Keil project I modified my app ROM to run from 0x1000 to 0xA000 , RAM from 0x10000200 and I realoccated the vector table for RAM(0x10000000). But when I call loadApp(); the SBL dont jump to my app and crash. I based my SBL  in the AN11257 and AN11961. I tried others way to execute my code but all crash. Anybody can help me?

for SBL
#define SBL_SLV_FIRMWARE_START 0x1000
__asm void loadApp(int addr)
{
ldr r1, [r0] ; Get SP value
msr msp, r1 ; load SP
ldr r1, [r0, #4] ; Get app reset vector
cpsie i
BX r1

}

for App
#define VCT_TBL_SIZE 512
#define APP_FLASH_START_ADDR ((uint8_t *)0x1000)
#define APP_RAM_START_ADDR ((uint8_t *)0x10000000)

void Vector_TBL_Relocate(void){
uint32_t i;
/* Copy interrupt vector table from Flash to RAM */
for(i = 0; i < VCT_TBL_SIZE; i++){
*(APP_RAM_START_ADDR + i) = *(APP_FLASH_START_ADDR + i);
}
/* Interrupt vectors mapped to user RAM*/
LPC_SYSCON->SYSMEMREMAP = 0x1;
}

Thanks 

Fernando Maesso

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

971件の閲覧回数
fernandomaesso
Contributor I

 When compile I get this error. I´m using Keil UV5 with default compiler.

0 件の賞賛
返信

990件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Fernando,

Regarding your issue, I think the api function has issue:

__asm void loadApp(int addr)
{
ldr r1, [r0] ; Get SP value
msr msp, r1 ; load SP
ldr r1, [r0, #4] ; Get app reset vector
cpsie i
BX r1

}

Pls try to modify it as:

__asm void loadApp(int addr)
{
ldr r1, [r0] ; Get SP value
msr msp, r1 ; load SP
ldr r1, [r0, #4] ; Get app reset vector

add r1,r1,#1 ;the lsb of PC must be 1 for thumb instruction
cpsie i
BLX r1

}

Pls have a try

BR

XiangJun Rong

0 件の賞賛
返信

986件の閲覧回数
fernandomaesso
Contributor I

HI xiangjun_rong,

  Thank for your reply. I added the line but i had a error A1859E: Flag preserving form of this instruction not available. Have other way to set the bit?

0 件の賞賛
返信

974件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Can you tell us what gives the error message "A1859E: Flag preserving form of this instruction not available."?

BR

XiangJun Rong

0 件の賞賛
返信

963件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I have tried with my MCUXpresso tools, I can pass the compilation with the code:

void loadApp(int addr)
{
__asm("ldr r1, [r0]"); // Get SP value
__asm("msr msp, r1"); // load SP
__asm("ldr r1, [r0, #4]"); // Get app reset vector

__asm("add r1,r1,#1"); //the lsb of PC must be 1 for thumb instruction
__asm("cpsie i");
__asm("BLX r1");

}

BR

XiangJun Rong

0 件の賞賛
返信