Sign in

username:

password:



Not a member?

Search avrclub



Search tips

Subscribe to avrclub



avrclub by Keywords

AT90S2313 | AT90S8515 | ATMega | ATmega128 | ECL | FETS | IAR | Keyboard | LCD | STK50 | TMOS | UART

Ads

Discussion Groups

Discussion Groups | AVRclub | excecuting through SRAM

Atmel AVR Microcontroller discussion group.

excecuting through SRAM - M Habib - Jul 2 4:57:00 2005

hi everybody
how can i excecute a program written on the sram using AT90S8515 or ATmega8515?

also how can i use the spm instruction to write one word only in the flash mem. using the ATmega8515??

thanx ---------------------------------
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football

[Non-text portions of this message have been removed]




(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )


Re: [AVR club] excecuting through SRAM - Zack Widup - Jul 2 9:00:00 2005

On Sat, 2 Jul 2005, M Habib wrote:

> hi everybody
> how can i excecute a program written on the sram using AT90S8515 or ATmega8515?
>
> also how can i use the spm instruction to write one word only in the flash mem. using the ATmega8515??
>
> thanx Have you downloaded the data sheet for the 90S8515 and studied it in
detail? The answers to your questions are all in the data sheet, and it's
free. You just have to take the time to download it.

You can't execute a program from SRAM in the 8515, BTW.

Zack




(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] excecuting through SRAM - Dave VanHorn - Jul 2 11:14:00 2005

At 03:57 AM 7/2/2005, M Habib wrote:
>hi everybody
>how can i excecute a program written on the sram using AT90S8515 or
>ATmega8515?

Well.. The processor won't execute code from there, but you could
store instructions there that are acted on by a bytecode interpreter.
It's a moderately advanced project though..

I wrote the kernel of one, and put it out for the public in my old
"getting started" code. Yikes, was that actually five years ago?
It ran bytecode stored in EEPROM, but there's no reason you couldn't
have the bytecode in ram.
I only implemented a few instructions in the example, but the whole
point was to illustrate how to do it, so you can write instructions
that are well suited to your application.




(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] excecuting through SRAM - poitsplace - Jul 5 23:52:00 2005

Doing a driveby in the group...may not follow things up later

There ARE some microcontrollers with the ability to execute code out
of their program memory AND (without resetting) code stored in SRAM.
Code stored in SRAM of course has a stiff penalty in execution
times...but it still works pretty darned fast. A couple of the PIC18
series so it and one of the Atmel 8051 type MCU's can do it.

The Atmel chip has 4k of program memory which is mapped on top of
external program memory. External program memory is ASSUMED to be
FLASH, ROM, EEPROM, etc...but there's not really any big difference
between the interface. The one minor issue (and it can be an
advantage) is that the MCU differentiates between program memory and
external SRAM with a line that you run to the chip enable of your
respective memories (obviously setting the logic properly to activate
each chip at the right time) BUT...you can just leave the control
line alone...which would have the affect of making your external
program memory AND your SRAM...the same memory (so you can easily
read and write to program memory)
...again, this isn't an AVR chip and so far as I can see there are
few versions of this chip available.

Oh, and there are apparently some USB microcontrollers that actually
boot from serial EEPROM and execute all their code out of SRAM
--- In avrclub@avrc..., Dave VanHorn <dvanhorn@d...> wrote:
> At 03:57 AM 7/2/2005, M Habib wrote:
> >hi everybody
> >how can i excecute a program written on the sram using AT90S8515
or
> >ATmega8515?
>
> Well.. The processor won't execute code from there, but you could
> store instructions there that are acted on by a bytecode
interpreter.
> It's a moderately advanced project though..
>
> I wrote the kernel of one, and put it out for the public in my old
> "getting started" code. Yikes, was that actually five years ago?
> It ran bytecode stored in EEPROM, but there's no reason you
couldn't
> have the bytecode in ram.
> I only implemented a few instructions in the example, but the whole
> point was to illustrate how to do it, so you can write instructions
> that are well suited to your application.




(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] excecuting through SRAM - Dave VanHorn - Jul 6 0:14:00 2005


>
>The Atmel chip has 4k of program memory which is mapped on top of
>external program memory. External program memory is ASSUMED to be
>FLASH, ROM, EEPROM, etc...

There IS NO external program memory in the AVR.
There is external data memory.
No Go Joe.




(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] excecuting through SRAM - poitsplace - Jul 6 3:35:00 2005

