Questions about MPC5748G Bootloader

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

Questions about MPC5748G Bootloader

1,414 Views
jeromeli
Contributor II

Hi there,

We're developing a bootloader based on CAN. Now the application code is programmed into the flash successfully. But the controller stops when trying to jump to application from the boot, using function pointer: (*(void (*)(void))(0x01000000))();

The same jumping method works in our MPC5643L boot. Any suggestion?

Another question: Is it possible for S32DS to output an aligned s-record, instead of using a hex tool to convert it afterwards?

Thanks!

0 Kudos
6 Replies

658 Views
yalamandadosaky
Contributor V

I am using the S32DS Power PC v1.1 .

Hi jeromeli‌ , lukaszadrapa‌, I am also facing similar problem(getting IVOR1 and IVOR6 error when suspend debug session) in MPC5777M,

But I have some doubt that , Currently I am getting .srec file from the build options ,And  i dont know how to align this srec file , if you have any idea , please suggest . 

And my boot loader memory sections in linker file are

MEMORY

{

     flash_rchw                : org = 0x00FD0000,        len = 0x4
    cpu0_reset_vec            : org = 0x00FD0000+0x10,   len = 0x4
    cpu1_reset_vec            : org = 0x00FD0000+0x14,   len = 0x4
    cpu2_reset_vec            : org = 0x00FD0000+0x04,   len = 0x4    
    cpuc_reset_vec            : org = 0x00FD0000+0x18,   len = 0x4

     m_text :    org = 0x1000000, len = 256K  
    m_data :    org = 0x40000000,   len = 128K

   

    int_iram  : org = 0x50000000,   len = 16K
    int_dram  : org = 0x50800000,   len = 64K  

}

And my Application memory secctions in linker file is

MEMORY
{

    flash_rchw : org = 0x00FC0000,   len = 0x4
    cpu0_reset_vec : org = 0x00FC0000+0x10,   len = 0x4
    cpu1_reset_vec : org = 0x00FC0000+0x14,   len = 0x4
    cpu2_reset_vec : org = 0x00FC0000+0x04,   len = 0x4    
    cpuc_reset_vec : org = 0x00FC0000+0x18,   len = 0x4    
        
    m_text :    org = 0x10C0000, len = 2560K  
    m_data :    org = 0x40000000,   len = 256K
    m_data_nocache :    org = 0x4003E000,   len = 8K
    
    int_iram  : org = 0x50000000,   len = 16K
    int_dram  : org = 0x50800000,   len = 64K   
}

And I am flashing the application at address 0x010C0000

and I am jumping to the

  ((void (*)(void)) 0x010C0004)();

Please suggest me , Whats wrong I am doing ?

0 Kudos

658 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Jerome,

this function pointer should work. Have you checked the asm code?

Another idea - do you use correct address? If standard boot header is used for user application, the reset vector is at address 0x01000004...

I have checked with S32DS expert and he told me that there's no such config option. So, it is necessary to use some kind of converter. I shared one in this application note (included in the zip file):

http://www.nxp.com/files/microcontrollers/doc/app_note/AN5319.pdf

http://www.nxp.com/files/microcontrollers/doc/app_note/AN5319SW.zip

Regards,

Lukas

0 Kudos

658 Views
jeromeli
Contributor II

Hi Lukas,

I tried 0x01000004, but it still didn't work.

pastedImage_2.png

When I suspended the debug, it stopped at IVOR1 (sometimes at IVOR6):

pastedImage_3.png

For the application project, I use default S32DS config, which means boot header is at 0xFA0000, reset vector for core0 is at 0xFA0010 and code for core0 starts from 0x1000000. In this case where should I jump to?

pastedImage_4.png

I also tried to use asm code directly in the C file (just like how you jump in the startup code of AN5319), but it stopped at IVOR1 too.

pastedImage_1.png

However, if I also do it in the startup code, it jumps correctly. But what we want is to run the bootloader first, and in there we decide whether jump to app or stay in boot.

Thanks!

0 Kudos

658 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Jerome,

if it jumps correctly in the startup code then it has to jump correctly also later in main code. This leads me to question - have you disabled all the interrupts before jump? You have to either configure all the features to its default state or the user application must be aware that some features are not in default reset state. It is important to disable interrupts. The rest is application dependent. Please give this a try.

Regards,

Lukas

 

0 Kudos

658 Views
jeromeli
Contributor II

Hi Lukas,

Actually I run asm("wrteei 0") before jump code. Is this enough?

0 Kudos

658 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Have you step the asm code? What is the content of LR or CTR register before executing se_blrl or se_bctrl instruction? That's the first thing you need to check.

There are three levels to enabled or disable interrupts - MSR[EE] bit, priority registers and local enable bits in peripherals. The best way is to disable all interrupts on all levels...

Not sure what's wrong, it requires some extensive debugging...

Regards,

Lukas

0 Kudos