Hi Team, do you know why I am not able to export the hex file in my Arduino ide
It generates bin file. So that i cant able to upload that bin file directly to proteus, proteus only accept the hex file. please give the instruction to export hex file in Arduino IDE 2.3.2 (i try to exchange bin file to hex file in Linux terminal but its file size gets more than needed size)
Hi @mahizhya_eswaran. The developer of each Arduino boards platform has the freedom to configure whichever binary file format they think appropriate for Arduino IDE to produce when the user performs an "Export Compiled Binary" operation while a board of their platform is selected.
Arduino IDE doesn't have any control whatsoever over the format so, short of modifying the platform, there is no way for you to cause Arduino IDE to produce a different format.
It might be that the compilation process is producing a .hex
file. If so, you only need to determine where it is stored. You can find that information from the Arduino IDE verbose compilation output. I'll provide instructions you can follow to obtain that:
- Open your sketch in Arduino IDE.
- Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open. - Check the box next to "Show verbose output during: ☐ compile" in the "Preferences" dialog.
- Click the "OK" button.
The "Preferences" dialog will close. - Select the target board from the Arduino IDE Tools > Board menu.
- Select Sketch > Verify/Compile from the Arduino IDE menus.
- Wait for the compilation to finish.
Now examine the contents of the black "Output" panel at the bottom of the Arduino IDE window. You may need to scroll the panel up to see the relevant information. There you will see the path of the temporary build folder where the compilation artifacts were stored.
For example, when I compile for a Nano 33 IoT board, I see this line in the output:
"C:\\Users\\per\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-objcopy" -O ihex -R .eeprom "C:\\Users\\per\\AppData\\Local\\Temp\\arduino\\sketches\\30E053B914A26778A9CB2DF2CC034975/sketch_jun27a.ino.elf" "C:\\Users\\per\\AppData\\Local\\Temp\\arduino\\sketches\\30E053B914A26778A9CB2DF2CC034975/sketch_jun27a.ino.hex"
So I can see that it saved a .hex
file at the following location on my hard drive:
"C:\Users\per\AppData\Local\Temp\arduino\sketches\30E053B914A26778A9CB2DF2CC034975\sketch_jun27a.ino.hex"
Yes sir, I tried all the things you mentioned above, but the problem is that when I choose the Arduino UNO board, it generates a .hex file. However, when I choose the NodeMCU 1.0 (ESP-12E Module), it does not generate a .hex file; it generates a .bin file instead.
Does it matter what it generates?
The upload tool in the board package (probably, can't check now) expects a bin file.
Why do you need a hex file and not a bin file.
Because the developers of that board's "Arduino AVR Boards" platform configured it to do that.
Because the developers of that board's "esp32" platform configured it to do that.
what did you expected? .BIN and .HEX the same size?
Sir, I need to upload the HEX file code into Proteus for simulation. The device data is sent to the cloud through the HTTP protocol using NodeMCU. However, I am encountering an error in Proteus 8 Professional: 'File extension '.bin' not recognized in PROGRAM property.'
Yes, I understand that point. Is there any way to change the HEX file extension? Proteus only recognizes the .hex file. If not, I will use an Arduino UNO board as a communicator. able to generate the HEX file and upload it into Proteus
'Program file is too big for the microcontroller' error pops up in Proteus when I upload the converted HEX file. I changed the file extension from .bin to .hex in the Linux terminal. The HEX file becomes much larger than the BIN file, which is why I used that word
e
I don't have any experience with Proteus, but I assume it allows you to configure which microcontroller you are simulating. Did you configure it for the ESP32 microcontroller, or do you still have it configured for the ATmega328P microcontroller of the UNO R3 board?
just rename should not convert bin to hex, use linux converter utility or online
Converting to .hex will not do the job. Your problem is that the ESP32 board package simply generates a far bigger code because there is e.g. far more to initialise in the processor than in an AVR based processor.
Another thing might be that an ESP32 is probably less efficient than an AVR based processor; e.g. an AVR based processor is able to set a pin high or low in one instruction and an ESP32 might only be able to do that in two or three or ... instructions.
The difference between .hex and .bin is that .hex contains a human readable text representation of the binary data. If you convert your binary file to hex, the file size will be twice as big; each nibble in a byte will be represented by one character. And if you export in the IDE, the hex file is written in the Intel hex format which adds some additional information.