Repository navigation
arch/arm/imxrt: enable itcm dtcm on imxrt118x - #20430
Conversation
2eb8d83 to
6ce9be5
Compare
|
This was quick; @arikimari in our team actually had some code ready for initializing the M7 DTCM from M33. So I now dropped the generic M7 TCM ECC initialization, and added Ari's code for M33 bootloader, to do TCM initialization before the M7 release. Tested again on imxrt1180-evk:bl + imxrt1180-evk:nsh combination, as well as with my PX4 configuration. All work fine. |
|
I just found out that the function "imxrt_dma_address" is common functionality needed also by other drivers. I just enabled also sdcard driver, and realized that the uSDHC DMA needs to do exactly the same address translation as the eDMA. So I could still break the address translation for M7 DTCM into an own header in this PR. Or, I can do this in a follow up PR when enabling the SD card, if that is preferred. What do you think @xiaoxiang781216 ? |
Add support for Cortex-M33 code to initialize the M7 TCM memories before releasing it to run. The TCM has ECC, which needs to be initialized before the memory is usable for M7. Specifically, the TCM needs to be initialized sequentially in 64-bit writes. Use eDMA4 for this; this is the same mechanism which the NXP MCUXpresso SDK code does. Split imxrt118x_release_cm7() into imxrt118x_prepare_cm7() and imxrt118x_start_cm7(). The TCM ECC initialization is done in imxrt118x_prepare_cm7(), after the M7 has been released from reset and before the M7 is started. Also reset M7_CFG[TCM_SIZE] to the default 256 KiB ITCM / 256 KiB DTCM layout. Co-Authored-By: Jukka Laitinen <[email protected]> Signed-off-by: Jukka Laitinen <[email protected]>
6ce9be5 to
a148576
Compare
Cortex-M7 core's DTCM is available for other peripherals via a dedicated address space. If transfers are done to or from the DTCM, translate addresses to work on this shadow memory region instead, via which the eDMA can access the DTCM. This allows using the existing imxrt peripherals, which use DMA, to work directly even if .data/.bss are located in DTCM. Signed-off-by: Jukka Laitinen <[email protected]>
…7 NSH Change the imxrt1180-evk M7 NSH configuration to use the SoC memories more efficiently: - Place .data, .bss, idle stack and primary heap into DTCM - Allocate available OCRAM as a secondary heap - Add a separate .dmamemory section in OCRAM for USB device DMA allocations - Place .ramfunc into ITCM, together with hand-picked "hot" functions. The section is copied to ITCM at boot by the ramfunc copy. The eDMA accesses DTCM through the SoC's dedicated bus window. This configuration acts as an example of performance optimization for imxrt1180 based boards. Signed-off-by: Jukka Laitinen <[email protected]>
a148576 to
e542efd
Compare
|
I re-based this, and moved the helper address translation functions imxrt_dma_transfer_address and imxrt_dma_cpu_address into an own header for future use by other drivers. Kept them inline, and 118x specific so that they get completely optimized away for other imxrt targets, keeping the existing functionality for them intact. |
Summary
When running larger application on the imxrt118x, I quickly run out of performance while running from XIP on
NOR flash.
Imxrt PX4 configurations for imxrt1176 place all the hot functions into ITCM. This patchset enables the same for imxrt118x, with the addition to placing .bss, .data and initial heap on DTCM + more heap to OCRAM.
Impact
No impact on other than imxrt platform; enables high performance on imxrt118x.
Testing
Tested on external application (PX4 on imxrt1189, 3 IMUs, 3 EKF instances). Running only from qSPI NOR as XIP, the configration doesn't run at all. With hot functions placed in ITCM, CPU load is ~85 %. With also .data, .bss and heap in DTCM, the load drops to ~66%, with 2 mavlink instances as well, one at high rate on USB ttyacm: