Repository navigation
Conversation
A Giga can leave the factory with the STM32H747's BCM4 option bit set (OPTSR 0x0bc6aaf0 on the board here; a Portenta and a Nicla Vision read 0x0b86aaf0, bit clear). The Cortex-M4 then boots at every reset from its boot address, 0x08100000, which is inside this firmware's text (FLASH_TEXT runs from 0x08040000 for 1280K), and runs whatever M7 code is there. That has visible effects: - mp_openamp_remoteproc_start refuses to start the M4 while the bit is set, so remoteproc can't be used on such a board. - Anything that rewrites bank 2 while the M4 runs from it is at risk: an OTA boot stub installing new firmware there failed on every update until the bit was cleared. Clear the bit in the board's early init, and reset once it reads clear so that this boot runs without the M4 as well. This happens once per board. Signed-off-by: Kwabena W. Agyeman <kwagyeman@live.com>
|
Code size report: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
A Giga can leave the factory with the STM32H747's BCM4 option bit set. Ours reads
OPTSR 0x0bc6aaf0; a Portenta and a Nicla Vision read0x0b86aaf0. With the bit set, the Cortex-M4 boots at every reset from its boot address,0x08100000. That address is inside this firmware's text (FLASH_TEXTis0x08040000+ 1280K), so the M4 runs whatever M7 code is there.Two consequences:
mp_openamp_remoteproc_start()refuses to start the M4 while the bit is set ("auto-boot is enabled via the option bytes"), so remoteproc can't be used on such a board.This clears the bit in
GIGA_board_early_init(), then resets once it reads clear, so that boot also runs without the M4. It only resets if the write took, so a failed write can't loop. It happens once per board.Testing
Built
ARDUINO_GIGA. On the Giga above, clearing BCM4 with the same sequence (unlock the option bytes, clear the bit inOPTSR_PRG,OPTSTART) left it at0x0b86aaf0across resets. With the M4 no longer booting, a boot stub's firmware install that had failed on every boot succeeded.Trade-offs and Alternatives
Anyone who relies on the M4 auto-booting its own firmware from
0x08100000loses that. MicroPython's text covers that address, so with MicroPython on the M7 nothing useful can live there anyway. The M4 is still started explicitly through remoteproc, which this makes possible.