1

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.

Shridhar R Kulkarni
  • 6,653
  • 3
  • 37
  • 57
  • Compute the "RAM and ROM overhead" of what? Relative to what? –  Apr 27 '17 at 07:12
  • The compiler will tell you how much ROM and RAM (static) are used. You need ot calculate the dynamic allocation of RAM if it exists. – i486 Apr 27 '17 at 07:30
  • @i486: Thanks! Can you please tell me any more details like where exactly can I see what compiler tells? – Shridhar R Kulkarni Apr 27 '17 at 07:33
  • @ShridharR.Kulkarni It depends from compiler and IDE. In my compiler the used memory is displayed right to each `.c` file after compilation (in source file tree). See also the final message after compilation - maybe there is Total of used RAM/ROM. – i486 Apr 27 '17 at 07:36
  • @i486: Okay. I am using mspgcc, gedit as text editor, no IDE and compilation is initiated from cooja simulator. – Shridhar R Kulkarni Apr 27 '17 at 07:39
  • @ShridharR.Kulkarni Find IDE for the same platform - it will show extra info. Probably Keil or other major IDE will be able to run in demo mode. – i486 Apr 27 '17 at 08:00

1 Answers1

3

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.

kfx
  • 8,136
  • 3
  • 28
  • 52