elmot / clion-embedded-arm

OpenOCD + STM32CubeMX support for CLion
https://blog.jetbrains.com/clion/2017/12/clion-for-embedded-development-part-ii
Other
170 stars 29 forks source link

Wrong objcopy executed. #133

Closed kbuc closed 5 years ago

kbuc commented 5 years ago

Expected Behavior

Building project should succeed.

Actual Behavior

Fails due to MinGW's objcopy being executed. Error says objcopy does not recognise elf file.

Steps to Reproduce the Problem

  1. don't put toolchain in path
  2. set full paths in CMakeLists.txt executables
  3. compile the project

Specification

Comments

Not sure if this is actually a bug or just my misconfiguration (due to toolchain not being in path), but my solution is to change CMakeLists.txt template from:

        COMMAND $${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:$${PROJECT_NAME}.elf> $${HEX_FILE}
        COMMAND $${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:$${PROJECT_NAME}.elf> $${BIN_FILE}

to

        COMMAND $${OBJCOPY} -Oihex $<TARGET_FILE:$${PROJECT_NAME}.elf> $${HEX_FILE}
        COMMAND $${OBJCOPY} -Obinary $<TARGET_FILE:$${PROJECT_NAME}.elf> $${BIN_FILE}

After that, a proper objcopy is called and building the project is successful.

elmot commented 5 years ago

Should be fixed when https://youtrack.jetbrains.com/issue/CPP-871 is done