Is it possible to boot from SDcard?

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Guys,

Is it possible to boot from SDCard or ATMEGA128?
So from flash, will redirect to SDcard and run my application from there..., to get more space..
Similar with Disk Operating System ?

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is not possible to execute code from an external source on an AVR, executable code must reside in AVR (flash) Program Memory.

However it is possible to bootload external code from a SDCard into an AVR which Cliff's SD/MMC bootloader project does.

http://spaces.atmel.com/gf/project/sdbootloader/

AVRs are specified for 10,000 flash write/erase cycles - should your SDCard/socket contacts last that long.

Stan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As Stan says you could use something like my bootloader to just have it start by reprogramming the flash with the new application but there is that limit of 10,000 erase cycles on the flash so you cannot do it that often.

The limit is that the AVR is a Harvard architecture processor and the only memory space it can make opcode fetches from is flash. So anything you want to run has to be put there first.

However your question comes up about once every 2-3 months and as noted in previous threads a way to achieve what you ask is to have the program that is in the flash itself be an "opcode interpreter" and one that is willing to pull it's own instructions from a different source such as RAM or SD/MMC card. Typical interpreters are "pCode" or "Java". There is an implementation of Java for AVR called nanoVM which would be modified to take the Java bytecode it runs from SD/MMC rather than code flash.

Another "instruction interpreter" would be code that emulates some other CPU. For example someone has interpreted a Z80 emulator on AVR and it is good enough to be able to run CP/M. Some really really mad person has even implemented an ARM emulator on AVR and it can load and run a copy of ARM Linux. The one downside is that the interpretation process is so slow that it takes about an hour to run through a normal Linux startup (that might take 15-20 seconds on an ARM) so it's not practical for real use. But it's a very clever experiment!

At one time I looked at writing an AVR simulator in AVR code. I never completed it as I could see it was not going that well and would be tricky to complete successfully but it was able to run some simple AVR programs. While I was actually holding the AVR opcodes to be run in the same flash image where the simulator was located it would have been trivial to modify it to fetch opcodes from RAM or some other storage such as SD/MMC.

Oh and if you implement an AVR core in an FPGA it is quite possible to have it fetch opcodes from a different source (it's usually done to fetch from RAM). There's no reason why that couldn't run as efficiently as a "real" AVR.

EDIT: this was my AVR simulator thread:

https://www.avrfreaks.net/index.p...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

While the comments above about possible ways to overcome flash shortage are valid, there exists two straight-forward answers (usually applied in the order given below):

1. Cut down on flash needs. Optimize. Cut down on app functionality. Etc.

2. Get a microcontroller with larger flash.

The most flash an XMega comes with is 384K. For a ATMega its 256K. If you need more than that, you should look at other microcontroller families. Still, 384K is A LOT. What is the app that won't fit that??

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In 256K-384K I'll bet a lot of it is data: pictures, sounds, videos, fonts. Obviously you could write an AVR app that lived in flash and loaded most of that kind of data from SD/MMC if needed.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I won't bet against you Clöiff, but the OP talked about

Quote:
[running the] application from [SDcard]

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But the stated purpose was

Quote:
to get more space
I doubt very much that the OP has more that 128k of code only.

Regards,
Steve A.

The Board helps those that help themselves.