410
uint16_t sp
Definition: sim_avr.h:114
struct avr_symbol_t ** codeline
Definition: sim_avr.h:104
void avr_callback_sleep_raw(avr_t *avr, avr_cycle_count_t howLong)
Definition: sim_avr.c:343
void * c
Definition: sim_avr.h:258
void avr_callback_sleep_gdb(avr_t *avr, avr_cycle_count_t howLong)
These are callbacks for the two 'main' behaviour in simavr.
Definition: sim_avr.c:283
uint32_t frequency
frequency we are running at
Definition: sim_avr.h:159
uint32_t e2end
Definition: sim_avr.h:148
#define AVR_IO_TO_DATA(v)
Map an IO address to the SRAM address space, i.e. add the register file offset to the address...
Definition: sim_avr.h:68
void avr_loadcode(avr_t *avr, uint8_t *code, uint32_t size, avr_flashaddr_t address)
Load code in the "flash".
Definition: sim_avr.c:252
void * param
Definition: sim_avr.h:234
we're free running
Definition: sim_avr.h:93
struct avr_gdb_t * gdb
gdb hooking structure. Only present when gdb server is active
Definition: sim_avr.h:288
avr_io_addr_t rampz
optional, only for ELPM/SPM on >64Kb cores
Definition: sim_avr.h:152
int old_pci
Definition: sim_avr.h:116
uint8_t vector_size
Definition: sim_avr.h:149
void avr_terminate(avr_t *avr)
Finish any pending operations.
Definition: sim_avr.c:118
int avr_run(avr_t *avr)
Run one cycle of the AVR, sleep if necessary.
Definition: sim_avr.c:396
uint16_t ramend
Definition: sim_avr.h:146
uint32_t aref
(optional) voltages in millivolts
Definition: sim_avr.h:161
struct avr_t::@27 io_shared_io[4]
struct avr_symbol_t avr_symbol_t
Symbol loaded from the .elf file.
uint16_t avr_io_addr_t
Definition: sim_avr_types.h:37
uint32_t addr
Definition: sim_avr.h:305
avr_flashaddr_t pc
Current PC Note that the PC is representing /bytes/ while the AVR value is assumed to be "words"...
Definition: sim_avr.h:221
16 bits register pairs
Definition: sim_avr.h:78
int gdb_port
if non-zero, the gdb server will be started when the core crashed even if not activated at startup if...
Definition: sim_avr.h:292
void avr_reset(avr_t *avr)
Resets the AVR, and the IO modules.
Definition: sim_avr.c:145
const char * mmcu
name of the AVR
Definition: sim_avr.h:144
uint8_t * data
SRAM memory, starting by the general purpose registers, and IO registers.
Definition: sim_avr.h:265
avr_t * avr
Definition: run_avr.c:54
avr_io_addr_t eind
optional, only for EIJMP/EICALL on >64Kb cores
Definition: sim_avr.h:153
Interrupt vectors, and their enable/clear registers.
Definition: sim_interrupts.h:51
int avr_init(avr_t *avr)
Initializes a new AVR instance. Will call the IO registers init(), and then reset() ...
Definition: sim_avr.c:78
struct avr_trace_data_t * trace_data
Only used if CONFIG_SIMAVR_TRACE is defined.
Definition: sim_avr.h:279
IRQ Pool structure.
Definition: sim_irq.h:69
uint8_t trace
DEBUG ONLY – value ignored if CONFIG_SIMAVR_TRACE = 0.
Definition: sim_avr.h:276
avr_io_read_t c
Definition: sim_avr.h:235
avr software stopped gracefully
Definition: sim_avr.h:97
uint32_t flashend
Definition: sim_avr.h:147
uint32_t avcc
Definition: sim_avr.h:161
void avr_set_command_register(avr_t *avr, avr_io_addr_t addr)
Set an IO register to receive commands from the AVR firmware it's optional, and uses the ELF tags...
Definition: sim_avr.c:216
avr_t * avr_make_mcu_by_name(const char *name)
Locate the maker for mcu "name" and allocates a new avr instance.
Definition: sim_avr.c:411
stack pointer
Definition: sim_avr.h:80
struct avr_t avr_t
Main AVR instance.
uint8_t address_size
2, or 3 for cores >128KB in flash
Definition: sim_avr.h:154
uint8_t fuse[4]
Definition: sim_avr.h:151
avr_cycle_timer_pool_t cycle_timers
Cycle timers tracking & delivery.
Definition: sim_avr.h:271
void(* special_deinit)(struct avr_t *avr, void *data)
called at termination time ( to clean special initializations)
Definition: sim_avr.h:182
uint32_t avr_flashaddr_t
Definition: sim_avr.h:58
uint8_t log
log level, default to 1
Definition: sim_avr.h:276
uint32_t sleep_usec
Sleep requests are accumulated in sleep_usec until the minimum sleep value is reached, at which point sleep_usec is cleared and the sleep request is passed on to the operating system.
Definition: sim_avr.h:175
avr_cycle_count_t cycle
current cycle
Definition: sim_avr.h:165
all is stopped, timers included
Definition: sim_avr.h:92
Timer pool contains a pool of timer slots available, they all start queued into the 'free' qeueue...
Definition: sim_cycle_timers.h:70
void(* avr_io_write_t)(struct avr_t *avr, avr_io_addr_t addr, uint8_t v, void *param)
Definition: sim_avr.h:63
avr_int_table_t interrupts
Interrupt vectors and delivery fifo.
Definition: sim_avr.h:273
void avr_callback_run_gdb(avr_t *avr)
Definition: sim_avr.c:291
void(* reset)(struct avr_t *avr)
called at reset time
Definition: sim_avr.h:186
const char * names[4]
name aliases
Definition: sim_avr.h:298
void avr_global_logger(struct avr_t *avr, const int level, const char *format,...)
Logs a message using the current logger.
Definition: sim_avr.c:54
struct avr_t::@26 io[MAX_IOs]
Callback when specific IO registers are read/written.
void * special_data
value passed to special_init() and special_deinit()
Definition: sim_avr.h:184
uint8_t signature[3]
Definition: sim_avr.h:150
SREG bit indexes.
Definition: sim_avr.h:75
uint8_t sreg[8]
Mirror of the SREG register, to facilitate the access to bits in the opcode decoder.
Definition: sim_avr.h:207
void(* avr_run_t)(struct avr_t *avr)
Definition: sim_avr.h:137
real SREG
Definition: sim_avr.h:82
avr_cycle_count_t run_cycle_count
cycles to run before next timer
Definition: sim_avr.h:169
#define OLD_PC_SIZE
DEBUG ONLY This keeps track of "jumps" ie, call,jmp,ret,reti and so on allows dumping of a meaningful...
Definition: sim_avr.h:110
tell gdb it's all OK, and give it registers
Definition: sim_avr.h:96
void avr_global_logger_set(avr_logger_p logger)
Sets a global logging function in place of the default.
Definition: sim_avr.c:64
struct avr_irq_t * irq
optional, used only if asked for with avr_iomem_getirq()
Definition: sim_avr.h:231
void avr_set_console_register(avr_t *avr, avr_io_addr_t addr)
Specify the "console register" – output sent to this register is printed on the simulator console...
Definition: sim_avr.c:245
avr_io_write_t c
Definition: sim_avr.h:240
uint8_t(* avr_io_read_t)(struct avr_t *avr, avr_io_addr_t addr, void *param)
Definition: sim_avr.h:62
uint32_t codeend
filled by the ELF data, this allow tracking of invalid jumps
Definition: sim_avr.h:156
uint64_t avr_cycle_count_t
Definition: sim_avr_types.h:36
uint8_t * flash
Flash memory (initialized to 0xff, and code loaded into it)
Definition: sim_avr.h:263
uint32_t avr_pending_sleep_usec(avr_t *avr, avr_cycle_count_t howLong)
Accumulates sleep requests (and returns a sleep time of 0) until a minimum count of requested sleep m...
Definition: sim_avr.c:269
void(* init)(struct avr_t *avr)
Called at init time.
Definition: sim_avr.h:178
struct avr_kind_t avr_kind_t
Static constructor for each of the AVR devices.
avr_run_t run
Default AVR core run function.
Definition: sim_avr.h:192
void(* sleep)(struct avr_t *avr, avr_cycle_count_t howLong)
Sleep default behaviour.
Definition: sim_avr.h:198
avr software crashed (watchdog fired)
Definition: sim_avr.h:98
int io_shared_io_count
This block allows sharing of the IO write/read on addresses between multiple callbacks.
Definition: sim_avr.h:251
Symbol loaded from the .elf file.
Definition: sim_avr.h:303
This is only ever used if CONFIG_SIMAVR_TRACE is defined.
Definition: sim_avr.h:102
void avr_callback_run_raw(avr_t *avr)
Definition: sim_avr.c:353
uint32_t touched[256/32]
DEBUG ONLY keeps track of which registers gets touched by instructions reset before each new instruct...
Definition: sim_avr.h:134
we're now sleeping until an interrupt
Definition: sim_avr.h:94
run ONE instruction, then...
Definition: sim_avr.h:95
avr_logger_p avr_global_logger_get(void)
Gets the current global logger function.
Definition: sim_avr.c:70
void(* special_init)(struct avr_t *avr, void *data)
called at init time (for special purposes like using a memory mapped file as flash see: simduino) ...
Definition: sim_avr.h:180
int state
stopped, running, sleeping
Definition: sim_avr.h:158
struct avr_io_t * io_port
Queue of io modules.
Definition: sim_avr.h:268
void(* avr_logger_p)(struct avr_t *avr, const int level, const char *format, va_list ap)
Type for custom logging functions.
Definition: sim_avr.h:352
avr_irq_pool_t irq_pool
Every IRQs will be stored in this pool.
Definition: sim_avr.h:203
uint8_t avr_core_watch_read(avr_t *avr, uint16_t addr)
Definition: sim_core.c:195
struct avr_vcd_t * vcd
Value Change Dump file (waveforms) This is the VCD file that gets allocated if the firmware that is l...
Definition: sim_avr.h:285
struct avr_trace_data_t::@25 old[OLD_PC_SIZE]
catches reset..
Main AVR instance.
Definition: sim_avr.h:142
IO module base struct Modules uses that as their first member in their own struct.
Definition: sim_io.h:42
int used
Definition: sim_avr.h:254
before initialization is finished
Definition: sim_avr.h:91
uint32_t pc
Definition: sim_avr.h:113
Public IRQ structure.
Definition: sim_irq.h:76
const char symbol[0]
Definition: sim_avr.h:306
void avr_sadly_crashed(avr_t *avr, uint8_t signal)
Called when the core has detected a crash somehow.
Definition: sim_avr.c:173
Bigger AVRs need more than 256-32 (mega1280)
Definition: sim_avr.h:85
avr_cycle_count_t run_cycle_limit
maximum run cycle interval limit
Definition: sim_avr.h:170
avr_t * avr_core_allocate(const avr_t *core, uint32_t coreLen)
Used by the cores, allocated a mutable avr_t from the const global.
Definition: sim_avr.c:403
Static constructor for each of the AVR devices.
Definition: sim_avr.h:296
uint32_t vcc
Definition: sim_avr.h:161
int8_t interrupt_state
Interrupt state: 00: idle (no wait, no pending interrupts) or disabled <0: wait till zero >0: interru...
Definition: sim_avr.h:214
Definition: sim_vcd_file.h:61
void avr_core_watch_write(avr_t *avr, uint16_t addr, uint8_t v)
These are accessors for avr->data but allows watchpoints to be set for gdb IO modules use that to set...
Definition: sim_core.c:156