321. Speculative prefetch of Cortex-M7 may require various preventative steps
Speculative prefetch in Cortex-M7 increases performance, but may also cause trouble in memories or memory areas, which are sensitive to unexpected/multiple reads.
In the Cortex-M7-based STM32 - the 'F7 and 'H7 families - users came across several issues stemming from this behaviour:
- spurious TCM reads, leading to ECC errors in uninitialized TCM RAM, even if TCM is not used in the program - unless caching are to be switched off, both ITCM and DTCM have to be explicitly initialized (every memory word has to be written to any value, so that ECC bits are set to valid values)
- spurious accesses to QSPI, potentially leading to lockup - problem stems from the fact that these accesses may go to QSPI portions which are not actually mapped to a physical memory; these have to be marked as Not Accessible + Execute Never in MPU. Some users reported probably related problems even with QSPI not set to memory mapping mode; in that case the above MPU marking should be extended to the whole memory mapped QSPI area.
- spurious reads through FSMC/FMC to external hardware, which is not a "pure" memory and has side effects when read (e.g. FPGA-based designs with autoincrementing address or triggering some process upon reading). Again, these reads may go to any address within the given FMC/FSMC Bank/Block, regardless of which range does the external hardware decode (read: in some address decoder implementations, the hardware may experience surprising read without validly decoded address, too). The solution again is to use the MPU, this time marking given area as Device (instead of Normal).