diff --git a/components/xtensa/trax/test/Makefile b/components/xtensa/trax/test/Makefile new file mode 100644 index 0000000000..c8c24904c0 --- /dev/null +++ b/components/xtensa/trax/test/Makefile @@ -0,0 +1,39 @@ +PROG_BIN := test.bin +PROG_ELF := test.elf +OBJ := test.o +PREFIX := xtensa-esp32-elf- +CC := $(PREFIX)gcc +LD := $(PREFIX)ld +GDB ?= $(PREFIX)gdb +CFLAGS := -g -O0 +LDFLAGS := -L $(IDF_PATH)/components/bootloader/subproject/main/ld/esp32 \ + -T bootloader.ld \ + -u entry \ + -e entry \ + -g + +TRACE_FILE := trace_pro.bin +GDB_LOG := gdb_log.txt +GDB_LOG_REF := gdb_log_expected.txt + +all: $(PROG_BIN) + +$(PROG_ELF): $(OBJ) + $(LD) $(LDFLAGS) -o $@ $< + +$(PROG_BIN): $(PROG_ELF) + esptool.py --chip esp32 elf2image --output $@ --flash_freq 40m --flash_mode dio $< + +flash: $(PROG_BIN) + esptool.py --port $(ESPPORT) write_flash 0x1000 $(PROG_BIN) + +test: + rm -f $(TRACE_FILE) + $(GDB) -n --batch -x gdbinit | tee $(GDB_LOG) + diff $(GDB_LOG) $(GDB_LOG_REF) + @echo "Test pass" + +clean: + rm -f $(PROG_ELF) $(PROG_BIN) $(OBJ) $(TRACE_FILE) $(GDB_LOG) + +.PHONY: all clean flash test diff --git a/components/xtensa/trax/test/gdb_log_expected.txt b/components/xtensa/trax/test/gdb_log_expected.txt index da8fdc1022..b765388ee9 100644 --- a/components/xtensa/trax/test/gdb_log_expected.txt +++ b/components/xtensa/trax/test/gdb_log_expected.txt @@ -4,7 +4,7 @@ Hardware assisted breakpoint 1 at 0x4008043d: file test.c, line 22. Temporary breakpoint 1, entry () at test.c:22 22 for (int i = 0; i < 10; ++ i) { -Program stopped. +Program received signal SIGINT, Interrupt. entry () at test.c:26 26 } 0001: Indirect branch message, 2 packets, PC range 0x40080400 - 0x4008040a, target PC 0x40080411, icnt=9, uaddr=0x11, exc=0 @@ -38227,3 +38227,4 @@ Dump of assembler code from 0x4008042c to 0x40080430: 0x4008042c : entry a1, 32 0x4008042f : mov.n a7, a1 End of assembler dump. +[Inferior 1 (Remote target) detached]