I am trying to flash a .rbf file onto my board to use the bootloader. However when I build or try to flash I get the following errors:
Any help is appreciated, thanks!
So I am just trying to swap the 256 linker with 192 memory version (Supplied with MBDT Toolbox) so I assume it's because of that.
I have compared the 2 and seen this difference which would explain the initial problem:
This now no longer reports a BSS error but now an error in the startup code:
I have attached the .rbf I am trying to put on the board. I just need it flashed to be able to use RAppID bootloader. I have also attached the linker file I am using, I assume these are the only 2 things I need? Do I need to modify linker size size if it's being used as a bootloader?
Thanks for the help!
the _start symbol is part of STD C library. You need to link STD C library in your project.
Anyway - the .rbf file is standard s-recod file. If you like to flash it - you can create empty project and instead of .elf file in debug configurations select the .rbf file:
Putting the .rbf instead of the .elf is how I've been flashing. Does it not use the linker script as it's a standard s-recod file?
It flashes fine if I start a new project and leave the linker script to the default S32K148_256_flash.ld. But the bootloader doesn't work. My assumption was because my application code uses S32K148_192_flash instead so maybe the sizes are mismatched? causing it not to work.
Mine doesn't look the same as yours either:
the .rbf file is product of build (same as an .elf file) - the linker related to the bootloader project was already applied.
Your application needs to met some specifications - like start address and So on. More details you can find in RappID documentation. There is also example in S32DS for Bootloader/App for reference:
you may find helpful this document - https://community.nxp.com/t5/S32-Design-Studio-Knowledge-Base/HOWTO-Use-RAppID-BL-tool-with-MPC5744P...
it is for different platform - for S32K14x you don't need jumper wires.
Basically - you need to flash the boodloader itself - .rbf file. After that - you can upload via RappID BL tool your application s-record - which is the example mentioned above (see the app starting address in linker file - 0x2000. Under 0x2000 address is bootloader).
Here is another thread related to RappID BL - https://community.nxp.com/t5/S32-Design-Studio/Bootloader-s32K-how-it-works-for-S32K144/m-p/733940
Hope it helps.
Is this the same for using RAppID as a CAN bootloader as well?
I am assuming because the .rbf is already made then the linker changes I make is for the application codes linker script?
And then I select .mot as the file I want to flash?
Set up like this:
Appreciate the help!
based on RappID BL documentation - the boodloader is listening on CAN bus and UART - So it can be used with CAN bus as well.
Yes - you are right. Modified linker script file has effect for application, not for Bootloader.
When you select your .mot (or s-recodr) file - is good idea - prior to start communication - reset the board. Bootloader is listening only for few second (don't know exact time - it is probably part of RappID BL documentation).
I have flashed the .rbf and have used a linker script for my application code build.
RAppID seems to flash over CAN to 100% completion. However, when the flash is completed no application code runs. (Used the settings I screenshotted above)
I have attached the linker I am using for my application code, is there anyway you could quickly check if I doing anything obvious wrong?
Thanks again for the help!
it is hard to say from linker file why bootloader doesn't jump into your application. The linker file looks okay.
Is your .bootdata section filled up properly? There should be valid APPKEY and app entry function address:
Please check the RappID documentation.
I'm not familiar with MBDT project you are using - good idea is ask on MDBT community space - https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/ct-p/mbdt
You can check if app key and other values are preset in your app s-record (or you can share your s-record and I'll look at it). App key and other values should be on address 0x2400 - 0x2410. If the area is empty - you need to add correct values into your project and re-build it. Doesn't matter where - you can add it for example in main.c
I have looked through the files that the MDBT creates when building application code and can't find any reference to 's-record' or appkey in any of the generated files.
Could I just add it into the main code either way then?
@mariuslucianand Does MDBT generate something that can help with this?
When the code is generated, MBDT introduces the APPKEY in the generated files inside the mbd_main.c.
Inside our linker file, you can see the memory location served for the boot data, defined in C.
Note that in order to have these lines of code generated in your project, you have to select the Download Interface as "Serial" in the Main configuration block.
Also, in our toolbox, the s-record final file has the .mot extension.
Hope this helps,
Thank you so much!! That was the missing step to this and the other long thread we have on the MDBT forum. I never knew about setting it to serial, knew it would be something simple I was missing in the end!
One odd observation is that you have to have "download code after build" enabled and the just let it fail:
otherwise the APPKEY part isn't included in the generated code, is this meant to be the case? I can then use the generated .mot to flash successfully
Also the parameter: "Delay before start of application (ms)" does not seem to do anything, no matter what it is set to it has a ~5s delay before the application starts when board is reset, is this supposed to change?
@jiri_kral or @mariuslucianand - Is there anyway to have multiple S32K148 boards on the same CAN bus and flash each one? Maybe by having a ID on each board? Or would the best way be to start all up and reset just one and begin bootloader (Meaning the other boards are not reset into into bootloader state) and the just reset the next one and so on? Hope that makes sense!
Thank you again for the help both of you, much appreciated!
I'm not sure if I got this right, so you are now able to flash the code over CAN? The issue was the "Serial" option selection?
Let me explain how the code generation behaves in our toolbox. When the download method is OpenSDA, the code will be generated with no appkey, and with the same linker file from the S32SDK. The code is built and if the "download code after build" option is checked it will flash the board by copying the .mot file on the board's mounted drive.
If the Serial option is checked, then in the generated code is inserted the appkey header and the linker file allocates space for keys as well. Now, if the "download code after build" is checked, then the toolbox will invoke the RappID Bootloader, but this will work only for the UART communication, so maybe this is the reason for that error you have attached. For CAN, you can uncheck the download option, and flash it as before.
Now, unfortunately, I don't have the experience for multiple targets connected to the same CAN bus for RappId Bootloader. @jiri_kral do you have any suggestions here?
Unticking the download after build option means that the appkey code is not included in the generated code for some reason.
Also is there anyway to reduce the startup delay?:
Changing the value in the config produces the code above: