This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RE : Using flash memory on AT91eb55


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]