Import a Zephyr project

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

Import a Zephyr project

Jump to solution
994 Views
nskartoredjo
Contributor II

I've created a Zephyr project similar in structure as in the example provided by Zephyr. I've been able to successfully import it on one of my machines using the MCUXpresso extension, however I wasn't able to do the same on another machine. If I attempt to import the project, it will provide me with the error message: Error: Selected file or folder is not a valid MCUXpresso project

My question is, how can I import the project on the other machine? Consequentially, I would like to know what the extension searches for to determine whether a project is a Zephyr project or not.

Below is an example of how I expect it to work:

image.png

And below her is how I don't expect it to work:

nskartoredjo_0-1698249086013.png

 

0 Kudos
Reply
1 Solution
958 Views
nskartoredjo
Contributor II

If you want your project to be recognised as a Zephyr project, you need at least the following files inside the .vscode directory:

  • cmake-kits.json
  • cmake-variants.json
  • mcuxpresso-tools.json
  • launch.json

For some operations, the extension expects one of these files to exists, and tries to change them according to the changes you make through the extension. If the file doesn't exist, it will complain. To generate those files, you can use the Import Example from Repository feature, and use the workspace application type. From the newly generated project, copy the .vscode directory to your own project.

The downside is that some fields inside these config files are personalised per machine. For example, the toolchainPath will be equal to something like X:/Users/your-name/zephyr-sdk-0.XX.X/arm-zephyr-eabiLuckily, these fields only need to exist to a certain extend. If you use the import project feature, the extension will automatically append these fields with proper values; just state them with empty ones:

Inside cmake-kits.json

  • "ZEPHYR_BASE": ""
  • "ZEPHYR_SDK_INSTALL_DIR": ""

Inside mcuxpresso-tools.json

  • "toolchainPath": ""
  • "toolchainVersion": ""
  • "sdk.path": ""

I've added an blank .vscode directory setup in the attachments. Note that the settings.json file states that the cmake source directory can be found at ${workspaceFolder}/app; feel free to change it if this is not the case for your project.

View solution in original post

0 Kudos
Reply
2 Replies
986 Views
nskartoredjo
Contributor II

To reply on myself, it turns out that you need the mcuxpresso-tools.json file inside the .vscode directory; I'll keep this post up to date to see what all is required inside it to make it work

0 Kudos
Reply
959 Views
nskartoredjo
Contributor II

If you want your project to be recognised as a Zephyr project, you need at least the following files inside the .vscode directory:

  • cmake-kits.json
  • cmake-variants.json
  • mcuxpresso-tools.json
  • launch.json

For some operations, the extension expects one of these files to exists, and tries to change them according to the changes you make through the extension. If the file doesn't exist, it will complain. To generate those files, you can use the Import Example from Repository feature, and use the workspace application type. From the newly generated project, copy the .vscode directory to your own project.

The downside is that some fields inside these config files are personalised per machine. For example, the toolchainPath will be equal to something like X:/Users/your-name/zephyr-sdk-0.XX.X/arm-zephyr-eabiLuckily, these fields only need to exist to a certain extend. If you use the import project feature, the extension will automatically append these fields with proper values; just state them with empty ones:

Inside cmake-kits.json

  • "ZEPHYR_BASE": ""
  • "ZEPHYR_SDK_INSTALL_DIR": ""

Inside mcuxpresso-tools.json

  • "toolchainPath": ""
  • "toolchainVersion": ""
  • "sdk.path": ""

I've added an blank .vscode directory setup in the attachments. Note that the settings.json file states that the cmake source directory can be found at ${workspaceFolder}/app; feel free to change it if this is not the case for your project.

0 Kudos
Reply