Skip to content

Add NXP i.MX 8M Mini (imx8mm) target - #931

Open
miyazakh wants to merge 10 commits into
wolfSSL:masterfrom
miyazakh:imx8mm
Open

miyazakh wants to merge 10 commits into
wolfSSL:masterfrom
miyazakh:imx8mm

Conversation

@miyazakh

@miyazakh miyazakh commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Adds wolfBoot support for the NXP i.MX 8M Mini, tested on the TechNexion PICO-IMX8MM (PICO-PI baseboard).

Boot modes

  • BL33 (default, IMX8MM_BL33=1): wolfBoot replaces U-Boot proper.
    BootROM -> U-Boot SPL -> ATF (BL31) -> wolfBoot -> Linux.
    wolfBoot reads a signed FIT (kernel + DTB) from eMMC p1 (FAT32, /fitImage_A.itb / /fitImage_B.itb), verifies it and boots Linux at EL2.
  • RAM-boot (IMX8MM_BL33=0): started from U-Boot proper with go 0x40480000; the signed kernel is bundled after wolfBoot.

Changes

  • src/sdhci.c: optional eMMC bus width and High Speed timing (SDHCI_EMMC_BUS_WIDTH, SDHCI_EMMC_HS). Defaults unchanged for other targets.
  • hal/imx8mm.*: UART2 console, uSDHC3 eMMC through the SDHCI layer (register shim from hal/imx8qm.c), identity MMU + D-cache with SDMA cache maintenance in BL33 mode.
  • config/examples/imx8mm-pico.config, test-app/app_imx8mm.c, Makefile (MAIN_TARGET), 3 CI build jobs.
  • tools/scripts/imx8mm/: build flash.bin (BL33), the signed FIT, and the go image.
  • docs/Targets.md: "NXP i.MX 8M Mini" section.

Testing

  • Built with Ubuntu GCC 13.3 and Linaro GCC 6.4.1 (all CI variants).
  • On hardware: eMMC standalone boot, A/B slot selection, signature verification and Linux boot (6.1.55 and 6.12.49 with the TechNexion Yocto rootfs). Load + verify of a 27 MB FIT takes about 1.7 s.
  • Boot chain set up from a fresh clone with u-boot-tn-imx tn-imx_v2023.04_6.1.55_2.2.0-stable and its install_uboot_imx8.sh.

Notes

  • HABv4 (authentication of wolfBoot itself) is not set up yet.
  • DTBs from the Linux tree lack /memory and bootargs (U-Boot normally adds them); imx8mm-mkfit.sh adds them before signing.

@miyazakh miyazakh self-assigned this Oct 8, 2026
Copilot AI balanced review requested due to automatic review settings October 8, 2026 01:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The image-generation scripts can reject valid bootargs or produce images that overlap memory or exceed runtime limits.

3 open findings
What changed in this PR

Adds NXP i.MX 8M Mini support for BL33 and U-Boot go boot flows.

Changes:

  • Adds i.MX8MM HAL, linker layout, configuration, test payload, and CI builds.
  • Extends SDHCI with configurable eMMC width and High Speed timing.
  • Adds scripts and documentation for producing signed FIT, go, and flash images.
File Description
.github/​workflows/​test-configs.yml Adds three i.MX8MM build variants.
.gitignore Ignores generated i.MX8MM artifacts.
Makefile Defines i.MX8MM build outputs.
config/​examples/​imx8mm-pico.config Configures PICO-IMX8MM boot modes.
docs/​Targets.md Documents setup, booting, and limitations.
hal/​imx8mm.c Implements UART, MMU/cache, and uSDHC HAL support.
hal/​imx8mm.h Defines i.MX8MM hardware constants.
hal/​imx8mm.ld Defines the DRAM memory layout.
include/​sdhci.h Adds eMMC High Speed constants.
src/​boot_aarch64.c Includes the i.MX8MM platform header.
src/​boot_aarch64_start.S Adds i.MX8MM EL2 startup handling.
src/​sdhci.c Adds configurable eMMC width and timing.
test-app/​app_imx8mm.c Adds a bare-metal boot payload.
tools/​scripts/​imx8mm/​imx8mm-mkfit.sh Builds signed kernel/DTB FIT images.
tools/​scripts/​imx8mm/​imx8mm-mkflashbin.sh Builds BL33 flash images.
tools/​scripts/​imx8mm/​imx8mm-mkgoimage.sh Builds U-Boot go images.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread tools/scripts/imx8mm/imx8mm-mkfit.sh Resolved

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #931

