I am using the NXP FRDM-MCXN236 board and I am relatively new to Zephyr.
As part of my Zephyr training, I have successfully built and run a basic Zephyr project using Visual Studio Code. I would now like to understand the boot and board bring-up process at a lower level.
My goal is to try building the following components separately:
MCUboot
Device Tree
Zephyr application/kernel
I would then like to understand which parts are actually flashed to the board, flash them separately where possible, and observe the boot sequence.
I feel this would be a useful exercise for understanding board bring-up, bootloaders, Device Tree, Kconfig, linker scripts, and the relationship between MCUboot and the Zephyr application.
I would also like to understand whether Zephyr can be customized in a way similar to the Linux kernel menuconfig workflow.
Board: NXP FRDM-MCXN236
Host OS: Windows 11
Build environment: Ubuntu 22.04 under WSL2
Zephyr: 4.4.99
Python: 3.10.12 currently installed
West: 1.5.0
CMake: 4.4.3
Ninja: 1.10.1
Zephyr SDK: 1.0.1
My workspace is:
~/zephyr-training/ ├── zephyr/ ├── mcuboot/ ├── my-zephyr-app/ └── workspace/
I cloned MCUboot separately under:
~/zephyr-training/mcuboot/
The Zephyr-specific MCUboot application is located at:
~/zephyr-training/mcuboot/boot/zephyr/
I found the following relevant CMake files:
mcuboot/boot/zephyr/CMakeLists.txt mcuboot/boot/zephyr/sysbuild/CMakeLists.txt mcuboot/boot/bootutil/CMakeLists.txt mcuboot/boot/bootutil/zephyr/CMakeLists.txt
I first tried to build the MCUboot Zephyr application using:
cd ~/zephyr-training west build \ -b frdm_mcxn236 \ -s ~/zephyr-training/mcuboot/boot/zephyr \ -d ~/zephyr-training/build-mcuboot
The intention here is to tell West:
-b frdm_mcxn236 → build for the FRDM-MCXN236 board
-s .../mcuboot/boot/zephyr → use the Zephyr MCUboot application as the source
-d .../build-mcuboot → keep the MCUboot build output separate from my normal Zephyr application
However, the build did not reach the actual CMake compilation stage.
I received this error:
Traceback (most recent call last): File "/usr/local/bin/west", line 8, insys.exit(main()) File "/usr/local/lib/python3.10/dist-packages/west/app/main.py", line 1199, in main app.run(argv or sys.argv[1:]) File "/usr/local/lib/python3.10/dist-packages/west/app/main.py", line 278, in run self.run_command(argv, early_args) File "/usr/local/lib/python3.10/dist-packages/west/app/main.py", line 584, in run_command self.run_extension(args.command, argv, self.topdir, manifest=self.manifest, File "/usr/local/lib/python3.10/dist-packages/west/app/main.py", line 739, in run_extension self.cmd.run(args, unknown, self.topdir, manifest=self.manifest, File "/home/umesh/zephyr-training/zephyr/scripts/west_commands/build.py", line 263, in do_run self._sanity_check() File "/home/umesh/zephyr-training/zephyr/scripts/west_commands/build.py", line 589, in _sanity_check_source_dir srcrel = pathlib.Path(self.source_dir).relative_to( TypeError: PurePath.relative_to() got an unexpected keyword argument 'walk_up'
My Python version is:
python3 --version Python 3.10.12
and:
west --version West version: v1.5.0 which python3 /usr/bin/python3 which west /usr/local/bin/west
It appears that the current Zephyr west build code is using:
Path.relative_to(..., walk_up=True)
which requires a newer Python version.
I also checked:
python3.12 --version
but Python 3.12 is not currently installed.
I tried installing it directly:
sudo apt update sudo apt install python3.12 python3.12-venv
but Ubuntu 22.04 returned:
E: Unable to locate package python3.12 E: Couldn't find any package by glob 'python3.12' E: Unable to locate package python3.12-venv E: Couldn't find any package by glob 'python3.12-venv'
So I am currently trying to resolve the Python/West compatibility issue before continuing with the MCUboot build.
Once I get MCUboot building, I would like to proceed step by step and understand:
How to build MCUboot separately for FRDM-MCXN236.
How the FRDM-MCXN236 Device Tree is selected and compiled.
Whether Device Tree can be built/inspected separately from the Zephyr application.
How the Zephyr kernel/application is built separately.
Which of these are actual flashable binaries and which are build-time configuration.
Whether MCUboot can be flashed independently and then the Zephyr application flashed separately.
How the MCUboot image layout and application image/slots are defined.
How to sign the Zephyr application so that MCUboot can boot it.
How to observe and verify the MCUboot → Zephyr boot sequence on the board.
How to customize the Zephyr kernel/configuration using something similar to the Linux kernel menuconfig workflow.
My intention is not just to get the application running, but to understand the complete boot flow:
FRDM-MCXN236
|
v
MCUboot
|
v
Zephyr application
|
v
Zephyr kernel / drivers
|
v
Device Tree + Kconfig configurationI believe doing this manually would help me better understand MCU/SoC startup, bootloader operation, flash layout, Device Tree, Kconfig, linker scripts, and board bring-up.
Any guidance on the correct sequence for doing this on the FRDM-MCXN236 would be appreciated.
MCUBOOT ZEPHYR-OS-EDGE @frdmuser
Hello @bottleneck,
I would suggest starting with the fundamentals of Zephyr and MCUboot, which appears to be where you are in the learning process right now.
To better understand how MCUboot works, I recommend first testing the SDK example without Zephyr. This can help you learn how image encryption and partition management work. The MCUXpresso Secure Provisioning Tool can also help with image encryption and includes a dedicated MCUboot workflow that complements this topic.
To run the MCUboot examples in our SDK, it is necessary to use the mcuboot_opensource and ota_mcuboot_basic projects. I highly recommend reviewing the README files of both examples to understand how they work, along with the Secure Provisioning Tool user guide.
You can also review the official MCUboot documentation for a more in-depth explanation of its functionality.
In addition, to better understand Device Tree configuration and the use of Kconfig, you can refer to this guide, which provides direct links to the Zephyr documentation for each topic. Our Zephyr Knowledge Hub also offers a collection of useful resources that are frequently referenced by developers who are learning and developing with Zephyr on NXP platforms.
If you are interested, the training section of the Zephyr page on the official NXP website offers several videos that may help with your development. In your particular case, I highly recommend watching "Accelerate Development with Zephyr™ OS Features and Modules", which explains the basic principles of Zephyr and other features of Zephyr OS, along with external modules, like MCUboot.
Finally, please refer to the MCUboot implementation in Zephyr and review its README file to better understand how it works.
This community post may also be helpful for understanding how build a created app for MCUboot. Although it was created for the MCXN947, you can follow the general flow for the MCXN236.
BR
Habib