Chibios projecct compilation in VScode

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

Moderators: RoccoMarco, lbednarz, tfAteba

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

Chibios projecct compilation in VScode

Post by ashishmac »

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: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Chibios projecct compilation in VScode

Post by Giovanni »

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: 551
Joined: Fri Oct 16, 2015 11:03 pm
Has thanked: 91 times
Been thanked: 50 times

Re: Chibios projecct compilation in VScode

Post by tfAteba »

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!
ashishmac
Posts: 2
Joined: Thu Jan 25, 2024 8:32 am

Re: Chibios projecct compilation in VScode

Post by ashishmac »

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: 6
Joined: Tue Apr 09, 2024 7:11 am

Re: Chibios projecct compilation in VScode

Post by emmayashri »

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