Search code examples
cmsp430contiki

RAM and ROM usage


I have modified contiki code to implement a solution to an attack. I want to measure the RAM and ROM usage of modified contiki code. What is the standard way to compute RAM and ROM usage in contiki? I am using Tmote sky motes in cooja simulator.

I could read in a conference paper about msp430-size tool but I found no resources for the same.

I am using mspgcc, gedit as text editor, no IDE and compilation is initiated from cooja simulator.


Solution

  • Use the msp430-size tool. If comes with your msp430-gcc compiler, as part of msp430 binutils.

    $ make TARGET=z1
     CC        ../../platform/z1/./contiki-z1-platform.c
     CC        ../../cpu/msp430/f2xxx/msp430.c
     CC        ../../cpu/msp430/./watchdog.c
     ...
    $ msp430-size hello-world.elf 
      text     data     bss     dec     hex filename
     63364      694   11848   75906   12882 hello-world.elf
    
    $ msp430-size obj_z1/cc2420.o 
     text      data     bss     dec     hex filename
     3014        13       9    3036     bdc obj_z1/cc2420.o
    

    The output shows the size of statically allocated RAM (.data and .bss sections) and ROM (.text section). Contiki does not really use dynamic memory allocation, so this information is sufficient to determine the run-time usage (excluding stack usage, but since you ask for the "standard way", reporting these numbers is sufficient, as that is what's done in most papers and expected by the research community).

    If you want more detailed info about individual functions and variables, use msp430-objdump -x.