From: Robin Krens Date: Thu, 19 May 2022 11:35:28 +0000 (+0200) Subject: makefile: added gdb X-Git-Url: https://robinkrens.nl/gitweb/?a=commitdiff_plain;h=30ec05023faf0b9c53437d12f1b27f97498a3193;p=lra-as-sensor makefile: added gdb --- diff --git a/Makefile b/Makefile index f8cbf9e..8b4955b 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,19 @@ # attiny25 makefile MCU = attiny25 +DEVICE = t25 F_CPU = 8000000UL BAUD = 57600 PROGRAMMER_TYPE = usbasp CC = avr-gcc +GDB = avr-gdb OBJCOPY = avr-objcopy OBJDUMP = avr-objdump AVRSIZE = avr-size AVRDUDE = avrdude +SIMAVR = simavr CPPFLAGS = -DF_CPU=$(F_CPU) -DBAUD=$(BAUD) -I. CFLAGS = -Os -g -Wall @@ -32,6 +35,7 @@ $(ODIR)/%.o: %.c $(DEPS) %.elf: $(OBJ) $(CC) $(CFLAGS) $(LDFLAGS) $(TARGET_ARCH) $^ -o $@ +# TODO: add fuse section with .j .fuse %.hex: %.elf $(OBJCOPY) -j .text -j .data -O ihex $< $@ @@ -49,17 +53,19 @@ clean: rm -rf $(ODIR)/*.o *.hex *.elf *.map check-dev: - $(AVRDUDE) -p t25 -c $(PROGRAMMER_TYPE) -b $(BAUD) + $(AVRDUDE) -p $(DEVICE) -c $(PROGRAMMER_TYPE) -b $(BAUD) flash: - $(AVRDUDE) -p t25 -c $(PROGRAMMER_TYPE) -b $(BAUD) -U flash:w:hbc.hex:i + $(AVRDUDE) -p $(DEVICE) -c $(PROGRAMMER_TYPE) -b $(BAUD) -U flash:w:hbc.hex:i read-flash-bin: - $(AVRDUDE) -p t25 -c $(PROGRAMMER_TYPE) -b $(BAUD) -P /dev/ttyUSB0 -U flash:r:flash.bin:r + $(AVRDUDE) -p $(DEVICE) -c $(PROGRAMMER_TYPE) -b $(BAUD) -P /dev/ttyUSB0 -U flash:r:flash.bin:r # simulator runs on localhost:1234 # load .elf file with avr-sim hex.elf # and start debugging sim: - simavr -f $(F_CPU) -m $(MCU) -g -t hbc.hex + $(SIMAVR) -f $(F_CPU) -m $(MCU) -g -t hbc.hex +gdb: + $(GDB) -x gdb-commands.txt hbc.elf diff --git a/gdb-commands.txt b/gdb-commands.txt new file mode 100644 index 0000000..ed8b387 --- /dev/null +++ b/gdb-commands.txt @@ -0,0 +1,2 @@ +target remote :1234 +layout next