Scan targets checked: wolfboot-src, wolfboot-bugs
Coverage: 2 of 5 in-scope changed file(s) opened by the reviewer; not opened: include/sdhci.h, src/boot_aarch64.c, test-app/app_imx8mm.c

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Lite

@miyazakh miyazakh assigned wolfSSL-Bot and unassigned miyazakh Oct 8, 2026
@miyazakh
miyazakh force-pushed the imx8mm branch 2 times, most recently from 9454a4f to 42ebd47 Compare October 14, 2026 08:59
@danielinux
danielinux requested a review from dgarske October 30, 2026 08:55

@dgarske dgarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miyazakh please resolve merge conflicts

SDHCI_EMMC_BUS_WIDTH (1/4/8, default 4) and SDHCI_EMMC_HS (CMD6
HS_TIMING, 50 MHz). Defaults are unchanged.
Boots a signed Linux kernel, either loaded into DRAM and started from
U-Boot proper (RAM-boot, go) or started by ATF as BL33 reading a
signed FIT from eMMC (uSDHC3, FAT32).
Includes a test app and CI builds.
Scripts for flash.bin (BL33), the signed FIT and the RAM-boot image.
wolfboot.bin omits the BSS that startup clears.
…_SIZE

The limit is read from the build configuration.
@miyazakh miyazakh removed their assignment Oct 31, 2026
Comment thread hal/imx8mm.c

static volatile uint64_t imx8mm_l1_table[512] __attribute__((aligned(4096)));

static void imx8mm_mmu_enable(void)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of this might be better as a pure assembly implementation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MMU enable and cache range ops implemented in assembly.

Comment thread hal/imx8mm.c Outdated

#if defined(DISK_EMMC) && !defined(SDHCI_SDMA_DISABLED)
/* Cache maintenance by address range for SDMA */
static void imx8mm_dcache_range(uintptr_t start, uint32_t sz, int invalidate)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Pure assembly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MMU enable and cache range ops implemented in assembly

Comment thread hal/imx8mm.c
@@ -0,0 +1,790 @@
/* imx8mm.c

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any code in this file also exists in hal/imx8qm.c consider some consolidation and I can regress on the QuadMax.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uSDHC shim shared as hal/imx_usdhc_sdhci.c/.h

Comment thread hal/imx8mm.c Outdated

/* uSDHC -> SDHCI register shim, taken from hal/imx8qm.c */

#ifndef CADENCE_SRS_OFFSET

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer more of the macros like these in the .h

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Macros in headers

Comment thread test-app/app_imx8mm.c Outdated
#include "hal/imx8mm.h"

/* UART2 console, already set up by the earlier boot stages */
#define UART_REG(off) \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the imx8mm.c macros are moved to the .h then you won't need this...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same above.

Comment thread test-app/app_imx8mm.c Outdated
/* Bounded wait for TX FIFO space */
#define UART_TX_SPIN_MAX 1000000

static void uart_putc(char c)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should leverage implementation from hal/imx8mm.c

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same above.

Comment thread test-app/app_imx8mm.c Outdated
(dtb & 0x3) != 0) {
uart_puts("(pointer not in DRAM or misaligned)\n");
}
else if (*((volatile uint32_t*)(uintptr_t)dtb) == FDT_MAGIC_LE) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps if you are wanting to prove the FDT pointer the test-app should link the fdt.c code too and parse it? No really required tho.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test-app parses the DTB with fdt.c

@@ -0,0 +1,123 @@
#!/usr/bin/env bash

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicating work in tools/scripts/imx8qm/imx8qm-flash.sh. Let's considolidate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find much overlap with imx8qm-flash.sh itself. Similar parts are
(1) the bootargs and /memory DTB edits in mkfit, vs hal_dts_fixup() on imx8qm,
(2) flashing over uuu/SD, which imx8mm only prints instructions for, and
(3) the zero-padding when bundling images (mkramimage vs imx8qm-mkflashbin).
Which did you mean, or is it fine as is?

@miyazakh

miyazakh commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@dgarske
Tested on PICO-IMX8MM (BL33 and RAM-boot). I have no QuadMax, so could you
regression-test b1c7e4f6 and 176f6c9c there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants