2023-10-26 02:07 AM - last edited on 2024-12-03 05:10 AM by Tesla DeLorean
Hi, I've developed a custom ExternalLoader for STM32U575VGT6Q installed on my board, following the online guides provided by ST, obtaining a fully functional version. On the new version of the board I have an STM32U545VET6Q, so in ExternalLoader project I've carried out the necessary porting for the new micro pinout, and the memory was replaced with a larger one but with the same interface.
On the new version of the board with STM32U545VET6Q, my ExternalLoader has been successfully tested in debug, both in reading and writing, but it does not work when launched from CubeProgrammer (with both versions 2.13 and 2.14 of CubeProg, the only ones that support U545). I attach the CubeProgrammer logs in the two cases, obtained with Verbosity Level 3. I've tried to read small portions of the external flash, but the CubeProgrammer interface always shows the error message when reading (same behavior for writing).
From the logs (the figure below shows an extract of the reading procedure for both micros) I've noticed that in the case of the U545 it seems that the ExtLoader binary is not loaded into RAM, unlike what happens on the U575 (lines 97-99 of the U575 log, absent in U545). Following this (and probably related to the previous problem..) the Main Stack Pointer of U575 seems to point to a coherent memory location, while on U545 it points to zero.
Does anyone have any suggestions on this?
Thank you
2023-10-26 02:38 AM
The loaders seem ridiculously large the first is close to 200KB, not sure of the second. Can you dump the headers of the second with objcopy or something similar, or provide the two binaries for inspection?
Correct it doesn't look to load it into RAM
2023-10-26 02:46 AM
2023-10-26 03:19 AM
Was looking for the .STLDR, but never mind
The other is smaller, but both look to have incorrect StorageInfo structures and don't look to be describing QSPI/OSPI, and each describes different memory spaces starting at zero (TCM), one 64Mb (8MB) the other 256Mb (32MB). I suspect this zero addressing conflicts with other expectations within the memory space.
Perhaps set the basis as 0x70000000 or 0x80000000 ?
2023-10-26 04:13 AM
Correct, my external memories are both SPI flash and the used address for them is zero, it works on U575. I've tried to change it to 0x70000000 or 0x80000000 but the error result on U545 is the same. The memory used with U575 has 4MB size, the one used with U545 has 16MB size. These are the two StorageInfo screenshot from my code:
Anyway, I've also tried on U545 with empty read/write functions that return LOADER_OK without doing anything else and I have the same error, in this scenario the storage info should not have any impact. I haven't understood why the loader isn't written into ram.
I attach stldr files.
Thanks a lot
2023-10-26 09:31 AM
@Sarra.S @Nawres GHARBI - Can we get some eyes on this as to why a loader might not get pulled into memory, the bigger 200KB one loads, where as the smaller 150KB does not. Structures look intact. Any additional debug output, or diagnostics that might be helpful? Output in logs is frequently duplicative rather than informative.
Some issue with the structure of the .ELF file? Support for one U5 and not the other in the current release? Hidden rules/choices being made here? Do those log / report in some way?
2023-10-27 08:27 AM
Hello @Pc10,
You have segments overlapping in both the loaders you attached, could you fix this for U545.stldr and retry with CubeProgrammer ? If that doesn't work, could you attach or PM me your EL project for U545 ?
Thanks in advance,
Aziz
2023-10-27 03:02 PM
@Aziz BRIGUI Ok, I see what you mean, some degree of conflict with the StorageInfo and other content, although the StorageInfo could be fished out via the Program Header or the 200-byte Section Header.
@Pc10 This is the Linker Script I use for the 0x20000004 RAM loaders, pushes the StorageInfo structure out at ZERO. Although you'd need to expand the the RAM section to accommodate 150 or 200 KB loaders
https://github.com/cturvey/stm32extldr/blob/main/ExternalLoader_F7.ld
2023-10-30 02:20 AM
Hello @Aziz BRIGUI ,
where do you see the mentioned segments overlap? Where should I check to avoid such scenario? I've analyzed my linker conf file without detecting the problem. I attach you my linker and startup files, thank you so much.
2023-10-30 02:27 AM
Thank you, I've tried your Linker Script, adapted to U545 architecture and startup file, but the final result is the same.
U545 doosn't have addressable RAM at address 0, so I have to put both StorageInfo and Loader into the same region