SimAVR
AVR Simulator
sim_elf.h
Go to the documentation of this file.
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 it under the terms of the GNU
9  * General Public License as published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * simavr is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
13  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14  * Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along with simavr. If not, see
17  * <http://www.gnu.org/licenses/>.
18  */
19 
28 #ifndef __SIM_ELF_H__
29 #define __SIM_ELF_H__
30 
31 #include "avr/avr_mcu_section.h"
32 
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37 
38 #ifndef ELF_SYMBOLS
39 #define ELF_SYMBOLS 1
40 #endif
41 
43 #define AVR_SEGMENT_OFFSET_FLASH 0
44 #define AVR_SEGMENT_OFFSET_EEPROM 0x00810000
45 
46 #include "sim_avr.h"
47 
48  typedef struct elf_firmware_t
49  {
50  char mmcu[64];
51  uint32_t frequency;
52  uint32_t vcc, avcc, aref;
53 
54  char tracename[128];
55  uint32_t traceperiod;
57  struct
58  {
59  uint8_t mask;
60  uint16_t addr;
61  char name[64];
62  } trace[32];
63 
64  struct
65  {
66  char port;
67  uint8_t mask, value;
68  } external_state[8];
69 
70  // register to listen to for commands from the firmware
73 
74  uint32_t flashbase;
75  uint8_t *flash;
76  uint32_t flashsize;
77  uint32_t datasize;
78  uint32_t bsssize;
79  // read the .eeprom section of the elf, too
80  uint8_t *eeprom;
81  uint32_t eesize;
82 
83 #if ELF_SYMBOLS
85  uint32_t symbolcount;
86 #endif
88 
90  int elf_read_firmware (const char *file, elf_firmware_t * firmware);
92  void avr_load_firmware (avr_t * avr, elf_firmware_t * firmware);
93 
94 #ifdef __cplusplus
95 };
96 #endif
97 
98 #endif /*__SIM_ELF_H__*/
99 
char port
Definition: sim_elf.h:66
uint32_t aref
Definition: sim_elf.h:52
int tracecount
Definition: sim_elf.h:56
struct elf_firmware_t::@32 external_state[8]
struct elf_firmware_t::@31 trace[32]
uint32_t frequency
Definition: sim_elf.h:51
uint8_t * eeprom
Definition: sim_elf.h:80
char name[64]
Definition: sim_elf.h:61
avr_t * avr
Definition: run_avr.c:54
uint8_t value
Definition: sim_elf.h:67
uint16_t command_register_addr
Definition: sim_elf.h:71
uint32_t flashsize
Definition: sim_elf.h:76
void avr_load_firmware(avr_t *avr, elf_firmware_t *firmware)
Load the firmware to the AVR instance.
Definition: sim_elf.c:43
avr_symbol_t ** symbol
Definition: sim_elf.h:84
uint32_t bsssize
Definition: sim_elf.h:78
Definition: sim_elf.h:48
int elf_read_firmware(const char *file, elf_firmware_t *firmware)
Read an ELF firmware.
Definition: sim_elf.c:234
uint16_t addr
Definition: sim_elf.h:60
uint16_t console_register_addr
Definition: sim_elf.h:72
uint32_t avcc
Definition: sim_elf.h:52
char mmcu[64]
Definition: sim_elf.h:50
uint32_t eesize
Definition: sim_elf.h:81
uint32_t flashbase
base address
Definition: sim_elf.h:74
uint32_t vcc
Definition: sim_elf.h:52
uint32_t traceperiod
Definition: sim_elf.h:55
Symbol loaded from the .elf file.
Definition: sim_avr.h:303
char tracename[128]
trace filename
Definition: sim_elf.h:54
uint32_t datasize
Definition: sim_elf.h:77
uint32_t symbolcount
Definition: sim_elf.h:85
uint8_t mask
Definition: sim_elf.h:59
Main AVR instance.
Definition: sim_avr.h:142
struct elf_firmware_t elf_firmware_t
uint8_t * flash
Definition: sim_elf.h:75