Skip to content

JigsawRenaissance/Ariadne-Bootloader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ariadne Bootloader for Arduino and WizNet W5100

Bootloader for Arduino with Ethernet

This is a beta stage bootloader for Arduino Ethernet board and the regular Arduino with Ethernet Shield. It is based on previous unfinished work by the Arduino developers. The bootloader implements a TFTP server on the Arduino board and flashing works using any regular TFTP client.

There are two ways to get this bootloader, both of them are really simple. You can either burn your Arduino with this new bootloader (using the guide below), or you can claim the Pioneer perk on codebender's IndieGoGo campaign and get an Arduino preloaded with our bootloader delivered straight to your door.

The Files and Folders in this Repository

The structure of this repository is made to follow the standarts of the Arduino IDE. This way you can simply copy the folders in your sketchbook and be ready

  • hardware: This is where the bootloader resides.
  • java-client: Demo client for the bootloader. Inherited by the initial project. Untested and probably non-functional
  • libraries: Helper libraries to support functions of the bootloader
  • utilities: Various stuff used for development and debugging

Downloading and Installing Files

First of all, you need to clone or download the repository. To clone the repository you need to have git installed, then you can run git clone https://github.com/codebendercc/Ariadne-Bootloader.git in a directory. This way you can later update your local repository by running git pull inside the Ariadne-Bootloader directory.

In case you want to avoid this hassle, you can use the ZIP button at the top of the page to download the latest snapshot of the repository in a zip archive and extract it.

After that you have to copy the hardware and libraries folders inside your sketchbook folder. Take extra care during coping not to overwrite any other files. Restart the Arduino IDE to load the new boards and libraries.

Burning the Bootloader

To burn the bootloader, you will need an AVR-ISP (in-system programmer), USBtinyISP or you can build a ParallelProgrammer or an ArduinoISP. The first three programmers should be connected to the ICSP pins (the 2 by 3 pin header) and make sure you plug it in the right way. The board must be powered by an external power supply or the USB port. In the case of ArduinoISP you should consult the above link for further instructions on how to build and use.

After you have connected the Arduino board and the programmer to your computer launch the Arduino IDE. Navigate to the Tools > Board menu and select Arduino Duemilanove/Uno(ATmega328) w/ Ariadne Bootloader if you have an Arduino Duemilanove or Uno with an Ethernet Shield or Arduino Ethernet w/ Ariadne Bootloader for Arduino Ethernet. Then go to Tools > Programmer and select the programmer you are using. In case you are using ArduinoISP, make sure that the selected port in the Tools > Serial Port menu refers to the ArduinoISP and not the board that you want to burn the bootloader on. Now, just launch the Tools > Burn Bootloader command and wait for about 15 seconds for the operation to complete.

Serial Flashing

Ariadne bootloader supports flashing through serial like any other regular bootloader. Using this way of uploading is built upon the very good Optiboot bootloader so it should be pretty straight forward to use. Just plug in the USB cable and select the serial port and the appropriate board from the Tools > Board menu. After that you must press the reset button and the indication LED on pin 13 or pin 9, in case of Arduino Ethernet, will start blinking rapidly. This means that the bootloader is running and the Arduino is ready to be programmed. If there is a valid program already flashed on the Arduino, you have to reprogram the device in the next 5 seconds. If you don't, the bootloader will initiate the program that is already in the Arduino. In case there is no program flashed or the program has been marked as invalid, the bootloader will never time out and you can reprogram it at any time.

After a succesful flashing,

  • Arduino Duemilanove will automatically start the user's application.
  • Arduino Uno will do a reset cycle and start the program after the bootloader times out.

This happens because Uno has the autoreset feature that resets the board after a serial connection.

Due to "autoreset" for remote tftp programming is being implemented using a watchddog timer timeout, the bootloader will do a full cycle after every reset, physical or software. For those who want Adaboot No-Wait Mod-like functionality, we have been testing some options on how to circumvent these limitations, but they still need refinement.

Configuring Network Settings

The default built-in network settings of the bootloader are listed below.

  • IP Address: 192.168.1.128
  • Subnet Mask: 255.255.255.0
  • Gateway: 192.168.1.1
  • MAC Address: 0xDE.0xAD.0xBE.0xEF.0xFE.0xED
  • TFTP Data Port: 46969

