PlatformIO in VS Code: generate a hex file for ESP32

Hello everyone.

I’m trying configure PlatformIO to compile a .hex file for my project but I’m getting this error and I can’t figure out how to solve it…

I already added this line to platformio.ini: extra_scripts = post:extra_script.py
The content of the scritp is as follows:

Import(“env”)

env.AddPostAction(
“$BUILD_DIR/${PROGNAME}.elf”,
env.VerboseAction(" ".join([
“$OBJCOPY”, “-O”, “ihex”, “-R”, “.eeprom”,
“$BUILD_DIR/${PROGNAME}.elf”, “$BUILD_DIR/${PROGNAME}.hex”
]), “Building $BUILD_DIR/${PROGNAME}.hex”)
)

Anyone can help me? Thanks

May I ask what is the reason for a hex file / what’s wrong about the bin file?

Afaik bin is more common in the Espressif world. At least I had never seen a hex file when working with ESP32’s.

Is your project builded without errors without extra script ?

This assumes like a xtensa-esp32-none-objcopy as $OBJCOPY, not esptool.py. You have to give esptool.py the proper commands for it to generate a hex, as their documentation says.

https://docs.espressif.com/projects/esptool/en/latest/esp32/esptool/basic-commands.html#hex-output-format

Hi all thank you for your reply.

Now i did some research and i try to export the bin because this is the mks robin nano and the file is Robin_nano35.bin

All ok but now i still learnin how to use stm32cubMX for mapping the pin (for this board) and if anyone have already the experience on that the help will be appreciate.

Thank you for your time and consideration