F421: work around bug in old bootloader #68
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
the released F421 bootloader that comes on F4A boards (at least for the holybro 4-in-1) does this:
that writes to the application stack area before jumping. If the application stack is set to the end of ram then the ldmia instruction hard faults as it writes past the end of memory
this avoids the issue by only giving the app 15k instead of 16k of ram. This is not needed when we fix the bootloader to use the right jump method, which is this:
this issue is why the gcc generated F421 code didn't boot on F4A. The linker script for the gcc build puts the stack at the end of ram 0x20004000, whereas for some strange reason keil puts it at 0x20000e50
Note that the F421 bootloader currently in the download section of am32.ca has different jump code. It does this:
that does not write to the stack before the bx, so doesn't have the problem.
I'd guess the f421 bootloader was recompiled at some stage with different keil compiler or different compiler options?