codebndr / ariadne-bootloader Goto Github PK
View Code? Open in Web Editor NEWThis project forked from arduino/tftp-bootloader
A little less unfinished TFTP bootloader for Arduino Ethernet or Arduino with Ethernet Shield
Home Page: codebender.cc
This project forked from arduino/tftp-bootloader
A little less unfinished TFTP bootloader for Arduino Ethernet or Arduino with Ethernet Shield
Home Page: codebender.cc
Since the network settings are being store in the EEPROM, it might be useful to have support for direct EEPROM access to avoid using a sketch. It might be less time consuming and more straight forward
Hi,
I couldn`t help but notice the bootloader is not protected by a WDT. I have a device on the field that from time to time hangs, and as I can see from logs writen on a SD card It does in the bootloader section. (it shows a "reboot" string on the log and then no "Power ON" string which is the very first thing it does on app start).
Ive changed the bootloader code to include proper wdt protection, but I
m unable to compile it... It may sound like a noob error, but it fails on the memcpy_PF... I`ve seen previous ppl having this error but no solution to it.
I do compile on windows, using the WinAVR toolchain.
Where should I change on the makefile so I can compile it? Tried everywhere and still got this error.
Note that I would gladly post the wdt fix once I`ve tested.
Hi, I know this is not a forum for support but I really need help.
I would like the bootloader to reset every time a TFTP put operation is performed. That is, every time I want to upload a new code would not need to use an http request to reprogram it, causing the upload to be "automatic".
Not sure, but in this case it would be necessary to use only wdt.reset () and NetEEPROM.writeImgBad()?
Which part of the code should I take a look?
Thanks.
Hello!
Ariadne works fine for bin-files from various Arduino-IDE-Versions.
If I try to upload a file from PlatformIO (http://platformio.org) Ariadne respond back an error (received opcode=800 sent WRQ <file=firmware.bin, mode=octet>).
Debug output:
Main: Ariadne for Arduino Uno, Version 0.5
Net: Built-in settings
Net: .Address: 0xC0.0xA8.0x01.0x80
Net: . Subnet: 0xFF.0xFF.0xFF.0x00
Net: .Gateway: 0xC0.0xA8.0x01.0xFE
Net: . MAC: 0xDE.0xAD.0xBE.0xEF.0xFE.0xED
Net: Network init done
Tftp: Init socket to port 0x0045
Tftp: TFTP server init done
Tftp: .DataPort: 0xB779
Tftp: Processing packet of size 0x001D
Tftp: Set up return address
Tftp: This is block 0x6669 with opcode 0x0002 and data length 0x0011
Tftp: Write request
Tftp: Init socket to port 0xB779
Tftp: Changed to port 0xB779
Tftp: Sent ACK
Tftp: Response sent
Tftp: Processing packet of size 0x020C
Tftp: Set up return address
Tftp: This is block 0x0001 with opcode 0x0003 and data length 0x0200
Tftp: Data block
Tftp: Writing data from address 0x000000
Tftp: Packet length adjusted to 0x0200
Tftp: Response sent
Tftp: Processing packet of size 0x8800
Tftp: Overflow
Tftp: Set up return address
Tftp: This is block 0xC19C with opcode 0x0A0B and data length 0xFE1D
Tftp: Invalid opcode 0x0000
Tftp: Init socket to port 0xB779
Tftp: Response sent
Tftp: Processing packet of size 0x020C
Tftp: Set up return address
Tftp: This is block 0x0001 with opcode 0x0003 and data length 0x0200
Tftp: Data block
Tftp: Writing data from address 0x000000
Tftp: Packet length adjusted to 0x0200
Tftp: Response sent
Tftp: Processing packet of size 0x8800
Tftp: Overflow
Tftp: Set up return address
Tftp: This is block 0xC19C with opcode 0x0A0B and data length 0xFE1D
Tftp: Invalid opcode 0x0000
Tftp: Init socket to port 0xB779
Tftp: Response sent
Tftp: Processing packet of size 0x020C
Tftp: Set up return address
Tftp: This is block 0x0001 with opcode 0x0003 and data length 0x0200
Tftp: Data block
Tftp: Writing data from address 0x000000
Tftp: Packet length adjusted to 0x0200
Tftp: Response sent
Tftp: Processing packet of size 0x8800
Tftp: Overflow
Robert
Since most ethernet shields have an SD card socket this might would be useful to have.
I am just leaving it here to see how many people are interested in having this feature integrated to
Ariadne.
It has been done before so, probably, i will be using the existing solution if it fits nicely with the rest of the code.
Hi Guys,
I try to recompile the bootloader for the mega2560 because I want to adapt it for a mega2561 and a w5500. But as you can see below I get an error.
The standard libs from the arduino package do not have the memcpy_PF in pgmspace.h.
the culprit is in tftp.c:
memcpy_PF(txBuffer, PROGMEM_OFFSET + (uint32_t)(uint16_t)tftp_unknown_error_packet, packetLength);
memcpy_P(txBuffer, tftp_unknown_error_packet, packetLength);
I already tried Arduino 1.05 and arduino 1.55, so I was wondering how did you compile the 2560 bootloaders?
cheers,
John
../../../../tools/avr/bin/avr-gcc -g -Wall -Wextra -Wstrict-prototypes -Os -fno-
inline-small-functions -fno-split-wide-types -mno-interrupts -mrelax -funsigned-
char -funsigned-bitfields -fpack-struct -fshort-enums -fno-jump-tables -std=gnu9
9 -mmcu=atmega2560 -DF_CPU=16000000L '-DDEBUG_MAIN=1' '-DDEBUG_NET=1' '-DDEBUG
_TFTP=1' '-DDEBUG_VALD=1' '-DBAUD_RATE=115200' -Wl,--section-start=.text=0x3e000
-Wl,--relax -Wl,--gc-sections -o ariadne_debug2560.elf main.o spi.o w5100.o tft
p.o validate.o debug.o watchdog.o serial.o util.o announce.o optiboot.o stk500bo
ot.o
tftp.o: In function tftpPoll': C:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\ariadne/tftp.c:4 79: undefined reference to
memcpy_PF'
tftp.o: In function sendResponse': C:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\ariadne/tftp.c:3 56: undefined reference to
memcpy_PF'
C:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\ariadne/tftp.c:3
58: undefined reference to `memcpy_PF'
make: *** [ariadne_debug2560.elf] Error 1
rm watchdog.o w5100.o tftp.o optiboot.o spi.o stk500boot.o serial.o validate.o a
nnounce.o debug.o main.o util.o
Due to the fuses set in boards.txt, the EEPROM is erased when Ariadne is flashed onto the ATMega, not sure if this is intended functionality, but I made it a point to move EEPROM data "out of the way" of the Ariadne settings locations in the EEPROM only to find out it was erased anyways. Patch below maintains existing fuse settings but adds the "don't erase EEPROM" fuse flag
/hardware/ariadne/boards.txt
@@ -7,7 +7,7 @@
ariadne328.upload.speed=115200
ariadne328.bootloader.low_fuses=0xFF
-ariadne328.bootloader.high_fuses=0xD8
+ariadne328.bootloader.high_fuses=0xD0
ariadne328.bootloader.extended_fuses=0x05
ariadne328.bootloader.path=ariadne
ariadne328.bootloader.file=ariadne_atmega328.hex
@@ -28,7 +28,7 @@
ariadne328eth.upload.speed=115200
ariadne328eth.bootloader.low_fuses=0xFF
-ariadne328eth.bootloader.high_fuses=0xD8
+ariadne328eth.bootloader.high_fuses=0xD0
ariadne328eth.bootloader.extended_fuses=0x05
ariadne328eth.bootloader.path=ariadne
ariadne328eth.bootloader.file=ariadne_atmega328_ethernet.hex
I was able to burn the bootloader to mega using usbisp/usbasp programmer using avrdude command.
avrdude -c usbasp -p m2560 -P usb -b 115200 -e -u -U lock:w:0x3F:m -U efuse:w:0xFD:m -U hfuse:w:0xD8:m -U efuse:w:0xFF:m
avrdude -c usbasp -p m2560 -P usb -b 115200 -V -U flash:w:ariadne_atmega2560.hex
avrdude -c usbasp -p m2560 -P usb -b 115200 -U lock:w:0x0F:m
Questions:
How do I change the location/address in eeprom where network info is stored. Most programs will store data starting at address 0, I think it will be better if the bootloader stores at the end of the eeprom.
I am running a webserver in my arduino program. I just need to add a uri that will make my code execute these lines of code to reboot the arduino right? Then I start tftp program to upload the new firmware?
#include <avr/wdt.h>
....
wdt_disable();
wdt_enable(WDTO_2S);
while(1);
thanks for sharing the program.
Hello, so I am able to burn the bootloader and upload the "ReadNetworkSettings" sketch using Serial USB Comm.
I am also able to ping the default IP when the Arduino is powered and connected (192.168.1.128)
Then I tried to upload the sample "blink" ( utilities\tests\blink\atmega328_blink9.bin ) by resetting the Arduino Board (LED13 now blinks quickly), then type "tftp -i 192.168.1.128 PUT atmega328_blink9.bin" (I already cd'd to the folder). After some times, it says "Connect request failed".
Previously, after uploading the sample "ReadNetworkSetting", the Arduino will be able to run the sketch after about 10 seconds after reset (the upload period).
But if I did attempt to TFTP the sketch (atmega328_blink9.bin), my Arduino is now not able to load the previous sketch and will keep blinking quickly (even after resetting, and waiting for 10 seconds). The previously uploaded sketch is now gone, but I am still able to upload sketches via serial. What should I do?.. (Windows 10 64bit, Arduino 1.6.7)
Anyone have a version for Mega2560 with ethernet bootloader working?
Can we get support for ENC28J60 ethernet chip? This project is a very cool way to push sketches. How can we use it on 28j60 instead of W5100?
Hello everyone,
I have often successfully used this wonderful software with Arduino UNO, Mega and the Ethernet Shield. Everything was great as far.
Unfortunately, I get the things with a W5100 Minibourd not go. (Here for example: https://www.amazon.com/XCSOURCE-Ethernet-Network-Arduino-TE230/dp/B01149ETWA or http://www.ebay.de/itm/New-Mini-W5100-LAN-Ethernet-Shield-Network-Module-board-Fuer-Arduino-DE-TE230-/261950470314 ) The normal Ethernet examples (web server, etc.) with the default bootloader work perfectly.
Ariadne can be installed without problems, ping 192.168.1.128 works. If I then, however, wants to change the network settings, or by TFPT something wants to upload does not work that way. While the LED is still blinking as tert expect, unfortunately, a ping 192.168.1.128 or to the new address is not working.
What am I doing wrong?
Greetings from Germany
Funny Paul
removed.
i get a error from the arduino when im flashing using the tftp client take a look at this.
this is the output fom the serial port.
ˆC¡*¥¹é Ariadne for Arduino Uno, Version 0.5
Net: EEPROM settings
Net: Address: 0xC0.0xA8.0x01.0x78
Net: Subnet: 0xFF.0xFF.0xFF.0x00
Net: Gateway: 0xC0.0xA8.0x01.0x01
Net: MAC: 0x12.0x34.0x56.0x78.0x9A.0xBC
Net: Network init done
Tftp: Init socket to port 0x0045
Tftp: TFTP server init done
Tftp: DataPort: 0xB779
Tftp: Processing packet of size 0x001E
Tftp: Set up return address
Tftp: This is block 0x426C with opcode 0x0002 and data length 0x0012
Tftp: Write request
Tftp: Init socket to port 0xB779
Tftp: Changed to port 0xB779
Tftp: Sent ACK
Tftp: Response sent
Tftp: Init socket to port 0x0045
Tftp: TFTP server init done
Tftp: DataPort: 0xB779
Tftp: Processing packet of size 0x001E
Tftp: Set up return address
Tftp: This is block 0x426C with opcode 0x0002 and data length 0x0012
Tftp: Write request
Tftp: Init socket to port 0xB779
Tftp: Changed to port 0xB779
Tftp: Sent ACK
Tftp: Response sent
Tftp: Init socket to port 0x0045
Tftp: TFTP server init done
Tftp: DataPort: 0xB779
Tftp: Processing packet of size 0x001F
Tftp: Set up return address
Tftp: This is block 0x0000 with opcode 0x0005 and data length 0x0013
Tftp: Error
Tftp: Response sent
Tftp: Processing packet of size 0x8613
Tftp: Overflow
Tftp: Set up return address
Tftp: This is block 0x979A with opcode 0x6D2C and data length 0xBCD4
Tftp: Invalid opcode 0x0000
Tftp: Init socket to port 0xB779
Tftp: Response sent
Tftp: Init socket to port 0x0045
Tftp: TFTP server init done
Tftp: DataPort: 0xB779
any ideas?
@MarekLew wrote:
Library TFTP wrong use registers REG_S3_RX_RD0, REG_S3_TX_WR0, REG_S3_RX_RSR0.
Trying to modify AriadneBootloader for W5200 and ATmega2560 with progaram> 64KB noticed that the transmission every time it stops at 55KB for the 2K buffer soket.
Analyzed the library and documentation W5100 and W5200.
REG_S3_TX_WR0 is NO PHYSICAL ADDRESS for the third soket and can not be freely modified. Is the number of bytes processed the program. A REG_S3_RX_RSR0 tells you how many bytes have to be read in the buffer.
In a few days try shared corrected code. For now, I have to very modified system and W5200. In the meantime, put 'suggested amendments.
Today I have only smartphone.
When soket is initialized:
spiWriteWord (REG_S3_RX_RD0, 0);
You can not move REG_S3_RX_RD0 of S3_RX_START:
-- If (readPointer == 0) readPointer = S3_RX_START;
or move back
-- If (readPointer == S3_RX_END) readPointer = S3_RX_START;
repleace with like this
++ if ((--packetSize) == 0)break;//end of package
or better
-- for(count = TFTP_PACKET_MAX_SIZE; count--;) {
++ for(count = packetSize; count--;) {
to read the bytes from the physical address, use the mask and shift:
-- SpiWriteWord (REG_S3_RX_RD0, readPointer);
++ SpiWriteWord (REG_S3_RX_RD0, S3_RX_START + (readPointer & 0x7ff));
0x7ff - mask for 2k
And of course analogous not to REG_S3_TX_WR0:
-- writePointer = spiReadWord (REG_S3_TX_WR0 - S3_TX_START);
++ writePointer = spiReadWord (REG_S3_TX_RD0);
-- If (writePointer == S3_TX_END) writePointer = S3_TX_START;
-- SpiWriteWord (REG_S3_TX_WR0, writePointer - S3_TX_START);
++ SpiWriteWord (REG_S3_TX_WR0, S3_TX_START + (writePointer & 0x7ff));
And now at last
uint16_t PacketSize = spiReadWord (REG_S3_RX_RSR0);
contains useful information how much data is left in the buffer.
You can probably remove.
while ((spiReadReg (REG_S3_IR) & IR_RECV)) {
spiWriteReg (REG_S3_IR, IR_RECV);
/ / FIXME: is this right after all? smaller delay but
/ / Still a delay and it still breaks occasionally
delayms (TFTP_PACKET_DELAY);
}
Besides, I've used yet PacketSize I used to check whether the data came in full.
I not use this for W5100 only W5200 and 4K socket.
Sorry for my English, I used a translator.
I am using a XBoard v2 from Dfrobot - and when using a direct ethernet connection from my laptop (static IP address 192.168.3.57) to the Xboard (at 192.168.3.51) upgrades fine - but through a dumb D-Link switch or a TP-Link router - Doesn't work at all..will not start uploading. I am using Tftpd64 to upload. Very strange. Any thoughts why through a dumb switch I would have problems?
Hi thanks for reading this, I know its been a while since a release, but this bootloader is so useful to me I hope its not just left in a sunset phase now.
I'm trying to use ariadne with its ethernet reset server alongside my sketch for some home automation equipment (saves massively and avoids laptops up ladders to update my controllers in odd locations). One of the tasks that does is send out a http POST to a remote home-assistant automation server with a JSON formatted string so it can keep the master house gui in sync with all the nodes.
When I enable reset.check in the main loop, the following code stops working
if (jsonclient.connect(Configuration.extJsonServer, Configuration.extJsonServerPort)) {
// Make a HTTP JSON request:
mylocalJsonData = (F("POST /api/states/switch."));
Serial.print (F("inner loop json data is "));Serial.print (String(mylocalJsonData)+ "\n");
} else { Serial.print ("Error :- "+String(jsonclient)+ "\n");}
In the serial log I see this
" Error :- 0"
Error code zero indicating failed connection of course. And it also doesn't send the packets out the interface at all on tcpdump output.
My sketch has 2 other ethernet services which function fine, (udp for ntp client, and ethernet server listening on port 80 http use in my sketch which uses GET requests) so it seems its just the outbound POST from my arduino ethernet tcp as a client affected.
If I comment out reset.check(); in the main loop, the json POST starts working. It has to be a POST to authenticate to the remote server in the JSON headers.
I read a post from a few years ago from Stelios Tsampas where he was discussing how to work around a similar sounding issue, is it documented somewhere and this issue now solved?
http://developers.arduino.narkive.com/m4JMgDNs/remotely-resetting-an-arduino
As a workaround, I already have a authenticated section in my configuration web gui, can I call a reset method from that instead of running a whole daemon on a higher port with a check in the main loop just for the reset? I already have a function that calls the following to do a soft reset after updating network config in eeprom, I could just expand that out if so.
asm volatile (" jmp 0");
I have burned Ariadne Aootloader to an arduino mega2560 using another arduino mega 2560 as an ISP, using Nick Gammon's Atmega_Board_Programmer. I followed Nick's instructions, to convert the .hex bootloader files on disk for use with his sketch. Everything reports a successful burn, and I can upload sketches via serial no problem (blink, fade etc).
However successful this sounds, I cannot upload via TFTP :
TFTP still fails. What have I missed?
suddenly my username doesnt seem so clever :(
Hi all,
i think this ist not a real issue, and should be solved in short time.
I am normaly using the Mega2560-Board without any Bootloader. but in one project i need the possibility to do a sketch-update via Ethernet.
So the Ariadne-Bootloader was a perfect solution!
It is running perfect!
But, when there is connected a PC to "Serial" it hangs, when both (PC and Arduino) starting at the same time. i think the pc is sending some trash, and the bootloader is thinking "hey cool, i have to receive a sketch"...
Disconnecting the PC from Serial is solving this problem. but i need this connection for controlling/debugging.
I don't need the serial-update feature. is it possible to disable it, or to get a version of this bootloader without serial functions?
Thanks a lot in advance.
cu
Hagen
I want to help you to create Ethernet Bootloader for Arduino Mega 2560.
Can you send me the source codes?
Open issues have been moved over to https://github.com/LoathingKernel/Ariadne-Bootloader/issues
Any new issues created here will be closed.
I have created a working implementation of installation of Ariadne to the Arduino IDE via Boards Manager. The URL is:
https://per1234.github.io/Ariadne-Bootloader/package_codebendercc_ariadne-bootloader_index.json
This can be added to Arduino IDE 1.6.4 in File > Preferences > Additional Boards Manager URLs. Then Ariadne Bootloader will appear as one of the options for installation under Tools > Board > Boards Manager...
I would like to create a pull request to add this capability to Ariadne but first I need the installation file to be available. The most common way of doing this seems to be a Github release. My installation file is here:
https://github.com/per1234/Ariadne-Bootloader/releases/download/v1.0.0/ariadne.zip
You can download mine to use or create your own. If you create your own notice that the folder structure has to be changed slightly.
For examples of how others have set this up see:
https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls
Thanks, Per
Ariadne Bootloader has been working well for me using a Arduino Ethernet Clone but the one item I have not been able to figure out (I'm just learning C++) is how to set/read the MAC address using the pointer variable.
ip = NetEEPROM.readIP();
gateway = NetEEPROM.readGW();
subnet = NetEEPROM.readSN();
All work fine but I can't figure out the MAC syntax/format.
Such as:
mac[] = NetEEPROM.readMAC();
Does NOT work correctly.
Sorry for this newbee question.
I'm getting endless reset after watchdog resets arduino (in the sketch I set it to 8sec as sketch is too big and it gets hangups time to time), and it does not stop even if I press reset button, only if I reflash the sketch. Is thwere any solution for that?
When I performed a network reset, without loading a new schetch, the watchdog timmer remains enabled at 2s. and the arduino is not booting again (the bootloader waits 5s. for a schetch to upload, but it does't disable watchdog timmer)
I solved this using wdt_enable(WDTO_8S) instead of wdt_enable(WDTO_2S) inside library
I hope you can fix this inside bootloader
I apologize for what is probably a simple question, but I downloaded the latest set of ariadne libraries. I can read and write network settings and upload sketches via the cloud (from codebender). I cannot, however, seem to get the "ResetServer" example from the EthernetReset library to work.
It will not verify. It initially shows the error
In file included from ResetServer.ino:34:
C:\Program Files (x86)\arduino-1.0.3\libraries\NetEEPROM/NetEEPROM.h:36: error: expected class-name before '{' token
I have poked around and made a few changes. Eventually I got it to compile but I never got it to work. The server at port 80 works fine, but I can't seem to reset or reprogram.
Thanks for any help!
Hello,
I try program this Ariadne-Bootloader to Arduino Mega2560 by ASIX PRESTO Programmer (I have only this programmer).
When I open hex file, there are some alert about Little or Big Endian:
Please help me with settings fuses. Is somewhere specify fuses for ariadne-bootloader?
I try default fuses with SPI prog. enabled, but it is not function ...
Many thanks,
Jan
EEPROM.put and get requests does not work with newEEPROM library, can anyone fix it? or suggest the way forward...
I had been successfully remote flashing my arduino ethernet via the "cloud flash" capability of codebender.
At some point, I was no longer able to load sketches; roughly 49 out of 50 times it would simply fail with the "Cloud Flash failed" message. I also noticed that the transmit LED on the board appeared to be lighting up much less frequently than I remembered.
After some fiddling, I removed the 4GB SD card and suddenly things started working again. I can replicate this behavior consistently: card in = fail, card out = success.
Thanks for any help!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.