Building MCUboot, Device Tree and Zephyr separately on FRDM-MCXN236
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.
My environment
My workspace is:
~/zephyr-training/
├── zephyr/
├── mcuboot/
├── my-zephyr-app/
└── workspace/
MCUboot source
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
MCUboot build attempt
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, in <module>
sys.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.
What I would like to understand
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