EmbDev.net

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


von Gast (Guest)


Rate this post
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

von Gast (Guest)


Rate this post
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

von Martin Thomas (Guest)


Rate this post
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.

von Guest (Guest)


Rate this post
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

von Gast (Guest)


Rate this post
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

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.