Chibios projecct compilation in VScode

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess

ashishmac
Posts: 2
Joined: Thu Jan 25, 2024 8:32 am

Chibios projecct compilation in VScode

Postby ashishmac » Thu Jan 25, 2024 8:50 am

Hi all,

Currently, I am working on one project based on freertos and stm32 hal, but now i decided to switch that project to chibios RT/hal.

I have used Chibi Studio for a basic understanding of how to compile and create board files,s, etc.

now I want to use chibios in the VS code environment.

can anyone help me to set up a toolchain for this?

thanks in advance

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Chibios projecct compilation in VScode

Postby Giovanni » Thu Jan 25, 2024 10:25 am

Hi,

It has been done but I don't know details,you could join the discord server and ask there to Vitaly.

https://discord.gg/s8b8v7VtrM

Anyway, ChibiOS is based on makefiles, I assume VSCode can import makefile projects like Eclipse does.

Giovanni

User avatar
tfAteba
Posts: 547
Joined: Fri Oct 16, 2015 11:03 pm
Location: Strasbourg, France
Has thanked: 91 times
Been thanked: 48 times

Re: Chibios projecct compilation in VScode

Postby tfAteba » Thu Jan 25, 2024 10:55 am

Hi all,

Mainly if your project if base on makefile, there will be no problem to compile it, just by running the make command in a terminal.
You will need to install some pluging (C, C++, cortext debug) this will help you to view some ARM registers.

But to debug you will need to create a vscode configuration file (launch.json), in this file you will have to specify all mandatories information for debug (openocd/stlink, svd file for STM23 registers, configuration file, target file etc...)

Here is an example of a file that i used last year.

Code: Select all

   
   {
     "version": "0.2.0",
     "configurations": [
       {
         "name": "Cortex debug",
         "cwd": "${workspaceRoot}",
         "executable": "./build/x237.elf",
         "request": "launch",
         "type": "cortex-debug",
         "servertype": "openocd",
         "device": "STM32L452RE",
         "svdFile": "/opt/st/stm32cubeide_1.9.0/plugins/com.st.stm32cube.ide.mcu.productdb.debug_2.0.200.202201061234/resources/cmsis/STMicroelectronics_CMSIS_SVD/STM32L4x2.svd",
         "configFiles": [
           "interface/stlink.cfg",
           "target/stm32l4x.cfg"
         ]
       },
       {
         "name": "C/C++: arm-none-eabi-gcc build and debug active file",
         "type": "cppdbg",
         "request": "launch",
         "program": "${fileDirname}/${fileBasenameNoExtension}",
         "args": [],
         "stopAtEntry": false,
         "cwd": "${fileDirname}",
         "environment": [],
         "externalConsole": false,
         "MIMode": "gdb",
         "setupCommands": [
           {
             "description": "Enable pretty-printing for gdb",
             "text": "-enable-pretty-printing",
             "ignoreFailures": true,
           },
           {
             "description": "Set Disassembly Flavor to Intel",
             "text": "-gdb-set disassembly-flavor intel",
             "ignoreFailures": true
           }
         ],
         "preLaunchTask": "C/C++: arm-none-eabi-gcc build active file",
         "miDebuggerPath": "/usr/bin/gdb"
       }
     ]
   }
   


I hope it will help you!
regards,

Theo.

ashishmac
Posts: 2
Joined: Thu Jan 25, 2024 8:32 am

Re: Chibios projecct compilation in VScode

Postby ashishmac » Fri Jan 26, 2024 1:44 pm

Thank you for your prompt reply.

I understand that the project is based on Makefile, and I can compile the code in VS Code as well.

However, my challenge lies in not knowing how to set the environment variables in VS Code. In Chibistudio, we typically run a BAT file to set all the necessary variables before opening Eclipse.

emmayashri
Posts: 3
Joined: Tue Apr 09, 2024 7:11 am
Location: India

Re: Chibios projecct compilation in VScode

Postby emmayashri » Tue Apr 09, 2024 7:26 am

Hey hi, install the ARM toolchain then ChibiOS repository in your project directory. Configure ChibiOS files and VS Code settings for ARM development.


Return to “General Support”

Who is online

Users browsing this forum: emmayashri and 2 guests