[Tinyos-help] ROM, RAM, Flash and EEPROM (micaz)
Aurelien Francillon
aurelien.francillon at inrialpes.fr
Wed Aug 20 06:01:33 PDT 2008
Le Wednesday 20 August 2008 12:47:07 Nicola Wegner, vous avez écrit :
> Hi,
>
> I am a little confused about the ROM and RAM values that are printed
> to the command line when I compile a application for micaz.
>
> When I have over 4KB of RAM usage my applications do not start any
> more. In the micaz datasheet (
> http://www.xbow.com/Products/Product_pdf_files/Wireless_pdf/MICAZ_Datasheet
>.pdf) I can not even find a value for the RAM size. Only the following
> memory is listed:
> 128K bytes Program Flash Memory
> 512K bytes Measurement Serial Flash
> 4 K bytes Configuration EEPROM
>
> Program Flash Memory is the ROM memory I think. I do not understand
> why there is a EEPROM and Serial Flash memory. Is this perhaps a typo
> and they mean RAM an not EEPROM? If not can anybody please tell me
> what the RAM size for micaz is.
>
no the documentation is right ... but incomplete!
the atmega128 has
- 128K bytes Program Flash Memory:
basically it's where your program code is (and initial values of global
variables ) . The value given by "ROM usage" when you compile an application
is about this memory so an application with ROM usage above 128KB can't
possibly work ...
- 4 K bytes of SRAM:
this is the internal SRAM (i.e. data memory ) available on the atmega128
(it's possible to have external SRAM but it's not the case on the micaz) .
The value given as RAM when you build a tinyos application is the memory
needed by your application in this SRAM for DATA and BSS sections (basically
global variables allocated or not. IIRC, this does not includes HEAP size,
but usually does not matter as dynamic allocation isn't commonly used under
TinyOS ).
But be very careful, this value does not includes stack usage. My guess is
that it's not included simply because there is no straight forward way to get
this value... (tool and details see [2] ).
So this means that when you get a value close from 4KB at the end of
compilation, your program is very likely to crash, because the stack will
overflow on the BSS or DATA section (unless you have *zero* function
calls ;) ).
- 4 K bytes Configuration EEPROM :
it's internal to the atmega 128, AFAK it's rarely used. The only "official"
use I know is in the deluge bootloader :
tinyos-2.x/tos/lib/tosboot/avr/InternalFlashC.nc
it's used to store parameters between reboots (image to reprogram, node
id ... )
- 512K bytes Measurement Serial Flash :
this is the external (ie external to the atmega128, it's soldered on the pcb)
flash chip accessed trough io ports i.e. used by the components like
BlockStorageC ...
HTH,
Aurélien
[2] http://www.cs.utah.edu/~regehr/stacktool/
More information about the Tinyos-help
mailing list