This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: How to declare an array of constants to be stored in FLASH only
- From: "Steven L. Zook" <SLZook at Qualstar dot com>
- To: "Jeff Krueger" <JKrueger at rft dot com>,<gcc-help at gcc dot gnu dot org>
- Cc: <dmgarske at yahoo dot com>
- Date: Mon, 3 Oct 2005 14:46:55 -0700
- Subject: RE: How to declare an array of constants to be stored in FLASH only
Look at __attribute__(section("section_name")) in conjunction with the
linker file to achieve what you're after.
-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Jeff Krueger
Sent: Monday, October 03, 2005 2:03 PM
To: gcc-help@gcc.gnu.org
Cc: dmgarske@yahoo.com
Subject: How to declare an array of constants to be stored in FLASH only
I am using the GCC compiler for an Atmel ATMEGA128 target.
I would like to declare a large array of constants so that it is
accessible from FLASH and does not use RAM.
static const unsigned char Data[] = {0x45, 0x23, .....} The above seems
to copy the constant data into RAM Is there a way to declare the above
array so that it does not create an initialized data in RAM I was able
to do this with a different compiler/linker with the __flash keyword
static const __flash unsigned char Data[] = {0x45, 0x23, .....} Thanks
in advance, Jeff