IAR does this even simpler - use the __ramfunc declarator on the
function. It is all auto-magic.
In LPC, it doesn't matter - RAM and FLASH are essentially the same speed
(barring branches). But on other ARMs, Flash may be very slow, so
copying to RAM is important for critical routines.
_____
From: lpc2000@yahoogroups.com [mailto:lpc2000@yahoogroups.com] On Behalf
Of Karl Olsen
Sent: Wednesday, January 18, 2006 2:14 AM
To: lpc2000@yahoogroups.com
Subject: [lpc2000] Re: How to get a function running in RAM
(Lpc21xx+GnuArm)?
--- In lpc2000@yahoogroups.com, "arkeryd" <arkeryd@y...> wrote:
> I am using uVision3 ide together with GnuArm compiler on LPC21xx.
>
> I need to have some interrupts enabled while using the IAP
> functions, and therefore have to place some interrupt service
> routines in RAM.
>
> I have been looking around in documents and example files, but have
> not found any solid info on this yet.
>
> Any example, or hint of how to achieve this would be much
> appreciated!
Put it in the .data section, and the startup code should copy it from
flash to RAM, just like initialization values for initialized data.
You'll get some assembler warnings "Warning: ignoring changed section
attributes for .data" that I haven't found out how to silence. It
works for me.
void ramfunc (int i) __attribute__ ((section(".data")));
void ramfunc (int i)
{
/* ... */
}
You cannot call such functions directly from flash functions (or call
flash functions from RAM functions) because RAM and flash are further
apart than a BL instruction can reach. You can use calls through
function pointers instead.
Karl Olsen
SPONSORED LINKS
Microprocessor
<http://groups.yahoo.com/gads?t=ms&k=Microprocessor&w1=Microprocessor&w2
=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocessor&c=4&s=9
3&.sig=tsVC-J9hJ5qyXg0WPR0l6g>
Microcontrollers
<http://groups.yahoo.com/gads?t=ms&k=Microcontrollers&w1=Microprocessor&
w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocessor&c=4&s
=93&.sig=DvJVNqC_pqRTm8Xq01nxwg>
Pic microcontrollers
<http://groups.yahoo.com/gads?t=ms&k=Pic+microcontrollers&w1=Microproces
sor&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocessor&c
=4&s=93&.sig=TpkoX4KofDJ7c6LyBvUqVQ>
8051 microprocessor
<http://groups.yahoo.com/gads?t=ms&k=8051+microprocessor&w1=Microprocess
or&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocessor&c=
4&s=93&.sig=1Ipf1Fjfbd_HVIlekkDP-A>
_____
YAHOO! GROUPS LINKS
* Visit your group "lpc2000
<http://groups.yahoo.com/group/lpc2000> " on the web.
* To unsubscribe from this group, send an email to:
lpc2000-unsubscribe@yahoogroups.com
<mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> .
_____
[Non-text portions of this message have been removed]Message
RE: [lpc2000] Re: How to get a function running in RAM (Lpc21xx+GnuArm)?
2006-01-18 by Dan Beadle
Attachments
- No local attachments were found for this message.