Uploading binary code to Arduino

Hello,

I would like to know if it is possible (and how?) to upload our code to Arduino in binary format instead of the source code?

This is to prevent illegal use and re-distribution of our proprietary libraries.

I know the whole purpose of Arduino is open source, but some parts of our code come from other implementations and we still would like to protect those parts.

I look forward to hearing from you.

Thanks.

Uploading raw binary files (hex) to Arduinos can be done through the command prompt. The actual commands depend on the Arduino board you are using.

What board and OS are you using?

From your post I gather that you want to distribute the hex files and have the end users upload it to their boards. Is that correct?

I would like to know if it is possible (and how?) to upload our code to Arduino in binary format instead of the source code?

You never upload source to an Arduino, always compiled code.

1 Like

berthfield: Uploading raw binary files (hex) to Arduinos can be done through the command prompt. The actual commands depend on the Arduino board you are using.

What board and OS are you using?

From your post I gather that you want to distribute the hex files and have the end users upload it to their boards. Is that correct?

Hello, Thanks for your reply. I have Arduino Uno. And yes, you are right regarding the hex files. End users are customers, partners, internal deployment team ... etc.

What is the command name, so I'd check its help and try it out?

Thanks.

AWOL: You never upload source to an Arduino, always compiled code.

I know, I meant uploading the binary so we don't have to give the code to someone else to compile it and upload it to Arduino!

Okay the command to use to upload the compiles hex file would be:

 avrdude -c stk500v1 -P [com port] -p atmega328p -U flash:w:[Filename.hex]:i

Where [com port] and [Filename.hex] would be replaced with your com port and the name of your .hex file respectively. You can also get an explanation of the various switched that can be used with Avrdude by entering the command without switches on any computer with the IDE installed.

There is also a utility called xloader that should automate the process for you but I have not tried that so use at your own risk.

berthfield: Okay the command to use to upload the compiles hex file would be:

 avrdude -c stk500v1 -P [com port] -p atmega328p -U flash:w:[Filename.hex]:i

Where [com port] and [Filename.hex] would be replaced with your com port and the name of your .hex file respectively. You can also get an explanation of the various switched that can be used with Avrdude by entering the command without switches on any computer with the IDE installed.

There is also a utility called xloader that should automate the process for you but I have not tried that so use at your own risk.

Thanks!

I can see another advantage of this.

You have a web page for registered users. On this page there is a form showing the various safe parameters that can be changed.

The user enters the parameters and they are checked.. and if valid the server created a HEX file for that user. This can be downloaded to the user's browser and a preinstalled 'updater' will load the HEX on to the Arduino.

All very clean :)

berthfield: Okay the command to use to upload the compiles hex file would be:

 avrdude -c stk500v1 -P [com port] -p atmega328p -U flash:w:[Filename.hex]:i

Where [com port] and [Filename.hex] would be replaced with your com port and the name of your .hex file respectively. You can also get an explanation of the various switched that can be used with Avrdude by entering the command without switches on any computer with the IDE installed.

There is also a utility called xloader that should automate the process for you but I have not tried that so use at your own risk.

Hi, I had a similar challenge and than ks for your help, but i got error "AVR Part "ESP8266" not found " and gave me a list of boards supported. I couldn't find any ESP8266 boards.

The avrdude works just for AVR parts and the ESP8266 isn’t AVR.

Budvar10: The avrdude works just for AVR parts and the ESP8266 isn't AVR.

So which SW does Arduino IDE rely on upon uploading firmware to ESP8266? Can it be used manually from command line?

Yes, turn on verbose upload in settings and it will show you exactly what it's doing

I am Working of a LiFi project and I want to know can we somehow transmit .bin extension file using arduino . If yes then how. If not, then whats the solution for this.

https://nodemcu.readthedocs.io/en/master/flash/

With verbose on you will see the bootloader line. It is the last line shown before the uploading starts.

bootloader_qio_80m.bin 0x10000 /tmp/arduino_build_685499/SimpleWiFiServer.ino.bin 0x8000 /tmp/arduino_build_685499/SimpleWiFiServer.ino.partitions.bin

My question is... as I understand it code goes to 0x10000 and the partition table goes to 0x8000. If I just have the bin where does the partition information come from that matches the program bin?