question about bootloader for S32DS

cancel
Showing results for 
Search instead for 
Did you mean: 

question about bootloader for S32DS

Jump to solution
575 Views
yangbo1
Contributor III

I write bootloader and relative user application in S32DS. Now the bootloader can download user application firmware to dedicated flash area, but when invoke the function _startup for user application, seems crash,  nothing happened after that. Does this process have problem? Is there anything ignored by me?

Thanks for your attention!

0 Kudos
1 Solution
526 Views
stanish
NXP Employee
NXP Employee

Hi,

Please check this thread:

https://community.nxp.com/t5/S32-Design-Studio/MPC5748G-bootloader-to-application-jump-issue/m-p/920...

 

Alternatively you can use C code to jump to the application:

typedef void (*func_ptr)(); // pointer to function type

void main(void)

{

...

JumpToApp(0xC000)

}


void JumpToApp(unsigned int AppStart)
{
(*(func_ptr)AppStart)(); // Jump at Startup
}

View solution in original post

6 Replies
527 Views
stanish
NXP Employee
NXP Employee

Please check this thread:

https://community.nxp.com/t5/S32-Design-Studio/MPC5748G-bootloader-to-application-jump-issue/m-p/920...

Alternativelly you can use C code to jump to the bootloader:

 

typedef void (*func_ptr)(); // pointer to function type

void JumpToApp(unsigned int AppStart)
{
  (*(func_ptr)AppStart)(); // Jump at Application start address
}


void main(void)
{
...
 JumpToApp(0xC000);

}

 

 

0 Kudos
565 Views
stanish
NXP Employee
NXP Employee

Hi,

if it crashes at the very begining of your user app. it may indicate the adress is wrong or wrongly aligned.

Are you jumping from bootloader at right starting address of your user application?

Please note: it is recommended to de-init all peripherals used by the bootloader so after jumping into the app there is no pending interrupt that jumps into unhandled exception.

There are many thread related to bootloader issues e.g:

https://community.nxp.com/t5/S32K/S32K146-BOOTLOADER/m-p/1058945

https://community.nxp.com/t5/S32K/S32K144-Bootloader-gt-JumpToApplication-Problem/m-p/889807

Hope it helps.

Stan

0 Kudos
561 Views
yangbo1
Contributor III

I think no problem with starting address(at 0xC000) for user application. I think the problem is I don't know how to jump to the user application correctly. The chip is MPC5607B. I use S32DS. The code snippet is shown as below.

void jump_to_app(void)

{

            __asm__(" " " e_b 0x0000C000" " ");

}

It doesn't working correctly. I am not familiar with powerpc assembly language. How to write it?

Thanks for your attention!

0 Kudos
527 Views
stanish
NXP Employee
NXP Employee

Hi,

Please check this thread:

https://community.nxp.com/t5/S32-Design-Studio/MPC5748G-bootloader-to-application-jump-issue/m-p/920...

 

Alternatively you can use C code to jump to the application:

typedef void (*func_ptr)(); // pointer to function type

void main(void)

{

...

JumpToApp(0xC000)

}


void JumpToApp(unsigned int AppStart)
{
(*(func_ptr)AppStart)(); // Jump at Startup
}

View solution in original post

264 Views
yangbo1
Contributor III

Hi, @stanish 

Thank you for your suggestion!

I use C code to jump to the application. It is another way. The address of jumping is boot block start address + 4 for my chip. Please refer to the Reference Manual

the code is as below.

( *( void(*)(void) ) ) ( *(uint32_t*)(boot_block_start_address + 4) );

0 Kudos
450 Views
yangbo1
Contributor III

Hi, @stanish 

Thank you very much! the asm code in that thread works.

please refer a pertinent suggestion from another thread.

https://community.nxp.com/t5/S32-Design-Studio/S32R274-bootloader-jump-to-app-project/m-p/1094380

completely de-init everything before jump. Most important - disable interrupts on all levels - by MSR[EE], by local enable bits in peripherals, by priority registers.

0 Kudos