EmbDev.net

Forum: ARM programming with GCC/GNU tools Using Flash and Ram


von Hussam H. (halherta)


Rate this post
useful
not useful
Hi all, I've been following this forum for sometime now but I'm still
lost on a few issues regarding how WinArm deals with the ROM/RAM issue.
I am a newbie....I realize that there is alot of questions here and i
appreciate help with any of them if not all of them...thank you for your
time and guidance!


1-When using the function attribute:
"__attribute__ ((long_call, section (".data")))" does this store the
function purely in RAM or does it store it in FLASH and then load it
into ram on runtime..i.e. if the device is reset will ths function
disappear?


2-If i use .fastrun or .data in the above function attribute declaration
does it make any difference?


3-Does the linker store the .data and .bss sections in ram only or does
it store them in flash and then load them into ram at runtime? and what
is the difference between this definition

.data :
{

 _data = .;
*(.data)
_edata = .;
} >ram AT >flash
 and this one in the linker script ? (">ram" vs ">ram AT > flash")
.data :
{

 _data = .;
*(.data)
_edata = .;
} >ram

4-I realize that in the LPC2XXX devices that the Interrupt vector table
can be remapped into RAM by setting the Memmap bits appropriately...How
would i code the ISR's in RAM as well

5-In the linker scripts (almost all the ones i saw) what does this do?

.stack ALIGN(256) :

  {

    . += STACK_SIZE;

    PROVIDE (_stack = .);

  } > RAM

6- Finally,in the lpc2129_ramfunction_20050510.zip there are two linker
scripts; RAM-based one for debugging and the rom_based one for
execution...why does the RAM-based one define ENTRY at _start and the
ROM-based one define ENTRY at _boot?

thanx!
Hussam

von Martin Thomas (Guest)


Rate this post
useful
not useful
Hussam Hertani wrote:

> 1-When using the function attribute:
> "__attribute__ ((long_call, section (".data")))" does this store the
> function purely in RAM or does it store it in FLASH and then load it
> into ram on runtime..i.e. if the device is reset will ths function
> disappear?

The funtion-code is also in Flash since it has to be compied into RAM
after Power-On or Reset. It gets executed from RAM. The code may still
be in RAM on Reset depends on how the controller internly initializes
it's RAM.

> 2-If i use .fastrun or .data in the above function attribute declaration
> does it make any difference?

An extra section ".fastrun" (or whatever name you choose) provides
better control i.e. to determine the size of the fastrun-functions and
for alignment in the linker-script. The basic handling is the same. Make
sure to adapt the linker-script if you a "choosen" section and not data.

> 3-Does the linker store the .data and .bss sections in ram only or does
> it store them in flash and then load them into ram at runtime? and what
> is the difference between this definition
>
> .data :
> {
>
>  _data = .;
> *(.data)
> _edata = .;
> } >ram AT >flash
>  and this one in the linker script ? (">ram" vs ">ram AT > flash")
> .data :
> {
>
>  _data = .;
> *(.data)
> _edata = .;
> } >ram

.data is used for initialization so a copy of these values is needed in
persistant memory. So data "consumes" Flash and RAM. Variables in bss
are known to init with 0 so no flash ist needed for
initialization-values.

> 4-I realize that in the LPC2XXX devices that the Interrupt vector table
> can be remapped into RAM by setting the Memmap bits appropriately...How
> would i code the ISR's in RAM as well

Use a section-attribute and place this section in RAM. Some of my
examples demonstrate this.

> 5-In the linker scripts (almost all the ones i saw) what does this do?
>
> .stack ALIGN(256) :
>
>   {
>
>     . += STACK_SIZE;
>
>     PROVIDE (_stack = .);
>
>   } > RAM

Reserves space for the stack in RAM for a setup where the stack located
is between "data" and "heap".

> 6- Finally,in the lpc2129_ramfunction_20050510.zip there are two linker
> scripts; RAM-based one for debugging and the rom_based one for
> execution...why does the RAM-based one define ENTRY at _start and the
> ROM-based one define ENTRY at _boot?

Hmm, don't remember why. Have to look at this code later.

Martin

von Hussam H. (halherta)


Rate this post
useful
not useful
Martin,
Thanks for your prompt response!

Hussam

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.