Bootloader on NUCLEO L476 #439
-
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 4 replies
-
Guys (@multiplemonomials @zhiyong-ft @lefebvresam ), do you find few minutes to look on this? |
Beta Was this translation helpful? Give feedback.
-
@Kormoran86 could you elaborate on how you flashed primary application into NULCEO-L476RG board? Try to manually sign the original hex file with imgtool and then flash it. The other thing to look into is
If SPIF is passed as secondary bd we need to make sure the SPIF chip is compatible with SPIF driver, this needs to be tested out. |
Beta Was this translation helpful? Give feedback.
-
Apologies, I didn't see this until now, GitHub doesn't notify me unless someone mentions me specifically... So sorry that you are having a tough time getting this to work! For starters, go ahead and try this branch of Mbed: #440 . I converted the linker script to support memory banks on your target (though it looks like the way you set it up is correct, this is just to check). From what you described, it sounds like something is going wrong when the bootloader jumps to the application, and we'll need to dig into why that is. I checked over your configuration, and it looks OK, all the addresses seem to match what I'd expect. To analyze this issue, you may need to be a bit creative with the debugger. I'd recommend:
Then ideally it should break right when the bootloader jumps to the application, and then you can step through and work out what's going on. I had to use this procedure at times when testing mcuboot, and it usually helps find the issue (after some messing around). |
Beta Was this translation helpful? Give feedback.
-
@Kormoran86 Could you double check if the signing-keys.pem passed to bootloader and primary application are the same? The other thing you can try might be to read the flash content with STM32CubeProgrammer and see if they match expectation. I attached the missing portion of your bootloader log below:
It seems your bootloader stuck when/after doing something with flash area 0 and before opening flash area 2(scratch area). Go back to MUCboot source code and see what is happening there. My hunch is this have something to do with configuration of scratch area, image sectors? I don't know this part of code enough to make a call. |
Beta Was this translation helpful? Give feedback.
-
@multiplemonomials @zhiyong-ft I tested the latest mbed-os ce and bootloader example version on the NUCLEO-L476RG both with internal flash and external flash for the secondaty slot and it's working! I'm using this board based on the SST26VF064B 8Mb serial flash chip. For reference, this is the mbed_app.json:
Thank you so much @multiplemonomials @zhiyong-ft for your help! |
Beta Was this translation helpful? Give feedback.
-
@Kormoran86 I'm glad you got it to work. If you plan to encrypt firmware images, please either manually sign/encrypt them, or use/test my fork for the time being until my PR is approved. |
Beta Was this translation helpful? Give feedback.
Good news! I tried to set up my own configuration on my NUCLEO_L452RE_P board, and I was able to replicate the hang you were getting. I did some debugging, and determined the cause. This doesn't have anything to do with the mbed_app.json configuration at all. It's crashing in the bootloader because it's running out of stack!
It turns out that
mcuboot
requires more than 1k of stack space to do its stuff, and the linker script for STM32L4 only allocates exactlytarget.boot-stack-size
(0x400 bytes) of stack, and if the application uses more than that, it will crash, HARD (can't even get to the fault handler to print the crash details).I have created this PR which both combines together the …