How to place Variables into flash instead of RAM?

Guest #1172220
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
Guest #1172221
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.
Guest #1172222
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
Guest #1172223
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

A question of your own? This thread is over 19 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.