Wanting to give back to the ChibiOS community, I made a repository containing a development environment for ChibiOS in VS Code, all built into a container solution based on VS Code + extensions, devcontainer, and docker. The solution is designed to be easily replicable and consistent (as long as you know how Docker containers, VS Code, and devcontainer works).
Link: https://github.com/engemil/chibios_devcontainer
The repository is inspired by a handful of recommendations and comments made on this forum and other webpages related to ChibiOS. It's tested on both Windows 11 and Ubuntu 24.04 as host computers. I also added notes on how to utilize "usbipd" and "WSL 2" on Windows to pass the USB connection from a Windows host OS to a docker container running ubuntu/linux, including setup .bat scripts.
Alternative to ChibiStudio: VS Code Development Environment
- Giovanni
- Site Admin
- Posts: 14603
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1125 times
- Been thanked: 938 times
Re: Alternative to ChibiStudio: VS Code Development Environment
Hi,
How do you import projects? a small description would be useful, I know for sure other users are using VSCode and could be interested.
Giovanni
How do you import projects? a small description would be useful, I know for sure other users are using VSCode and could be interested.
Giovanni
Re: Alternative to ChibiStudio: VS Code Development Environment
Notes to help people get started
Comments:
- This setup is for chips that are compatible with openocd, gdb-multiarch, and gcc-arm-none-eabi.
- There is a setting file .vscode/settings.json that allows you to configure for different chips. If you need to develop for other chip types that requires other tools, I recommend to read up on it and customize all the files in .vscode and .devcontainer.
- I might look into other microcontrollers, not only STM32. Which could lead into me making a system that simplifies and automates the customization part of the development environment.
- Keep in mind there might be some compatibility limits with the extensions that are added in the devcontainer. Depending on your chip, framework, etc.
Here is a simple demo video (on Windows 11): https://youtu.be/KvjpBKam7nM?si=H3Vm8eTqAubbDR2_
HOW-TO Use
Prerequisites
- Install Docker (Recommend Docker Engine for Ubuntu): https://docs.docker.com/engine/install/ubuntu/
- Install VS Code (Recommend the .deb from here): https://code.visualstudio.com/Download
- (For Windows): Install usbipd and setup WSL. I added notes about this in the repo.
In VS Code go to Extensions and add
- devcontainer: https://marketplace.visualstudio.com/it ... containers
- Docker: https://marketplace.visualstudio.com/it ... ode-docker (Good combination with Docker engine, instead of Docker Desktop on Ubuntu/Linux)
Pull the repository: https://github.com/engemil/chibios_devcontainer
Open the folder in VS Code and start the container by clicking on "Reopen in a container". This will spin up the folder in a container, reproducing the defined development environment.
To import your project, you can just replace the content of the "project" folder with yours. Alternatively, you can make your own task(s) that does the work for you.
To adjust for your chip look into .vscode/settings.json. There are some manual work required.
Use the defined task(s) to get ChibiOS, Build, Clean, Rebuild, and flash (tasks are defined in .vscode/tasks.json).
NB! Getting access to USB devices from host computer tends to be a challenge for non-experienced users. Nonetheless, the container should have "privilege" to get access, and for Windows I added notes on how to get access with usbipd and WSL.
For debugging go to the Debug-page in VS Code and start one of the two prepared debug launches (debug launches are defined in .vscode/launch.json)
I'll keep an eye on this post, in case there are any struggles. Keep in mind, you should build understanding of Docker containers, devcontainer extension in VS Code, and VS Code config files (in .vscode).
Comments:
- This setup is for chips that are compatible with openocd, gdb-multiarch, and gcc-arm-none-eabi.
- There is a setting file .vscode/settings.json that allows you to configure for different chips. If you need to develop for other chip types that requires other tools, I recommend to read up on it and customize all the files in .vscode and .devcontainer.
- I might look into other microcontrollers, not only STM32. Which could lead into me making a system that simplifies and automates the customization part of the development environment.
- Keep in mind there might be some compatibility limits with the extensions that are added in the devcontainer. Depending on your chip, framework, etc.
Here is a simple demo video (on Windows 11): https://youtu.be/KvjpBKam7nM?si=H3Vm8eTqAubbDR2_
HOW-TO Use
Prerequisites
- Install Docker (Recommend Docker Engine for Ubuntu): https://docs.docker.com/engine/install/ubuntu/
- Install VS Code (Recommend the .deb from here): https://code.visualstudio.com/Download
- (For Windows): Install usbipd and setup WSL. I added notes about this in the repo.
In VS Code go to Extensions and add
- devcontainer: https://marketplace.visualstudio.com/it ... containers
- Docker: https://marketplace.visualstudio.com/it ... ode-docker (Good combination with Docker engine, instead of Docker Desktop on Ubuntu/Linux)
Pull the repository: https://github.com/engemil/chibios_devcontainer
Open the folder in VS Code and start the container by clicking on "Reopen in a container". This will spin up the folder in a container, reproducing the defined development environment.
To import your project, you can just replace the content of the "project" folder with yours. Alternatively, you can make your own task(s) that does the work for you.
To adjust for your chip look into .vscode/settings.json. There are some manual work required.
Use the defined task(s) to get ChibiOS, Build, Clean, Rebuild, and flash (tasks are defined in .vscode/tasks.json).
NB! Getting access to USB devices from host computer tends to be a challenge for non-experienced users. Nonetheless, the container should have "privilege" to get access, and for Windows I added notes on how to get access with usbipd and WSL.
For debugging go to the Debug-page in VS Code and start one of the two prepared debug launches (debug launches are defined in .vscode/launch.json)
I'll keep an eye on this post, in case there are any struggles. Keep in mind, you should build understanding of Docker containers, devcontainer extension in VS Code, and VS Code config files (in .vscode).
Who is online
Users browsing this forum: No registered users and 23 guests