Load sketch code from SD Card

If anyone is interested, I've written a bootloader which, besides interfacing normally with the IDE, also loads code from an SD Card. So now you can update code without being connected to the IDE.

It checks a pin on reset, and if it's low, then the bootloader pulls a hex file from the SD card and programs the flash.

b

1 Like

While I may not have a direct need for this right now, that is pretty darn spiffy

Interesting! cant wait to see some useful ideas on what can be done with this.

What was your initial inspiration for a reason to come up with this?

Whoa!

I wanted to do this some time ago but I don't honestly have enough programming knowledge to do it.

Please can you provide more sauce? :wink:

This will be infinitely useful.

How are you writing the hex file to the SD card?

Mowcius

I can see my dream of programming an arduino from an arduino working soon...

Just need to get a hex compiler working in another sketch now...

Could another arduino read from the sd card and send it via serial to the other arduino? :-/

Then it'd work! :wink:

The von Neuman machines are comming!!!
RUN FOR YOUR LIVES :o

They are MULTIPLYING !!
Now where did I put my nanobot-powder ::slight_smile:

David.

I am interested too.
How much flash memory is left for the actual application (sketch)?
Can you choose what to load or it loads a default hex file?
Thanks.

The bootloader takes up less than 4K total. This means that you'll have 28K at your disposal (on the '328). I'm actually using the bootloader on one of our AVR boards - with an ATmega644P - which means I have 60K left for goodies.

Right now, you can only load a hex file named "sketch.hex". The file is in native hex format which is parsed inside the bootloader - so no fiddly changes - just copy onto the card and go.

Tw34kd: I needed to load code on a remote installation (maybe that's obvious). Specifically, they are for POP (point of purchase) units that play music and capture metrics.

I'll put together a page with the bootloader and other info in the next couple of days.

b

Yiehha, i am really interested.
Sounds damn cool. I read about all the questions and halftries in this Forum, and gave up hope that somebody enough skilled programmer has the need for this :slight_smile:

Waiting excitedly for this! Wanted this ability for a long time.

I guess I'll have to get over my fear of burning the 644P bootloader with a parallel programmer.

Can the hex file live on the card with other files?
(Guess I can wait till Christmas to find out.)

Thanks again for your great work. This for sure is a chick magnet! You should score mightily.

I think we are all interested in seeing your work
Are you using any of the popular FAT libraries?
Does it handle verification? How does it handle verification (page by page or all at once at the end)? What does it do when there is a mismatch?

This for sure is a chick magnet! You should score mightily.

Maybe if you are looking really geeky chicks ;D

Mowcius

Maybe if you are looking really geeky chicks

Right! And I can certainly appreciate your firm grasp on the obvious. The comment was made with regard to bhagman's tag line.

Right! And I can certainly appreciate your firm grasp on the obvious.

Life is obvious, i have a firm grasp on life, oh wait, maybe not ;D

Mowcius

ping.... for any more information regarding this boot loader.

Really interested in learning more.

Awesome! I was looking for something like this back when I was playing with the Basic Stamp. I had Palm, and would have loved to be able to program the device out in the field. There wasn't a straight forward method to doing it though. Of course, at that time there wasn't anything like an XBee.

Now is there any way to edit a .pde file from a smart phone?

You might be able to edit a .pde file on your smart phone, but how would you compile it? You need to write the resulting .hex file to the SD card, to be loaded by the Arduino, not the edited .pde file.

That's what I was looking into some time ago. I was looking at an arduino doing the compiling and then programming another arduino.

I didn't get very far becuase I realised that that was rather out of my reach with limited knowledge (none) of the bootloader/chip architecture/arduino IDE etc.

I got as far as that you could make sketches to run on arduino but you would need something on the arduino to interpret it (bitlash or similar). Then you could change the code and run different programs at different times, create them on anything as long as you could save it as a text file on a microSD card (or any media that can be interfaced with an arduino). With the new arduino chips (on the mega etc) with a lot more space, bitlash (or similar) could be made so that it could run most commands that you would ever want to run on an arduino.

In theory, you could make your own program that could interpret C++ code and run it using a program on your arduino. Then you wouldn't need to compile it as a hex (or whatever the chip uses), you could have your arduino interpret it as it runs it. It would not be as fast as straight forward 'code' but for most things, that would not matter too much.

Anyone want to embark on a C++ interpreter version of bitlash with me?
It is a project on my list but I have been a bit busy recently and not had much chance to start on this (possibly massive) project.

Mowcius

You might be able to edit a .pde file on your smart phone, but how would you compile it?

Just get a Linux-based smartphone, and install arduino-0017 on it :wink:

Just get a Linux-based smartphone, and install arduino-0017 on it

Hehe, maybe another project for the arduino team, a mobile friendly version (if there could be such a thing!)

Mowcius