Tutorial: PlatformIO in VSCode
Last updated
Last updated
You can install Python in Window by following the instruction here:
How to check if you already have Python
Open Window Command Prompt > Type python --version
If you see the version, then you already have python installed.
Refer to Installation-guide: VS CDOE
You may not need this step if you are going to use VS Code. But, install anyway.
Download python file of PlatformIO Core: 다른이름으로 링크저장: get-platformio.py
Download and save it as in py file
WIN OS: In command prompt
MAC OS
Open VS Code
Open VSCode Package Manager
Search for the official PlatformIO IDE in extension.
Install PlatformIO IDE
Go to PlatformIO Home by clicking on the PlatformIO Icon
Create New Project
Name the project as EC
or EC2024
Select Setting as follows
Board: ST Nucleo F411RE
Framework: CMSIS
Location: Your EC workspace
Open VSCode and select the EC workspace folder
eg.: \repos\EC\
Go to PlatformIO Home by clicking on the PlatformIO Icon
You can start your Tutorial or LAB by following the instructions given in the report.
For example, for LAB_GPIO_DIO_LED, we created the project folder and the main program file, under the workspace of ...\repos\EC\
as
Folder: \LAB\LAB_GPIO_DIO_LED\
Main src: LAB_GPIO_DIO_LED.c
For this tutorial, create the project folder and program file as
Folder: \tutorial\TU_CreateProject_VSC\
Main src 1: TU_CreateProject_Example1_main.c
Main src 2: TU_CreateProject_Example2_main.c
TU_CreateProject_Example1_main.c
TU_CreateProject_Example2_main.c
You can add your EC library header files under the directory of \include
You can add it under the directory of
\lib.
But you need to modify the include_dir folder inplatformio.ini
For every new TU or LAB, you can create a new environment that shares the MCU configuration. You do not need to re-configure the MCU setup everytime you create a new project. Simply, add a new environment that links your new program main file.
For this tutorial, we will learn how to add new environments for each TU_CreateProject_Example1_main.c
, and TU_CreateProject_Example2_main.c
.
Modify platformio.ini
in the workspace folder as
Click on Switch the environment
on VSCode
Select the Environment you want to build.
For this tutorial, first select [env:TU_CreateProject_Example1]
BUILD. If you have MCU connected, you can also UPLOAD
Now, Select the other Environment that uses your EC library [env:TU_CreateProject_Example2]
PlatformIO IDE Toolbar is located in VSCode Status Bar (left corner) and contains quick access buttons for the popular commands. Each button contains hint (delay mouse on it).
PlatformIO: Build
PlatformIO: Upload
PlatformIO: Clean
Project environment switcher (if more than one environment is available). See [Section env] of “platformio.ini” (Project Configuration File) .