Go Down

Topic: Load sketch code from SD Card (Read 46790 times) previous topic - next topic

kiltjim

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?

PaulS

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.

mowcius

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

RanTalbott

Quote
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   ;)

mowcius

Quote
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

RanTalbott

Quote
Anyone want to embark on a C++ interpreter version of bitlash with me?

Nobody that you'd trust unsupervised with sharp objects  8-)

A C++ (or even C) interpreter or compiler is completely impossible:  it just doesn't have the needed memory resources to load or run one,  even slowly.

If you want to run an interpreter on an Arduino,  you need to scale back your expectations to a language like FORTH or Tiny BASIC.  Or something like bitlash.

Ran

mowcius

Quote
A C++ (or even C) interpreter or compiler is completely impossible:  it just doesn't have the needed memory resources to load or run one,  even slowly.

If you want to run an interpreter on an Arduino,  you need to scale back your expectations to a language like FORTH or Tiny BASIC.  Or something like bitlash.

Ok, I thought it would be difficult...

Now I think about it, I see what you mean. It is not just simple commands, you are asking it to interpret curly brackets, variables and everything in between.

I will look more into bitlash. I think I saw another attempt at an interpreter type thingy somewhere? Anyone know what it was?

Mowcius

bhagman

FYI: I'm still working on documenting it better, but here's the code and a short write-up.  I'll make up some fancy connection diagrams and such.

http://www.roguerobotics.com/wikidocs/code/bootloader_using_ummc

b
http://wiring.org.co/ - Wiring - Where Arduino came from. (Wiring begat Arduino)

http://loftypremises.com/ - Everything you wanted to know about me.... and less

http://roguerobotics.com/ - #1 Canadian Arduino distributor

lgeek

#23
Jan 11, 2010, 08:09 am Last Edit: Jan 11, 2010, 08:09 am by lgeek Reason: 1
Regarding the interpreter you were talking about earlier, I was thinking about that a couple of days ago and I belive that it is perfectly doable if the script is compiled to some form of bytecode before being copied to the storage medium.
It would be slow even if "interpreting" compiled code that could run natively on the board, but I'm positive it could work. Probably this sounds weird, but:
  • I think that "interpreting" native code would have the lowest overhead
  • The AVR being a Harvard architecture, you can't just load the code into RAM and then jump to it (this is how the von Neumann architecture works because it doesn't differentiate between program storage and data storage).

mowcius

Quote
I'm still working on documenting it better, but here's the code and a short write-up.  I'll make up some fancy connection diagrams and such.

http://www.roguerobotics.com/wikidocs/code/bootloader_using_ummc


Can it work with any SD card storage? I do not have the roguerobotics board (I am thinking of getting the rMP3). Is there something specific that is needed on the rr board?

How are you getting your hex files for putting on the microSD card, are you taking them from the file folder that the arduino IDE creates?

Mowcius

mowcius

Quote
The AVR being a Harvard architecture, you can't just load the code into RAM and then jump to it (this is how the von Neumann architecture works because it doesn't differentiate between program storage and data storage).


Is there any way that we could have a Von Neumann arduino? What chips use the Von Neumann architecture?

Some ARM processors can do that can they not? I presume the ARM arduino that I saw a bit ago will be using a harvard ARM chip...

Mowcius

lgeek

Microcontrollers are built using the Harvard architecture to keep the complexity, cost and power consumption low. In contrast, I think that all modern CPU families use the Von Neumann architecture. This includes ARM and X86. It's pretty clear why if you want to run different programs or to implement a real operating system.

You could take a look at some ARM dev boards if you need something more powerful than the AVRs, but now I think I got totally offtopic.  :)

mowcius

Yes, a bit off topic now. There is also a new command line for arduino floating around that could be very good with a bit of development:
http://tp://sites.google.com/site/anotherarduinobot/cmd

Mowcius

lgeek

Yeah, but it just executes different functions included in the sketch when it recognises a command.

mowcius

Yes I know but still could be made to load commands off of an SD card to then run simple sketches on the arduino...

Mowcius

Go Up