2022-07-01 05:40 AM
@Jocelyn RICARD
I've built, installed and used SBSFU to successfully update the firmware through the serial terminal with a YModem transfer. This update was from version "0" to version "1".
Now I have built a new version "2" which only differs from version "1" in that it prints a different version number at startup. The build process and scrips used are exactly the same. Now when I try to install version "2", it downloads correctly, but after that SBSFU throws an error: "Installation not validated: rollback procedure initiated (SLOT_ACTIVE_1 / SLOT_DWL_1)"
I've tried it multiple times, each update from "0" to "1" works without problems, but going from "1" to "2" throws the same error. I'm completely mystified.... Log is attached.
Solved! Go to Solution.
2022-07-05 04:50 AM
Right now I'm struggling to get normal debugging operation. I did break into SE_IMG_SetActiveFwState, but then I cannot step through it normally and the breaks jump all over the place. I'm confident I can at least find the source of the bug if I can debug. So I'm going to try some more things to hopefully get debugging sorted. If I can't I will make a detailed description how I setup debugging, perhaps you can then tell me what I'm doing wrong.
2022-07-05 05:06 AM
Hi @Community member ,
Here are main things to do
1) Change compiler option for se_fwimg.c
2) Rebuild SECoreBin Project
3) Clean and build SBSFU project
4) Build your user app project to get big image
5) download this binary to the target
6) Create a debug session based on your user app
7) In main debug tab you can disable autobuild
8) go to startup tab, add SECoreBin and disable download:
That's it !
In debug session you should get something like:
You can check with assembly window that code is well aligned with instructions. This is an important if you are not 100% sure.
Then you can step in the code, and with debug optimization of this part you should follow the code order.
Best regards
Jocelyn
2022-07-05 10:38 AM
That is exactly what I was doing, but could not replicate. In despair, I decided to do a clean install to make sure the problem is not in my toolchain. Now that I went from CubeIDE 1.8.0 to 1.10.0, I cannot even build anymore.
After searching, this is due to:
4 months ago you mentioned an update to SBSFU that fixes this would be released in about a month. Is this update available yet?
I followed the steps to resolve this linking problem closely, but the linking problem remains. A SBSFU release that works out of the box would be greatly appreciated.
2022-07-05 11:12 AM
Hi @Community member ,
I'm using exactly same version (1.8.0) as the one you use.
Now I realized is already installed the GNU toolchain version 10.3 which required the described change, so not exactly same configuration.
I didn't install 1.10.0 yet but you can give it a try.
The update of the project described in the post doesn't take more than five minutes.
The update of SBSFU is not available yet.
Best regards
Jocelyn
2022-07-05 11:14 AM
Hi @Community member
One other solution, if possible is that you send me your project, I can try to find the issue.
Best regards
Jocelyn
2022-07-05 01:20 PM
Hi @Jocelyn RICARD
I did a fresh install of CubeIDE 1.8.0 and SBSFU 2.6.0 builds without problems. So I tried debugging the default userapp and could not get that to work (the debugger simply exited after starting mentioning Break at address "0xfffffffe" with no debug information available, or outside of program code).
However I did manage to get the debugger running for my own app, and I did get it to break in SE_IMG_GetActiveFwState() but within that function is breaks at points were there are no break points and jumps seemingly randomly through the lines.
Any help is greatly appreciated, I'm happy to share my project with you, I will write some instructions on how to setup the paths and folders in order to build my app. My contact info is here:
2022-07-05 01:39 PM
Hi @Community member,
I sent you a file request using our mft tool.
This is a secure transfer tool.
Best regards
Jocelyn
2022-07-06 05:15 AM
Hello @Community member ,
First, thank you for sharing your project and build details. Build went smoothly.
Regarding debug configuration. You added SBSFU in the picture.
To make things work with also SBSFU, the SECoreBin.elf should be in first place.
One possible reason for the issue you are facing (step debugging is going in random places) could be related to your USB cable or intermediate USB Hub.
You can give it a try.
Regarding the issue, the first thing I can see is that you are calling SE_APP_ValidateFw unconditionally.
As you can see in the SE code, if you want to validate a firmware that is already validated, you get an error.
But the issue is still here.
For some reason, when calling HAL_Init() in your code, the flash of the flash PGERR is rising. I couldn't find the reason as this seems related to some interrupts triggering at early stages.
Now, if you clear this flash before calling the service the validation works.
So, here is the code I used to make it work:
if (fw_state_mb == 3)
{
if (__HAL_FLASH_GET_FLAG(FLASH_FLAG_PGSERR))
{
LogPrint("Clearing FLASH_FLAG_PGSERR flag \r\n");
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_PGSERR);
}
if(SE_SUCCESS == SE_APP_ValidateFw(&eSE_Status, SLOT_ACTIVE_1)){
LogPrint("\n\rFirmware validated..\n\r");
}
else{
LogPrint("\n\rFirmware validation error..\n\r");
}
}
Then here is the trace I get:
Current firmware state = [FWIMG_STATE_SELFTEST]..
Clearing FLASH_FLAG_PGSERR flag
Firmware validated..
So, something needs to be checked at ealy initialization in HAL_Init but you have at least a validated image :)
Best regards
Jocelyn
2022-07-06 07:04 AM
@Jocelyn RICARD
Yes! that did the trick! I verified it to work with the OTA process as well as the standard YModem update. I can sigh of relief now, knowing that I can ship my products now and push updates over the air.
Thank you so much!!
I still need to sort my debugging issues, but at least now I can work on that without time pressure on it.