EmbDev.net

Forum: ARM programming with GCC/GNU tools How to place Variables into flash instead of RAM?


Author: Gast (Guest)
Posted on:

Rate this post
0 useful
not useful
Hello

For testing purposes i wish to place some Structures and/or DataTables
into ROM instead of the Onchip RAM.
Is there a Way to do so in Sourcecode with some Attributes or Pragmas ?
I've tried to search the Forum for that Problem, but no Luck yet ..

thanks in advance

Author: Gast (Guest)
Posted on:

Rate this post
0 useful
not useful
well, after a search in the GCC Docs I've found that
"__attribute__ ((section (".text")))" (where ".text" is the sectionname
for my Flashdata)works fine for me. The Compiler issues a warning, but
the Section placement is done correct.

..

LG

Author: Martin Thomas (Guest)
Posted on:

Rate this post
0 useful
not useful
Gast wrote:
> well, after a search in the GCC Docs I've found that
> "__attribute__ ((section (".text")))" (where ".text" is the sectionname
> for my Flashdata)works fine for me. The Compiler issues a warning, but
> the Section placement is done correct.

If you link for flash/ROM: did you try just to add const? Works for me.
No need for an attribute.

Author: Guest (Guest)
Posted on:

Rate this post
0 useful
not useful
Martin Thomas wrote:

> If you link for flash/ROM: did you try just to add const? Works for me.
> No need for an attribute.

Hello Martin.

Sure, I tried. It doesn't work for me :( The mapfile shows the Data in
the .data Section and a Adresslookup from running Program does too.
I use CrossStudio for ARM with the GNU-C/C++ 4.1.0. Can you give any
Hint to get it work? Maybe a Linkeroption or something.. Just adding
const keyword for placing such Data into Flash sounds realy good.

Thanks in Advance

Author: Gast (Guest)
Posted on:

Rate this post
0 useful
not useful
It's me again ;)

After a short search if found the Fault on my Side. In the Project
Propertys the Section for constant Data was antered as .data instead of
.rodata.
Dont know how this happens, but it works fine now.

Thanks again

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.