Sidewalk: The IoT network from Amazon
08.05.2024
Elektronik | Funk | Software
Der Technik-Blog
If a program is uploaded to a microcontroller from the Arduino IDE, the program must first be compiled. The compiler converts the program written in C or C++ into a machine language. This produces either a hex file (.hex file) or a bin file (.bin file) depending on your hardware. This article is about exporting codes to a HEX or BIN file from the Arduino IDE.
The hex and bin file contains the finished program including all integrated libraries. An export of this file is therefore useful when:
It happens again and again that libraries are no longer updated by the developers. In contrast, the Arduino IDE and the compiler are updated from time to time. The consequence is that compilation problems can occur. It can also happen that the compilation process was successful and yet the program or a hardware no longer works due to an old library. This can be prevented with a program export, as the compiled exported program is independent of the Arduino IDE version or libraries. Changes to the code cannot be made after the compilation process. Also, the source code is no longer viewable after compiling. Attention: There are tools that allow to decompile an already compiled file again. In practice, however, this works only conditionally. In simple terms, this means that you can get a rough overview of a compiled program, but a direct decompile, change and recompile is not possible.
Meanwhile the program export with the Arduino IDE is very simple. Under [Sketch] -> [Export compiled Binary] the program will be compiled and a file will be created afterwards. For ESP projects a .BIN file is created, AVR projects are saved as .HEX file. The file is saved directly to the project folder parallel to the .ino file. The following screenshot shows the export function in the Arduino IDE:
For the ESP32 there is an own flash tool, which can upload the previously exported BIN file. This is especially advantageous if the program is given to other people and there is no need to install an Arduino IDE. The Software and the instructions are in this article:
With the Flash Download Tool you can load exported programs (.BIN file) to an ESP32/ESP8266 without Arduino IDE.
read moreBeside the upload to an ESP32/ESP8266 you can also export the finished program in the Arduino IDE to a file as BIN (HEX) and pass it on to others
read moreAEQ-WEB © 2015-2024 All Right Reserved