Sorry for asking something that should be obvious, but I cannot figure it out.
First, here is what is working on my computer:
I am using Linux Mint 21.3. I have installed Zephyr according to https://docs.zephyrproject.org/latest/develop/getting_started/index.html and then installed VSCode and the MCUXpresso extension. I can import hello world project from the repository and step through it in the debugger. I imported the dumb_http_server sample to the ~/zephyrproject/applications/dumb_http_server directory and it works when it is serving the small plain-text example file.
But here is what does not work:
I created a Zephyr project in ~/zephyrproject/applications/test using the example-application recommended in the Zephyr documentation, but when I try to import it with "Import Project" in the MCUXpresso extension, I get the message "There are no projects in /home/fpeelo/zephyrproject/applications/test or they are already imported."
The sample project is basic but works. The command to create it is `git clone https://github.com/zephyrproject-rtos/example-application test` run in the ~/zephyrproject/applications directory. I modified app/prj.conf and app/src/main.c to make my own project; it compiles with `west build --force -p always -b frdm_mcxn947/mcxn947/cpu0 app/` and goes to the board with `west flash`; I cab see it output stuff to the serial port with `sudo picocom -b 115200 /dev/ttyACM0`. So there is a basic Zephyr project there. But MCUXpresso doesn't seem to believe that.
I mentioned importing the dumb_http_server sample, above, in ~/zephyrproject/applications/dumb_http_server. If I do the exact same Import Project for that directory, MCUXpresso recognises there is a project there.
So it seems to me that there must be some files or something related to dumb_http_server, that I don't have for my example-application project, that is needed to import a project into MCUXpresso.
But what exactly is it that I am missing?
Solved! Go to Solution.
Thanks for your reply Diego!
Firstly, as I mentioned, it was necessary to modify at least app/prj.conf and app/src/main.c to make a project that will compile.
Simplest option is to use what is in the "hello world" sample: for app/prj.conf use
# nothing here!
and for app/srsc/main.c use
#include <stdio.h>
int main(void)
{
printf("Hello World! %s\n", CONFIG_BOARD_TARGET);
return 0;
}
Next, before running the west build command, cd to the directory that you cloned. In your case, since you didn't specify a directory name, the directory is called example-application.
Then, specify the app directory as what is to be compiled.
So, if your board's name is mimxrt1010_evk, the command is:
west build --force -p always -b mimxrt1010_evk app
Secondly, thanks for the wiki hint! I missed the .vscode directory; should have looked for hidden files!
I tried working through the README you listed, this command
git clone https://github.com/wolfSSL/nxp-appcodehub.git ssh-rgb
got me a setup.sh which I think is the one referenced in
https://github.com/wolfSSL/nxp-appcodehub/blob/main/README.md
although there is no nxp-appcodehub directory.
(.venv) test@zephyr-vm:~/zephyrproject/applications/ssh-rgb$ ./setup.sh dm-wolfssl-tls-hello-server-with-zephyr
Created .vscode directory in dm-wolfssl-tls-hello-server-with-zephyr.
cmake-kits.json created.
cmake-variants.json created.
launch.json created.
mcuxpresso-tools.json created.
settings.json created.
As I mentioned, I was able to import a couple of the zephyr sample projects into VSCode -- "Import Example from Repository" works, it's "Import Project" that I have a problem with -- so I do have a couple of VSCode projects. So I was able to copy a .vscode directory with
launch.json mcuxpresso-tools.json settings.json tasks.json
But there was no sign of a cmake-kits.json or cmake-variants.json anywhere in my home directory so I added the files from your script.
Now the Import Project seems to be working!
Hi @fpeelo
Thank you for interest on our MCX N products!
I am limited to use Windows 10, running natively.
I followed the https://docs.zephyrproject.org/latest/develop/getting_started/index.html as well to install the zephyr project. Then I imported this repo to my VS code extension, everything where working well to import examples from the repo using the VS code, or importing again as files those examples. No complains from the tool.
Then I tried to import the https://github.com/zephyrproject-rtos/example-application and created applications folder at zephyrproject\applications. I used the:
git clone https://github.com/zephyrproject-rtos/example-application,
I obtained the below errors when running west build, yet I do not know yet how to solve them, so I could not reproduce the issue you are getting.
According to the MCUXpresso VS code wiki, those are the settings that VS code expect from a project.
We have an example project, that you could use to test and compared for missing files
https://github.com/wolfSSL/nxp-appcodehub/blob/main/dm-wolfssh-rgb-server-with-zephyr/README.md
You could try to diff check both examples, and try to follow your procedure (git clone into zephyrproject\applications) to test with a sample project we expect to work under our VS code.
I hope this could help you
Diego
Thanks for your reply Diego!
Firstly, as I mentioned, it was necessary to modify at least app/prj.conf and app/src/main.c to make a project that will compile.
Simplest option is to use what is in the "hello world" sample: for app/prj.conf use
# nothing here!
and for app/srsc/main.c use
#include <stdio.h>
int main(void)
{
printf("Hello World! %s\n", CONFIG_BOARD_TARGET);
return 0;
}
Next, before running the west build command, cd to the directory that you cloned. In your case, since you didn't specify a directory name, the directory is called example-application.
Then, specify the app directory as what is to be compiled.
So, if your board's name is mimxrt1010_evk, the command is:
west build --force -p always -b mimxrt1010_evk app
Secondly, thanks for the wiki hint! I missed the .vscode directory; should have looked for hidden files!
I tried working through the README you listed, this command
git clone https://github.com/wolfSSL/nxp-appcodehub.git ssh-rgb
got me a setup.sh which I think is the one referenced in
https://github.com/wolfSSL/nxp-appcodehub/blob/main/README.md
although there is no nxp-appcodehub directory.
(.venv) test@zephyr-vm:~/zephyrproject/applications/ssh-rgb$ ./setup.sh dm-wolfssl-tls-hello-server-with-zephyr
Created .vscode directory in dm-wolfssl-tls-hello-server-with-zephyr.
cmake-kits.json created.
cmake-variants.json created.
launch.json created.
mcuxpresso-tools.json created.
settings.json created.
As I mentioned, I was able to import a couple of the zephyr sample projects into VSCode -- "Import Example from Repository" works, it's "Import Project" that I have a problem with -- so I do have a couple of VSCode projects. So I was able to copy a .vscode directory with
launch.json mcuxpresso-tools.json settings.json tasks.json
But there was no sign of a cmake-kits.json or cmake-variants.json anywhere in my home directory so I added the files from your script.
Now the Import Project seems to be working!
Hi @fpeelo
I think this could be of use for other community users too, thanks a lot for sharing to this level of detail and for providing me the missing steps to setup the sample project. I am glad to know that you where able to solve the problem!
Diego