有没有可能让gnu和gnu-arm编译器在同一系统上共存?
我首先在windows10上成功地运行了MinGW32来编译windows软件,然后我越来越觉得GNU系列软件很好用,那么为什么不使用GNU-ARM来编译stm32呢?但是我不能在vscode上用cmake成功编译stm32,
我遇到的第一个问题是系统变量,GNU和GNU-ARM都需要注册C,C++系统变量,下面是用GNU -ARM10编译stm32,但工作过程中显示给我的信息,vscode还在调用GNU 5.3,(GNU安装了5.3版本,GNU-ARM安装是比较新的)版本)
> Executing task: cmake -G 'MinGW Makefiles' L:\000_PROJECT\STM32\Project\vscode\dso138 <
-- The C compiler identification is GNU 5.3.0
-- The CXX compiler identification is GNU 5.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: E:/mingw32/bin/gcc.exe
-- Check for working C compiler: E:/mingw32/bin/gcc.exe - works
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: E:/mingw32/bin/c++.exe
-- Check for working CXX compiler: E:/mingw32/bin/c++.exe - works
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- MCU_FLAGS: -mcpu=cortex-m3 -mthumb
-- DBG_FLAGS: -g3 -gdwarf-2 -O0
-- Configuring done
-- Generating done
-- Build files have been written to: L:/000_PROJECT/STM32/Project/vscode/dso138/build虽然它看起来工作得很好,没有错误消息,但是没有编译bin或elf文件。
第二个问题是关于vscode中任务列表的参数。
//task.json
task:[
{
...
{
/************************************************************************************
* cmake
***********************************************************************************/
"label": "cmake",
"command": "cmake",
"type": "shell",
"args": [
"-G",
"MinGW Makefiles",
"${workspaceFolder}"
],
"group": {
"kind": "build",
"isDefault": true
},
"options": {
"cwd": "${workspaceFolder}/build",
},
"dependsOn": [
"build_dir"
]
},
{
/************************************************************************************
* make
***********************************************************************************/
"label": "make",
"group": "build",
"type": "shell",
"command": "make",
"options": {
"cwd": "${workspaceFolder}/build",
"executable": "E:/gcc_arm/bin/arm-none-eabi-nm.exe"
},
"args": [
"-j"
],
"dependsOn": [
"cmake",
"del_exe"
]
}
...
}我不确定,但问题可能是使用以下命令引起的:
cmake -G MinGW Makefiles第三个问题是关于make的命令:
"E:/gcc_arm/bin/arm-none-eabi-nm.exe",
不确定上述参数是否正确。
感谢您分享您的智慧和经验;
发布于 2021-07-09 18:23:56
我用了将近十年的GNU Arm嵌入式工具链并行与GNU系统专用的版本GNU的GCC,没有任何问题,但在GNU/Linux下用的是纯正的make。
我认为在Windows上的解决方案类似于Linux的情况。使用正确的路径到编译器并配置CMake (也许您可以在vscode下完成这项工作,或者尝试直接使用工具)。我找到了一个非常有用的启动触发器(除了文档之外):How to specify a compiler in CMake?
https://stackoverflow.com/questions/68290097
复制相似问题