[STM32F4] 如何修改无头构建的选项?

[复制链接]
314|0
地瓜patch 发表于 2025-11-7 20:40 | 显示全部楼层 |阅读模式
我想启用 converthex 功能,在编译后输出 hex 文件。
我可以通过以下命令执行无头构建:
Linux 系统:
cd <my project path>
/opt/st/stm32cubeide_1.11.0/headless-build.sh -import . -cleanBuild <my project name>/Debug
Windows 系统:
C:\ST\STM32CubeIDE_1.11.0\STM32CubeIDE\headless-build.bat -import . -cleanBuild <project_name>/Debug
但我希望不修改项目本身就能生成 hex 文件。headless-build.sh 的文档说明如下:
Usage: /opt/st/stm32cubeide_1.11.0/stm32cubeide -data <workspace> -application org.eclipse.cdt.managedbuilder.core.headlessbuild [ OPTIONS ]
[...]
   -Ta        {toolid} {optionid=value} append to a tool option value in each configuration built
[...]
              Tool option values are parsed as a string, comma separated list of strings or a boolean based on the options type
工具选项值会根据选项类型,解析为字符串、逗号分隔的字符串列表或布尔值
如果我在 IDE 中手动勾选 “生成 hex 文件”(对应 converthex 功能),会在 .cproject 文件中添加以下行:
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.converthex.760051483" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.converthex" value="true" valueType="boolean"/>
我试了以下命令,但没有生成 hex 文件:
Linux 系统:
/opt/st/stm32cubeide_1.11.0/headless-build.sh -import . -cleanBuild <my project name>/Debug -Tp com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug com.st.stm32cube.ide.mcu.gnu.managedbuild.option.converthex=true
Windows 系统:
cC:\ST\STM32CubeIDE_1.11.0\STM32CubeIDE\headless-build.bat -import . -cleanBuild <project_name>/Debug -Ta com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.debug.2132964004 com.st.stm32cube.ide.mcu.gnu.managedbuild.option.converthex.371515941=true
或直接调用 stm32cubeidec.exe:
C:\ST\STM32CubeIDE_1.11.0\STM32CubeIDE\stm32cubeidec.exe --launcher.suppressErrors -nosplash <-data "workspace_path>" -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import . -cleanBuild<project_name>/Debug -Ta com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.debug.2132964004 com.st.stm32cube.ide.mcu.gnu.managedbuild.option.converthex.371515941=true
如何通过命令行启用 converthex 功能?


您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:出一块TI-PLABS-AMP-EVM

2056

主题

15589

帖子

31

粉丝
快速回复 在线客服 返回列表 返回顶部