s32k148 boot loader

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

s32k148 boot loader

2,456 Views
sathish_sekar
Contributor III

Hello All,

I am working on to modify the bootloader / startup sequence for s32k148.

Able to identify the bootloader code, but i required to modify the startup code.

i.e in startupcode I want to select the another bootloader(i require to use multi bootloader, selection is based on switch/jumper settings.)

Could any help me to identify the startupcode to modify?

Startup code files are available in my PC in the following path   ...\Bootloader_Software\S32K148_bootloader\Project_Settings\Startup_Code

But unable to identify the sequence, from where boot loader sequence is called.

NOTE:

I am using windows PC, and installed necessary softwares/ not using linux.

0 Kudos
6 Replies

1,795 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello Sathish,

I would like to describe a possible solution.

 

At first, I have created the function in a startup.c 

For example, init the related PORT and check the level of a pin and on that basis decide into which bootloader you will jump in that function.

After that, I have modified startup_S32K148.S and under the Reset_Handler I call Myfunction:

Reset_Handler:
cpsid i /* Mask interrupts */

ldr r0,=MyFunction
blx r0

I hope it helps. 

Best Regards,

Diana

1,795 Views
sathish_sekar
Contributor III

Hello Diana Batrlova,

Sorry for the delayed reply, after vacation I start to work from today on this bootloader implementation.

Thanks for the detailed info. I am trying this solution and able to build the code today, unable to debug.

i.e during bootup(after power ON) if the terminal(or teratem) is connected via comport, we can able to see the boot sequence in terminal console. But this facility is seems not available in s32k148. 

If we connect s32k148 with terminal, then  the bootup sequence can be seen in terminal console.

Is this possible?

0 Kudos

1,795 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello Sathish,

I'm not sure if I understand well your description. What do you mean by boot sequence and the facility which is not available on the S32K148?

Do you use our evaluation board S32K148EVB?

Or could you please send some screens from the terminal how your boot sequence looks like?

After what action are you unable to debug the code, after jump into bootloader?

Thank you in advance.

Best Regards,

Diana

0 Kudos

1,795 Views
sathish_sekar
Contributor III

Hello Diana,

I am using S32K148EVB, in this modifying boot loader implementation is in progress.

I am not using any terminal console, i want to use the terminal to print the data to debug.

 

Refer the below code

int bootloader1(void)
{

/* Initialize clock */
clock_initi();

/* Initialize communication interfaces */
init_comm();

/* Initialize timeout */
init_timeout();

printf("\n Bootloader 1 is running");
/* Check if boot start has been received or timeout occurred */
do{
uint8_t word_received = comm_status_rx();
if(word_received){
boot_from_comm = 1;
comm_download_app();
}
} while((!timeout()) & (!boot_from_comm));

/* Disable all systems and leave device as if coming out of reset */
disable_timeout();
disable_comm();
reset_clock();

/* Check if a valid application is loaded and jump to it */
JumpToUserApplication(*((uint32_t*)APP_START_ADDRESS), *((uint32_t*)(APP_START_ADDRESS + 4)));

/* Should never return from application code */
for (;;) {};
/* Never leave main */
return 0;
}

int bootloader2 (void)
{
printf("\n Bootloader 2 is running");
return 0;
}

In startup_S32K148.S 

Reset_Handler:

/* Init .data and .bss sections */
ldr r0,=init_data_bss
blx r0
cpsie i /* Unmask interrupts */
ldr r0,=bootloader2
blx r0
bl bootloader1

 

I would like to ensure that both print statements are executed or not.

for that I need terminal console.

Hope I have explained the issue, in case of need of more info pls write again.

0 Kudos

1,795 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello Sathis,

Thank you for your comments. I see this is about printf() implementation.

In that case, I would like to direct you to link below:

printf() through OpenSDA 

There can be found very useful details.

I hope it helps.

Best Regards,

Diana

1,795 Views
sathish_sekar
Contributor III

Thanks Diana Batrlova,

printf() through OpenSDA  is made for s32k144, I will adopt this to s32k148.

Thanks

0 Kudos