I been using Visual Studio and VSCode for a long time; therefore, it will be great if I can use it instead of Eclipse or Keil. Should I move to those IDEs? I like having no dependencies where I have a make file that compiles and flashes my code to an stm32. Moreover, I can customize VSCode a lot. For example I have a plugin called highlight and I have a regex that will highlight everything that is between USER CODE BEGIN
and USER CODE END
. As a result my code looks like this:
Now I know that my code can only exist on the highlighted regions. That way if I make any changes using CubeMx my code will not be lost.
Thanks to this videos I am able to debug, compile and flash stm32 projects:
- Part 1: https://youtu.be/PxQw5_7yI8Q
- Part 2: https://youtu.be/PxQw5_7yI8Q
For some reason I had to create a
build
directory at the root of my project for my make file to run.
Anyways my question is how can I remove the squiggles on VSCode? It will be great if VSCode gave me no errors/warnings
For example I get a lot of squiggles on the SystemCLock_Config
function:
But that is strange because if I press F12 on the __HAL_PWR_VOLTAGESCALING_CONFIG
function it takes me to ...MyProject\Drivers\STM32L1xx_HAL_Driver\Inc\stm32l1xx_hal_pwr.h
and the definition is #define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) (MODIFY_REG(PWR->CR, PWR_CR_VOS, (__REGULATOR__)))
So for some reason F12 is able to find the definition but not the compiler. A solution would be to place this at the top of my main.c file:
#ifdefine _DEBUG
#define PWR 0
#endif
But it is tedious to do that for every squiggly error.
This question from stack-overflow has help me remove some errors but not all: uint32_t does not name a type - VSCode with STM32 in Windows.
Anyways from doing research from the internet this is how my c_cpp_properties.json file looks like:
{
"configurations": [
{
"name": "STM32 L1",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE",
"DUSE_HAL_DRIVER",
"DSTM32L152xE",
"STM32L1xx",
"__CC_ARM"
],
"intelliSenseMode": "gcc-arm",
"compilerPath": "${env:ARMGCC_DIR}/arm-none-eabi-gcc.exe",
"compilerArgs": [
"-mcpu=cortex-m3",
"-mthumb"
],
"cStandard": "c11",
"cppStandard": "c++17"
}
],
"version": 4
}
I am using this board: https://www.st.com/en/evaluation-tools/nucleo-l152re.html . I have also tried it with the bluepill and I get the same results.