Zephyr Lab MCXN947 Hello World - nxp-mcuxpresso/vscode-for-mcux GitHub Wiki
In this lab, you will learn:
- How to import an example from the Zephyr Repo in the VS Code workspace
- How to build, clean, debug, and run the example
- How to connect the Serial Monitor for UART console
- How to navigate and edit files in the Explorer view
After successfully installing Zephyr and setting up the VS Code extension for MCUXpresso, let’s go through the detailed steps to run the Zephyr hello_world application on the FRDM-MCXN947.
-
To import the hello_world application from the Zephyr Repository, click Import example from Repository in the Quickstart Panel.
- Select the following board settings to import the example:
-
For selecting the board, type n947 to find the board target frdm_mcxn947/mcxn947/cpu0. Make sure that the board ends with
cpu0
. -
For selecting the example, type hello to find the application zephyr/samples/hello_world
-
For application type, select Repository Application.
-
Click Create and the example should be added to the PROJECTS view.
We need to build hello_world project to generate the application image. After the code builds without any errors, the application can be run on the board.
-
Build the project by clicking the Build Selected icon.
After the build, the Terminal view displays the memory usage (or compiler errors if any).
To use the Serial Monitor integrated into VS Code, connect the USB Type-C cable to J17 to power the board. The onboard debugger provides a USB-UART bridge to interface with the Serial monitor.
-
Connect the Serial monitor to the board’s COM port and select the Baud rate. The screenshots show the board enumerates as COM15, but the COM port number may be different for you. To capture the data sent over UART, click Start Monitoring.
It can be disconnected by clicking Stop Monitoring after debug.
-
If the serial monitor view is disabled, right-click on the panel and select the Serial Monitor option.
-
Optional settings for the Serial Monitor:
6.1. To add a monitor for another COM port select Open an additional monitor.
6.2. Click the icon to clear the output terminal.
6.3. Click the gear icon for additional settings (data bits, stop bits, parity, DTR, RTS).
6.4. To send a message to the serial terminal, type the command in the text box.
This section uses the GDB debugger to connect to the MCU, and program the flash.
-
Click the play icon to Debug the application:
-
The execution will pause, and a debugger toolbar pops up at the top of VS Code. To continue execution click Continue on the debug options.
-
In the Serial Monitor view, the application prints the boot banner during the startup code and halts at main(). The boot banner also includes the version of Zephyr used in the build. In main(), the application prints
hello world
.
This lab is completed. But the following steps will clean up the VS Code workspace:
-
Click Stop to end the debug session.
-
Close all Editor tabs. Right-Click on a tab, and select Close All.
-
If this is the last lab and you are done using the board, you should disconnect the Serial Monitor. Find the Serial Monitor view, and click Stop Monitoring.
Lab completed. Return to the MCXN947 Zephyr Labs Overview Training Zephyr Getting Started MCXN947