PlatformIO Community

Where to find a .bin file

Hi, I need to find/ generate a .bin or .hex file from the current project. Where can i find/generate that file?
Im using platformIO in Visual Studio Code on a Mac.

See .pio\ folder within your project?

2 Likes

I see that folder, but no .hex or .bin file

Tell me what files you see in that folder.

These 17

So can you show me what’s in this hifive1 folder?

13

Well the .elf file is the already linked binary, you should be able to use it with flasher software like openocd etc.

If you want a hex file then you can go to your <user home folder>/.platformio/platforms/sifive/builder/main.py and replace this line by

target_buildprog = env.Alias("buildprog", target_hex, target_hex)

after recompilng there is a firmware.elf and firmware.hex file.

Alternatively you can invoke the objcopy yourself in a shell in the directory where the firmware.elf is.

<home folder>/.platformio/packages/toolchain-riscv/bin/riscv64-unknown-elf-objcopy -O ihex firmware.elf firmware.hex

(can also be used with -O binary)

However I agree that it would be usefull to build this by default. You can open an issue at the repository for it.

2 Likes