S32K144

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K144

551 Views
zq1
Contributor III

i am building a bootloader project , in others projrct based infineon  TC233  ,i see the app address in pflash is 0x80020020,  but  when system reset ,the  jump address  for app is 0x80020000, the two address is different ,i want to know ,why they are not the same address ??????

now i am building a bootloader based on s32k144 ,the adderss jump app is 0x00010000,how should i set the app start address in pflash???

void Appl_JumpApp(uint32_t add)
{
    static void (*jump_to_application)(void);
  static uint32_t stack_pointer;
  uint32_t appEntry, appStack;
  appStack = *(uint32_t *)(add);
  appEntry = *(uint32_t *)(add + 4);
  /*把应用程序入口地址赋值给函数指针*/
  jump_to_application = (void (*)(void))appEntry;
  stack_pointer = appStack;
  /* 重新定向中断向量表 */
  S32_SCB->VTOR = (uint32_t)add;
  /* 设置栈指针  */
  __asm volatile ("MSR msp, %0\n" : : "r" (stack_pointer) : "sp");
  __asm volatile ("MSR psp, %0\n" : : "r" (stack_pointer) : "sp");
  /*跳转*/
  jump_to_application();
}
0 Kudos
3 Replies

533 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @zq1 

Standard reset vector is always placed at address 0x4. This is used by your bootloader.

lukaszadrapa_0-1689925328613.png

If you shift user application to 0x10000, the reset vector can be found at 0x10004 and initial value of stack pointer at 0x10000. That's what your code shows (add is the base address 0x10000):

appStack = *(uint32_t *)(add);
appEntry = *(uint32_t *)(add + 4);

If you are asking how to shift application to 0x10000 then just change this in your linker file:

MEMORY
{
/* Flash */
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0007FBF0

 

to this:

MEMORY
{
/* Flash */
m_interrupts (RX) : ORIGIN = 0x00010000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00010400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00010410, LENGTH = 0x0007FBF0-0x10000

 

Regards,

Lukas

 

0 Kudos

523 Views
zq1
Contributor III

i want to know ,the origin    m_interrupts (RX) : ORIGIN = 0x00000000   must be same with APP_START_ADDR ????  

0 Kudos

498 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Yes, that's correct.

0 Kudos