From: RichardBarry Date: Fri, 27 Jul 2007 07:59:50 +0000 (+0000) Subject: Updated AVR32 demos and added AVR32 UC3B demo. X-Git-Tag: V4.4.0~5 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=116d974cd64580ee62c6ff0e2095f263916b56f9;p=freertos Updated AVR32 demos and added AVR32 UC3B demo. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@96 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Demo/AVR32_UC3/AT32UC3A/GCC/Makefile b/Demo/AVR32_UC3/AT32UC3A/GCC/Makefile index 1b829fe63..55ee8bc9a 100644 --- a/Demo/AVR32_UC3/AT32UC3A/GCC/Makefile +++ b/Demo/AVR32_UC3/AT32UC3A/GCC/Makefile @@ -13,12 +13,17 @@ # elf file.elf Link: create ELF output file from object files. # lss file.lss Create extended listing from target output file. # sym file.sym Create symbol table from target output file. +# hex file.hex Create Intel HEX image from ELF output file. # bin file.bin Create binary image from ELF output file. # sizes Display target size information. +# isp Use ISP instead of JTAGICE mkII when programming. # cpuinfo Get CPU information. # halt Stop CPU execution. +# chiperase Perform a JTAG Chip Erase command. +# erase Perform a flash chip erase. # program Program MCU memory from ELF output file. -# reset Reset CPU. +# secureflash Protect chip by setting security bit. +# reset Reset MCU. # debug Open a debug connection with the MCU. # run Start CPU execution. # readregs Read CPU registers. @@ -78,11 +83,13 @@ DPNDFILES = $(CSRCS:.c=.d) $(ASSRCS:.S=.d) CPPFILES = $(CSRCS:.c=.i) CC = avr32-gcc -CFLAGS = $(DEBUG) $(OPTIMIZATION) $(C_EXTRA_FLAGS) +CFLAGS = $(DEBUG) $(OPTIMIZATION) $(C_EXTRA_FLAGS) \ + $(PLATFORM_INC_PATH:%=-Wa,-I%) $(INC_PATH:%=-Wa,-I%) $(AS_EXTRA_FLAGS) ASFILES = $(CSRCS:.c=.x) $(ASSRCS:.S=.x) AS = avr32-as -ASFLAGS = $(DEBUG) $(AS_EXTRA_FLAGS) +ASFLAGS = $(DEBUG) \ + $(PLATFORM_INC_PATH:%=-Wa,-I%) $(INC_PATH:%=-Wa,-I%) $(AS_EXTRA_FLAGS) OBJFILES = $(CSRCS:.c=.o) $(ASSRCS:.S=.o) LD = avr32-ld @@ -98,17 +105,19 @@ NM = avr32-nm SYM = $(TGTFILE:$(TGTTYPE)=.sym) OBJCOPY = avr32-objcopy +HEX = $(TGTFILE:$(TGTTYPE)=.hex) BIN = $(TGTFILE:$(TGTTYPE)=.bin) SIZE = avr32-size -SUDO = $(shell if [ -x /usr/bin/sudo ]; then echo sudo; fi) - SLEEP = sleep SLEEPUSB = 9 PROGRAM = avr32program +ISP = batchisp +ISPFLAGS = -device at32$(PART) -hardware usb -operation + DBGPROXY = avr32gdbproxy DOCGEN = doxygen @@ -127,11 +136,15 @@ MSG_ARCHIVING = Archiving to \`$@\'. MSG_LINKING = Linking to \`$@\'. MSG_EXTENDED_LISTING = Creating extended listing to \`$@\'. MSG_SYMBOL_TABLE = Creating symbol table to \`$@\'. +MSG_IHEX_IMAGE = Creating Intel HEX image to \`$@\'. MSG_BINARY_IMAGE = Creating binary image to \`$@\'. MSG_GETTING_CPU_INFO = Getting CPU information. MSG_HALTING = Stopping CPU execution. -MSG_PROGRAMMING = Programming MCU memory from \`$<\'. -MSG_RESETTING = Resetting CPU. +MSG_ERASING_CHIP = Performing a JTAG Chip Erase command. +MSG_ERASING = Performing a flash chip erase. +MSG_PROGRAMMING = Programming MCU memory from \`$(TGTFILE)\'. +MSG_SECURING_FLASH = Protecting chip by setting security bit. +MSG_RESETTING = Resetting MCU. MSG_DEBUGGING = Opening debug connection with MCU. MSG_RUNNING = Starting CPU execution. MSG_READING_CPU_REGS = Reading CPU registers. @@ -151,11 +164,11 @@ include $(MAKECFG) # Default goal: build the project. ifeq ($(TGTTYPE),.a) .PHONY: all -all: ccversion a lss sym +all: ccversion a lss sym sizes else ifeq ($(TGTTYPE),.elf) .PHONY: all -all: ccversion elf lss sym bin sizes +all: ccversion elf lss sym hex bin sizes else $(error $(ERR_TARGET_TYPE)) endif @@ -166,6 +179,7 @@ endif clean: @echo $(MSG_CLEANING) -$(VERBOSE_CMD)$(RM) $(BIN) + -$(VERBOSE_CMD)$(RM) $(HEX) -$(VERBOSE_CMD)$(RM) $(SYM) -$(VERBOSE_CMD)$(RM) $(LSS) -$(VERBOSE_CMD)$(RM) $(TGTFILE) @@ -219,9 +233,15 @@ lss: $(LSS) sym: $(SYM) ifeq ($(TGTTYPE),.elf) + +# Create Intel HEX image from ELF output file. +.PHONY: hex +hex: $(HEX) + # Create binary image from ELF output file. .PHONY: bin bin: $(BIN) + endif # Display target size information. @@ -229,17 +249,37 @@ endif sizes: $(TGTFILE) @echo @echo +ifeq ($(TGTTYPE),.a) + @$(SIZE) -Bxt $< +else +ifeq ($(TGTTYPE),.elf) @$(SIZE) -Ax $< + @$(SIZE) -Bx $< +endif +endif + @echo + @echo ifeq ($(TGTTYPE),.elf) +# Use ISP instead of JTAGICE mkII when programming. +.PHONY: isp +ifeq ($(filter-out isp verbose,$(MAKECMDGOALS)),) +isp: all +else +isp: + @: +endif + +ifeq ($(findstring isp,$(MAKECMDGOALS)),) + # Get CPU information. .PHONY: cpuinfo cpuinfo: @echo @echo $(MSG_GETTING_CPU_INFO) - $(VERBOSE_CMD)$(SUDO) $(PROGRAM) -cUSB cpuinfo -ifneq ($(call LastWord,$(filter cpuinfo program reset debug run readregs,$(MAKECMDGOALS))),cpuinfo) + $(VERBOSE_CMD)$(PROGRAM) cpuinfo +ifneq ($(call LastWord,$(filter cpuinfo chiperase erase program secureflash reset debug run readregs,$(MAKECMDGOALS))),cpuinfo) @$(SLEEP) $(SLEEPUSB) else @echo @@ -248,45 +288,85 @@ endif # Stop CPU execution. .PHONY: halt halt: -ifeq ($(filter cpuinfo program reset run readregs,$(MAKECMDGOALS)),) +ifeq ($(filter cpuinfo chiperase erase program secureflash reset run readregs,$(MAKECMDGOALS)),) @echo @echo $(MSG_HALTING) - $(VERBOSE_CMD)$(SUDO) $(PROGRAM) -cUSB halt + $(VERBOSE_CMD)$(PROGRAM) halt ifneq ($(call LastWord,$(filter halt debug,$(MAKECMDGOALS))),halt) @$(SLEEP) $(SLEEPUSB) else @echo endif else - @echo > /dev/null + @: +endif + +# Perform a JTAG Chip Erase command. +.PHONY: chiperase +chiperase: + @echo + @echo $(MSG_ERASING_CHIP) + $(VERBOSE_CMD)$(PROGRAM) chiperase +ifneq ($(call LastWord,$(filter cpuinfo chiperase program secureflash reset debug run readregs,$(MAKECMDGOALS))),chiperase) + @$(SLEEP) $(SLEEPUSB) +else + @echo +endif + +# Perform a flash chip erase. +.PHONY: erase +erase: +ifeq ($(filter chiperase program,$(MAKECMDGOALS)),) + @echo + @echo $(MSG_ERASING) + $(VERBOSE_CMD)$(PROGRAM) erase $(FLASH:%=-f%) +ifneq ($(call LastWord,$(filter cpuinfo erase secureflash reset debug run readregs,$(MAKECMDGOALS))),erase) + @$(SLEEP) $(SLEEPUSB) +else + @echo +endif +else + @: endif # Program MCU memory from ELF output file. .PHONY: program -program: $(TGTFILE) +program: all @echo @echo $(MSG_PROGRAMMING) - $(VERBOSE_CMD)$(SUDO) $(PROGRAM) -cUSB program $(FLASH:%=-f%) -e -v -R $(if $(findstring run,$(MAKECMDGOALS)),-r) $< -ifneq ($(call LastWord,$(filter cpuinfo program debug readregs,$(MAKECMDGOALS))),program) + $(VERBOSE_CMD)$(PROGRAM) program $(FLASH:%=-f%) $(PROG_CLOCK:%=-c%) -e -v -R $(if $(findstring run,$(MAKECMDGOALS)),-r) $(TGTFILE) +ifneq ($(call LastWord,$(filter cpuinfo chiperase program secureflash debug readregs,$(MAKECMDGOALS))),program) @$(SLEEP) $(SLEEPUSB) else @echo endif -# Reset CPU. +# Protect chip by setting security bit. +.PHONY: secureflash +secureflash: + @echo + @echo $(MSG_SECURING_FLASH) + $(VERBOSE_CMD)$(PROGRAM) secureflash +ifneq ($(call LastWord,$(filter cpuinfo chiperase erase program secureflash reset debug run readregs,$(MAKECMDGOALS))),secureflash) + @$(SLEEP) $(SLEEPUSB) +else + @echo +endif + +# Reset MCU. .PHONY: reset reset: ifeq ($(filter program run,$(MAKECMDGOALS)),) @echo @echo $(MSG_RESETTING) - $(VERBOSE_CMD)$(SUDO) $(PROGRAM) -cUSB reset -ifneq ($(call LastWord,$(filter cpuinfo reset debug readregs,$(MAKECMDGOALS))),reset) + $(VERBOSE_CMD)$(PROGRAM) reset +ifneq ($(call LastWord,$(filter cpuinfo chiperase erase secureflash reset debug readregs,$(MAKECMDGOALS))),reset) @$(SLEEP) $(SLEEPUSB) else @echo endif else - @echo > /dev/null + @: endif # Open a debug connection with the MCU. @@ -294,8 +374,8 @@ endif debug: @echo @echo $(MSG_DEBUGGING) - $(VERBOSE_CMD)$(SUDO) $(DBGPROXY) -cUSB $(patsubst cfi@%,-f%,$(FLASH:internal@%=-f%)) -ifneq ($(call LastWord,$(filter cpuinfo halt program reset debug run readregs,$(MAKECMDGOALS))),debug) + $(VERBOSE_CMD)$(DBGPROXY) $(FLASH:%=-f%) +ifneq ($(call LastWord,$(filter cpuinfo halt chiperase erase program secureflash reset debug run readregs,$(MAKECMDGOALS))),debug) @$(SLEEP) $(SLEEPUSB) else @echo @@ -307,14 +387,14 @@ run: ifeq ($(findstring program,$(MAKECMDGOALS)),) @echo @echo $(MSG_RUNNING) - $(VERBOSE_CMD)$(SUDO) $(PROGRAM) -cUSB run $(if $(findstring reset,$(MAKECMDGOALS)),-R) -ifneq ($(call LastWord,$(filter cpuinfo debug run readregs,$(MAKECMDGOALS))),run) + $(VERBOSE_CMD)$(PROGRAM) run $(if $(findstring reset,$(MAKECMDGOALS)),-R) +ifneq ($(call LastWord,$(filter cpuinfo chiperase erase secureflash debug run readregs,$(MAKECMDGOALS))),run) @$(SLEEP) $(SLEEPUSB) else @echo endif else - @echo > /dev/null + @: endif # Read CPU registers. @@ -322,13 +402,80 @@ endif readregs: @echo @echo $(MSG_READING_CPU_REGS) - $(VERBOSE_CMD)$(SUDO) $(PROGRAM) -cUSB readregs -ifneq ($(call LastWord,$(filter cpuinfo program reset debug run readregs,$(MAKECMDGOALS))),readregs) + $(VERBOSE_CMD)$(PROGRAM) readregs +ifneq ($(call LastWord,$(filter cpuinfo chiperase erase program secureflash reset debug run readregs,$(MAKECMDGOALS))),readregs) @$(SLEEP) $(SLEEPUSB) else @echo endif +else + +# Perform a flash chip erase. +.PHONY: erase +erase: +ifeq ($(findstring program,$(MAKECMDGOALS)),) + @echo + @echo $(MSG_ERASING) + $(VERBOSE_CMD)$(ISP) $(ISPFLAGS) erase f memory flash blankcheck +ifeq ($(call LastWord,$(filter erase secureflash debug run,$(MAKECMDGOALS))),erase) + @echo +endif +else + @: +endif + +# Program MCU memory from ELF output file. +.PHONY: program +program: all + @echo + @echo $(MSG_PROGRAMMING) + $(VERBOSE_CMD)$(ISP) $(ISPFLAGS) erase f memory flash blankcheck loadbuffer $(TGTFILE) program verify $(if $(findstring run,$(MAKECMDGOALS)),$(if $(findstring secureflash,$(MAKECMDGOALS)),,start $(if $(findstring reset,$(MAKECMDGOALS)),,no)reset 0)) +ifeq ($(call LastWord,$(filter program secureflash debug,$(MAKECMDGOALS))),program) + @echo +endif + +# Protect chip by setting security bit. +.PHONY: secureflash +secureflash: + @echo + @echo $(MSG_SECURING_FLASH) + $(VERBOSE_CMD)$(ISP) $(ISPFLAGS) memory security addrange 0x0 0x0 fillbuffer 0x01 program $(if $(findstring run,$(MAKECMDGOALS)),start $(if $(findstring reset,$(MAKECMDGOALS)),,no)reset 0) +ifeq ($(call LastWord,$(filter erase program secureflash debug,$(MAKECMDGOALS))),secureflash) + @echo +endif + +# Reset MCU. +.PHONY: reset +reset: + @: + +# Open a debug connection with the MCU. +.PHONY: debug +debug: + @echo + @echo $(MSG_DEBUGGING) + $(VERBOSE_CMD)$(DBGPROXY) $(FLASH:%=-f%) +ifeq ($(call LastWord,$(filter erase program secureflash debug run,$(MAKECMDGOALS))),debug) + @echo +endif + +# Start CPU execution. +.PHONY: run +run: +ifeq ($(filter program secureflash,$(MAKECMDGOALS)),) + @echo + @echo $(MSG_RUNNING) + $(VERBOSE_CMD)$(ISP) $(ISPFLAGS) start $(if $(findstring reset,$(MAKECMDGOALS)),,no)reset 0 +ifeq ($(call LastWord,$(filter erase debug run,$(MAKECMDGOALS))),run) + @echo +endif +else + @: +endif + +endif + endif # Build the documentation. @@ -352,11 +499,11 @@ rebuilddoc: cleandoc doc # Display main executed commands. .PHONY: verbose -ifeq ($(MAKECMDGOALS),verbose) +ifeq ($(filter-out isp verbose,$(MAKECMDGOALS)),) verbose: all else verbose: - @echo > /dev/null + @: endif ifneq ($(findstring verbose,$(MAKECMDGOALS)),) # Prefix displaying the following command if and only if verbose is a goal. @@ -456,9 +603,17 @@ $(SYM): $(TGTFILE) $(VERBOSE_NL) ifeq ($(TGTTYPE),.elf) + +# Create Intel HEX image from ELF output file. +$(HEX): $(TGTFILE) + @echo $(MSG_IHEX_IMAGE) + $(VERBOSE_CMD)$(OBJCOPY) -O ihex $< $@ + $(VERBOSE_NL) + # Create binary image from ELF output file. $(BIN): $(TGTFILE) @echo $(MSG_BINARY_IMAGE) $(VERBOSE_CMD)$(OBJCOPY) -O binary $< $@ $(VERBOSE_NL) + endif diff --git a/Demo/AVR32_UC3/AT32UC3A/GCC/config.mk b/Demo/AVR32_UC3/AT32UC3A/GCC/config.mk index 9f3d2749a..c776d5341 100644 --- a/Demo/AVR32_UC3/AT32UC3A/GCC/config.mk +++ b/Demo/AVR32_UC3/AT32UC3A/GCC/config.mk @@ -42,12 +42,15 @@ UTIL_PATH = $(PRJ_PATH)/UTILS # CPU architecture: {ap|uc} ARCH = uc -# Part: {none|ap7000|ap7010|ap7020|uc3a0256|uc3a0512|uc3a1128|uc3a1256|uc3a1512} +# Part: {none|ap7xxx|uc3xxxxx} PART = uc3a0512 -# Flash memories: [type@address,size]... +# Flash memories: [{cfi|internal}@address,size]... FLASH = internal@0x80000000,512Kb +# Clock source to use when programming: [{xtal|extclk|int}] +PROG_CLOCK = xtal + # Device/Platform/Board include path PLATFORM_INC_PATH = \ $(BRDS_PATH)/ @@ -57,13 +60,15 @@ TARGET = rtosdemo.elf # Definitions: [-D name[=definition]...] [-U name...] # Things that might be added to DEFS: -# BOARD Board used: {EVK1100} +# BOARD Board used: {EVKxxxx} +# EXT_BOARD Extension board used (if any): {EXTxxxx} DEFS = -D BOARD=EVK1100 # Include path INC_PATH = \ $(UTIL_PATH)/ \ $(UTIL_PATH)/PREPROCESSOR/ \ + $(SERV_PATH)/USB/CLASS/DFU/EXAMPLES/ISP/BOOT/ \ $(DRVR_PATH)/INTC/ \ $(DRVR_PATH)/PM/ \ $(DRVR_PATH)/GPIO/ \ @@ -81,7 +86,7 @@ CSRCS = \ $(DRVR_PATH)/GPIO/gpio.c \ $(DRVR_PATH)/TC/tc.c \ ../../../../Source/portable/GCC/AVR32_UC3/port.c \ - ../../../../Source/portable/MemMang/heap_3.c \ + ../../../../Source/portable/MemMang/heap_2.c \ ../../../../Source/list.c \ ../../../../Source/queue.c \ ../../../../Source/tasks.c \ @@ -100,6 +105,7 @@ CSRCS = \ # Assembler source files ASSRCS = \ + $(SERV_PATH)/USB/CLASS/DFU/EXAMPLES/ISP/BOOT/trampoline.S \ ../../../../Source/portable/GCC/AVR32_UC3/exception.S # Library path @@ -109,7 +115,7 @@ LIB_PATH = LIBS = # Linker script file if any -LINKER_SCRIPT = +LINKER_SCRIPT = $(UTIL_PATH)/LINKER_SCRIPTS/AT32UC3A/0512/GCC/link_uc3a0512.lds # Options to request or suppress warnings: [-fsyntax-only] [-pedantic[-errors]] [-w] [-Wwarning...] # For further details, refer to the chapter "GCC Command Options" of the GCC manual. @@ -127,13 +133,13 @@ OPTIMIZATION = -O0 -ffunction-sections -fdata-sections CPP_EXTRA_FLAGS = # Extra flags to use when compiling -C_EXTRA_FLAGS = -DGCC_AVR32_PORT +C_EXTRA_FLAGS = # Extra flags to use when assembling AS_EXTRA_FLAGS = # Extra flags to use when linking -LD_EXTRA_FLAGS = -Wl,--gc-sections +LD_EXTRA_FLAGS = -Wl,--gc-sections -Wl,-e,_trampoline # Documentation path DOC_PATH = \ @@ -141,4 +147,4 @@ DOC_PATH = \ # Documentation configuration file DOC_CFG = \ - ../../doxyfile.doxygen + ../doxyfile.doxygen diff --git a/Demo/AVR32_UC3/AT32UC3A/GCC/gdb_cmdfile.txt b/Demo/AVR32_UC3/AT32UC3A/GCC/gdb_cmdfile.txt new file mode 100644 index 000000000..dfe1fc174 --- /dev/null +++ b/Demo/AVR32_UC3/AT32UC3A/GCC/gdb_cmdfile.txt @@ -0,0 +1,29 @@ +target extended-remote :4711 +symbol uc3a0512-rtosdemo.elf + +b _handle_Unrecoverable_Exception +b _handle_TLB_Multiple_Hit +b _handle_Bus_Error_Data_Fetch +b _handle_Bus_Error_Instruction_Fetch +b _handle_NMI +b _handle_Instruction_Address +b _handle_ITLB_Protection +b _handle_Breakpoint +b _handle_Illegal_Opcode +b _handle_Unimplemented_Instruction +b _handle_Privilege_Violation +b _handle_Floating_Point +b _handle_Coprocessor_Absent +b _handle_Data_Address_Read +b _handle_Data_Address_Write +b _handle_DTLB_Protection_Read +b _handle_DTLB_Protection_Write +b _handle_DTLB_Modified +b _handle_ITLB_Miss +b _handle_DTLB_Miss_Read +b _handle_DTLB_Miss_Write + +define current_task +printf "Task name: %s\n", ((tskTCB *)pxCurrentTCB)->pcTaskName +printf "pxTopOfStack: %x\n", ((tskTCB *)pxCurrentTCB)->pxTopOfStack +end diff --git a/Demo/AVR32_UC3/AT32UC3A/IAR/rtosdemo.ewd b/Demo/AVR32_UC3/AT32UC3A/IAR/rtosdemo.ewd index bc38c6ac9..aeb046dff 100644 --- a/Demo/AVR32_UC3/AT32UC3A/IAR/rtosdemo.ewd +++ b/Demo/AVR32_UC3/AT32UC3A/IAR/rtosdemo.ewd @@ -71,9 +71,9 @@ JTAGICEMKIIAVR32 - 2 + 3 - 0 + 1 1 1 + + @@ -160,19 +168,19 @@ - $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 - $EW_DIR$\common\plugins\Orti\Orti.ewplugin + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 - $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin 1 - $EW_DIR$\common\plugins\Stack\Stack.ewplugin + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin 1 @@ -246,9 +254,9 @@ JTAGICEMKIIAVR32 - 2 + 3 - 0 + 1 1 0 + + @@ -335,19 +351,19 @@ - $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ewplugin + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 - $EW_DIR$\common\plugins\Orti\Orti.ewplugin + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 - $EW_DIR$\common\plugins\Profiling\Profiling.ewplugin + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin 1 - $EW_DIR$\common\plugins\Stack\Stack.ewplugin + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin 1 diff --git a/Demo/AVR32_UC3/AT32UC3A/IAR/rtosdemo.ewp b/Demo/AVR32_UC3/AT32UC3A/IAR/rtosdemo.ewp index a4ff3bfe7..0a9a40bb7 100644 --- a/Demo/AVR32_UC3/AT32UC3A/IAR/rtosdemo.ewp +++ b/Demo/AVR32_UC3/AT32UC3A/IAR/rtosdemo.ewp @@ -149,15 +149,14 @@ ICCAVR32 - 2 + 3 - 4 + 5 1 1 - - - - + + + @@ -503,15 +497,7 @@ JAVATOC 0 - - 0 - 1 - 1 - - + CUSTOM @@ -556,7 +542,7 @@ ICCAVR32 - 2 + 3 - 4 + 5 1 0 - - - - + + + @@ -1327,15 +1307,7 @@ JAVATOC 0 - - 0 - 1 - 0 - - + CUSTOM @@ -1380,7 +1352,7 @@