This is turning out to be something weird.
The issue is between
a) code loaded into the target via the STLINK V2/V3 debugger
b) code loaded into the target via a firmware update feature
And it is not the obvious thing (item b) being duff). The firmware update route has been exhaustively tested over more than a year, but not since Cube was updated to v10, and the GCC tools updated with it.
This is the post build batch file I am using, to generate the firmware update file:
arm-none-eabi-objcopy -S --strip-all -R .bss -R .main_heap -R .ccmram -O binary yyy.elf zzz.dat
I know with 100% certainty that zzz.dat used to be identical to the content of the CPU FLASH. There is/was ~350k of code running fine.
But now, not quite, and this is why it took so many hours to home in on it. The following examples are: cpu flash and then the file
It starts off nicely


and starts to break around here (line 1, halfway along)


In terms of the resulting code, it is still about 80% there. Bloody confusing...
Does anyone have any ideas?
I haven't done a "diff" properly because I don't actually have a file of the CPU FLASH. Yes, I could write a bit of code on my board and write one out. But fairly clearly the first difference is at offset 488 hex which is 110 decimal.
The flash size (before the FFs start) is 377964 whereas the above zzz.dat file is 372748.
I have no idea of what command Cube is using to drive the debugger but I see this
make all
arm-none-eabi-size KDE485.elf
text data bss dec hex filename
354696 69480 57584 481760 759e0 yyy.elf
Finished building: default.size.stdout
The reset issue may still be there, but all the time I have different data in the firmware-update file (which is where the problem is confined to) I don't have a hope of a working system, obviously.
Software reset - and WD reset, too - generates a pulse on NRST, that's why it's in effect identical to pushbutton reset. Except if you prevent that pulse e.g. by using a push-pull output reset generator to NRST.
That's useful to know!
UPDATE: I wrote out a file of the actual CPU FLASH (the board has a 2MB FatFS filesystem) and treating that as a firmware update does work!
So what has changed in the bloody GCC objcopy, making the above command line produce a small % of garbage?
arm-none-eabi-objcopy -S --strip-all -R .bss -R .main_heap -R .ccmram -O binary out.elf out.datI can extract a firmware update file out of a running target by writing out the CPU FLASH into a file, but it is a pretty weird way to go about it.