FRDM-MCXN236 mcuboot

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FRDM-MCXN236 mcuboot

60 Views
bottleneck
Contributor III

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:

  1. MCUboot

  2. Device Tree

  3. 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

  • 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/

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:

  1. How to build MCUboot separately for FRDM-MCXN236.

  2. How the FRDM-MCXN236 Device Tree is selected and compiled.

  3. Whether Device Tree can be built/inspected separately from the Zephyr application.

  4. How the Zephyr kernel/application is built separately.

  5. Which of these are actual flashable binaries and which are build-time configuration.

  6. Whether MCUboot can be flashed independently and then the Zephyr application flashed separately.

  7. How the MCUboot image layout and application image/slots are defined.

  8. How to sign the Zephyr application so that MCUboot can boot it.

  9. How to observe and verify the MCUboot → Zephyr boot sequence on the board.

  10. 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 configuration

I 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 

0 Kudos
Reply
0 Replies
%3CLINGO-SUB%20id%3D%22lingo-sub-2416812%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EFRDM-MCXN236%20mcuboot%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2416812%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CH3%20id%3D%22toc-hId-2056050675%22%20id%3D%22toc-hId-2056072904%22%3EBuilding%20MCUboot%2C%20Device%20Tree%20and%20Zephyr%20separately%20on%20FRDM-MCXN236%3C%2FH3%3E%3CP%3EI%20am%20using%20the%20%3CSTRONG%3ENXP%20FRDM-MCXN236%3C%2FSTRONG%3E%20board%20and%20I%20am%20relatively%20new%20to%20Zephyr.%3C%2FP%3E%3CP%3EAs%20part%20of%20my%20Zephyr%20training%2C%20I%20have%20successfully%20built%20and%20run%20a%20basic%20Zephyr%20project%20using%20%3CSTRONG%3EVisual%20Studio%20Code%3C%2FSTRONG%3E.%20I%20would%20now%20like%20to%20understand%20the%20boot%20and%20board%20bring-up%20process%20at%20a%20lower%20level.%3C%2FP%3E%3CP%3EMy%20goal%20is%20to%20try%20building%20the%20following%20components%20separately%3A%3C%2FP%3E%3COL%3E%3CLI%3E%3CP%3EMCUboot%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EDevice%20Tree%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EZephyr%20application%2Fkernel%3C%2FP%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%3EI%20would%20then%20like%20to%20understand%20which%20parts%20are%20actually%20flashed%20to%20the%20board%2C%20flash%20them%20separately%20where%20possible%2C%20and%20observe%20the%20boot%20sequence.%3C%2FP%3E%3CP%3EI%20feel%20this%20would%20be%20a%20useful%20exercise%20for%20understanding%20%3CSTRONG%3Eboard%20bring-up%2C%20bootloaders%2C%20Device%20Tree%2C%20Kconfig%2C%20linker%20scripts%2C%20and%20the%20relationship%20between%20MCUboot%20and%20the%20Zephyr%20application%3C%2FSTRONG%3E.%3C%2FP%3E%3CP%3EI%20would%20also%20like%20to%20understand%20whether%20Zephyr%20can%20be%20customized%20in%20a%20way%20similar%20to%20the%20Linux%20kernel%20menuconfig%20workflow.%3C%2FP%3E%3CH3%20id%3D%22toc-hId-248596212%22%20id%3D%22toc-hId-248618441%22%3EMy%20environment%3C%2FH3%3E%3CUL%3E%3CLI%3E%3CP%3EBoard%3A%20%3CSTRONG%3ENXP%20FRDM-MCXN236%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EHost%20OS%3A%20%3CSTRONG%3EWindows%2011%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EBuild%20environment%3A%20%3CSTRONG%3EUbuntu%2022.04%20under%20WSL2%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EZephyr%3A%20%3CSTRONG%3E4.4.99%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EPython%3A%20%3CSTRONG%3E3.10.12%3C%2FSTRONG%3E%20currently%20installed%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EWest%3A%20%3CSTRONG%3E1.5.0%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3ECMake%3A%20%3CSTRONG%3E4.4.3%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3ENinja%3A%20%3CSTRONG%3E1.10.1%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EZephyr%20SDK%3A%20%3CSTRONG%3E1.0.1%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3EMy%20workspace%20is%3A%3C%2FP%3E%3CPRE%3E~%2Fzephyr-training%2F%0A%E2%94%9C%E2%94%80%E2%94%80%20zephyr%2F%0A%E2%94%9C%E2%94%80%E2%94%80%20mcuboot%2F%0A%E2%94%9C%E2%94%80%E2%94%80%20my-zephyr-app%2F%0A%E2%94%94%E2%94%80%E2%94%80%20workspace%2F%3C%2FPRE%3E%3CH3%20id%3D%22toc-hId--1558858251%22%20id%3D%22toc-hId--1558836022%22%3EMCUboot%20source%3C%2FH3%3E%3CP%3EI%20cloned%20MCUboot%20separately%20under%3A%3C%2FP%3E%3CPRE%3E~%2Fzephyr-training%2Fmcuboot%2F%3C%2FPRE%3E%3CP%3EThe%20Zephyr-specific%20MCUboot%20application%20is%20located%20at%3A%3C%2FP%3E%3CPRE%3E~%2Fzephyr-training%2Fmcuboot%2Fboot%2Fzephyr%2F%3C%2FPRE%3E%3CP%3EI%20found%20the%20following%20relevant%20CMake%20files%3A%3C%2FP%3E%3CPRE%3Emcuboot%2Fboot%2Fzephyr%2FCMakeLists.txt%0Amcuboot%2Fboot%2Fzephyr%2Fsysbuild%2FCMakeLists.txt%0Amcuboot%2Fboot%2Fbootutil%2FCMakeLists.txt%0Amcuboot%2Fboot%2Fbootutil%2Fzephyr%2FCMakeLists.txt%3C%2FPRE%3E%3CH3%20id%3D%22toc-hId-928654582%22%20id%3D%22toc-hId-928676811%22%3EMCUboot%20build%20attempt%3C%2FH3%3E%3CP%3EI%20first%20tried%20to%20build%20the%20MCUboot%20Zephyr%20application%20using%3A%3C%2FP%3E%3CPRE%3Ecd%20~%2Fzephyr-training%0A%0Awest%20build%20%5C%0A%20%20-b%20frdm_mcxn236%20%5C%0A%20%20-s%20~%2Fzephyr-training%2Fmcuboot%2Fboot%2Fzephyr%20%5C%0A%20%20-d%20~%2Fzephyr-training%2Fbuild-mcuboot%3C%2FPRE%3E%3CP%3EThe%20intention%20here%20is%20to%20tell%20West%3A%3C%2FP%3E%3CUL%3E%3CLI%3E%3CP%3E-b%20frdm_mcxn236%20%E2%86%92%20build%20for%20the%20FRDM-MCXN236%20board%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E-s%20...%2Fmcuboot%2Fboot%2Fzephyr%20%E2%86%92%20use%20the%20Zephyr%20MCUboot%20application%20as%20the%20source%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E-d%20...%2Fbuild-mcuboot%20%E2%86%92%20keep%20the%20MCUboot%20build%20output%20separate%20from%20my%20normal%20Zephyr%20application%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3EHowever%2C%20the%20build%20did%20not%20reach%20the%20actual%20CMake%20compilation%20stage.%3C%2FP%3E%3CP%3EI%20received%20this%20error%3A%3C%2FP%3E%3CPRE%3ETraceback%20(most%20recent%20call%20last)%3A%0A%20%20File%20%22%2Fusr%2Flocal%2Fbin%2Fwest%22%2C%20line%208%2C%20in%20%3CMODULE%3E%0A%20%20%20%20sys.exit(main())%0A%20%20File%20%22%2Fusr%2Flocal%2Flib%2Fpython3.10%2Fdist-packages%2Fwest%2Fapp%2Fmain.py%22%2C%20line%201199%2C%20in%20main%0A%20%20%20%20app.run(argv%20or%20sys.argv%5B1%3A%5D)%0A%20%20File%20%22%2Fusr%2Flocal%2Flib%2Fpython3.10%2Fdist-packages%2Fwest%2Fapp%2Fmain.py%22%2C%20line%20278%2C%20in%20run%0A%20%20%20%20self.run_command(argv%2C%20early_args)%0A%20%20File%20%22%2Fusr%2Flocal%2Flib%2Fpython3.10%2Fdist-packages%2Fwest%2Fapp%2Fmain.py%22%2C%20line%20584%2C%20in%20run_command%0A%20%20%20%20self.run_extension(args.command%2C%20argv%2C%20self.topdir%2C%20manifest%3Dself.manifest%2C%0A%20%20File%20%22%2Fusr%2Flocal%2Flib%2Fpython3.10%2Fdist-packages%2Fwest%2Fapp%2Fmain.py%22%2C%20line%20739%2C%20in%20run_extension%0A%20%20%20%20self.cmd.run(args%2C%20unknown%2C%20self.topdir%2C%20manifest%3Dself.manifest%2C%0A%20%20File%20%22%2Fhome%2Fumesh%2Fzephyr-training%2Fzephyr%2Fscripts%2Fwest_commands%2Fbuild.py%22%2C%20line%20263%2C%20in%20do_run%0A%20%20%20%20self._sanity_check()%0A%20%20File%20%22%2Fhome%2Fumesh%2Fzephyr-training%2Fzephyr%2Fscripts%2Fwest_commands%2Fbuild.py%22%2C%20line%20589%2C%20in%20_sanity_check_source_dir%0A%20%20%20%20srcrel%20%3D%20pathlib.Path(self.source_dir).relative_to(%0ATypeError%3A%20PurePath.relative_to()%20got%20an%20unexpected%20keyword%20argument%20'walk_up'%3C%2FMODULE%3E%3C%2FPRE%3E%3CP%3EMy%20Python%20version%20is%3A%3C%2FP%3E%3CPRE%3Epython3%20--version%0APython%203.10.12%3C%2FPRE%3E%3CP%3Eand%3A%3C%2FP%3E%3CPRE%3Ewest%20--version%0AWest%20version%3A%20v1.5.0%0A%0Awhich%20python3%0A%2Fusr%2Fbin%2Fpython3%0A%0Awhich%20west%0A%2Fusr%2Flocal%2Fbin%2Fwest%3C%2FPRE%3E%3CP%3EIt%20appears%20that%20the%20current%20Zephyr%20west%20build%20code%20is%20using%3A%3C%2FP%3E%3CPRE%3EPath.relative_to(...%2C%20walk_up%3DTrue)%3C%2FPRE%3E%3CP%3Ewhich%20requires%20a%20newer%20Python%20version.%3C%2FP%3E%3CP%3EI%20also%20checked%3A%3C%2FP%3E%3CPRE%3Epython3.12%20--version%3C%2FPRE%3E%3CP%3Ebut%20Python%203.12%20is%20not%20currently%20installed.%3C%2FP%3E%3CP%3EI%20tried%20installing%20it%20directly%3A%3C%2FP%3E%3CPRE%3Esudo%20apt%20update%0Asudo%20apt%20install%20python3.12%20python3.12-venv%3C%2FPRE%3E%3CP%3Ebut%20Ubuntu%2022.04%20returned%3A%3C%2FP%3E%3CPRE%3EE%3A%20Unable%20to%20locate%20package%20python3.12%0AE%3A%20Couldn't%20find%20any%20package%20by%20glob%20'python3.12'%0AE%3A%20Unable%20to%20locate%20package%20python3.12-venv%0AE%3A%20Couldn't%20find%20any%20package%20by%20glob%20'python3.12-venv'%3C%2FPRE%3E%3CP%3ESo%20I%20am%20currently%20trying%20to%20resolve%20the%20Python%2FWest%20compatibility%20issue%20before%20continuing%20with%20the%20MCUboot%20build.%3C%2FP%3E%3CH3%20id%3D%22toc-hId--878799881%22%20id%3D%22toc-hId--878777652%22%3EWhat%20I%20would%20like%20to%20understand%3C%2FH3%3E%3CP%3EOnce%20I%20get%20MCUboot%20building%2C%20I%20would%20like%20to%20proceed%20step%20by%20step%20and%20understand%3A%3C%2FP%3E%3COL%3E%3CLI%3E%3CP%3EHow%20to%20build%20%3CSTRONG%3EMCUboot%20separately%3C%2FSTRONG%3E%20for%20FRDM-MCXN236.%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EHow%20the%20%3CSTRONG%3EFRDM-MCXN236%20Device%20Tree%3C%2FSTRONG%3E%20is%20selected%20and%20compiled.%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EWhether%20Device%20Tree%20can%20be%20built%2Finspected%20separately%20from%20the%20Zephyr%20application.%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EHow%20the%20%3CSTRONG%3EZephyr%20kernel%2Fapplication%3C%2FSTRONG%3E%20is%20built%20separately.%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EWhich%20of%20these%20are%20actual%20flashable%20binaries%20and%20which%20are%20build-time%20configuration.%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EWhether%20MCUboot%20can%20be%20flashed%20independently%20and%20then%20the%20Zephyr%20application%20flashed%20separately.%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EHow%20the%20MCUboot%20image%20layout%20and%20application%20image%2Fslots%20are%20defined.%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EHow%20to%20sign%20the%20Zephyr%20application%20so%20that%20MCUboot%20can%20boot%20it.%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EHow%20to%20observe%20and%20verify%20the%20MCUboot%20%E2%86%92%20Zephyr%20boot%20sequence%20on%20the%20board.%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EHow%20to%20customize%20the%20Zephyr%20kernel%2Fconfiguration%20using%20something%20similar%20to%20the%20Linux%20kernel%20menuconfig%20workflow.%3C%2FP%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%3EMy%20intention%20is%20not%20just%20to%20get%20the%20application%20running%2C%20but%20to%20understand%20the%20complete%20boot%20flow%3A%3C%2FP%3E%3CPRE%3EFRDM-MCXN236%0A%20%20%20%20%20%20%7C%0A%20%20%20%20%20%20v%0A%20%20%20MCUboot%0A%20%20%20%20%20%20%7C%0A%20%20%20%20%20%20v%0A%20Zephyr%20application%0A%20%20%20%20%20%20%7C%0A%20%20%20%20%20%20v%0A%20Zephyr%20kernel%20%2F%20drivers%0A%20%20%20%20%20%20%7C%0A%20%20%20%20%20%20v%0A%20Device%20Tree%20%2B%20Kconfig%20configuration%3C%2FPRE%3E%3CP%3EI%20believe%20doing%20this%20manually%20would%20help%20me%20better%20understand%20%3CSTRONG%3EMCU%2FSoC%20startup%2C%20bootloader%20operation%2C%20flash%20layout%2C%20Device%20Tree%2C%20Kconfig%2C%20linker%20scripts%2C%20and%20board%20bring-up%3C%2FSTRONG%3E.%3C%2FP%3E%3CP%3EAny%20guidance%20on%20the%20correct%20sequence%20for%20doing%20this%20on%20the%20FRDM-MCXN236%20would%20be%20appreciated.%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fc-pwmxy87654%2FMCUBOOT%2Fpd-p%2FMCUBOOT%22%20class%3D%22lia-product-mention%22%20data-product%3D%223152-1%22%20target%3D%22_blank%22%3EMCUBOOT%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fc-pwmxy87654%2FZEPHYR-OS-EDGE%2Fpd-p%2FZEPHYR-OS-EDGE%22%20class%3D%22lia-product-mention%22%20data-product%3D%222682-1%22%20target%3D%22_blank%22%3EZEPHYR-OS-EDGE%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F104386%22%20target%3D%22_blank%22%3E%40frdmuser%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E