0
votes

I have a custom board that uses ATmega168PV, and I have a bin file that when I use Atmel Studio 6.0, I can program it to my board.

I have the source code for the binary (in the format of sketch), and I want to change/compile the code and program the board with them.

I can open my *.ino file in Arduino IDE and it is verifying it and says that

Binary sketch size: 12,096 bytes (of a 32,256 byte maximum)

but I searched the folder that files exist and I could not find any binary file.

How can I compile the code using Arduino IDE?

1
Could you provide us more information about which board are you using? Is an Arduino board?user1829200
Thanks for your reply. As I stated in my question, it is a custom board but the code for it is written in arduino sketch.mans

1 Answers

1
votes

Build process

Sketches are compiled by avr-gcc.

The include path includes the sketch's directory, the target directory (/hardware/core//) and the avr include directory (/hardware/tools/avr/avr/include/), as well as any library directories (in /hardware/libraries/) which contain a header file which is included by the main sketch file.

When you verify a sketch, it is built in a temporary directory in the system temp directory (e.g. /tmp on the Mac). When you upload it, it is built in the applet/ subdirectory of the sketch's directory (which you can access with the "Show Sketch Folder" item in the "Sketch" menu).

The .c and .cpp files of the target are compiled and output with .o extensions to this directory, as is the main sketch file and any other .c or .cpp files in the sketch and any .c or .cpp files in any libraries which are #included in the sketch.

These .o files are then linked together into a static library and the main sketch file is linked against this library. Only the parts of the library needed for your sketch are included in the final .hex file, reducing the size of most sketches.

The .hex file is the final output of the compilation which is then uploaded to the board. During a "Verify" the .hex file is written to /tmp (on Mac and Linux) or \Documents and Settings\\Local Settings\Temp (on Windows). During upload, it's written to the applet sub-directory of the sketch directory (which you can open with the "Show Sketch Folder" item in the Sketch menu).

Do a file search in your temp folder for *.cpp.hex