Add SOF support for M7 core on NXP i.MX8MP#10556
Add SOF support for M7 core on NXP i.MX8MP#10556dbaluta wants to merge 6 commits intothesofproject:mainfrom
Conversation
This adds platform files necessary to run SOF on CM7 core of i.MX8MP. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Add configuration option to support build for i.MX8MP CM7 core. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
This includes required sources in order to build imx8mp cm7 support. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Similar with support for imx8mp adsp, the cm7 instance uses sdma3 and HOST_DMA. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
This enables host_dma, sdma3 and sai3 nodes and their respective drivers. Also, we enable CONFIG_ROMSTART_RELOCATION_ROM option in order to put romstart section into ITCM (because M7 gets its first instruction at adress 0 in ITCM). Note that we temporarily disable COMP_ASRC because there is a conflict between NXP HAL and SOF ASRC headers. e.g NXP HAL defines: #define ASRC ((ASRC_Type *)ASRC_BASE) and ASRC modules uses: #if SOF_USE_MIN_HIFI(5, ASRC) which results in a compilation error. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
This builds SOF binary firmware for M7 core on i.MX8MP. Resulted firmware name is: sof-imx8m_cm7.ri Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
There was a problem hiding this comment.
Pull request overview
This pull request adds SOF (Sound Open Firmware) support for the M7 core on the NXP i.MX8MP platform. The i.MX8MP has both an HIFI4 DSP core (already supported) and an M7 core, and this PR enables SOF on the M7 core. The implementation follows a similar pattern to the existing imx95 M7 platform support.
Changes:
- Add platform-specific implementation for imx8m_cm7 (platform.c, clock configuration, header files)
- Extend DMA configuration to support both MIMX8ML8_ADSP and MIMX8ML8_M7
- Add build configuration, board overlay/conf files, and rimage configuration for the new platform
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| zephyr/lib/dma.c | Extended DMA configuration conditional to include M7 core |
| zephyr/CMakeLists.txt | Added build configuration for imx8m_cm7 platform |
| tools/rimage/config/imx8m_cm7.toml | Added rimage configuration defining memory zones |
| src/platform/imx8m_cm7/platform.c | New platform initialization code for M7 core |
| src/platform/imx8m_cm7/linker/data-sections.ld | Linker script for firmware metadata section |
| src/platform/imx8m_cm7/lib/clk.c | Clock configuration implementation |
| src/platform/imx8m_cm7/include/platform/trace/trace.h | Platform trace header (placeholder) |
| src/platform/imx8m_cm7/include/platform/platform.h | Platform configuration defines |
| src/platform/imx8m_cm7/include/platform/lib/memory.h | Memory layout and configuration |
| src/platform/imx8m_cm7/include/platform/lib/mailbox.h | Mailbox region definitions |
| src/platform/imx8m_cm7/include/platform/lib/dma.h | DMA header (placeholder) |
| src/platform/imx8m_cm7/include/platform/lib/clk.h | Clock configuration header |
| src/platform/Kconfig | Added IMX8M_CM7 Kconfig option |
| scripts/xtensa-build-zephyr.py | Added imx8m_cm7 platform configuration |
| app/boards/imx8mp_evk_mimx8ml8_m7_ddr.overlay | Device tree overlay for board configuration |
| app/boards/imx8mp_evk_mimx8ml8_m7_ddr.conf | Board-specific configuration options |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| KEEP (*(*.fw_metadata)) | ||
| . = ALIGN(16); | ||
| } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) |
There was a problem hiding this comment.
The .fw_metadata section should use GROUP_ROM_LINK_IN instead of GROUP_DATA_LINK_IN. The fw_metadata (windows variable in platform.c) is declared as const, indicating it's read-only data that should be placed in ROM. The imx95 platform uses GROUP_ROM_LINK_IN for the same purpose, which is the correct approach for read-only metadata.
| } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) | |
| } GROUP_ROM_LINK_IN(ROMABLE_REGION) |
| static const struct freq_table platform_cpu_freq[] = { | ||
| { | ||
| .freq = CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC, | ||
| .ticks_per_msec = CONFIG_SYS_CLOCK_TICKS_PER_SEC * 1000, |
There was a problem hiding this comment.
The ticks_per_msec calculation appears incorrect. It should be CONFIG_SYS_CLOCK_TICKS_PER_SEC / 1000 (ticks per millisecond), not multiplied by 1000. Looking at the imx8m platform, it uses a direct value of 800000 (for 800MHz), which represents ticks per millisecond. The current calculation would result in ticks per nanosecond.
| .ticks_per_msec = CONFIG_SYS_CLOCK_TICKS_PER_SEC * 1000, | |
| .ticks_per_msec = CONFIG_SYS_CLOCK_TICKS_PER_SEC / 1000, |
| zephyr_library_sources( | ||
| ${SOF_SRC_PATH}/schedule/zephyr_ll.c | ||
| ) | ||
|
|
There was a problem hiding this comment.
The zephyr_ll.c scheduler source is already included automatically via the schedule subdirectory CMakeLists.txt (line 240 in this file calls add_subdirectory for schedule, which includes zephyr_ll.c at line 37 of src/schedule/CMakeLists.txt). This explicit inclusion is redundant and could potentially cause build issues due to duplicate symbols. Other similar platforms like imx95 (CONFIG_SOC_MIMX9596_M7) don't explicitly include this file.
| zephyr_library_sources( | |
| ${SOF_SRC_PATH}/schedule/zephyr_ll.c | |
| ) |
| #include <kernel/abi.h> | ||
| #include <kernel/ext_manifest.h> | ||
| #include <sof/drivers/mu.h> | ||
| #include <zephyr/cache.h> |
There was a problem hiding this comment.
The zephyr/cache.h header is included but doesn't appear to be used anywhere in this file. Consider removing this unused include.
| #include <zephyr/cache.h> |
This patchseries enables SOF support on M7 core of i.MX8MP. Note that on i.MX8MP there is an HIFI4 core which is already supported with SOF.
This depends on Zephyr PR: zephyrproject-rtos/zephyr#104250