These can be changed using our NetEEPROM library. The library is going to have it's own documentation on how it can be used but for the purpose of changing and reading the network settings you can use the included examples. To load them navigate to File > Examples > NetEEPROM and select one of the examples. You can write the network settings using the WriteNetworkSettings sketch or print them to the serial using the ReadNetworkSettings.

Note that the settings array in the WriteNetworkSettings sketch hasn't got the settings in the usual order but rather in the order that W1500 reads them, so make sure you have put the correct values. If you set the network settings you also have to set the TFTP data transfer port. The default is good enough but you may need to change it for the reasons that are listed below in the Configuring your Router for Remote Flashing section.There is also documentation on how use these sketches in the form of comments so be sure to read them.

TFTP Flashing

Now for the real reason we made this bootloader and why you should use it. First of all you can watch Ariadne in action in this how-to video for remote flashing using TFTP here. In the video may notice that the board is being reset by hand. In the next couple of weeks we are going to release the library that will allow for remote resetting through a simple web server with some security measures. More on that as the library progresses.

Unlike serial flashing that uses HEX files to flash the Arduino, the TFTP server implemented in the bootloader works with binary files. This means that you have to manually convert your programs to the right format. To do that, first build your sketch inside Arduino IDE using the Verify button. After that, without exiting the Arduino IDE you need to navigate to the temporary directory where your project was built. That is C:\Users\owner\AppData\Local\Temp\ on Windows or /tmp on Linux. There you will find a folder named something like build2429295348207572157.tmp. That is where the Arduino temporary build files reside. Enter the directory and make sure that there is a .elf or a .hex file with the same name as your sketch. That is the file you need to convert. To achieve that you have to run one of the following commands in a terminal.

  • avr-objcopy -j .text -j .data -O binary [sketch].elf [sketch].bin
  • avr-objcopy -I ihex [sketch].hex -O binary [sketch].bin

Or,if you have scons installed, you can use the modified SConstruct script you can find in Ariadne-Bootloader/utilities. This being based on the arscons script, it can be used in two ways. If you used the previous process to generate the HEX file you can just copy the SConstruct file inside the temporary Arduino IDE build directory (as mentioned above) and run scons in a terminal inside that directory.

The other way to use it is to copy the SConstruct script inside the sketch's directory and, as above, run scons in a terminal inside that directiry. This way you will build your project outside Arduino IDE creating the .bin file in the process.

Configuring your Router for Remote Flashing

If you are having troubles flashing your Arduino at home from the road, you probably need to enable port forwarding. You need to forward ports 69 and 46969 to your Arduino in your router's configuration. In case you have changed the incoming data port from 46969 to another port i.e. 50232, you have to forward 50232 port instead of 46969. This is particularly useful when you have more than one Arduinos, that you want to flash, behind your router. In addition to this you are going to have to translate an external port of your choice on the router to the internal port and ip of the Arduino in the local network. An example is that you have 2 devices, one at 192.168.1.120 and one at 192.168.1.121. They both listen to port 69 for the initial connection. In this case you can translate external port 6969(any random port will do) on your router to 192.168.1.120:69 and external port 6970 to 192.168.1.121:69 and specify these in the tftp client you are using.

Port Forward has excellent guides on how to enable port forwarding for a vast number of routers.

Codebender

One of the best ways and easiest ways to use this bootloader is along with codebender.cc. Just register, enter your Arduino's IP (external IP for those in corporate or home networks behind NAT) and flash.

Supported Boards

Right now the ATmega328 processor and the WizNet W5100 ethernet controller are supported. That means that your Arduino Uno, Arduino Duemilanove, Arduino Ethernet or any Arduino compatible board using these chipsets can be burned with the Ariadne bootloader. If you have the know-how you can probably compile the bootloader for other processors but note that we haven't tested it. The following list will be updated over time.

  • Arduino Ethernet
  • Arduino Uno
  • Arduino Duemilanove w/ ATmega328

Roadmap

Right now the main focus for the first packaged release is bug fixing and improve existing functionality. That is why we encourage you to use the bootloader and report any bugs, misbehaviours or feature requests here on github. There is also on going work to work on the Arduino Mega and support for Arduino Leonardo is planned after that. Support for other ethernet or wifi controllers is being discussed but after the bootloader has been stabilized.

Acknoledgements

About

A little less unfinished TFTP bootloader for Arduino Ethernet or Arduino Uno with Ethernet Shield

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published