|
From: | David Sowa |
Subject: | Re: [avr-gcc-list] Large array in the FLASH size limitation |
Date: | Tue, 15 Oct 2002 10:15:34 -0400 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826 |
Alex Chernyshoff wrote:
Hi! My attempts to declare array of chars in the FLASH memory is failure, if size of array more then 0x07fff. Probably, GCC use INT data type to calculate array size... I use "avrfreaks" windows build AVR-GCC 3.2 with the avr-libc-20020630, makefile is standart with "MCU = atmega103" Is it a bug, or exist some way to avoid this size limitation?
None of the AVR c compilers seem to have come to grips with having an address space bigger than an int issue yet. Not that I'm complaining, the AVR is a great little micro but its 3 address space model does make it hard to map into standard c. I had this same issue on my project and here are the workarounds I use. For the arrays I need I wrote a utility that breaks the data into 0x7000 byte chunks. If these are declared one after another in your code the compiler/linker will put them continously into the flash and you can treat them like one big array. The next problem you may run into is that GCC can't give a proper pointer to a flash array that begins after the 0x8000 point in flash, it always converts them to an int for you. I ended up needing to write my own flash memory routines because the code generated by gcc uses the LPM instruction and I needed the ELPM instruction to get at the data past the 0x8000 point. So basically I'm saying, force the compiler to build the data into flash the way you want it, then get a pointer to your big block of stuff and get at it that way. Regards, David Sowa avr-gcc-list at http://avr1.org
[Prev in Thread] | Current Thread | [Next in Thread] |