--- In avrclub@avrc..., Dave VanHorn <dvanhorn@d...> wrote:
>
> >
> >The Atmel chip has 4k of program memory which is mapped on top of
> >external program memory. External program memory is ASSUMED to be
> >FLASH, ROM, EEPROM, etc...
>
> There IS NO external program memory in the AVR.
> There is external data memory.
> No Go Joe.

I did in fact say that it was one of their 8051 variants.

I quote (me)
"A couple of the PIC18 series so it and one of the Atmel 8051 type
MCU's can do it.
The Atmel chip has 4k of program memory which is mapped on top of
external program memory..."

Just thought it was worthy of mention




(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] excecuting through SRAM - Dave VanHorn - Jul 6 9:37:00 2005


>
>The Atmel chip has 4k of program memory which is mapped on top of
>external program memory..."
>
>Just thought it was worthy of mention

There's the thing though. Although the addresses overlap, you won't
find instruction fetches accessing the SRAM no matter what you do.
So, you can't get there from here, at least in the current parts.

Pity, it would be fun.
I've done self-modifying code before, in a couple of different
bytecode interpreters, including one I wrote for the AVR, but that
code lived in EEspace.
Still, you could move that to SRAM easily enough.




(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] excecuting through SRAM - poitsplace - Jul 6 13:36:00 2005

No, you misunderstand. It maps the 4k on top of the external program
memory...meaning that you simply can't access the lower 4k of SRAM as
program memory. If you have it execute any address above the
internal 4k, it fetches the instruction from SRAM.

...and here's the datasheet (NOTE: this is NOT an AVR)
http://www.atmel.com/dyn/resources/prod_documents/doc3053.pdf

...and in that datasheet it CLEARLY states

"If the EA pin is connected to GND, all program
fetches are directed to external memory. On the
AT89LS51, if EA is connected to VCC, program
fetches to addresses 0000H through FFFH are
directed to internal memory and fetches to
addresses 1000H through FFFFH are directed to
external memory."

And this chip is relatively inexpensive. $2 or so from digikey.
--- In avrclub@avrc..., Dave VanHorn <dvanhorn@d...> wrote:
>
> >
> >The Atmel chip has 4k of program memory which is mapped on top of
> >external program memory..."
> >
> >Just thought it was worthy of mention
>
> There's the thing though. Although the addresses overlap, you won't
> find instruction fetches accessing the SRAM no matter what you do.
> So, you can't get there from here, at least in the current parts.
>
> Pity, it would be fun.
> I've done self-modifying code before, in a couple of different
> bytecode interpreters, including one I wrote for the AVR, but that
> code lived in EEspace.
> Still, you could move that to SRAM easily enough.




(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] excecuting through SRAM - Dave VanHorn - Jul 6 13:45:00 2005

At 12:36 PM 7/6/2005, poitsplace wrote:
>No, you misunderstand. It maps the 4k on top of the external program
>memory...meaning that you simply can't access the lower 4k of SRAM as
>program memory. If you have it execute any address above the
>internal 4k, it fetches the instruction from SRAM.

Yes, I was speaking of the AVR. I know other devices do this, but the
AVR does not.




(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

RE: [AVR club] excecuting through SRAM - stevech - Jul 7 0:49:00 2005

Seems to me that if you want code and data accessed in the same memory
space, then you want a chip/CPU with a classic von Neuman architecture
rather than a Harvard architecture with separate data/code spaces.
But this is too obvious, eh? Maybe you guys are just chatting about how to
coerce the Harvard chip.

-----Original Message-----
From: avrclub@avrc... [mailto:avrclub@avrc...] On Behalf Of
Dave VanHorn
Sent: Wednesday, July 06, 2005 10:45 AM
To: avrclub@avrc...; avrclub@avrc...
Subject: Re: [AVR club] excecuting through SRAM

At 12:36 PM 7/6/2005, poitsplace wrote:
>No, you misunderstand. It maps the 4k on top of the external program
>memory...meaning that you simply can't access the lower 4k of SRAM as
>program memory. If you have it execute any address above the
>internal 4k, it fetches the instruction from SRAM.

Yes, I was speaking of the AVR. I know other devices do this, but the
AVR does not.

Yahoo! Groups Links




(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] excecuting through SRAM - poitsplace - Jul 7 10:27:00 2005

--- In avrclub@avrc..., "stevech" <stevech@s...> wrote:
> Seems to me that if you want code and data accessed
> in the same memory space, then you want a chip/CPU
> with a classic von Neuman architecture rather than
> a Harvard architecture with separate data/code spaces.
> But this is too obvious, eh? Maybe you guys are just
> chatting about how to coerce the Harvard chip.

Yeah, but in this case it ACTUALLY gives more functionality. By
simply ignoring that program/data memory control line, you get a
unified memory (and it takes the same number of cycles either way).
You could also use the control line (with something to switch banks)
and have a program occupying the full 60k bank of program memory AND
the full 64k of data memory.

...although I'll grant you that it's not the most useful concept :)

