2024-02-29 10:51 PM - edited 2024-02-29 11:17 PM
Dear @Khouloud ZEMMELI , @Imen.D ,
I am building IOC file with help of a make release file which I execute under bash.
The (default) STM32CubeIDE project has Debug as the Active configuration and also has the "-O ihex" enabled under the MCU Post build outputs settings.
I want to also pass the "Convert to Intel HEx file (-O ihex)" setting as input to STM32CubeIDE when I execute below under bash
C:/ST/STM32CubeIDE_1.14.1/STM32CubeIDE/stm32cubeidec.exe -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -cleanBuild ${BLD_TYPE} -importAll ./ -data ${TMPDIR} > BuildResult.Log
Please suggest how this shall be achieved.
I assume the number / id / optionid 1613718931 will differ for different projects,
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.converthex.1613718931" name="Convert to Intel Hex file (-O ihex)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.converthex" useByScannerDiscovery="false" value="true" valueType="boolean"/>
I am unaware what to use with -T option
Invalid Arguments: [-cleanBuild, all, -importAll, ./, -T, 1613718931=true]
Error: Index 6 out of bounds for length 6
Please suggest a solution that if possible is independent of the optionid number
More info added:
If above is not possible how do I execute below, without having to bother about the location of arm-none-eabi-objcopy executable
arm-none-eabi-objcopy -O ihex $(EXECUTABLES) "Project_HEX_File.hex"
Thanks!
Rajeev
Solved! Go to Solution.
2024-03-06 08:39 PM - edited 2024-03-06 08:40 PM
Hi @Pavel A.
I've created a bash script that helps me find paths and execute required executables from bash itself.
#!/bin/bash
source "$(dirname $0)/test.config"
declare -i Index=1
for s in $(MSYS_NO_PATHCONV=1 reg.exe query HKLM\\software\\STMicroelectronics\\STM32CubeIDE /s /v Path /reg:32)
do
((Index++))
if [ ${Index} -ne 6 ]; then
continue
else
STM232CUBE_IDE_PATH=${s}
fi
done
if [ -n "${STM232CUBE_IDE_PATH}" ]; then
_CIDE_INST_PATH=$(cygpath -u ${STM232CUBE_IDE_PATH})/STM32CubeIDE
if [ -f "${_CIDE_INST_PATH}/stm32cubeide.exe" ]; then
echo EXE exists
RS=$(grep ^"\-Declipse.buildId=Version " ${_CIDE_INST_PATH}/stm32cubeide.ini)
echo STM32CubeIDE ${RS#\-Declipse.buildId=}
PATH_ELF_TO_HEX=$(find "${_CIDE_INST_PATH}/plugins" -type d -iname "com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32*")/tools/bin
${PATH_ELF_TO_HEX}/arm-none-eabi-objcopy --help
fi
fi
2024-03-01 01:09 AM
Hello @RajeevAroraCrcEvans ,
Try this link that may help you on your issue.
Please, keep us informed about your progress on this issue and feel free to share feedback with us.
2024-03-01 03:52 AM
Hello @Imen.D
The bash is unaware of the path to arm-none-eabi-objcopy
Also the path to the executable is pretty long.
With STM32CubeMX and STM32CubeIDE newer versions being released, I will also have to change below to something more generic, or otherwise rely on the tool installer (from ST) to remove previous path from PATH variable and add the latest path of the tool to it:
C:/ST/STM32CubeIDE_1.14.1/STM32CubeIDE
Please share your views.
Thanks,
Rajeev
2024-03-01 05:56 PM - edited 2024-03-01 06:21 PM
@RajeevAroraCrcEvans The option "Convert to Intel Hex file" is already set in your CubeIDE projects, so when your projects build, the hex files should be created.
If you want to run objcopy separately, you'll have to figure out location of the cross tools from the location of CubeIDE.exe. This is tedious but not rocket science.
The options for Eclipse CDT headless build are documented here.
Attached: script to find installed CubeIDE and toolchains for Windows.
2024-03-02 06:28 PM
Dear @Pavel A. ,
Thanks for sharing the script! I will go through it.
Currently after I generate a project from IOC file:
1. by default the Debug configuration gets used when I build the code through STM32CubeIDE. In order to use the Release configuration, I need to manually select it. (I am not aware of whether there is some difference between the two besides the code size options -O0 verses -O3. After setting optimization to none for both Debug and Release (for testing) I find the generated elf information is alike.)
2. I have to manually open the project settings and enable option -O ihex for the project. I wanted to avoid this step as my teammates will use the .cproject / ,project with default settings and makerelease file to generate the hex file.
Regards,
Rajeev
2024-03-02 06:40 PM - edited 2024-03-02 07:22 PM
2024-03-03 02:43 AM
Hi @RajeevAroraCrcEvans The path is in 32-bit part of the registry: HKLM\Software\WOW6432NODE\STMicroelectronics . Reg.exe looks there automatically.
2024-03-06 08:39 PM - edited 2024-03-06 08:40 PM
Hi @Pavel A.
I've created a bash script that helps me find paths and execute required executables from bash itself.
#!/bin/bash
source "$(dirname $0)/test.config"
declare -i Index=1
for s in $(MSYS_NO_PATHCONV=1 reg.exe query HKLM\\software\\STMicroelectronics\\STM32CubeIDE /s /v Path /reg:32)
do
((Index++))
if [ ${Index} -ne 6 ]; then
continue
else
STM232CUBE_IDE_PATH=${s}
fi
done
if [ -n "${STM232CUBE_IDE_PATH}" ]; then
_CIDE_INST_PATH=$(cygpath -u ${STM232CUBE_IDE_PATH})/STM32CubeIDE
if [ -f "${_CIDE_INST_PATH}/stm32cubeide.exe" ]; then
echo EXE exists
RS=$(grep ^"\-Declipse.buildId=Version " ${_CIDE_INST_PATH}/stm32cubeide.ini)
echo STM32CubeIDE ${RS#\-Declipse.buildId=}
PATH_ELF_TO_HEX=$(find "${_CIDE_INST_PATH}/plugins" -type d -iname "com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32*")/tools/bin
${PATH_ELF_TO_HEX}/arm-none-eabi-objcopy --help
fi
fi