ELF: Redone the .mmcu section
[simavr] / simavr / sim / sim_elf.h
1 /*
2         sim_elf.h
3
4         Copyright 2008, 2009 Michel Pollet <buserror@gmail.com>
5
6         This file is part of simavr.
7
8         simavr is free software: you can redistribute it and/or modify
9         it under the terms of the GNU General Public License as published by
10         the Free Software Foundation, either version 3 of the License, or
11         (at your option) any later version.
12
13         simavr is distributed in the hope that it will be useful,
14         but WITHOUT ANY WARRANTY; without even the implied warranty of
15         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16         GNU General Public License for more details.
17
18         You should have received a copy of the GNU General Public License
19         along with simavr.  If not, see <http://www.gnu.org/licenses/>.
20  */
21
22 #ifndef ELF_H_
23 #define ELF_H_
24
25 #include "avr_mcu_section.h"
26
27 #ifndef ELF_SYMBOLS
28 #define ELF_SYMBOLS 1
29 #endif
30
31 #include "sim_avr.h"
32
33 typedef struct elf_firmware_t {
34         char  mmcu[64];
35         uint32_t        frequency;
36
37         char            tracename[128]; // trace filename
38         uint32_t        traceperiod;
39         int                     tracecount;
40         struct {
41                 uint8_t mask;
42                 uint16_t addr;
43                 char    name[64];
44         } trace[32];
45         
46         uint8_t * flash;
47         uint32_t flashsize;
48         uint32_t datasize;
49         uint32_t bsssize;
50         // read the .eeprom section of the elf, too
51         uint8_t * eeprom;
52         uint32_t eesize;
53
54 #if ELF_SYMBOLS
55         avr_symbol_t **  codeline;
56         uint32_t                codesize;       // in elements
57 #endif
58 } elf_firmware_t ;
59
60 int elf_read_firmware(const char * file, elf_firmware_t * firmware);
61
62 void avr_load_firmware(avr_t * avr, elf_firmware_t * firmware);
63
64 #endif /* ELF_H_ */