Flashing a sketch from SD card using 2boot bootloader

OK, you are added. WE can probably take this offline to github, unless they are general ideas you feel others would be interested.
I created the v.1 branch which nobody should touch (putback to master)
Later today I'll draft some groundrules. Basically if you are confident with your change, you can put it back directly. If you want a review, it is best to fork the repository, and then do a pull request.

Also, if you have "application specific features" that aren't of general use, you should probably just put those in your own fork. You can have as many as you want.

Hi to everyone, interesting thread.

I've a lot of problems to let it working.
I'm using an arduino ethernet board
4gb Microsd sdhc, partitioned to only 2gb fat16 formatted.

I've dowload the code from here :https://github.com/osbock/avr_boot/downloads

I've compiled and flash fw into my board making only little modifications at the file provided then i've put a app.bin sketch file named in the root of sdcard.
Nothing happen, after reset, app.bin fw not loaded, i can see only the board led (in my board connected to pin9) always on.

Any suggestion?
Thanks in advance.

Did you set the chipselect?
It's been a while since I tried this and some folks have made some changes. I'll try to look and see if I can see anything obvious. Unfortunately I don't have an arduino ethernet to test

No i've not set any chipselect.

For what Board that fw is ready TO go?
It's possibile that problem come from sdhc card?
Thanks again tor your time.

By default it's set up for Arduino Ethernet (someone else tested it, though I emulated it with a specially wired sd holder)
I think your problem might be that it is looking for the program name in eeprom. It is supposed to default to app.bin, but I'm not sure that's tested.

You are trying to load a binary file right? this firmware doesn't read hex files.
This was a feature that someone wanted, but I think I'm going to revert back to a fixed filename. Your program could always rename another program to app.bin .

Sure i try TO upload a bin file, not an hex .

I thought that this bootloader does not read filename from eprom but it is already made fixed to app.bin.
I need to see deep the code...

Little update:

i've let it working flashing directly this hex file for bootloader : http://baldwisdom.com/data/ArduinoEthernetSDBoot.hex

In wich is different from the code on github?

Thanks again osbock.

Hi, I am very interested in this project and I would like to get involved. In addition make it compatible with the 2560. Can someone tell me where it currently stands what the latest builds are etc?

I am using a 2560v running at 8Mhz so the whole board is running at 3.3v so I have no level shifter. The SD card is connected directly to the SPI lines.

My board is one of these with an W5200 Ethernet module attached. (Same way as the W5100)

Over a year ago there was interest in a very small SD read program as the base for a boot loader. I wrote the attached program which may be useful.

It is FAT16 only for standard (2GB or less) SD cards.

I estimate the size is about 1200 bytes.

It has two functions

bool fileOpen(uint8_t* dirName);
int fileRead();

dirName is the filename in directory format, 11 bytes with blank fill like this.

  // open TEST.BIN
  if (!fileOpen((uint8_t*)"TEST    BIN")) {
    // open failed
  }

fileRead() reads a single byte or returns -1 for error or EOF.

The programs are packaged as a library. Try the examples.

You must be logged in to download the attached zip file.

SdBoot20130403.zip (8.46 KB)

My goal is to place a sketch on the SD Card and run program that sketch to the chip itself or run the sketch off the chip. travelvietnam I am using pin 53 as chip select for the SD

hello everyone,
i'm trying to do something similar to this by uploading a sketch from an external memory.
my goal is to rewrite the bootloader that started in this post, with osbock, and make it first compile under atmel studio (i hade to change some global variables to constants...).

finally i've succeeded compiling that bootloader under atmel studio and now i have a few quwstions please:

  1. this bootloader can't upload .hex file at all and specifically from the arduino ide, correct? if so why not?

  2. if i want that bootloader to upload only sketches with the correct name (app.bin or lets say app.hex) will it check for changes? on restart and program the sketch only if it's new? if not why?

  3. if i won't to do the same thing but from external flash chip, on a breadboard and make the bootloader check whether there is a "new" file on the uSD or ext. Flash, what changes are needed? any reference?

  4. what are the correct numbers for this bootloader on arduino mega 2560 with sparkfun micro-sd shield (not eth') (speed, legs CS etc, memory addresses... etc)

thank you,
snir.

hello, where is the current stand of this project?

I think the project has somewhat stalled. I have tried to message the original contributors with no results. :frowning:

What a pity this has stalled. Just what I was looking for :frowning:

GregM:
What a pity this has stalled. Just what I was looking for :frowning:

I think, it was stalled, but then i found this.
The thread owner has found a way to make it work.

His changes are on his own github repository...

Hi, I am serching for some info about this quite a long time. And still I am not sure which project is actualy working or how to use it. Could somebody help me, give me some clues and summarize the situation. thx

Hi,

because of the problems (only FAT16 and endless loop with FAT32 sd card in on boot) with the 2boots bootloader, i switched to the avr_boot. (GitHub - osbock/avr_boot: SD card Bootloader for atmega processors)
I have made some changes for my project.
The main differences between 2boot and avr_boot:

  • booting only from sd card. No serial option
  • booting from SDHC possible, FAT32 and FAT16
  • much bigger, about 4kb...
  • no support for hex file, you need to convert the hex file into a binary file

my changes: (you can find it in OpenSeaMapLogger/bootloader/avr_boot-master at master · willie68/OpenSeaMapLogger · GitHub)

  • desired platform ATMega328P with attached SD Card standard connection (MOSI, MISO...)
  • names of firmware files will be OSMFWxxx.BIN, will be programmed, if xxx > EEPROM-Version number. If no EEPROM Version number is present 12 is the magic number. if not, file will be ignored. The next version must be within 10 version numbers. (Files will be testet from EEPROM Version + 10 down to EEPROM Version + 1) if nothing is found at last a file name OSMFIRMW.BIN will be testet and programmed, if present.
  • In the firmware setup routine the actual version is written into the EEPROM.
  • a small java program helps to convert the hex file to a bin file.

Hello forum,

I finally managed to write the bootloader to my atmega 328p (with some help of a friend to compile it) and ran into the next problem. what format the file on the sd card must have? what must i do with the .ino file to make the thing work.

Thanks in advance for your answers, Michael

Which bootloader?
Some prefer hex files (which the arduino IDE already generate, look into the build folder in the temp folder.), my avr_boot needs a binary file, so i must convert the hex file into a binary version...