Reply by Richard H. April 4, 20072007-04-04
jamie wrote:
> Actually, what I want to implement is a kind of "wireless application > download" for sensor network. > Which means sensor network device can install new application through > the RF packet. > I heard re-writing the flash rom by itself is possible but that was > not I was intended.
Check out a project called PicoWeb (http://www.picoweb.net). It's a smaller AVR with Ethernet and a pcode-style language that runs from SRAM. It was probably developed this way because he created it as a commercial product but published a do-it-yourself version in Circuit Cellar magazine. So, you can get the DIY project running with the compiled code + your pcode script. The actual source code is available under license only, but would show you a working example.
Reply by larwe April 4, 20072007-04-04
On Apr 4, 7:13 am, "Ulf Samuelsson" <u...@a-t-m-e-l.com> wrote:

> > memory space. The ATmega128 cannot do this - the external memory bus > > is for data only, not code. In fact, I don't think any AVR can do > > There are AVR ASIC chips which implements 4/8 MB external busses > with shared memory.
Good to know Ulf, but that is not an AVR - it's an ASIC that has an AVR core inside.
Reply by Ulf Samuelsson April 4, 20072007-04-04
"larwe" <zwsdotcom@gmail.com> skrev i meddelandet
news:1175655710.101511.125040@n76g2000hsh.googlegroups.com...
> On Apr 3, 10:44 pm, "jamie" <jamie...@gmail.com> wrote: > >> Actually, what I want to implement is a kind of "wireless application >> download" for sensor network. >> Which means sensor network device can install new application through >> the RF packet. >
> 3. Use a Harvard-architecture microcontroller that can use external > program memory (e.g. 8051) and put some SRAM in the external program > memory space. The ATmega128 cannot do this - the external memory bus > is for data only, not code. In fact, I don't think any AVR can do > this.
There are AVR ASIC chips which implements 4/8 MB external busses with shared memory. -- Best Regards, Ulf Samuelsson This is intended to be my personal opinion which may, or may not be shared by my employer Atmel Nordic AB
Reply by larwe April 4, 20072007-04-04
On Apr 3, 10:44 pm, "jamie" <jamie...@gmail.com> wrote:

> Actually, what I want to implement is a kind of "wireless application > download" for sensor network. > Which means sensor network device can install new application through > the RF packet.
This sort of requirement suggests one of three design choices: 1. Implement the add-in software components in an interpreted language. 2. Use a von Neumann-architecture microcontroller. 3. Use a Harvard-architecture microcontroller that can use external program memory (e.g. 8051) and put some SRAM in the external program memory space. The ATmega128 cannot do this - the external memory bus is for data only, not code. In fact, I don't think any AVR can do this.
Reply by jamie April 3, 20072007-04-03
On 3=BF=F929=C0=CF, =BF=C0=C8=C411=BD=C351=BA=D0, Herbert Kleebauer <k...@u=
nibwm.de> wrote:
> jamie wrote: > > > Hello I have a question about "executing code in SRAM" with Atmega128 > > MCU. > > > I know instructions (code) in flash rom area can be executed by AVR > > cpu and now I'm wondering if the code in SRAM can also be executed. > > > Imagine I have some AVR instructions ( or function code ) in SRAM > > area, > > If I jump program counter to the area ( in SRAM ) then will the > > instruction be executed without any problem? > > If I need to setup something beforehand, what would it be ? > > The question is, why do you want to execute code from SRAM. The > ATmega128 has 128 kbyte Flash and only 4 kbyte SRAM so I suppose, > it's not because the Flash is to small. Maybe there is a different > solution for your problem than executing code in the SRAM.
Actually, what I want to implement is a kind of "wireless application download" for sensor network. Which means sensor network device can install new application through the RF packet. I heard re-writing the flash rom by itself is possible but that was not I was intended.
Reply by Arlet March 29, 20072007-03-29
On Mar 29, 8:54 am, "jamie" <jamie...@gmail.com> wrote:

> Hello I have a question about "executing code in SRAM" with Atmega128 > MCU. > > I know instructions (code) in flash rom area can be executed by AVR > cpu and now I'm wondering if the code in SRAM can also be executed. >
As long as you don't do it too often, you could copy the code from SRAM to Flash, and run it there. You have two restrictions: 1. code must be position independent, or must be aware of the ultimate (absolute) position in Flash. 2. The flash only support 10,000 erase cycles (maybe less if you only erase part of it), so this is restricted to occasional use.
Reply by Herbert Kleebauer March 29, 20072007-03-29
jamie wrote:
> > Hello I have a question about "executing code in SRAM" with Atmega128 > MCU. > > I know instructions (code) in flash rom area can be executed by AVR > cpu and now I'm wondering if the code in SRAM can also be executed. > > Imagine I have some AVR instructions ( or function code ) in SRAM > area, > If I jump program counter to the area ( in SRAM ) then will the > instruction be executed without any problem? > If I need to setup something beforehand, what would it be ?
The question is, why do you want to execute code from SRAM. The ATmega128 has 128 kbyte Flash and only 4 kbyte SRAM so I suppose, it's not because the Flash is to small. Maybe there is a different solution for your problem than executing code in the SRAM.
Reply by jamie March 29, 20072007-03-29
On 3=BF=F929=C0=CF, =BF=C0=C8=C44=BD=C347=BA=D0, "Al  Borowski" <al.borow..=
.@gmail.com> wrote:
> On Mar 29, 4:54 pm, "jamie" <jamie...@gmail.com> wrote: > > > Hello I have a question about "executing code in SRAM" with Atmega128 > > MCU. > > > I know instructions (code) in flash rom area can be executed by AVR > > cpu and now I'm wondering if the code in SRAM can also be executed. > > No, you can't do it sorry. At least not directly. You could always > write an emulator or interpreter that pulls instructions from SRAM and > executes them. > > Cheers, > > Al
Al, thank you for your kind answer. Actually I've asked the same question to Atmel technical support team and got an answer as follows. ----------------- It is not possible to execute code from the SRAM. The reason is that the AVR uses a Harvard Architecture where the Data and Instruction Memory is located on separate busses. This allows for accessing both Instructions and Data simultaneously, but the SRAM is physically disconnected from the instruction bus, so you can't execute instructions from SRAM. Atmel AVR Technical Support
Reply by Al Borowski March 29, 20072007-03-29
On Mar 29, 4:54 pm, "jamie" <jamie...@gmail.com> wrote:
> Hello I have a question about "executing code in SRAM" with Atmega128 > MCU. > > I know instructions (code) in flash rom area can be executed by AVR > cpu and now I'm wondering if the code in SRAM can also be executed.
No, you can't do it sorry. At least not directly. You could always write an emulator or interpreter that pulls instructions from SRAM and executes them. Cheers, Al
Reply by jamie March 29, 20072007-03-29
Hello I have a question about "executing code in SRAM" with Atmega128
MCU.

I know instructions (code) in flash rom area can be executed by AVR
cpu and now I'm wondering if the code in SRAM can also be executed.

Imagine I have some AVR instructions ( or function code ) in SRAM
area,
If I jump program counter to the area ( in SRAM ) then will the
instruction be executed without any problem?
If I need to setup something beforehand, what would it be ?

Thank you in advance.
Jamie