Add debugging support with simavr
This commit is contained in:
parent
7a9eb33c51
commit
b014926833
6
Makefile
6
Makefile
@ -42,9 +42,11 @@ CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
|
||||
#CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
|
||||
CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CSTANDARD) $(CEXTRA)
|
||||
|
||||
|
||||
#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
|
||||
|
||||
ifeq ($(BUILD),debug)
|
||||
CFLAGS += -DDEBUG
|
||||
endif
|
||||
|
||||
#Additional libraries.
|
||||
|
||||
@ -140,6 +142,8 @@ program: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
|
||||
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
|
||||
|
||||
|
||||
debug:
|
||||
make "BUILD=debug"
|
||||
|
||||
|
||||
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
|
||||
|
16
include/debug.h
Normal file
16
include/debug.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
#include <avr/io.h>
|
||||
#include "/usr/include/simavr/avr/avr_mcu_section.h"
|
||||
AVR_MCU(F_CPU, "atmega328p");
|
||||
const struct avr_mmcu_vcd_trace_t _mytrace[] _MMCU_ = {
|
||||
{ AVR_MCU_VCD_SYMBOL("DDRB"), .what = (void *) &DDRB, },
|
||||
{ AVR_MCU_VCD_SYMBOL("DDRD"), .what = (void *) &DDRD, },
|
||||
{ AVR_MCU_VCD_SYMBOL("PORTD"), .what = (void *) &PORTD, },
|
||||
{ AVR_MCU_VCD_SYMBOL("TCCR0B"), .what = (void *) &TCCR0B, },
|
||||
{ AVR_MCU_VCD_SYMBOL("TCCR0A"), .what = (void *) &TCCR0A, },
|
||||
{ AVR_MCU_VCD_SYMBOL("OCR0A"), .what = (void*)&OCR0A, },
|
||||
};
|
||||
|
||||
#endif /* DEBUG_H */
|
@ -5,6 +5,10 @@
|
||||
#include "main.h"
|
||||
#include "io.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "debug.h"
|
||||
#endif /* DEBUG */
|
||||
|
||||
void initIO()
|
||||
{
|
||||
DDRD |= (1 << LED_1);
|
||||
|
Loading…
Reference in New Issue
Block a user