1.. zephyr:board:: imx8mq_evk
2
3Overview
4********
5
6i.MX8MQ EVK board is based on NXP i.MX8MQ applications
7processor, composed of a quad Cortex®-A53 cluster and a single Cortex®-M4 core.
8Zephyr OS is ported to run on the Cortex®-M4 core.
9
10- Board features:
11
12  - RAM: 3GB LPDDR4
13  - Storage:
14
15    - 16GB eMMC5.0
16    - 32MB QSPI NOR
17    - microSD Socket
18  - Wireless:
19
20    - WiFi: 2.4/5GHz IEEE 802.11 a/b/g/n/ac
21    - Bluetooth: v4.1
22  - USB:
23
24    - OTG - 1x type C
25    - HOST - 1x type A
26  - Ethernet
27  - PCI-E M.2
28  - LEDs:
29
30    - 1x Power status LED
31    - 1x UART LED
32  - Debug
33
34    - JTAG 10-pin connector
35    - MicroUSB for UART debug, two COM ports for A53 and M4
36
37More information about the board can be found at the
38`NXP website`_.
39
40Supported Features
41==================
42
43The Zephyr mimx8mq_evk board configuration supports the following hardware
44features:
45
46+-----------+------------+-------------------------------------+
47| Interface | Controller | Driver/Component                    |
48+===========+============+=====================================+
49| NVIC      | on-chip    | nested vector interrupt controller  |
50+-----------+------------+-------------------------------------+
51| SYSTICK   | on-chip    | systick                             |
52+-----------+------------+-------------------------------------+
53| CLOCK     | on-chip    | clock_control                       |
54+-----------+------------+-------------------------------------+
55| PINMUX    | on-chip    | pinmux                              |
56+-----------+------------+-------------------------------------+
57| UART      | on-chip    | serial port-polling;                |
58|           |            | serial port-interrupt               |
59+-----------+------------+-------------------------------------+
60
61The default configuration can be found in the defconfig file:
62:zephyr_file:`boards/nxp/imx8mq_evk/imx8mq_evk_mimx8mq6_m4_defconfig`.
63
64Other hardware features are not currently supported by the port.
65
66Connections and IOs
67===================
68
69MIMX8MQ EVK board was tested with the following pinmux controller
70configuration.
71
72+---------------+-----------------+---------------------------+
73| Board Name    | SoC Name        | Usage                     |
74+===============+=================+===========================+
75| UART2 RXD     | UART2_TXD       | UART Console              |
76+---------------+-----------------+---------------------------+
77| UART2 TXD     | UART2_RXD       | UART Console              |
78+---------------+-----------------+---------------------------+
79
80System Clock
81============
82
83The M4 Core is configured to run at a 266 MHz clock speed.
84
85Serial Port
86===========
87
88The i.MX8MQ SoC has four UARTs. UART_2 is configured for the console and
89the remaining are not used/tested.
90
91Programming and Debugging
92*************************
93
94The MIMX8MQ EVK board doesn't have QSPI flash for the M4 and it needs
95to be started by the A53 core. The A53 core is responsible to load the M4 binary
96application into the RAM, put the M4 in reset, set the M4 Program Counter and
97Stack Pointer, and get the M4 out of reset. The A53 can perform these steps at
98bootloader level or after the Linux system has booted.
99
100The M4 can use up to 3 different RAMs. These are the memory mapping for A53 and M4:
101
102+------------+-------------------------+------------------------+-----------------------+----------------------+
103| Region     | Cortex-A53              | Cortex-M4 (System Bus) | Cortex-M4 (Code Bus)  | Size                 |
104+============+=========================+========================+=======================+======================+
105| OCRAM      | 0x00900000-0x0091FFFF   | 0x20200000-0x2021FFFF  | 0x00900000-0x0091FFFF | 128KB                |
106+------------+-------------------------+------------------------+-----------------------+----------------------+
107| TCMU       | 0x00800000-0x0081FFFF   | 0x20000000-0x2001FFFF  |                       | 128KB                |
108+------------+-------------------------+------------------------+-----------------------+----------------------+
109| TCML       | 0x007E0000-0x007FFFFF   |                        | 0x1FFE0000-0x1FFFFFFF | 128KB                |
110+------------+-------------------------+------------------------+-----------------------+----------------------+
111| OCRAM_S    | 0x00180000-0x00187FFF   | 0x20180000-0x20187FFF  | 0x00180000-0x00187FFF | 32KB                 |
112+------------+-------------------------+------------------------+-----------------------+----------------------+
113
114For more information about memory mapping see the
115`i.MX 8M Applications Processor Reference Manual`_  (section 2.1.2 and 2.1.3)
116
117At compilation time you have to choose which RAM will be used. This
118configuration is done in the file :zephyr_file:`boards/nxp/imx8mq_evk/imx8mq_evk_mimx8mq6_m4.dts`
119with "zephyr,flash" (when CONFIG_XIP=y) and "zephyr,sram" properties.
120The available configurations are:
121
122.. code-block:: none
123
124   "zephyr,flash"
125   - &tcml_code
126   - &ocram_code
127   - &ocram_s_code
128
129   "zephyr,sram"
130   - &tcmu_sys
131   - &ocram_sys
132   - &ocram_s_sys
133
134Load and run Zephyr on M4 from A53 using u-boot.
135
136.. tabs::
137
138   .. group-tab:: From an SD card
139      Copy the compiled ``zephyr.bin`` to the first FAT partition of the
140      SD card and plug the SD card into the board. Power it up and stop the u-boot
141      execution at prompt.
142
143      Load the M4 binary onto the desired memory and start its execution using:
144
145      .. code-block:: console
146
147         fatload mmc 0:1 0x40480000 zephyr.bin
148         cp.b 0x40480000 0x7e0000 0x8000
149         bootaux 0x7e0000
150
151   .. group-tab:: From serial
152      This procedure requires ``screen`` and ``lrzsz`` to be installed.
153
154      Start ``screen``, power up the board, and stop the u-boot execution at prompt:
155
156      .. code-block:: console
157
158         screen <tty-device> 115200
159
160      Start ``loadx`` with offset ``7e0000``:
161
162      .. code-block:: console
163
164         loadx 7e0000 115200
165
166      Send the compiled ``zephyr.bin`` with ``sx`` by pressing :kbd:`Ctrl-a` followed by :kbd:`:`
167      and write:
168
169      .. code-block:: console
170
171         exec !! sx </full/path/to/zephyr.bin>
172
173      Start execution:
174
175      .. code-block:: console
176
177         bootaux 0x7e0000
178
179Debugging
180=========
181
182MIMX8MQ EVK board can be debugged by connecting an external JLink
183JTAG debugger to the J401 debug connector and to the PC. Then
184the application can be debugged using the usual way.
185
186Here is an example for the :zephyr:code-sample:`hello_world` application.
187
188.. zephyr-app-commands::
189   :zephyr-app: samples/hello_world
190   :board: imx8mq_evk/mimx8mq6/m4
191   :goals: debug
192
193Open a serial terminal, step through the application in your debugger, and you
194should see the following message in the terminal:
195
196.. code-block:: console
197
198   ***** Booting Zephyr OS build zephyr-v2.6.99-30942-g6ee70bd22058 *****
199   Hello World! imx8mq_evk
200
201References
202==========
203
204.. _NXP website:
205   https://www.nxp.com/design/development-boards/i-mx-evaluation-and-development-boards/evaluation-kit-for-the-i-mx-8m-applications-processor:MCIMX8M-EVK
206
207.. _i.MX 8M Applications Processor Reference Manual:
208   https://www.nxp.com/webapp/Download?colCode=IMX8MDQLQRM
209