Build application in release mode with vs code

Hello,
We’re still working with Torizon OS Easy Pairing 7.2.0 and Verdin iMX8M Mini DualLite 1GB.

We’ve successfully buit and debugged the Gpio cpp example with Visual Studio Code.
We’re now trying to build the application in release mode and run it on the target…
How do I build it for the arm64 target?
We’re assuming we need to run it in the pre-compiled container with libgpiod installed, provided by Toradex ? right ?
Thanks for your help.

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello! Great to hear that you’ve successfully built and debugged your GPIO C++ example on Torizon OS with your Verdin iMX8M Mini.

For building your application in release mode for the arm64 (aarch64) architecture, you do not need to use the pre-compiled container provided by Toradex. Instead, you should perform a release build of your project using Visual Studio Code and the Torizon IDE Extension, which will create a container image optimized for your application.

Here are the steps to build and deploy your application for release:

  1. Update Your Dependencies
    Ensure your project’s torizonPackages.json includes the required GPIO libraries:

    {
        "deps": [
           "libgpiod2"
        ],
        "devDeps": [
           "libgpiod-dev"
        ]
    }
    
  2. Modify docker-compose.yml for Device Access
    Make sure your docker-compose.yml includes access to the GPIO device:

    devices:
      - "/dev/gpiochip0"
    
  3. Build your Release Image
    In Visual Studio Code:

    • Open the Command Palette (Ctrl + Shift + P)
    • Type and select Torizon: Build Container Image (Release)
    • Select the release configuration (usually Release)
    • The Torizon IDE Extension will automatically build the container image for the arm64 target using cross-compilation.
  4. Deploy the Release Image
    After the build completes, you can deploy and run the image on your target device using either the “Torizon: Deploy and Debug” for a release build or by running the container manually as described in the documentation.

The resulting container image will include only the runtime dependencies (like libgpiod2), making it optimized for deployment.

More detailed documentation and a sample release configuration can be found here:

Let me know if you need details on any specific step.

Best regards,
Toradex AI Assistant.

Hi @slou26 !

On top of ToradexAI’s answer, this is a good reference when moving into production: Build, Test and Push Applications for Production | Toradex Developer Center

This bit is incorrect, though. As pointed out in the documentation (the link I shared above), you need to use the task run-container-torizon-release-<arch>.

Let us know if this helps you :slight_smile:

Best regards,

Ok thanks … It works from visual studio code …
And is there a way to run it directly from the target ?
Regards,

Hi @slou26 !

I am not sure if I correctly understood the question :sweat_smile:

The task run-container-torizon-release-<arch> will launch your application on the module if you make == your module’s architecture. In your case, since you are on Verdin iMX8M Mini, you can use the task run-container-torizon-release-arm64 for this.

Let me know if you meant something else :slight_smile:

Best regards,

Sorry…
In fact, I would like to launch the application without going through Visual Studio Code but directly through an SSH session?

Hi @slou26 !

Understood!

Since on Torizon OS your application is containerized, you can use docker command to start it.

You can use:

  • docker run and pass all the arguments via CLI, or
  • docker compose and leverage from the docker-compose.yml that you have already for your Torizon IDE project.

Let us know if you need further clarification :slight_smile:

Best regards,