Table of Contents

1. Compiler Version and Dwarf Debug Information
2. Building eSimu
3. Compiling WSim with eSimu option

In order to use eSimu with WSim your toolchain must be able to generate Dwarf debug information format in the ELF file.

WSim have been tested and is known to work for MSP430 microcontrollers with the following configuration:

1. Compiler Version and Dwarf Debug Information

To test the version of your MSPGCC and check that you are at least using version 4.x you can use the --version

	     
shell$ msp430-gcc --version
msp430-gcc (MSPGCC4_r4-20100210) 4.4.3
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
	  
	

Dwarf information can be verified in ELF file using the msp430-readelf. Your elf file must contain valid debug information that can be found in debug_* sections of the file. The following example shows a valid elf file containing dwarf debug information section.

	     
shell$ msp430-readelf -S wsn430-demo.elf 
There are 17 section headers, starting at offset 0x1c210:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        00004000 0000b4 0035fa 00  AX  0   0  2
  [ 2] .data             PROGBITS        00001100 0036ae 00000c 00  WA  0   0  2
  [ 3] .bss              NOBITS          0000110c 0000b4 000050 00  WA  0   0  2
  [ 4] .vectors          PROGBITS        0000ffe0 0036ba 000020 00  AX  0   0  1
  [ 5] .debug_aranges    PROGBITS        00000000 0036da 00008c 00      0   0  1
  [ 6] .debug_pubnames   PROGBITS        00000000 003766 004dc7 00      0   0  1
  [ 7] .debug_info       PROGBITS        00000000 00852d 00d1d2 00      0   0  1
  [ 8] .debug_abbrev     PROGBITS        00000000 0156ff 0011aa 00      0   0  1
  [ 9] .debug_line       PROGBITS        00000000 0168a9 002524 00      0   0  1
  [10] .debug_frame      PROGBITS        00000000 018dce 0009cc 00      0   0  2
  [11] .debug_str        PROGBITS        00000000 01979a 001ab2 01  MS  0   0  1
  [12] .debug_loc        PROGBITS        00000000 01b24c 000e53 00      0   0  1
  [13] .debug_ranges     PROGBITS        00000000 01c09f 0000c4 00      0   0  1
  [14] .shstrtab         STRTAB          00000000 01c163 0000ab 00      0   0  1
  [15] .symtab           SYMTAB          00000000 01c4b8 002040 10     16 346  4
  [16] .strtab           STRTAB          00000000 01e4f8 001250 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)
	
      

If you still use gcc3 or a version without dwarf debug info your elf sections will look like these ones. The only debug information are the symbol table (.symtab) and eSimu won't work on your file. You must upgrade your toolchain.

	     
shell$ msp430-readelf -S wsn430-demo.elf 
There are 10 section headers, starting at offset 0x14a30:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        00004000 0000b4 002f2c 00  AX  0   0  2
  [ 2] .data             PROGBITS        00001100 002fe0 00001c 00  WA  0   0  2
  [ 3] .bss              NOBITS          0000111c 0000b4 000036 00  WA  0   0  2
  [ 4] .vectors          PROGBITS        0000ffe0 002ffc 000020 00  AX  0   0  1
  [ 5] .stab             PROGBITS        00000000 00301c 00adac 0c      6   0  4
  [ 6] .stabstr          STRTAB          00000000 00ddc8 006c21 00      0   0  1
  [ 7] .shstrtab         STRTAB          00000000 0149e9 000044 00      0   0  1
  [ 8] .symtab           SYMTAB          00000000 014bc0 001e10 10      9 312  4
  [ 9] .strtab           STRTAB          00000000 0169d0 0012ad 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)
	
      

2. Building eSimu

eSimu is build around two libraries ecalib and etracelib. The build process is straightforward if you have the right libdwarf version, flex and bison.

	
$ (cd ecalib ; make)
$ (cd etracelib ; make)
$ (cd esimu-ng ; make)
	
      

3. Compiling WSim with eSimu option

The eSimu backend is not yet enabled by default in the WSim build process. A special version of WSim, linked to eSimu libtrace library needs to be generated.

Once the eSimu libraries and binary have been generated, you can compile a new version of your simulator using the following configure options.

	
$ configure [...] --enable-etrace \
          --with-etracelib-prefix=[path-to-esimu-src]/etracelib
	
      

Important parts of the command line are the etrace and etracelib options.

The build process will produce wsim-* binaries as usual but they will contain to more options with regards to a standard build:

	

[...]
   --esimu[=arg]          : enable energy trace
   --esimu-start          : enable energy trace from simulation start
[...]