fix(linker): correct cross-toolchain memory map inconsistencies - #17
Open
94xhn wants to merge 1 commit into
Open
fix(linker): correct cross-toolchain memory map inconsistencies#1794xhn wants to merge 1 commit into
94xhn wants to merge 1 commit into
Conversation
…Memory The MDK-ARM project for STM322xG_EVAL/Examples/FSMC/FSMC_SRAM_DataMemory declares the external FSMC SRAM region (OCR_RVCT9, base 0x64000000) with a size of 0x20000 (128 KB), while the GCC linker script (SW4STM32/STM322xG_EVAL/STM32F207IGHx_FLASH.ld) and the active IAR linker file (EWARM/stm32f207xx_extsram.icf, selected via IlinkIcfOverride) both declare the identical physical memory at the same base address as 0x100000 (1 MB). The board's external memory is an ISSI IS61WV102416BLL-10MLI SRAM (1M x 16-bit = 2 MB), so the GCC/IAR 1 MB figure is a plausible subset of the real chip capacity, while Keil's 128 KB figure under-declares the usable window by 8x for no apparent reason. This brings the Keil project's declared region size back in line with the other two toolchains for the same physical memory. Signed-off-by: 94xhn <87560781+94xhn@users.noreply.github.com>
KRASTM
approved these changes
Jul 22, 2026
Contributor
|
ST Internal Reference: 9d1b6095831a8b147e8514b71eda1e9e |
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
Cross-toolchain audit of the linker/memory configuration files under
Projects/(GCC.ld, IAR.icf, Keil.uvprojx) for this repository, comparing the memory-region declarations for the same physical memory across the three toolchains within each project.Finding: Keil external SRAM region under-declared in
FSMC_SRAM_DataMemoryProject:
Projects/STM322xG_EVAL/Examples/FSMC/FSMC_SRAM_DataMemoryThis example redirects the application's data memory (heap, stack, and a test buffer) entirely into the board's external FSMC SRAM at
0x64000000, as stated inreadme.txt:For GCC and IAR, both linker files declare this external region as 1 MB:
SW4STM32/STM322xG_EVAL/STM32F207IGHx_FLASH.ld:RAM (xrw) : ORIGIN = 0x64000000, LENGTH = 1024KEWARM/stm32f207xx_extsram.icf(the file actually selected by the project viaIlinkIcfOverrideinProject.ewp, not the unused siblingstm32f207xx_flash.icf):__ICFEDIT_region_RAM_start__ = 0x64000000,__ICFEDIT_region_RAM_end__ = 0x640FFFFF→ 0x100000 = 1 MBBut
MDK-ARM/Project.uvprojxdeclared the same address,OCR_RVCT9(Type 0 = RAM), with<Size>0x20000</Size>— only 128 KB, an 8x smaller window than the other two toolchains for the identical base address0x64000000.The board's external memory is an ISSI
IS61WV102416BLL-10MLISRAM (1M x 16-bit = 2 MB total capacity), so 1 MB is a sensible declared subset of the real chip, consistent between two independently-authored toolchain files (GCC and IAR). Keil's 128 KB figure has no similar justification and appears to be a stale/incorrect value.Fix: changed
OCR_RVCT9's<Size>from0x20000to0x100000inProject.uvprojx, bringing Keil's declared external-SRAM window in line with GCC and IAR for the same physical memory.Other candidates investigated and ruled out (false positives)
Applications/IAP/IAP_binary_template— flagged by an automated size-diff pass because its FLASH region (992 KB, starting at0x08008000) differs from the board'sTemplatesproject (1 MB, starting at0x08000000). Manually verified: GCC (.ld), IAR (.icf), and Keil (Project.uvprojx<Cpu>tag) all three agree on0x08008000/992 KB — the application intentionally reserves the first 32 KB of flash for theIAP_Mainbootloader. Not a bug; the mismatch is expected given the different purpose of the project versus the plainTemplatesproject..icffiles underFSMC_SRAM_DataMemory/EWARM— the folder contains two.icffiles (stm32f207xx_flash.icfandstm32f207xx_extsram.icf); onlystm32f207xx_extsram.icfis actually referenced by the project (IlinkIcfOverrideinProject.ewp). The other file is vestigial/unused. Confirmed by inspecting the.ewpproject file directly rather than trusting a naive per-directory scan..ldand IAR.icfRAM region across the entire repository (e.g. GCC declares 128 KB, IAR's computed size is 128 KB + 1 byte) — this is because IAR's__ICFEDIT_region_RAM_end__symbol is defined as one address higher than the true last valid byte (0x20020000instead of0x2001FFFF) in every single project's.icf, including the board's ownTemplatesgold reference. This is a repo-wide (and, based on prior audits of 17 sibling STM32Cube repositories, ST-wide) convention/quirk in how the ICF editor writes theRAM_endsymbol, not a toolchain-specific bug — excluded as noise, not reported.IAP_Mainbootloader project declaring aCCMRAMregion (0x10000000, 64 KB) — GCC, IAR, and Keil all three agree on this region, so there is no cross-toolchain drift to report regardless of whether it reflects real silicon.Test plan
No local ARM toolchain (GCC/arm-none-eabi, IAR EWARM, or Keil MDK) was available to build and link this project. Verification was done purely through address arithmetic cross-checked against three independent sources for each project:
MEMORYregions (ORIGIN/LENGTH).icf__ICFEDIT_region_*_start__/_end__symbols (cross-checked against the actual.ewpIlinkIcfOverrideto confirm which.icfis the one actually used, since a project may contain more than one).uvprojxOCR_RVCTn(Type/StartAddress/Size) entries, cross-checked against the top-level<Cpu>tagIS61WV102416BLL, confirmed via public distributor listings) as an independent sanity check on which declared size is plausibleThis same methodology (without local toolchain builds) has previously surfaced and had merged 65+ confirmed cross-toolchain linker inconsistencies across 17 other STM32Cube repositories.
Disclosure
This investigation and fix were carried out with the assistance of Claude (Anthropic AI). All findings were manually cross-checked against the raw linker/project files and the external SRAM chip's datasheet before being reported here, and every change in this PR was reviewed by me before submission.