avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Re: ROM data and far and huge ptrs


From: Volkmar Dierkes
Subject: [avr-gcc-list] Re: ROM data and far and huge ptrs
Date: Sun, 11 Apr 2004 16:14:04 +0200
User-agent: 40tude_Dialog/2.0.10.1de Hamster/2.0.4.0

On Fri, 9 Apr 2004 18:34:50 +0200, Baffaut Pierre-antoine wrote: 

> 1/ When defining something like "const unsigned char toto=0x5A",
> the compiler puts it in the .bss RAM segment and generates some
> code to initialize the value. I don't want it to happen so, to
> spare RAM space, initialization time and safety (risk of data
> corruption by SW bugs). I used the following workaround :
> defining const (ROM) data in one file, and allocating the .data
> segment of this file at a ROM address at link time. Anyone has a
> better solution ? 

Look for the attribute PROGMEM in the avr-libc documentation. With
this you store the (constant) data directly in flash. But than you
need the Program space functions like pgm_read_byte().

> 2/ If I declare a pointer (e.g. unsigned char * pXxxx), then
> avr-gcc generates a 16-bits ptr allowing only indirect accesses
> to the RAM. Usually, on other microcontroller, one needs to
> declare FAR or HUGE pointers so that these pointers are actually
> able to address any memory space (usually through a dedicated
> routine). Anyone can tell me how to define far or huge pointers,
> or how to define pointers on ROM constants ? 

I think the program space functions and the documentation gives you
more information for pointers on ROM constants.

HTH

Volkmar

_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list


reply via email to

[Prev in Thread] Current Thread [Next in Thread]