Looking for resources on importing/creating real world Zephyr projects

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

Looking for resources on importing/creating real world Zephyr projects

1,661 Views
armstrom
Contributor II

My team and I are starting on a long, multi-year development project based on the RT1170 family of processors and have chosen Zephyr as our RTOS based on the apparent "all-in" strategy from NXP on Zephyr while moving away from ThreadX/Azure.

We have followed all the tutorials and everything is fine with standard zephyr sample projects like hello world and blinky.. Now we have run into a wall. The reality is that no one releases hellow world or blinky... and no one targets the EVK boards. We have started on our own custom board definition and created a project that builds using the standard zephyr meta tool west. Now we're having a very hard time getting that project to import into the MCUXpresso in VSCode. The import tool appears to think the project is a standard CMake project rather than Zephyr.

Are there any resources available showing, from start to finish, how to build real project on a custom board? My initial search did not turn up anything.

Thanks!

-Matt

0 Kudos
Reply
3 Replies

1,621 Views
Harry_Zhang
NXP Employee
NXP Employee
0 Kudos
Reply

1,615 Views
armstrom
Contributor II
Sorry, but these are just an older version of the tutorials I have already followed. Did you read the initial post?

My team and I have already followed the tutorials for getting Hello World and Blinky working and properly deployed/debugged on our 1170EVK boards. We have a series of custom boards built with the RT1176 processor but are sufficiently different from the EVK configuration. We have created our own board files for these configurations. Similarly, we have created a handful of basic projects to target each of these boards and have them building in the command line using west. Here's the question that remains:

How can we import these projects into MCUXpresso for VSCode? They are not samples that ship with zephyr so the "import example from repository" command does not work. When trying to use the "import project" command they are recognized as generic CMake projects and not Zephyr projects.

Thanks!
-Matt
0 Kudos
Reply

1,566 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @armstrom 

Here are some steps and recommendations to help you achieve this:

1. Check CMakeLists.txt and Board Configuration

Your project’s CMakeLists.txt should properly reference Zephyr and your custom board configuration.

• Ensure that your CMakeLists.txt includes the necessary Zephyr initialization commands:

cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(your_project_name)

target_sources(app PRIVATE src/main.c)


• Your custom board files should be correctly placed in the boards/arm/your_custom_board/ directory within your Zephyr workspace.

2. Importing a Zephyr Project into MCUXpresso

Since your project is recognized as a generic CMake project rather than a Zephyr project, you may need to manually adjust the project settings in MCUXpresso:

• Import the Project Manually: Use the “Open Folder” feature in VSCode to open your project’s root directory. This should load the project in the workspace, but it might still be treated as a CMake project.
• Update Configuration Files: You may need to create or update configuration files like .vscode/settings.json to ensure that Zephyr is correctly identified:

{
 "cmake.configureArgs": [
   "-DBOARD=your_custom_board"
 ],
 "cmake.generator": "Ninja",
 "cmake.buildDirectory": "${workspaceFolder}/build",
 "cmake.toolchainFile": "$ENV{ZEPHYR_BASE}/cmake/toolchain/zephyr/arm/toolchain.cmake"
}

• This configuration tells VSCode (and MCUXpresso) to treat the project as a Zephyr project and provides the necessary build arguments.

3. Zephyr-Specific CMake Integration

If the project is still not recognized as a Zephyr project, you can try explicitly specifying Zephyr in your CMakeLists.txt:

• Add the following line at the beginning of your CMakeLists.txt:

set(ZEPHYR_TOOLCHAIN_VARIANT zephyr)
set(BOARD your_custom_board)


• Alternatively, set these as environment variables or in your VSCode configuration:

"cmake.configureSettings": {
 "ZEPHYR_TOOLCHAIN_VARIANT": "zephyr",
 "BOARD": "your_custom_board"
}

You can also refer to this link

Solved: Import a Zephyr project - NXP Community

BR

Hang

 

0 Kudos
Reply