Skip to content

build: Fix missing const qualifier - #4

Merged
aurore-poirier merged 1 commit into
cheriotfrom
aurore/const
Jul 13, 2026
Merged

aurore-poirier merged 1 commit into
cheriotfrom
aurore/const

Conversation

@aurore-poirier

Copy link
Copy Markdown
Collaborator

A const qualifier was missing in previous PR, breaking compilation because of -Werror. -Wno-error is still required to build (including in ci) while we're not done rebasing on upstream because similar errors are still happening there

Change-Id: I411bb6a2fc02694e37ee3ca3a48dcd1924602ae0
@aurore-poirier aurore-poirier self-assigned this Jul 13, 2026
@aurore-poirier aurore-poirier added the bug Something isn't working label Jul 13, 2026
@aurore-poirier
aurore-poirier merged commit 914cec0 into cheriot Jul 13, 2026
1 check passed
@aurore-poirier
aurore-poirier deleted the aurore/const branch July 13, 2026 07:38
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant