Can anyone tell me how to convert .elf to .bin please

Can anyone tell me how to convert .elf to .bin please?

I’m on Mac OS X Catalina.

TIA

This depends on which platform (ststm32, espressif32, etc) you are working on. In many cases, PlatformIO already builds the .bin file in the .pio\buid\<environment> folder. What project are you compiling on which platform?

2 Likes

Sorry been away the last few days.

I’m trying to convert the firmware.elf file that compiled successfully to firmware.bin to flash my BigTreeTech SKR PRO 1.1.

What’s wrong with the .bin that is generated as part of the compile?

image

Anyway, some variant of objcopy -O binary elf-file.elf bin-file.bin should do it. For STM32, I think it’s located in ~/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/bin/ so it would be something like ~/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/bin/objcopy -O binary elf-file.elf bin-file.bin, preferablyfrom a platformio terminal just in case any compiler paths or the like are needed.

Ok - so this is what I get when I type in what you gave me which is the same as what this guy says to do in his video with the exception of typing “-S”. https://www.youtube.com/watch?v=cu_-X6EQJDo

Screen Shot 2020-05-13 at 3.35.41 AM

Check above… I updated the path after I initially posted it…

~/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/bin/objcopy

Otherwise, look in the ~/.platformio/packages/ directory and see what the correct toolchain-* folder is for MAC and see where that gets you.