Skip to content

Generate cortex r52 tcm configuration - #830

Merged
zeddii merged 2 commits into
devicetree-org:masterfrom
bentheredonethat:generate-Cortex-R52-TCM-configuration
Sep 8, 2026
Merged

Generate cortex r52 tcm configuration#830
zeddii merged 2 commits into
devicetree-org:masterfrom
bentheredonethat:generate-Cortex-R52-TCM-configuration

Conversation

@bentheredonethat

Copy link
Copy Markdown
Collaborator

@zeddii this is needed for cleaner RPU ELF code execution on ARM R52s

Cortex-R52 firmware can use BTCM for writable data and exception
stacks before normal C initialization. If its local TCM region remains
disabled, those accesses can reach the system address map and corrupt
memory owned by another processor.

Normalize the R52 local TCM layout to ATCM at 0x0, BTCM at 0x10000,
and CTCM at 0x18000. Emit configuration words that Zephyr consumes
early during reset to enable the selected B and C banks while leaving
the existing ATCM configuration unchanged.

Update the R52 fixture and generator checks for the corrected CTCM
address and generated configuration values.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Exercise the generated .tcm_config block through the linker renderer
so the words Zephyr reads at reset stay pinned.

Symbol names are a cross-repository ABI. Renaming them on one side
alone makes Zephyr fall back to its weak defaults instead of failing,
so assert the exact spelling alongside the bank-derived words, the
ATCM placement, the unselected-bank case, and the DDR profile that
emits no configuration at all.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
@bentheredonethat

Copy link
Copy Markdown
Collaborator Author

I re-opened as I was waiting for the corresponding zephyr TCM patch to land

@zeddii zeddii left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All five points addressed, with tests. test_tcm_config_declares_the_zephyr_startup_symbols pins the symbol names, which is the cross-repository contract that would otherwise rot silently.

Deleting the duplicated validation in _infer_profile rather than syncing a second copy of the constant was the better call.

I also settled the ATCM question I couldn't verify last time. zephyrproject-rtos/zephyr#118037 consumes the same z_arm_tcm_*_region names, and its reset path does tst r1, #1 / beq ahead of the mcr — a clear bit 0 skips the write, so the zero word preserves the boot-firmware configuration rather than disabling the bank. The symbols are .weak there, so a script without them still links.

One leftover, non-blocking: zephyr_memory.py:600's ATCM must use local address 0x0 is the same dead check as the block you removed, since _normalized_memory has already pinned ATCM to 0x0 before _infer_profile sees it. Worth taking next time you're in the file.

@zeddii
zeddii merged commit 7c54cf4 into devicetree-org:master Sep 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants