This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Memory initialization (not)
- From: Eljay Love-Jensen <eljay at adobe dot com>
- To: Jim Dougherty <j_dougherty at ecrm dot com>, GCC-help <gcc-help at gcc dot gnu dot org>
- Date: Tue, 30 Sep 2008 09:28:03 -0500
- Subject: Re: Memory initialization (not)
Hi Jim,
How do you access the battery backed RAM?
Is the battery backed RAM part of the heap? Special section?
On a system that I worked on, which had I/O memory at 0xC0000000, part of
which was battery backed memory, I used this:
char* RawC000Page = (char*)0xC0000000;
I also used this for the same memory:
struct C000Page_t* C000Page = (struct C000Page_t*)0xC0000000;
Note: some of the C000Page_t was write-only (reading would be BAD), some of
C000Page_t was read-only (writing would be BAD), some was read/write (but
reading and writing semantically meant different things to the I/O
register), and some was battery backed RAM (reading/writing okay).
The memory was not part of the heap, nor was it part of the .data or .bss
sections. I just wrangled a pointer to point to it. There was no OS, it
was just the code in EEPROM, bootstrapped from an initialization ROM. There
was a managed heap using malloc/free, but that heap was no where near the
0xC0000000 page. The stack was carved out of the heap.
Would something like this work for you?
HTH,
--Eljay