2023-07-20 09:16 AM
I am using stm32h743, my program is too big to fit in internal flash so I have to use QSPI or FMC. My question is that I don't want to put the whole application in external flash since it is slower, are there ways to have my part of the application in IROM and part in external ROM?
I am thinking to use linker script, and __attribute some functions to NOR, would that work? and how do I deploy the binary (I am using Keil IDE)? or do I have to write a BL to copy code to NOR before launching my app?
Thanks!
2023-07-20 09:41 AM
The relative performance can be addressed significantly with caching.
I'd generally recommend a boot loader approach, not least to get the clocks and memory interfaces up initially, but also facilitate the update. You can't write/erase from a QPSI memory whilst you XIP / Memory-Map it. Doing a lot of initialization of clocks / pins / peripherals saves a lot of wasted time and repeat work down stream.
You can partition the memory via linker script or scatter file. Could use attributes, but can also do at a file/object level. Perhaps put library and critical code in Internal Flash, less critical and used once code in External Flash. Using the BL approach the APP can have a lot of flexibility as it's handed a mostly working system.
Other critical code could be moved to Internal SRAM. The Keil scatter loader can hide a lot of the complexity as the linker builds nice tables which it automatically processes via __main() call. Bring up system in SystemInit(). With GNU/GCC you'll need to rework startup.s to manage all the detail.