hello,
Does S32K1xx have OTA function? How to use OTA function? Is there a document for reference?
wish your help?
Hi,
please check this application note:
https://www.nxp.com/docs/en/application-note/AN12323.pdf
https://www.nxp.com/docs/en/application-note-software/AN12323SW.zip
Regards,
Lukas
hello Lukas,
As of today, I have read the OTA document you sent. How can I put bootloader into d-flash?
about OTA Another problem is In the example you gave me, I can see that the current app will pause when upgrading how to upgrade the app code while running itThat is, the upgrade does not affect the current app operation)?
thanks in advance!
Hi Kui,
to put the bootloader to specific area, you need to change the linker file. You can check this file:
..\AN12323SW.zip\AN_S32K_OTA\OTA_S32K146_Use_Case_WS\S32K146_FOTA_Bootloader\Project_Settings\Linker_Files\S32K1xx_flexnvm.ld
If you want to keep your application running when updating new firmware, important point is that you need a microcontroller with more partitions in code flash, so you can execute your firmware from one partition while another one is being updated. That means either S32K146 or S32K148.
S32K144 (or all S32K11x) have only single partition in case of code flash.
The procedure is thoroughly explained in chapter "6.2 S32K146 use case". Please read whole chapter, especially description of SCENARIO (1) and SCENARIO (2).
Regards,
Lukas
Dear lukas
1. if bootloader save in D-Flash ,it seems that it is conflict with the following function.
2. when update firmware, how does the code jump between APP & bootloader?
Hi Kui,
1. Yes, there are two partitions in S32K146, so it supports updating of one partition while the other is being updated.
2. I wrote that it is supported:
"If you want to keep your application running when updating new firmware, important point is that you need a microcontroller with more partitions in code flash, so you can execute your firmware from one partition while another one is being updated. That means either S32K146 or S32K148."
3. S32K146 implements scenario 2.
4. Yes, secure boot always uses start address 0. But the bootloader can be still protected by secure boot. It can be relatively easily solved by chain of trust. You can place simple piece of code to the first sector of flash. This can be protected directly by secure boot. This piece of code then can check CMAC of the bootloader in D-Flash. If it is correct, jump to the bootloader.
5. Simply use function pointer. It's shown in the demo codes.
Regards,
Lukas
hello Lukas.
5. Simply use function pointer. It's shown in the demo codes.
S32K146 implements scenario 2, it need jump between APP and bootloader untill Firmware updated complete.
Step 1. every time when received the update firmware data , code jump from APP to bootloader and execute from the first line code if main function, then write the new foreware to anther bank. every time code will call the init function in bootloader.
Step 2
of course evevy time when wrote new fireware data completely, code will jump to APP for handing user's application & receiving the new fireware data. code will also do init work then run to while 1 in main function.
if my understanding right?
thus ervey time for jumping from APP to bootloader or jumping from bootloader to APP, bootloader or APP will do init work
The zip package contain demo code for S32K146 and it's for scenario 2.
Take a look at the code, not complete initialization is done. Only some specific functions are called.
Regards,
Lukas
hello lukas,
I still can't find the code which jump to bootloader from app in demo code, could you tell me which line code do this jump?
I still have a doublt, when jump every time, it should save the PC pointer and stack, when return it will restore the PC and stack. is my understanding wrong?
thanks very much!
Hi Kui,
well, I can see now that there are only binaries of the application.
But if you take closer look at the bootloader, you can see in linker file:
And then in main.c:
and
So, address 0x10003FFC contains pointer to function which you should call from application and address 0x2000EFFC contains status (return value) of that function which you are supposed to read after return.
In application, simply create a pointer to function:
void (*f_ptr)(void);
Load content of address 0x10003FFC to the pointer:
f_ptr = (void(*)(void))(*(unsigned int*)0x10003FFC);
And call the function:
f_ptr();
When you return from the function, simply read status from 0x2000EFFC using a pointer.
You do not need to save/restore register content because you are still using C and EABI.
Regards,
Lukas
hello Lukas,
3. S32K146 implements scenario 2.
I have the dmo for scenario 1.
whether could you send the demo (scenario 2) code for me?
thanks very much!
hello Lukas,
3. S32K146 implements scenario 2.
whether could you send the demo code for me?
thanks very much!
Hello Lukas,
<1>My device is S32K146, according to reference manual, it should be support two partition for P-Flash? is my understanding wrong as the following picture description?
<2>As the last mail your description, S32K146 or 148 can not support application running when updating new firmware??
<3>which SCENARIO (chapter "6.2 S32K146 use case". SCENARIO (1) and SCENARIO (2) )does the OTA demo code for in https://www.nxp.com/docs/en/application-note-software/AN12323SW.zip ??? if this demo code fufil SCENARIO (1), thus whether has the demo code for SCENARIO (2)?
thank for your anser!
hello Lukas,
My device is S32K146, according to reference manual, it should be support two partition for P-Flash? is my understanding wrong as the following picture description?
As the last mail your description, S32K146 or 148 can not support application running when updating new firmware??
thank for your anser!