LPC546xx IAP

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPC546xx IAP

跳至解决方案
3,902 次查看
tinglee
Contributor II

Hi,

  I use LPC54606 in design like below:

0x0 -- 0x7FFF                  0x8000-...

  boot code            -----     app code

How to jump from "boot code" to "app code" ?

My code is reference from LPC17xxx, but faild!

My code:

__asm void MSR_MSP(uint32_t addr)
{
      MSR MSP, r0 //set Main Stack value
      BX r14
}

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
3,740 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi Ting Lee,

Thanks for your reply.
Please check the attachment.

Have a great day,

TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
回复
7 回复数
3,740 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi Ting Lee,

Thank you for your interest in NXP Semiconductor products and
the opportunity to serve you.
To provide the fastest possible support, I'd like to suggest you refer to the application: AN12384 which demonstrates how to design a simple Secondary Bootloader (SBL) software, please refer to it for details.

Have a great day,

TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 项奖励
回复
3,740 次查看
tinglee
Contributor II

 Hi,

refer to  the application: AN12384,but can't get it work, I don't know why!Can you help me,or give an example.Thanks!

here is my code:

#define SECTOR_1_START 0x00008000
typedef volatile uint32_t vu32;
typedef void (*voidfun)(void);

void IAP_LoadApp(uint32_t appxaddr)
{
if(((*(vu32*)appxaddr)&0x20000000) == 0x20000000) //0x20000000
{
voidfun firmwareFunc;
uint32_t fwStackVal = *((uint32_t *)(appxaddr)); /* the first word is for the stack pointer. */
uint32_t fwEntryVal = *((uint32_t *)(appxaddr+4U)); /* the second works is for the boot function. */

printf("fwStackVal: %x\r\n", fwStackVal);
printf("fwEntryVal: %x\r\n", fwEntryVal);

__disable_irq();
firmwareFunc = (voidfun)fwEntryVal;
SCB->VTOR = appxaddr; /* The stack address is also the start address of vector. */
__set_MSP(fwStackVal); /* setup the stack address for MSP. */
__set_PSP(fwStackVal); /* setpu the stack address for PSP. */
firmwareFunc();

}
else
{
printf("Code in Flash is Error\r\n");
}
}

int main(void)
{
get_clk();
#if (1 == PRINTF)
uart_init(DEBUG_UART, DEBUG_UART_BAUD, DEBUG_UART_TX_PIN, DEBUG_UART_RX_PIN);
#endif

pint_init(PINT_CH0, B2,LOW);
pint_enable_irq(PINT_CH0);
EnableInterrupts; //

#ifdef BOOT_CODE
printf("BOOT goto main()\r\n");
IAP_LoadApp(SECTOR_1_START);
#endif
#ifdef APP_CODE
printf("APP goto main()\r\n");
#endif
while(1)
{
}
}

here is my config:

pastedImage_1.png

pastedImage_3.png

pastedImage_2.png

0 项奖励
回复
3,740 次查看
tinglee
Contributor II

and my vector offset configpastedImage_1.png

0 项奖励
回复
3,740 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi Ting Lee,

Thanks for your reply.
After having a brief review of your code, I don't find something wrong in the jump application code, regarding your application,
I'd like to suggest that you should assure the clock configuration before jumping to the application image to be as same as the original clock status of the application demo. Otherwise, it will cause the jumping to fail.

Have a great day,

TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 项奖励
回复
3,740 次查看
tinglee
Contributor II

I try it, but can't get it work! I don't know why.

Can you give me a brief example?

0 项奖励
回复
3,741 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi Ting Lee,

Thanks for your reply.
Please check the attachment.

Have a great day,

TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 项奖励
回复
3,740 次查看
tinglee
Contributor II

Thank you!

Compare to the example, I find the problem:

      in APP sector code, before full init, can't enable interrupt. otherwise will cast to crash!