Having the 4k of internal program memory mapped over the top of the
external memory also has good and bad points. On the one hand it
takes up 4k...but on the other hand, it's a nice place to put a bank
switching routine...so technically you could put a big ol' SRAM on a
relatively inexpensive MCU (again, they're under $2) and it could
actually have 512k (or more) of program memory.

LOL, again, theoretically useful, but usually not :D
> -----Original Message-----
> From: avrclub@avrc... [mailto:avrclub@avrc...] On
Behalf Of
> Dave VanHorn
> Sent: Wednesday, July 06, 2005 10:45 AM
> To: avrclub@avrc...; avrclub@avrc...
> Subject: Re: [AVR club] excecuting through SRAM
>
> At 12:36 PM 7/6/2005, poitsplace wrote:
> >No, you misunderstand. It maps the 4k on top of the external
program
> >memory...meaning that you simply can't access the lower 4k of SRAM
as
> >program memory. If you have it execute any address above the
> >internal 4k, it fetches the instruction from SRAM.
>
> Yes, I was speaking of the AVR. I know other devices do this, but
the
> AVR does not. >
>
> Yahoo! Groups Links




(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] excecuting through SRAM - Dave VanHorn - Jul 7 10:40:00 2005


>
>Yeah, but in this case it ACTUALLY gives more functionality. By
>simply ignoring that program/data memory control line, you get a
>unified memory (and it takes the same number of cycles either way).

In the AVR, there is no such line. So you can't do this in the AVR.




(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] excecuting through SRAM - poitsplace - Jul 7 11:48:00 2005

--- In avrclub@avrc..., Dave VanHorn <dvanhorn@d...> wrote:
>
> >
> >Yeah, but in this case it ACTUALLY gives more functionality. By
> >simply ignoring that program/data memory control line, you get a
> >unified memory (and it takes the same number of cycles either way).
>
> In the AVR, there is no such line. So you can't do this in the AVR.

Ah...apparently you missed the part in which I ONCE AGAIN stated that I
wasn't even talking about AVR. In SOME ways, it makes this off topic
(on an AVR group) but in others (the fact that AVR MCUs are totally
useless for such projects) it's very on topic.

...since there's no point looking where you KNOW you won't find that
which you seek :P




(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] excecuting through SRAM - Jeffrey Engel - Jul 7 14:28:00 2005

--- poitsplace <lmburt@lmbu...> wrote:

> --- In avrclub@avrc..., Dave VanHorn
> <dvanhorn@d...> wrote:
> >
> > >
> > >Yeah, but in this case it ACTUALLY gives more
> functionality. By
> > >simply ignoring that program/data memory control
> line, you get a
> > >unified memory (and it takes the same number of
> cycles either way).
> >
> > In the AVR, there is no such line. So you can't do
> this in the AVR.
>
> Ah...apparently you missed the part in which I ONCE
> AGAIN stated that I
> wasn't even talking about AVR. In SOME ways, it
> makes this off topic
> (on an AVR group) but in others (the fact that AVR
> MCUs are totally
> useless for such projects) it's very on topic.
>
> ...since there's no point looking where you KNOW you
> won't find that
> which you seek :P

But this is an AVR list. . .

Jeff Engel
Arlington, TX Happiness is - positive intake manifold pressure.
____________________________________________________
Sell on Yahoo! Auctions – no fees. Bid on great items.
http://auctions.yahoo.com/





(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] exce thru SRAM (no point in trying to make suggestions) - poitsplace - Jul 7 19:05:00 2005

--- In avrclub@avrc..., Jeffrey Engel <jengeltx@y...> wrote:
> --- poitsplace <lmburt@e...> wrote:

> > Ah...apparently you missed the part in which I
> > ONCE AGAIN stated that I wasn't even talking
> > about AVR. In SOME ways, it makes this off
> > topic (on an AVR group) but in others (the fact
> > that AVR MCUs are totally useless for such
> > projects) it's very on topic.
> >
> > ...since there's no point looking where you
> > KNOW you won't find that which you seek :P

> But this is an AVR list. . .

You're right...next time I'll make sure to NOT steer someone into a
direction that might point them towards something with the
functionality they want or even be remotely helpful. Can't go around
being helpful if it's off topic. While we're at it there should
probably be a rule against posting links to datasheets for flash
memory when someone asks about the protocol. I mean, the reply is
off topic...Or A/D converters, serial eeproms, PCB making,
electronics, or any field related that isn't SPECIFICALLY ABOUT the
AVR. <sarcasm>After all, the AVR contains everything one could ever
need to do anyting in the known universe </sarcasm>

I especially like your reiteration OF THE POINT I MADE. "In SOME
ways, it makes this off topic (on an AVR group)..."

Sorry, a couple of people seem to have hit hit a pet peeve. By the
way, this post IS on topic as it pertains to the policies of the
group.

Have a nice day.




(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] exce thru SRAM (no point in trying to make suggestions) - Dave VanHorn - Jul 7 19:26:00 2005


>
>I especially like your reiteration OF THE POINT I MADE. "In SOME
>ways, it makes this off topic (on an AVR group)..."




(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

WAS: (no point in trying to make suggestions) NOW: Huh? - Jeffrey Engel - Jul 8 0:21:00 2005

--- poitsplace <lmburt@lmbu...> wrote:
> --- In avrclub@avrc..., Jeffrey Engel
> <jengeltx@y...> wrote:
> > --- poitsplace <lmburt@e...> wrote:
>
> > > Ah...apparently you missed the part in which I
> > > ONCE AGAIN stated that I wasn't even talking
> > > about AVR. In SOME ways, it makes this off
> > > topic (on an AVR group) but in others (the fact
> > > that AVR MCUs are totally useless for such
> > > projects) it's very on topic.
> > >
> > > ...since there's no point looking where you
> > > KNOW you won't find that which you seek :P
>
> > But this is an AVR list. . .
>
> You're right...next time I'll make sure to NOT steer
> someone into a
> direction that might point them towards something
> with the
> functionality they want or even be remotely helpful.
> Can't go around
> being helpful if it's off topic.

LOL! I said all that?

> While we're at it there should
> probably be a rule against posting links to
> datasheets for flash
> memory when someone asks about the protocol. I
> mean, the reply is
> off topic...Or A/D converters, serial eeproms, PCB
> making,
> electronics, or any field related that isn't
> SPECIFICALLY ABOUT the AVR.

IIRC, the initial query was about executing code from
an AVR's SRAM. Apparently it can't be done.

Of course other processor families can execute from
SRAM even if we limit ourselves to discussing the
Harvard architecture. I think we're all aware of
that. Your examples from the 805x family where
Harvard architecture is fooled into executing code
from data memory is also valid - and as far as I read
- correct.

The AVR family isn't sold into that market. It has
most of its memory resources internally and little
support for external memory.

So if the initial question is still how to execute
code from an AVR's SRAM, the answer is still 'it can't
be done - with an AVR'.

> <sarcasm>After all, the AVR contains
> everything one could ever
> need to do anyting in the known universe </sarcasm>

Not particularly, but they are nice units given their
range. I especially like the 'C' and BASIC support it
has.

> I especially like your reiteration OF THE POINT I
> MADE. "In SOME
> ways, it makes this off topic (on an AVR group)..."

Didn't you write that? I'm certainly not the Topic
Police and wasn't trying to enforce anything.

> Sorry, a couple of people seem to have hit hit a pet
> peeve. By the way, this post IS on topic as it
> pertains to the policies of the group.
>
> Have a nice day.

Thanks! I did.

You do that same.

Jeff Engel
Arlington, TX

Happiness is - positive intake manifold pressure.
____________________________________________________
Sell on Yahoo! Auctions – no fees. Bid on great items.
http://auctions.yahoo.com/





(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] WAS: (no point in trying to make suggestions) NOW: Huh? - Dave VanHorn - Jul 8 9:31:00 2005


>
> > Have a nice day.
>
>Thanks! I did.

Me too, I just delivered a nice AVR project that I've been working on
for about 6 months.
Client just did the "big demo" for his customer, and everybody's happy! :)




(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )

Re: [AVR club] WAS: (no point in trying to make suggestions) NOW: Huh? - Jeffrey Engel - Jul 8 11:12:00 2005

--- Dave VanHorn <dvanhorn@dvan...> wrote:

> > > Have a nice day.
> >
> >Thanks! I did.
>
> Me too, I just delivered a nice AVR project that
> I've been working on
> for about 6 months.
> Client just did the "big demo" for his customer, and
> everybody's happy! :)

Good way to start a weekend!

Congratulations on the demo.

Jeff Engel
Arlington, TX

Happiness is - positive intake manifold pressure.

__________________________________________________
">http://mail.yahoo.com





(You need to be a member of avrclub -- send a blank email to avrclub-subscribe@yahoogroups.com )