Repository navigation
build: Fix missing const qualifier - #4
Merged
Merged
Conversation
Change-Id: I411bb6a2fc02694e37ee3ca3a48dcd1924602ae0
aurore-poirier
pushed a commit
that referenced
this pull request
Oct 8, 2026
NuMicro microcontroller families map their Flash Memory Controller (FMC) registers to different base addresses (0x5000C000 for legacy M0 series, 0x4000C000 for M031, M4, and newer series). Previously, the flash writing algorithm was selected based on whether m_page_size == NUMICRO_PAGESIZE (512 bytes), and the FMC base addresses were hardcoded in separate assembly loaders (numicro_m0.S and numicro_m4.S) using a literal pool. However, Cortex-M0 microcontrollers like the M031 series have a 512-byte page size, but their FMC registers are mapped at 0x4000C000 (m_address_bias_offset = 0x10000000). Because numicro_flash_write_code hardcoded the legacy 0x5000C000 base address, running it on M031 caused target execution timeouts during flash write operations. Pass the FMC base address dynamically from OpenOCD via register r3 to the write algorithm (numicro_m0.S). 1. Update numicro_m0.S to use immediate-offset loads/stores relative to r3 (e.g. [r3, #4], [r3, #8], [r3, #16], [r3, #0]), eliminating the literal pool table and shrinking the loader from 56 to 34 bytes. 2. In numicro.c, add r3 to reg_params and pass the calculated FMC base address (NUMICRO_FLASH_ISPCON - m_address_bias_offset). 3. Use the Cortex-M0 (ARMv6-M Thumb) loader universally across all NuMicro families and remove obsolete numicro_m4.S / numicro_m4.inc. Reference: - NuMicro® Family M031/M032 Series Technical Reference Manual, Chapter 6.3.5 "System Memory Map" and Chapter 6.4.5 "Register Map" https://www.nuvoton.com.cn/export/ resource-files/TRM_M031_M032_Series_EN_Rev2.02.pdf Change-Id: Ia4422de13cd1134f8220bca5bf1dc909381a3af7 Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/9965 Reviewed-by: Tomas Vanek <tomas.vanek.oocd@gmail.com> Tested-by: jenkins
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.
A const qualifier was missing in previous PR, breaking compilation because of
-Werror.-Wno-erroris still required to build (including in ci) while we're not done rebasing on upstream because similar errors are still happening there