From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29500 invoked by alias); 14 Dec 2007 11:20:44 -0000 Received: (qmail 29491 invoked by uid 22791); 14 Dec 2007 11:20:43 -0000 X-Spam-Check-By: sourceware.org Received: from londo.lunn.ch (HELO londo.lunn.ch) (80.238.139.98) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 14 Dec 2007 11:20:27 +0000 Received: from lunn by londo.lunn.ch with local (Exim 3.36 #1 (Debian)) id 1J38aW-0005oA-00; Fri, 14 Dec 2007 12:20:16 +0100 Date: Fri, 14 Dec 2007 13:07:00 -0000 From: Andrew Lunn To: Champion J?r?me Cc: Andrew Lunn , ecos-discuss@sourceware.org Message-ID: <20071214112016.GF13033@lunn.ch> Mail-Followup-To: Champion J?r?me , Andrew Lunn , ecos-discuss@sourceware.org References: <20071213154254.GA8694@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: [ECOS] Re: RE : [ECOS] Using flash memory on AT91eb55 X-SW-Source: 2007-12/txt/msg00083.txt.bz2 On Fri, Dec 14, 2007 at 11:38:31AM +0100, Champion J?r?me wrote: > The evaluation board has 3 memory : > > * 256K byte of 16-bit SRAM (upgradeable to 1 MB) > * 2M bytes of 16-bit Flash (of which 1 MB is available for user software) > * 4M bytes of Serial Data Flash (upgradeable to 16 MB) > > As I understand, the 256kb SRAM is used by the variables in my code. > > 1 mb of flash is used by my code which take 900 kb. > the other 1mb is used by the bootloader, which take only 200kb, so I think I can perhaps use the 800 other. > So I just have to make a "const char* myArray = 0x01050000" and the data will go there ? > > I can use the 4mb of serial flash, but I don't really know how to do it. > > Why is it revelent if I work in the ram or the rom, the error happen at compilation time? The compilation time error is just saying your don't have enough memory. Im assuming here it is saying you don't have enough RAM, but it could be saying the flash is too small. The difference between a RAM image and a ROM image is to do with where the code lives when executed. With a ROM image, the executable code stays in ROM, and only your stacks, writable variables etc are in RAM. With a RAM image, everything is is RAM, including the code. So a ROM image has the advantage you need less RAM. The disadvantage is that often flash is slower to read than RAM, so your program runs slower. If you have a ROM image, the linker needs to decide for each variable where to put it. Does it put it in RAM or in FLASH. Anything which can be modified has to be in RAM. Anything which is constant can be put in FLASH. So if you declare your array as const int foo[4] = { 1, 2, 3, 4}; the linker knows it can put it into FLASH. Without the const, it is possible your code does something like foo[2] = 42; and so it needs to be in RAM. Andrew -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss