Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: How to get a function running in RAM (Lpc21xx+GnuArm)?

2006-01-18 by Karl Olsen

--- 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

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.