From a426ed789809014f4eefbb4def24f3fb820bbd4a Mon Sep 17 00:00:00 2001 From: Jiafei Pan Date: Mon, 28 Apr 2025 14:49:54 +0800 Subject: [PATCH] boards: imx8mn_evk: add JLink runner for A53 Core Use JLink runner for flash and debug on A53 Core. Signed-off-by: Jiafei Pan --- boards/nxp/imx8mn_evk/board.cmake | 9 +++ boards/nxp/imx8mn_evk/doc/index.rst | 97 ++++++++++++++++++++++------- 2 files changed, 83 insertions(+), 23 deletions(-) diff --git a/boards/nxp/imx8mn_evk/board.cmake b/boards/nxp/imx8mn_evk/board.cmake index 9881313609a..ff37ad0855d 100644 --- a/boards/nxp/imx8mn_evk/board.cmake +++ b/boards/nxp/imx8mn_evk/board.cmake @@ -1 +1,10 @@ +# +# Copyright 2025 NXP +# # SPDX-License-Identifier: Apache-2.0 + +if(CONFIG_SOC_MIMX8MN6_A53) + board_runner_args(jlink "--device=MIMX8MN6_A53_0" "--no-reset" "--flash-sram") + + include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) +endif() diff --git a/boards/nxp/imx8mn_evk/doc/index.rst b/boards/nxp/imx8mn_evk/doc/index.rst index 3102e2a159b..0231f1194a1 100644 --- a/boards/nxp/imx8mn_evk/doc/index.rst +++ b/boards/nxp/imx8mn_evk/doc/index.rst @@ -62,28 +62,88 @@ Programming and Debugging .. zephyr:board-supported-runners:: +There are multiple methods to program and debug Zephyr on the A53 core: + +Option 1. Boot Zephyr by Using JLink Runner +=========================================== + +The default runner for the board is JLink, connect the EVK board's JTAG connector to +the host computer using a J-Link debugger, power up the board and stop the board at +U-Boot command line. + +Then use "west flash" or "west debug" command to load the zephyr.bin +image from the host computer and start the Zephyr application on A53 core0. + +Flash and Run +------------- + +Here is an example for the :zephyr:code-sample:`hello_world` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :host-os: unix + :board: imx8mn_evk/mimx8mn6/a53 + :goals: flash + +Then the following log could be found on UART4 console: + +.. code-block:: console + + *** Booting Zephyr OS build v4.1.0-3063-g38519ca2c028 *** + Hello World! imx8mn_evk/mimx8mn6/a53 + +Debug +----- + +Here is an example for the :zephyr:code-sample:`hello_world` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :host-os: unix + :board: imx8mn_evk/mimx8mn6/a53 + :goals: debug + +Option 2. Boot Zephyr by Using U-Boot Command +============================================= + U-Boot "cpu" command is used to load and kick Zephyr to Cortex-A secondary Core, Currently it has been supported in latest U-Boot version by `patch serials`_. .. _patch serials: https://patchwork.ozlabs.org/project/uboot/list/?series=417536&archive=both&state=* -Copy the compiled ``zephyr.bin`` to the first FAT partition of the SD card and -plug the SD card into the board. Power it up and stop the u-boot execution at -prompt. +Step 1: Download Zephyr Image into DDR Memory +--------------------------------------------- -Use U-Boot to load and kick zephyr.bin to Cortex-A53 Core0: +Firstly need to download Zephyr binary image into DDR memory, it can use tftp: .. code-block:: console - fatload mmc 1:1 0x93c00000 zephyr.bin; dcache flush; icache flush; go 0x93c00000 + tftp 0x93c00000 zephyr.bin -Or kick zephyr.bin to the other Cortex-A53 Core, for example Core2: +Or copy the Zephyr image ``zephyr.bin`` SD card and plug the card into the board, for example +if copy to the FAT partition of the SD card, use the following U-Boot command to load the image +into DDR memory (assuming the SD card is dev 1, fat partition ID is 1, they could be changed +based on actual setup): .. code-block:: console - fatload mmc 1:1 0x93c00000 zephyr.bin; dcache flush; icache flush; cpu 2 release 0x93c00000 + fatload mmc 1:1 0x93c00000 zephyr.bin; +Step 2: Boot Zephyr +------------------- + +Then use the following command to boot Zephyr on the core0: + +.. code-block:: console + + dcache off; icache flush; go 0x93c00000; + +Or use "cpu" command to boot from secondary Core, for example Core1: + +.. code-block:: console + + dcache flush; icache flush; cpu 1 release 0x93c00000 Use this configuration to run basic Zephyr applications and kernel tests, for example, with the :zephyr:code-sample:`synchronization` sample: @@ -92,28 +152,19 @@ for example, with the :zephyr:code-sample:`synchronization` sample: :zephyr-app: samples/synchronization :host-os: unix :board: imx8mn_evk/mimx8mn6/a53 - :goals: run + :goals: build This will build an image with the synchronization sample app, boot it and display the following ram console output: .. code-block:: console - *** Booting Zephyr OS build zephyr-v3.1.0-3575-g44dd713bd883 *** - thread_a: Hello World from cpu 0 on mimx8mn_evk_a53! - thread_b: Hello World from cpu 0 on mimx8mn_evk_a53! - thread_a: Hello World from cpu 0 on mimx8mn_evk_a53! - thread_b: Hello World from cpu 0 on mimx8mn_evk_a53! - thread_a: Hello World from cpu 0 on mimx8mn_evk_a53! - -Use Jailhouse hypervisor, after root cell linux is up: - -.. code-block:: console - - #jailhouse enable imx8mn.cell - #jailhouse cell create imx8mn-zephyr.cell - #jailhouse cell load 1 zephyr.bin -a 0x93c00000 - #jailhouse cell start 1 + *** Booting Zephyr OS build v4.1.0-3063-g38519ca2c028 *** + thread_a: Hello World from cpu 0 on mimx8mn_evk! + thread_b: Hello World from cpu 0 on mimx8mn_evk! + thread_a: Hello World from cpu 0 on mimx8mn_evk! + thread_b: Hello World from cpu 0 on mimx8mn_evk! + thread_a: Hello World from cpu 0 on mimx8mn_evk! .. include:: ../../common/board-footer.rst :start-after: nxp-board-footer