Generate cortex r52 tcm configuration - #830
Conversation
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>
|
I re-opened as I was waiting for the corresponding zephyr TCM patch to land |
zeddii
left a comment
There was a problem hiding this comment.
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 this is needed for cleaner RPU ELF code execution on ARM R52s