Cannot run and debug C code in VS Code to my iMX6

Hello,

I have an Ixora board with imx6 dual SoM.
I am trying to run a hello world code on VS Code following this tutorial. I detect my device via network, have installed Docker with connection to WSL2, ran this command because I had other errors before docker run --rm -it --privileged torizon/binfmt. But nothing seems to work.
Every time I get the following thing:
image
This is the message that I get in my terminal:

Any suggestions what can be the problem and how it can be fixed?

Hi @Svetoslav ,

From your image I can see that your C/C++ project was created for ARM64 (aarch64) devices, but the Apalis iMX6 you’re using is ARM32, so the SoM is not compatible with your current project.

I suggest creating a new C/C++ project using our extension and choosing any arm32 option as the target platform during the initial setup. After that you can copy your source files to the new project.

See if this helps you.

Best regards,
Lucas Akira

Hello,

I changed the configuration to 32 and I got a bit further but then I get the following error:
image

My SSH works fine and I have no problem connecting.
Could it be a problem with the port that it is trying to reach or again is something in the configuration?

This is my json configuration which is suggested to open in the error message:

Hi @Svetoslav ,

it seems to be a very short launch.json file. Did you create this file by yourself?

By the way Toradex launched a new version of its extension called ApolloX.

The new extension helps you in creating the initial projects (for example for C++)

Maybe you want to give this a try.

Best Regards
Kevin

Hi @Svetoslav ,

I changed the configuration to 32 and I got a bit further but then I get the following error:

The error seems related to an architecture mismatch between the GDB server and client. Did you create a new C/C++ project, or did you add support for a new platform for your current project? If you did the latter you have to delete the old binary and object file (.o file) before trying to debug in a new architecture, as these files are probably still for ARM64 devices.

As @kevin.tx said, you can also try using ApolloX as an alternative.

Best regards,
Lucas Akira

Thank you for the response I will try this.
I did not create the file, I followed the getting started in this tutorial and haven’t added anything else to the code.

I deleted the old project and started a new one. But I don’t know if the problem might be caused because I named them the same name.
I will try again with ApolloX

I can’t use AppoloX because it doesn’t have support for Windows 64bit.
THe steps I follow for creating a project are:
Torizon/C C++: Create C/C++ application->Choosing empty folder->Makefile-based project->arm32v7-debian-no-ssh_bullseye->choosing a name ‘torizon’->debug.
I get the followng message when the project is initialized:
image
I don’t know why since it’s a new project.
This is the log I get on the output:

When I try to debug I choose the following option: C/C++: arm-linux-gnueabihf-gcc build and debug active file.
And again I get the same error.

Hi @Svetoslav ,

I can’t use AppoloX because it doesn’t have support for Windows 64bit.

On ApolloX VSCode should be connected to WSL, as otherwise you will get the ‘Windows 64bit not supported’ message. For more details you can check this post: An error occurred setting up the container - #8 by lucas_a.tx

See if you can proceed with ApolloX after doing the above.

Best regards,
Lucas Akira

Thank you for your help.
This method worked and I was able to run and debug code on my board.

1 Like

Glad I was able to help!

Best regards,
Lucas Akira