STM32U5A5: DCache as "memory"?
My question might sound "strange" for HW experts.
My STM32U5A5 MCU has DCache (16KByte). Datasheet says: used when external memory is connected (e.g. NAND/NOR flash, OCTOSPI).
DCache is not used for internal memory (when running from MCU flash or internal SRAM, obvious: not needed, internal SRAM seems to be with same speed as MCU = no DCache needed).
But: 16KByte of memory is provided in chip as DCache:
How could I use this memory without any external memory device used, not connecting external memory?
16KByte, provided as DCache, would give me an option to place the stack region on it (large enough).
So, the "idea" is:
- There is not any external memory connected.
- But I enable DCache and I read/write via the intended base address (for external memory).
- I use the MPU and configure in a way, that this base address is a "write-through" region
I mean:
- if I could configure DCache and MPU so that the DCache is never evicted (not "cleaned", not writing to real external memory)
- and no need to "invalidate" the DCache (nobody has updated the (not-existing) "external memory")
- I could "potentially" use the DCache like a "regular memory"
OK, I understand: when DCache tries to update external memory (for "write-through" or "clean") - the system will potentially hang (because the AXI/AHB bus master will raise an error).
But if I could configure the system in way, that the DCache content is never written neither read back from external memory - it could behave like a regular memory. Just to figure out if MPU config allows a setting for such a "use case".
Dear STM team:
it sounds to me like a "waste" of chip space and memory if DCache is there, but just used with external memories. It would be "cool" if DCache memory becomes available as "regular" memory (with some "config tricks").
"*** idea"? I know, but technically not so difficult to say: "just do read/write on DCache, but never access external memory = do not do any cache policy, not needed to be done, disable transactions to external memory).
Just add a register bit, or a "cache policy" setting in MPU where DCache would never access external memory (and it could work).
