VMCU_VECT - Milo-D/libvmcu-Virtual-MCU-Library GitHub Wiki
Defined in libvmcu_analyzer.h |
---|
typedef enum { ..., VMCU_VECT_USART_RX, ... } VMCU_VECT |
Enumeration of IRQ vectors, used to identify a single instance of vmcu_vector_t
. A complete listing of
VMCU_VECT can be found in libvmcu_analyzer.h
#include "libvmcu_analyzer.h" // VMCU_VECT
static void print_instruction(const vmcu_instr_t *instr) {
printf("%s", instr->mnem.base);
if(instr->dest.type != VMCU_OPTYPE_NONE)
printf(" %s,", instr->mnem.dest);
if(instr->src.type != VMCU_OPTYPE_NONE)
printf(" %s", instr->mnem.src);
printf(" %s\n", instr->mnem.comment);
}
int main(const int argc, const char **argv) {
vmcu_model_t *m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
vmcu_report_t *report = vmcu_analyze_file("file.srec", m328p);
for(uint32_t i = 0; i < report->progsize; i++) {
for(uint32_t j = 0; j < report->n_vector; j++) {
vmcu_vector_t *vector = &report->vector[j];
vmcu_instr_t *isr_start = vector->xto->i;
if(vector->id == VMCU_VECT_INT0)
// print start of INT0 ISR
print_instruction(isr_start);
}
}
}
vmcu_report_dtor(report);
vmcu_model_dtor(m328p);
return 0;
}
push r24
1 The integer value of a single VMCU_VECT
does not have a special meaning
2 VMCU_VECT_NONE
= -1 (no IRQ vector)
[1] see official device datasheet for the vector listing