From 7209a08483fb90f3878ba59cb8c8fd3a6f65e64c Mon Sep 17 00:00:00 2001 From: "alden.hart" Date: Sat, 13 Apr 2013 09:41:24 -0400 Subject: [PATCH 01/14] Commented out colliding motate code; got printf working again --- TinyG2/Debug/Makefile | 92 ++-- TinyG2/Debug/makedep.mk | 134 +++--- TinyG2/TinyG2.cppproj | 4 +- TinyG2/TinyG3.cppproj | 616 ------------------------ TinyG2/TinyG3_6_0.cppproj | 572 ---------------------- TinyG2/arduino/syscalls_sam3.c | 140 ------ TinyG2/platform/atmel_sam/libsam/chip.h | 25 +- TinyG2/stepper.cpp | 15 +- TinyG2/system.h | 5 +- 9 files changed, 161 insertions(+), 1442 deletions(-) delete mode 100755 TinyG2/TinyG3.cppproj delete mode 100755 TinyG2/TinyG3_6_0.cppproj delete mode 100644 TinyG2/arduino/syscalls_sam3.c diff --git a/TinyG2/Debug/Makefile b/TinyG2/Debug/Makefile index 47c71e3f..59866617 100755 --- a/TinyG2/Debug/Makefile +++ b/TinyG2/Debug/Makefile @@ -23,16 +23,16 @@ C_DEPS := C_DEPS_AS_ARGS := EXECUTABLES := OUTPUT_FILE_PATH := +OUTPUT_FILE_PATH_AS_ARGS := AVR_APP_PATH :=$$$AVR_APP_PATH$$$ -# AVR_APP_PATH :=$$$AVR_APP_PATH$$$ QUOTE := " ADDITIONAL_DEPENDENCIES:= OUTPUT_FILE_DEP:= LIB_DEP:= # Every subdirectory with source files must be described here -../arduino/USB \ SUBDIRS := \ +../arduino/USB \ ../cmsis/ \ ../cmsis/linkerScripts/ \ ../cmsis/src/ \ @@ -58,17 +58,17 @@ C_SRCS += \ ../arduino/hooks.c \ ../arduino/iar_calls_sam3.c \ ../arduino/IPAddress.cpp \ -../arduino/main.cpp \ +../arduino/itoa.c \ ../arduino/Print.cpp \ ../arduino/Reset.cpp \ ../arduino/RingBuffer.cpp \ ../arduino/Stream.cpp \ ../arduino/syscalls_sam3.cpp \ ../arduino/UARTClass.cpp \ +../arduino/USARTClass.cpp \ ../arduino/USB/CDC.cpp \ ../arduino/USB/HID.cpp \ ../arduino/USB/USBCore.cpp \ -../arduino/USARTClass.cpp \ ../arduino/WInterrupts.c \ ../arduino/wiring.c \ ../arduino/wiring_analog.c \ @@ -78,6 +78,7 @@ C_SRCS += \ ../arduino/WMath.cpp \ ../arduino/WString.cpp \ ../cmsis/src/startup_sam3xa.c \ +../cmsis/src/system_sam3xa.c \ ../config.c \ ../config_app.c \ ../json_parser.c \ @@ -110,15 +111,14 @@ C_SRCS += \ ../platform/atmel_sam/libsam/source/uotghs_host.c \ ../platform/atmel_sam/libsam/source/usart.c \ ../platform/atmel_sam/libsam/source/wdt.c \ -../cmsis/src/system_sam3xa.c \ ../stepper.cpp \ +../system.cpp \ ../TinyG2.cpp \ ../util.c \ ../variants/variant.cpp \ ../xio/xio.c \ ../xio/xio_signals.c \ ../xio/xio_usart.c -../variants/variant.cpp PREPROCESSING_SRCS += @@ -133,17 +133,17 @@ arduino/cxxabi-compat.o \ arduino/hooks.o \ arduino/iar_calls_sam3.o \ arduino/IPAddress.o \ -arduino/main.o \ +arduino/itoa.o \ arduino/Print.o \ arduino/Reset.o \ arduino/RingBuffer.o \ arduino/Stream.o \ arduino/syscalls_sam3.o \ arduino/UARTClass.o \ +arduino/USARTClass.o \ arduino/USB/CDC.o \ arduino/USB/HID.o \ arduino/USB/USBCore.o \ -arduino/USARTClass.o \ arduino/WInterrupts.o \ arduino/wiring.o \ arduino/wiring_analog.o \ @@ -153,6 +153,7 @@ arduino/wiring_shift.o \ arduino/WMath.o \ arduino/WString.o \ cmsis/src/startup_sam3xa.o \ +cmsis/src/system_sam3xa.o \ config.o \ config_app.o \ json_parser.o \ @@ -185,15 +186,14 @@ platform/atmel_sam/libsam/source/uotghs_device.o \ platform/atmel_sam/libsam/source/uotghs_host.o \ platform/atmel_sam/libsam/source/usart.o \ platform/atmel_sam/libsam/source/wdt.o \ -cmsis/src/system_sam3xa.o \ stepper.o \ +system.o \ TinyG2.o \ util.o \ variants/variant.o \ xio/xio.o \ xio/xio_signals.o \ xio/xio_usart.o -variants/variant.o OBJS_AS_ARGS += \ @@ -202,17 +202,17 @@ arduino/cxxabi-compat.o \ arduino/hooks.o \ arduino/iar_calls_sam3.o \ arduino/IPAddress.o \ -arduino/main.o \ +arduino/itoa.o \ arduino/Print.o \ arduino/Reset.o \ arduino/RingBuffer.o \ arduino/Stream.o \ arduino/syscalls_sam3.o \ arduino/UARTClass.o \ +arduino/USARTClass.o \ arduino/USB/CDC.o \ arduino/USB/HID.o \ arduino/USB/USBCore.o \ -arduino/USARTClass.o \ arduino/WInterrupts.o \ arduino/wiring.o \ arduino/wiring_analog.o \ @@ -222,6 +222,7 @@ arduino/wiring_shift.o \ arduino/WMath.o \ arduino/WString.o \ cmsis/src/startup_sam3xa.o \ +cmsis/src/system_sam3xa.o \ config.o \ config_app.o \ json_parser.o \ @@ -254,15 +255,14 @@ platform/atmel_sam/libsam/source/uotghs_device.o \ platform/atmel_sam/libsam/source/uotghs_host.o \ platform/atmel_sam/libsam/source/usart.o \ platform/atmel_sam/libsam/source/wdt.o \ -cmsis/src/system_sam3xa.o \ stepper.o \ +system.o \ TinyG2.o \ util.o \ variants/variant.o \ xio/xio.o \ xio/xio_signals.o \ xio/xio_usart.o -variants/variant.o C_DEPS += \ @@ -271,17 +271,17 @@ arduino/cxxabi-compat.d \ arduino/hooks.d \ arduino/iar_calls_sam3.d \ arduino/IPAddress.d \ -arduino/main.d \ +arduino/itoa.d \ arduino/Print.d \ arduino/Reset.d \ arduino/RingBuffer.d \ arduino/Stream.d \ arduino/syscalls_sam3.d \ arduino/UARTClass.d \ +arduino/USARTClass.d \ arduino/USB/CDC.d \ arduino/USB/HID.d \ arduino/USB/USBCore.d \ -arduino/USARTClass.d \ arduino/WInterrupts.d \ arduino/wiring.d \ arduino/wiring_analog.d \ @@ -291,6 +291,7 @@ arduino/wiring_shift.d \ arduino/WMath.d \ arduino/WString.d \ cmsis/src/startup_sam3xa.d \ +cmsis/src/system_sam3xa.d \ config.d \ config_app.d \ json_parser.d \ @@ -323,15 +324,14 @@ platform/atmel_sam/libsam/source/uotghs_device.d \ platform/atmel_sam/libsam/source/uotghs_host.d \ platform/atmel_sam/libsam/source/usart.d \ platform/atmel_sam/libsam/source/wdt.d \ -cmsis/src/system_sam3xa.d \ stepper.d \ +system.d \ TinyG2.d \ util.d \ variants/variant.d \ xio/xio.d \ xio/xio_signals.d \ xio/xio_usart.d -variants/variant.d C_DEPS_AS_ARGS += \ @@ -340,17 +340,17 @@ arduino/cxxabi-compat.d \ arduino/hooks.d \ arduino/iar_calls_sam3.d \ arduino/IPAddress.d \ -arduino/main.d \ +arduino/itoa.d \ arduino/Print.d \ arduino/Reset.d \ arduino/RingBuffer.d \ arduino/Stream.d \ arduino/syscalls_sam3.d \ arduino/UARTClass.d \ +arduino/USARTClass.d \ arduino/USB/CDC.d \ arduino/USB/HID.d \ arduino/USB/USBCore.d \ -arduino/USARTClass.d \ arduino/WInterrupts.d \ arduino/wiring.d \ arduino/wiring_analog.d \ @@ -360,6 +360,7 @@ arduino/wiring_shift.d \ arduino/WMath.d \ arduino/WString.d \ cmsis/src/startup_sam3xa.d \ +cmsis/src/system_sam3xa.d \ config.d \ config_app.d \ json_parser.d \ @@ -392,20 +393,19 @@ platform/atmel_sam/libsam/source/uotghs_device.d \ platform/atmel_sam/libsam/source/uotghs_host.d \ platform/atmel_sam/libsam/source/usart.d \ platform/atmel_sam/libsam/source/wdt.d \ -cmsis/src/system_sam3xa.d \ stepper.d \ +system.d \ TinyG2.d \ util.d \ variants/variant.d \ xio/xio.d \ xio/xio_signals.d \ xio/xio_usart.d -variants/variant.d + OUTPUT_FILE_PATH +=TinyG2.elf -OUTPUT_FILE_PATH +=TinyG3.elf + OUTPUT_FILE_PATH_AS_ARGS +=TinyG2.elf -OUTPUT_FILE_PATH_AS_ARGS +=TinyG3.elf ADDITIONAL_DEPENDENCIES:= @@ -550,55 +550,55 @@ LIB_DEP+= arduino/%.o: ../arduino/%.c @echo Building file: $< @echo Invoking: ARM/GNU C Compiler : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\arm\include" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" + $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -Os -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" @echo Finished building: $< arduino/%.o: ../arduino/%.cpp @echo Building file: $< @echo Invoking: ARM/GNU C Compiler : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\arm\include" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -fno-rtti -fno-exceptions -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" + $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -fno-rtti -fno-exceptions -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" @echo Finished building: $< arduino/USB/%.o: ../arduino/USB/%.cpp @echo Building file: $< @echo Invoking: ARM/GNU C Compiler : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\arm\include" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -fno-rtti -fno-exceptions -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" + $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -fno-rtti -fno-exceptions -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" @echo Finished building: $< cmsis/src/%.o: ../cmsis/src/%.c @echo Building file: $< @echo Invoking: ARM/GNU C Compiler : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\arm\include" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" + $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -Os -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" @echo Finished building: $< ./%.o: .././%.c @echo Building file: $< @echo Invoking: ARM/GNU C Compiler : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\arm\include" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" + $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -Os -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" @echo Finished building: $< ./%.o: .././%.cpp @echo Building file: $< @echo Invoking: ARM/GNU C Compiler : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\arm\include" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -fno-rtti -fno-exceptions -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" + $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -fno-rtti -fno-exceptions -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" @echo Finished building: $< + platform/atmel_sam/libsam/source/%.o: ../platform/atmel_sam/libsam/source/%.c -system/source/%.o: ../system/source/%.c @echo Building file: $< @echo Invoking: ARM/GNU C Compiler : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\arm\include" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" + $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -Os -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" @echo Finished building: $< variants/%.o: ../variants/%.cpp @echo Building file: $< @echo Invoking: ARM/GNU C Compiler : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\arm\include" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -fno-rtti -fno-exceptions -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" + $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -fno-rtti -fno-exceptions -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" @echo Finished building: $< xio/%.o: ../xio/%.c @echo Building file: $< @echo Invoking: ARM/GNU C Compiler : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\arm\include" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" + $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -Os -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" @echo Finished building: $< @@ -609,7 +609,7 @@ xio/%.o: ../xio/%.c # AVR32/GNU Assembler -all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES) + ifneq ($(MAKECMDGOALS),clean) @@ -619,21 +619,21 @@ endif endif # Add inputs and outputs from these tool invocations to the build variables + # All Target all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES) - $(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP) $(LIB_DEP) @echo Building target: $@ @echo Invoking: ARM/GNU Linker : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="TinyG2.map" -Wl,--start-group -lm -Wl,--end-group -L"../platform/arm/lib" -L"../cmsis/linkerScripts" -Wl,--gc-sections -mcpu=cortex-m3 -Tsam3x8e_flash.ld - "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-objcopy.exe" -O binary "TinyG2.elf" "TinyG2.bin" - "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature "TinyG2.elf" "TinyG2.hex" - "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O binary "TinyG2.elf" "TinyG2.eep" || exit 0 - "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-objdump.exe" -h -S "TinyG2.elf" > "TinyG2.lss" - "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature "TinyG2.elf" "TinyG2.srec" - "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-size.exe" "TinyG2.elf" - "$(BASE_PATH)arm-none-eabi-size$(EXEC)" "TinyG3.elf" + $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="TinyG2.map" -Wl,--start-group -lm -Wl,--end-group -L"../cmsis/linkerScripts" -Wl,--gc-sections -mcpu=cortex-m3 -Tsam3x8e_flash.ld + @echo Finished building target: $@ + "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-objcopy.exe" -O binary "TinyG2.elf" "TinyG2.bin" + "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature "TinyG2.elf" "TinyG2.hex" + "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O binary "TinyG2.elf" "TinyG2.eep" || exit 0 + "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-objdump.exe" -h -S "TinyG2.elf" > "TinyG2.lss" + "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature "TinyG2.elf" "TinyG2.srec" + "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-size.exe" "TinyG2.elf" @@ -642,6 +642,6 @@ $(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP) $(LIB_DEP) # Other Targets clean: - rm -rf "TinyG2.elf" "TinyG2.a" "TinyG2.hex" "TinyG2.bin" "TinyG2.lss" "TinyG2.eep" "TinyG2.map" "TinyG2.srec" - rm -rf "TinyG3.elf" "TinyG3.a" "TinyG3.hex" "TinyG3.bin" "TinyG3.lss" "TinyG3.eep" "TinyG3.map" "TinyG3.srec" + -$(RM) $(OBJS_AS_ARGS)$(C_DEPS_AS_ARGS) $(EXECUTABLES) + rm -rf "TinyG2.elf" "TinyG2.a" "TinyG2.hex" "TinyG2.bin" "TinyG2.lss" "TinyG2.eep" "TinyG2.map" "TinyG2.srec" \ No newline at end of file diff --git a/TinyG2/Debug/makedep.mk b/TinyG2/Debug/makedep.mk index 395ef0a9..8d7346b6 100755 --- a/TinyG2/Debug/makedep.mk +++ b/TinyG2/Debug/makedep.mk @@ -14,8 +14,6 @@ arduino\IPAddress.cpp arduino\itoa.c -arduino\main.cpp - arduino\Print.cpp arduino\Reset.cpp @@ -30,6 +28,12 @@ arduino\UARTClass.cpp arduino\USARTClass.cpp +arduino\USB\CDC.cpp + +arduino\USB\HID.cpp + +arduino\USB\USBCore.cpp + arduino\WInterrupts.c arduino\wiring.c @@ -50,65 +54,83 @@ cmsis\src\startup_sam3xa.c cmsis\src\system_sam3xa.c +config.c + +config_app.c + +json_parser.c + +kinen.c + +main.cpp + +platform\atmel_sam\libsam\source\adc.c + +platform\atmel_sam\libsam\source\adc12_sam3u.c + +platform\atmel_sam\libsam\source\can.c + +platform\atmel_sam\libsam\source\dacc.c + +platform\atmel_sam\libsam\source\efc.c + +platform\atmel_sam\libsam\source\emac.c + +platform\atmel_sam\libsam\source\gpbr.c + +platform\atmel_sam\libsam\source\interrupt_sam_nvic.c + +platform\atmel_sam\libsam\source\pio.c + +platform\atmel_sam\libsam\source\pmc.c + +platform\atmel_sam\libsam\source\pwmc.c + +platform\atmel_sam\libsam\source\rstc.c + +platform\atmel_sam\libsam\source\rtc.c + +platform\atmel_sam\libsam\source\rtt.c + +platform\atmel_sam\libsam\source\spi.c + +platform\atmel_sam\libsam\source\ssc.c + +platform\atmel_sam\libsam\source\tc.c + +platform\atmel_sam\libsam\source\timetick.c + +platform\atmel_sam\libsam\source\trng.c + +platform\atmel_sam\libsam\source\twi.c + +platform\atmel_sam\libsam\source\udp.c + +platform\atmel_sam\libsam\source\udphs.c + +platform\atmel_sam\libsam\source\uotghs.c + +platform\atmel_sam\libsam\source\uotghs_device.c + +platform\atmel_sam\libsam\source\uotghs_host.c + +platform\atmel_sam\libsam\source\usart.c + +platform\atmel_sam\libsam\source\wdt.c + stepper.cpp system.cpp -system\source\adc.c +TinyG2.cpp -system\source\adc12_sam3u.c - -system\source\can.c - -system\source\dacc.c - -system\source\efc.c - -system\source\emac.c - -system\source\gpbr.c - -system\source\interrupt_sam_nvic.c - -system\source\pio.c - -system\source\pmc.c - -system\source\pwmc.c - -system\source\rstc.c - -system\source\rtc.c - -system\source\rtt.c - -system\source\spi.c - -system\source\ssc.c - -system\source\tc.c - -system\source\timetick.c - -system\source\trng.c - -system\source\twi.c - -system\source\udp.c - -system\source\udphs.c - -system\source\uotghs.c - -system\source\uotghs_device.c - -system\source\uotghs_host.c - -system\source\usart.c - -system\source\wdt.c - -tinyg2.cpp +util.c variants\variant.cpp +xio\xio.c + +xio\xio_signals.c + +xio\xio_usart.c + diff --git a/TinyG2/TinyG2.cppproj b/TinyG2/TinyG2.cppproj index 0debc802..5516aac0 100755 --- a/TinyG2/TinyG2.cppproj +++ b/TinyG2/TinyG2.cppproj @@ -91,11 +91,11 @@ ..\Arduino\USB ..\variants ..\motate - ..\platform\arm\include ..\platform\atmel_sam\libsam ..\platform\atmel_sam\libsam\include + Optimize for size (-Os) True Maximum (-g3) True @@ -114,7 +114,6 @@ ..\Arduino\USB ..\variants ..\motate - ..\platform\arm\include ..\platform\atmel_sam\libsam ..\platform\atmel_sam\libsam\include @@ -129,7 +128,6 @@ - ../platform/arm/lib ../cmsis/linkerScripts diff --git a/TinyG2/TinyG3.cppproj b/TinyG2/TinyG3.cppproj deleted file mode 100755 index 63521af1..00000000 --- a/TinyG2/TinyG3.cppproj +++ /dev/null @@ -1,616 +0,0 @@ - - - - 2.0 - 6.1 - com.Atmel.ARMGCC.CPP - {488dbd8b-89dd-4714-ab7e-4b71ed48dc60} - ATSAM3X8E - none - Executable - CPP - $(MSBuildProjectName) - .elf - $(MSBuildProjectDirectory)\$(Configuration) - TinyG3 - TinyG3 - TinyG3 - Native - true - false - exception_table - 1 - 3.5.0 - com.atmel.avrdbg.tool.samice - JTAG - - com.atmel.avrdbg.tool.samice - SAM-ICE - 000028011884 - - 127.0.0.1 - 1026 - False - - - JTAG - - 0 - 1000000 - 150000 - false - true - 0 - 0 - 0 - 0 - - - - - - - - - - - - - - - true - true - 0x20000000 - - 0 - - - - - __SAM3X8E__ - True - True - True - True - True - - - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\CMSIS\Include - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL\sam3xa\include - - - Optimize for size (-Os) - True - True - - - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\CMSIS\Include - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL\sam3xa\include - - - Optimize for size (-Os) - True - True - - - libm - - - - - ../cmsis/linkerScripts - - - True - -Tsam3x8e_flash.ld - - - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\CMSIS\Include - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL\sam3xa\include - - - - - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\CMSIS\Include - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL\sam3xa\include - - - - - - - - - __SAM3X8E__ - True - True - True - True - True - - - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\CMSIS\Include - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL\sam3xa\include - ..\arduino - ..\system - ..\system\include - ..\system\source - ..\variants - ..\motate - ..\motate\utility - - - Optimize (-O1) - True - Maximum (-g3) - True - - - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\CMSIS\Include - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL\sam3xa\include - ..\arduino - ..\system - ..\system\include - ..\system\source - ..\variants - ..\motate - ..\motate\utility - - - True - Maximum (-g3) - True - -fpermissive - - - libm - - - - - ../cmsis/linkerScripts - - - True - -Tsam3x8e_flash.ld - - - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\CMSIS\Include - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL\sam3xa\include - - - Default (-g) - - - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\CMSIS\Include - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL\sam3xa\include - - - Default (-Wa,-g) - - - - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - - - - - - - - - - - - - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - - \ No newline at end of file diff --git a/TinyG2/TinyG3_6_0.cppproj b/TinyG2/TinyG3_6_0.cppproj deleted file mode 100755 index 8be9ba47..00000000 --- a/TinyG2/TinyG3_6_0.cppproj +++ /dev/null @@ -1,572 +0,0 @@ - - - - 2.0 - 6.0 - com.Atmel.ARMGCC - {488dbd8b-89dd-4714-ab7e-4b71ed48dc60} - ATSAM3X8E - none - Executable - CPP - $(MSBuildProjectName) - .elf - $(MSBuildProjectDirectory)\$(Configuration) - TinyG3 - TinyG3 - TinyG3 - Native - true - false - - 1 - 3.5.0 - com.atmel.avrdbg.tool.samice - JTAG - - com.atmel.avrdbg.tool.samice - SAM-ICE - 000028011884 - true - false - - - - 127.0.0.1 - 1135 - False - - - JTAG - - 0 - 1000000 - 150000 - false - true - 0 - 0 - 0 - 0 - - - - - - - - __SAM3X8E__ - True - True - True - True - True - - - C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles - C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles\CMSIS\Include - C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles\Device\ATMEL - C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles\Device\ATMEL\sam3xa\include - - - Optimize for size (-Os) - True - True - - - C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles - C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles\CMSIS\Include - C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles\Device\ATMEL - C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles\Device\ATMEL\sam3xa\include - - - Optimize for size (-Os) - True - True - - - m - - - - - ../cmsis/linkerScripts - - - True - -Tsam3x8e_flash.ld - - - - - - - __SAM3X8E__ - True - True - True - True - True - - - C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles - C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles\CMSIS\Include - C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles\Device\ATMEL - C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles\Device\ATMEL\sam3xa\include - ..\arduino - ..\system - ..\system\include - ..\system\source - ..\variants - ..\motate - ..\motate\utility - - - Optimize (-O1) - True - Maximum (-g3) - True - - - C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles - C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles\CMSIS\Include - C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles\Device\ATMEL - C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles\Device\ATMEL\sam3xa\include - ..\arduino - ..\system - ..\system\include - ..\system\source - ..\variants - ..\motate - ..\motate\utility - - - True - Maximum (-g3) - True - -fpermissive - - - m - - - - - ../cmsis/linkerScripts - - - True - -Tsam3x8e_flash.ld - Default (-g) - Default (-Wa,-g) - - - - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - - - - - - - - - - - - - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - compile - - - - \ No newline at end of file diff --git a/TinyG2/arduino/syscalls_sam3.c b/TinyG2/arduino/syscalls_sam3.c deleted file mode 100644 index 23256db6..00000000 --- a/TinyG2/arduino/syscalls_sam3.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - Copyright (c) 2011 Arduino. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -/** - * \file syscalls_sam3.c - * - * Implementation of newlib syscall. - * - */ - -/*---------------------------------------------------------------------------- - * Headers - *----------------------------------------------------------------------------*/ - - -#include "syscalls.h" - -#include -#include -#include "sam.h" -#if defined ( __GNUC__ ) /* GCC CS3 */ - #include - #include -#endif - -/*---------------------------------------------------------------------------- - * Exported variables - *----------------------------------------------------------------------------*/ - -#undef errno -extern int errno ; -extern int _end ; - -/*---------------------------------------------------------------------------- - * Exported functions - *----------------------------------------------------------------------------*/ -extern void _exit( int status ) ; -extern void _kill( int pid, int sig ) ; -extern int _getpid ( void ) ; - -extern caddr_t _sbrk ( int incr ) -{ - static unsigned char *heap = NULL ; - unsigned char *prev_heap ; - - if ( heap == NULL ) - { - heap = (unsigned char *)&_end ; - } - prev_heap = heap; - - heap += incr ; - - return (caddr_t) prev_heap ; -} - -extern int link( char *cOld, char *cNew ) -{ - return -1 ; -} - -extern int _close( int file ) -{ - return -1 ; -} - -extern int _fstat( int file, struct stat *st ) -{ - st->st_mode = S_IFCHR ; - - return 0 ; -} - -extern int _isatty( int file ) -{ - return 1 ; -} - -extern int _lseek( int file, int ptr, int dir ) -{ - return 0 ; -} - -extern int _read(int file, char *ptr, int len) -{ - return 0 ; -} - -extern int _write( int file, char *ptr, int len ) -{ - int iIndex ; - - -// for ( ; *ptr != 0 ; ptr++ ) - for ( iIndex=0 ; iIndex < len ; iIndex++, ptr++ ) - { -// UART_PutChar( *ptr ) ; - - // Check if the transmitter is ready - while ((UART->UART_SR & UART_SR_TXRDY) != UART_SR_TXRDY) - ; - - // Send character - UART->UART_THR = *ptr; - } - - return iIndex ; -} - -extern void _exit( int status ) -{ - printf( "Exiting with status %d.\n", status ) ; - - for ( ; ; ) ; -} - -extern void _kill( int pid, int sig ) -{ - return ; -} - -extern int _getpid ( void ) -{ - return -1 ; -} diff --git a/TinyG2/platform/atmel_sam/libsam/chip.h b/TinyG2/platform/atmel_sam/libsam/chip.h index 0d90c7f1..073a3b2a 100755 --- a/TinyG2/platform/atmel_sam/libsam/chip.h +++ b/TinyG2/platform/atmel_sam/libsam/chip.h @@ -24,6 +24,17 @@ */ #include "sam.h" +// ASH: ++++ The following modifies the SAM3XA_SERIES #define from the sam.h file to fix compilation problems in adc.h +// Ref: http://asf.atmel.no/docs/latest/common.services.calendar.example2.stk600-rcuc3d/html/group__sam__part__macros__group.html +//#define SAM3XA_SERIES (SAM3A4 || SAM3A8) // original define in sam.h file +#undef SAM3XA_SERIES +#define SAM3XA_SERIES (SAM3X4 || SAM3X8 || SAM3A4 || SAM3A8) + +// ASH: ++++ Added as this is note defined anywhere else +#define USB_PID USB_PID_DUE + +/**** TO HERE ****/ + /* Define attribute */ #if defined ( __GNUC__ ) /* GCC CS3 */ #define WEAK __attribute__ ((weak)) @@ -42,14 +53,21 @@ * Peripherals */ #include "include/adc.h" +#if (SAM3XA_SERIES) || (SAM3N_SERIES) || (SAM3S_SERIES) #include "include/dacc.h" +#endif // (SAM3XA_SERIES) || (SAM3N_SERIES) || (SAM3S_SERIES) + #include "include/interrupt_sam_nvic.h" +#include "include/efc.h" +#include "include/gpbr.h" #include "include/pio.h" #include "include/pmc.h" #include "include/pwmc.h" +#include "include/rstc.h" #include "include/rtc.h" #include "include/rtt.h" #include "include/spi.h" +#include "include/ssc.h" #include "include/tc.h" #include "include/twi.h" #include "include/usart.h" @@ -59,9 +77,12 @@ #include "include/USB_device.h" #include "include/USB_host.h" -#if SAM3XA_SERIES +#if (SAM3XA_SERIES) +#include "include/can.h" +#include "include/emac.h" +#include "include/trng.h" #include "include/uotghs_device.h" #include "include/uotghs_host.h" -#endif /* SAM3XA_SERIES */ +#endif /* (SAM3XA_SERIES) */ #endif /* _LIB_SAM_ */ diff --git a/TinyG2/stepper.cpp b/TinyG2/stepper.cpp index 1f0c241f..aa7ee92d 100755 --- a/TinyG2/stepper.cpp +++ b/TinyG2/stepper.cpp @@ -145,6 +145,8 @@ #include "motatePins.h" using namespace Motate; +/* + // Setup a stepper template to hold our pins template struct Stepper { @@ -162,6 +164,7 @@ Pin6 dir_2(kOutput); // direction channel 2 Pin7 dir_3(kOutput); // direction channel 3 Pin8 enable(kOutput); // common enable +*/ volatile int temp = 0; volatile long dummy; // convenient register to read into @@ -280,7 +283,7 @@ static inline void pinOutput(int pin, int val) void ISR_Handler_DDA(void) { dummy = REG_SR_DDA; // read SR to clear interrupt condition - +/* if ((st.m[MOTOR_1].counter += st.m[MOTOR_1].steps) > 0) { st.m[MOTOR_1].counter -= st.timer_ticks_X_substeps; x_motor.step.set(); // turn step bit on @@ -303,10 +306,11 @@ void ISR_Handler_DDA(void) // temp = LOW; // } // digitalWrite(3,temp); +*/ } - _load_move(); -} +// _load_move(); +//} /* * ISR - DDA timer interrupt routine - service ticks from DDA timer @@ -315,6 +319,7 @@ void ISR_Handler_DDA(void) * it's faster than using indexed timer and port accesses. I checked. * Even when -0s or -03 is used. */ +/* void ISR_Handler_DDA(void) { dummy = REG_SR_DDA; // read SR to clear interrupt condition @@ -343,7 +348,7 @@ void ISR_Handler_DDA(void) step_1.clear(); step_2.clear(); step_3.clear(); - +*/ /* if (--st.timer_ticks_downcount == 0) { // end move // enable.set(); // disable DDA timer @@ -363,7 +368,7 @@ void ISR_Handler_DDA(void) _load_move(); // load the next move } */ -} +//} /* * st_disable() - stop the steppers. Requires re-init to recover diff --git a/TinyG2/system.h b/TinyG2/system.h index 0be608e5..c79d8812 100755 --- a/TinyG2/system.h +++ b/TinyG2/system.h @@ -27,7 +27,7 @@ #ifndef system_h #define system_h -#include "motatePins.h" +//#include "motatePins.h" //using namespace Motate; void sys_init(void); // master hardware init @@ -44,6 +44,7 @@ void sys_init(void); // master hardware init /**** Resource Assignment via Motate ****/ +/* Motate::pin_number x_step_pin_num = 2; Motate::pin_number y_step_pin_num = 3; Motate::pin_number z_step_pin_num = 4; @@ -51,7 +52,7 @@ Motate::pin_number x_dir_pin_num = 5; Motate::pin_number y_dir_pin_num = 6; Motate::pin_number z_dir_pin_num = 7; Motate::pin_number enable_pin_num = 8; - +*/ /**** Resource Assignment **** * This section describes what modules use resources such as timers, pins, etc. * Base addresses and channels are setup here, see detailed setup may be found From 22968494c26984f3e3cab0947920134286d98f4b Mon Sep 17 00:00:00 2001 From: "alden.hart" Date: Sat, 13 Apr 2013 09:46:43 -0400 Subject: [PATCH 02/14] updated TInyG2.cppproj only --- TinyG2/TinyG2.cppproj | 164 +++++++++++++++++++++--------------------- 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/TinyG2/TinyG2.cppproj b/TinyG2/TinyG2.cppproj index 5516aac0..ca8ca058 100755 --- a/TinyG2/TinyG2.cppproj +++ b/TinyG2/TinyG2.cppproj @@ -70,88 +70,88 @@ Z:\Alden\Projects\proj64_ArduinoDue\g2\HW\Makefile - __SAM3X8E__ - True - True - True - True - True - - - F_CPU=84000000UL - - - - - ..\cmsis - ..\cmsis\CMSIS\Include - ..\cmsis\Device\ATMEL - ..\cmsis\Device\ATMEL\sam3xa\include - ..\arduino - ..\Arduino\USB - ..\variants - ..\motate - ..\platform\atmel_sam\libsam - ..\platform\atmel_sam\libsam\include - - - Optimize for size (-Os) - True - Maximum (-g3) - True - - - F_CPU=84000000UL - - - - - ..\cmsis - ..\cmsis\CMSIS\Include - ..\cmsis\Device\ATMEL - ..\cmsis\Device\ATMEL\sam3xa\include - ..\arduino - ..\Arduino\USB - ..\variants - ..\motate - ..\platform\atmel_sam\libsam - ..\platform\atmel_sam\libsam\include - - - True - Maximum (-g3) - True - - - libm - - - - - ../cmsis/linkerScripts - - - True - -Tsam3x8e_flash.ld - - - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\CMSIS\Include - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL\sam3xa\include - - - Default (-g) - - - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\CMSIS\Include - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL - C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL\sam3xa\include - - - Default (-Wa,-g) - + __SAM3X8E__ + True + True + True + True + True + + + F_CPU=84000000UL + + + + + ..\cmsis + ..\cmsis\CMSIS\Include + ..\cmsis\Device\ATMEL + ..\cmsis\Device\ATMEL\sam3xa\include + ..\arduino + ..\Arduino\USB + ..\variants + ..\motate + ..\platform\atmel_sam\libsam + ..\platform\atmel_sam\libsam\include + + + Optimize for size (-Os) + True + Maximum (-g3) + True + + + F_CPU=84000000UL + + + + + ..\cmsis + ..\cmsis\CMSIS\Include + ..\cmsis\Device\ATMEL + ..\cmsis\Device\ATMEL\sam3xa\include + ..\arduino + ..\Arduino\USB + ..\variants + ..\motate + ..\platform\atmel_sam\libsam + ..\platform\atmel_sam\libsam\include + + + True + Maximum (-g3) + True + + + libm + + + + + ../cmsis/linkerScripts + + + True + -Tsam3x8e_flash.ld + + + C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel + C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\CMSIS\Include + C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL + C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL\sam3xa\include + + + Default (-g) + + + C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel + C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\CMSIS\Include + C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL + C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\..\..\CMSIS_Atmel\Device\ATMEL\sam3xa\include + + + Default (-Wa,-g) + From 35a9d1f91c8e5b88192f3f761c9fb68c2210fbc5 Mon Sep 17 00:00:00 2001 From: Robert Giseburt Date: Sat, 13 Apr 2013 22:24:35 -0500 Subject: [PATCH 03/14] Put system_sam3xa.c back into the CMSIS structure. Fixed Makefile/XCode project. --- .../ATMEL/sam3xa/source/system_sam3xa.c | 191 ++++++++++++++++++ TinyG2/Makefile | 12 +- TinyG2/TinyG2.xcodeproj/project.pbxproj | 22 +- TinyG2/main.cpp | 113 ++++++----- TinyG2/platform/atmel_sam.mk | 2 +- 5 files changed, 265 insertions(+), 75 deletions(-) create mode 100644 TinyG2/CMSIS/Device/ATMEL/sam3xa/source/system_sam3xa.c diff --git a/TinyG2/CMSIS/Device/ATMEL/sam3xa/source/system_sam3xa.c b/TinyG2/CMSIS/Device/ATMEL/sam3xa/source/system_sam3xa.c new file mode 100644 index 00000000..229c10d8 --- /dev/null +++ b/TinyG2/CMSIS/Device/ATMEL/sam3xa/source/system_sam3xa.c @@ -0,0 +1,191 @@ +/*! \file ********************************************************************* + * + * \brief Provides the low-level initialization functions that called + * on chip startup. + * + * $asf_license$ + * + * \par Purpose + * + * This file provides basic support for Cortex-M processor based + * microcontrollers. + * + * \author Atmel Corporation: http://www.atmel.com \n + * Support and FAQ: http://support.atmel.no/ + * + ******************************************************************************/ + +#include "sam3xa.h" + +/* @cond 0 */ +/**INDENT-OFF**/ +#ifdef __cplusplus +extern "C" { +#endif +/**INDENT-ON**/ +/* @endcond */ + +/* Clock settings (84MHz) */ +#define SYS_BOARD_OSCOUNT (CKGR_MOR_MOSCXTST(0x8)) +#define SYS_BOARD_PLLAR (CKGR_PLLAR_ONE \ + | CKGR_PLLAR_MULA(0xdUL) \ + | CKGR_PLLAR_PLLACOUNT(0x3fUL) \ + | CKGR_PLLAR_DIVA(0x1UL)) +#define SYS_BOARD_MCKR (PMC_MCKR_PRES_CLK_2 | PMC_MCKR_CSS_PLLA_CLK) + +/* Clock Definitions */ +#define SYS_UTMIPLL (480000000UL) /* UTMI PLL frequency */ + +#define SYS_CKGR_MOR_KEY_VALUE CKGR_MOR_KEY(0x37) /* Key to unlock MOR register */ + +/* FIXME: should be generated by sock */ +uint32_t SystemCoreClock = CHIP_FREQ_MAINCK_RC_4MHZ; + +/** + * \brief Setup the microcontroller system. + * Initialize the System and update the SystemFrequency variable. + */ +void SystemInit(void) +{ + /* Set FWS according to SYS_BOARD_MCKR configuration */ + EFC0->EEFC_FMR = EEFC_FMR_FWS(4); + EFC1->EEFC_FMR = EEFC_FMR_FWS(4); + + /* Initialize main oscillator */ + if (!(PMC->CKGR_MOR & CKGR_MOR_MOSCSEL)) { + PMC->CKGR_MOR = SYS_CKGR_MOR_KEY_VALUE | SYS_BOARD_OSCOUNT | + CKGR_MOR_MOSCRCEN | CKGR_MOR_MOSCXTEN; + while (!(PMC->PMC_SR & PMC_SR_MOSCXTS)) { + } + } + + /* Switch to 3-20MHz Xtal oscillator */ + PMC->CKGR_MOR = SYS_CKGR_MOR_KEY_VALUE | SYS_BOARD_OSCOUNT | + CKGR_MOR_MOSCRCEN | CKGR_MOR_MOSCXTEN | CKGR_MOR_MOSCSEL; + + while (!(PMC->PMC_SR & PMC_SR_MOSCSELS)) { + } + PMC->PMC_MCKR = (PMC->PMC_MCKR & ~(uint32_t)PMC_MCKR_CSS_Msk) | + PMC_MCKR_CSS_MAIN_CLK; + while (!(PMC->PMC_SR & PMC_SR_MCKRDY)) { + } + + /* Initialize PLLA */ + PMC->CKGR_PLLAR = SYS_BOARD_PLLAR; + while (!(PMC->PMC_SR & PMC_SR_LOCKA)) { + } + + /* Switch to main clock */ + PMC->PMC_MCKR = (SYS_BOARD_MCKR & ~PMC_MCKR_CSS_Msk) | PMC_MCKR_CSS_MAIN_CLK; + while (!(PMC->PMC_SR & PMC_SR_MCKRDY)) { + } + + /* Switch to PLLA */ + PMC->PMC_MCKR = SYS_BOARD_MCKR; + while (!(PMC->PMC_SR & PMC_SR_MCKRDY)) { + } + + SystemCoreClock = CHIP_FREQ_CPU_MAX; +} + +void SystemCoreClockUpdate(void) +{ + /* Determine clock frequency according to clock register values */ + switch (PMC->PMC_MCKR & PMC_MCKR_CSS_Msk) { + case PMC_MCKR_CSS_SLOW_CLK: /* Slow clock */ + if (SUPC->SUPC_SR & SUPC_SR_OSCSEL) { + SystemCoreClock = CHIP_FREQ_XTAL_32K; + } else { + SystemCoreClock = CHIP_FREQ_SLCK_RC; + } + break; + case PMC_MCKR_CSS_MAIN_CLK: /* Main clock */ + if (PMC->CKGR_MOR & CKGR_MOR_MOSCSEL) { + SystemCoreClock = CHIP_FREQ_XTAL_12M; + } else { + SystemCoreClock = CHIP_FREQ_MAINCK_RC_4MHZ; + + switch (PMC->CKGR_MOR & CKGR_MOR_MOSCRCF_Msk) { + case CKGR_MOR_MOSCRCF_4_MHz: + break; + case CKGR_MOR_MOSCRCF_8_MHz: + SystemCoreClock *= 2U; + break; + case CKGR_MOR_MOSCRCF_12_MHz: + SystemCoreClock *= 3U; + break; + default: + break; + } + } + break; + case PMC_MCKR_CSS_PLLA_CLK: /* PLLA clock */ + case PMC_MCKR_CSS_UPLL_CLK: /* UPLL clock */ + if (PMC->CKGR_MOR & CKGR_MOR_MOSCSEL) { + SystemCoreClock = CHIP_FREQ_XTAL_12M; + } else { + SystemCoreClock = CHIP_FREQ_MAINCK_RC_4MHZ; + + switch (PMC->CKGR_MOR & CKGR_MOR_MOSCRCF_Msk) { + case CKGR_MOR_MOSCRCF_4_MHz: + break; + case CKGR_MOR_MOSCRCF_8_MHz: + SystemCoreClock *= 2U; + break; + case CKGR_MOR_MOSCRCF_12_MHz: + SystemCoreClock *= 3U; + break; + default: + break; + } + } + if ((PMC->PMC_MCKR & PMC_MCKR_CSS_Msk) == PMC_MCKR_CSS_PLLA_CLK) { + SystemCoreClock *= ((((PMC->CKGR_PLLAR) & CKGR_PLLAR_MULA_Msk) >> + CKGR_PLLAR_MULA_Pos) + 1U); + SystemCoreClock /= ((((PMC->CKGR_PLLAR) & CKGR_PLLAR_DIVA_Msk) >> + CKGR_PLLAR_DIVA_Pos)); + } else { + SystemCoreClock = SYS_UTMIPLL / 2U; + } + break; + } + + if ((PMC->PMC_MCKR & PMC_MCKR_PRES_Msk) == PMC_MCKR_PRES_CLK_3) { + SystemCoreClock /= 3U; + } else { + SystemCoreClock >>= ((PMC->PMC_MCKR & PMC_MCKR_PRES_Msk) >> + PMC_MCKR_PRES_Pos); + } +} + +/** + * Initialize flash. + */ +void system_init_flash(uint32_t dw_clk) +{ + /* Set FWS for embedded Flash access according to operating frequency */ + if (dw_clk < CHIP_FREQ_FWS_0) { + EFC0->EEFC_FMR = EEFC_FMR_FWS(0); + EFC1->EEFC_FMR = EEFC_FMR_FWS(0); + } else if (dw_clk < CHIP_FREQ_FWS_1) { + EFC0->EEFC_FMR = EEFC_FMR_FWS(1); + EFC1->EEFC_FMR = EEFC_FMR_FWS(1); + } else if (dw_clk < CHIP_FREQ_FWS_2) { + EFC0->EEFC_FMR = EEFC_FMR_FWS(2); + EFC1->EEFC_FMR = EEFC_FMR_FWS(2); + } else if (dw_clk < CHIP_FREQ_FWS_3) { + EFC0->EEFC_FMR = EEFC_FMR_FWS(3); + EFC1->EEFC_FMR = EEFC_FMR_FWS(3); + } else { + EFC0->EEFC_FMR = EEFC_FMR_FWS(4); + EFC1->EEFC_FMR = EEFC_FMR_FWS(4); + } +} + +/* @cond 0 */ +/**INDENT-OFF**/ +#ifdef __cplusplus +} +#endif +/**INDENT-ON**/ +/* @endcond */ diff --git a/TinyG2/Makefile b/TinyG2/Makefile index f2eb32cf..87344e84 100644 --- a/TinyG2/Makefile +++ b/TinyG2/Makefile @@ -25,7 +25,7 @@ PROJECT = TinyG2 -SOURCE_DIRS = . arduino variants +SOURCE_DIRS = . arduino arduino/USB variants FIRST_LINK_SOURCES := arduino/syscalls_sam3.c # List all user directories here @@ -60,9 +60,9 @@ CFLAGS += -Wsign-compare -Waggregate-return #CFLAGS += -Wstrict-prototypes #CFLAGS += -Wmissing-prototypes -Wmissing-declarations CFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -CFLAGS += -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wlong-long +CFLAGS += -Wredundant-decls -Wnested-externs -Winline -Wlong-long CFLAGS += -Wunreachable-code -#CFLAGS += -Wcast-align +#CFLAGS += -Wcast-align -Wpacked #CFLAGS += -Wmissing-noreturn #CFLAGS += -Wconversion @@ -80,8 +80,8 @@ CPPFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef CPPFLAGS += -Wshadow -Wpointer-arith -Wwrite-strings #CPPFLAGS += -Wsign-compare -Waggregate-return -Wmissing-declarations CPPFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -CPPFLAGS += -Wpacked -Wredundant-decls -Winline -Wlong-long -#CPPFLAGS += -Wmissing-noreturn +CPPFLAGS += -Wredundant-decls -Winline -Wlong-long +#CPPFLAGS += -Wmissing-noreturn -Wpacked #CPPFLAGS += -Wconversion # To reduce application size use only integer printf function. @@ -248,6 +248,8 @@ MK_DIRS = $(shell \ [[ -d $$d ]] || mkdir -p $$d; \ done) +$(eval $(DEVICE_RULES)) + define RULES OUTDIR = $(OBJ)/$(1) REQUIRED_DIRS += $(OUTDIR) diff --git a/TinyG2/TinyG2.xcodeproj/project.pbxproj b/TinyG2/TinyG2.xcodeproj/project.pbxproj index 1a6265ca..52eb6fe2 100644 --- a/TinyG2/TinyG2.xcodeproj/project.pbxproj +++ b/TinyG2/TinyG2.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + D432963A171A5564001611B6 /* syscalls_sam3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D4329639171A5564001611B6 /* syscalls_sam3.cpp */; }; + D432963C171A5577001611B6 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D432963B171A5577001611B6 /* main.cpp */; }; D457112F17053C3A00EA19A8 /* MotatePins.h in Sources */ = {isa = PBXBuildFile; fileRef = D45710C81705334000EA19A8 /* MotatePins.h */; }; D457113017053C3A00EA19A8 /* MotateTimers.h in Sources */ = {isa = PBXBuildFile; fileRef = D45710C91705334000EA19A8 /* MotateTimers.h */; }; D457113117053C3A00EA19A8 /* AvrPins.h in Sources */ = {isa = PBXBuildFile; fileRef = D45710D61705334100EA19A8 /* AvrPins.h */; }; @@ -16,7 +18,6 @@ D457113517053C3A00EA19A8 /* stepper.h in Sources */ = {isa = PBXBuildFile; fileRef = D45710DA1705334100EA19A8 /* stepper.h */; }; D457117017053C3A00EA19A8 /* system.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D45711181705334100EA19A8 /* system.cpp */; }; D457117117053C3A00EA19A8 /* system.h in Sources */ = {isa = PBXBuildFile; fileRef = D45711191705334100EA19A8 /* system.h */; }; - D457117217053C3A00EA19A8 /* tinyg2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D457111A1705334100EA19A8 /* tinyg2.cpp */; }; D457117317053C3A00EA19A8 /* tinyg2.h in Sources */ = {isa = PBXBuildFile; fileRef = D457111B1705334100EA19A8 /* tinyg2.h */; }; D457117417053C3A00EA19A8 /* pins_arduino.h in Sources */ = {isa = PBXBuildFile; fileRef = D457111D1705334100EA19A8 /* pins_arduino.h */; }; D457117517053C3A00EA19A8 /* variant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D457111E1705334100EA19A8 /* variant.cpp */; }; @@ -28,12 +29,10 @@ D49EB89317054CB800F2BF9B /* iar_calls_sam3.c in Sources */ = {isa = PBXBuildFile; fileRef = D49EB85D17054CB800F2BF9B /* iar_calls_sam3.c */; settings = {COMPILER_FLAGS = "-D__SAM3X8H__"; }; }; D49EB89417054CB800F2BF9B /* IPAddress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D49EB85E17054CB800F2BF9B /* IPAddress.cpp */; }; D49EB89517054CB800F2BF9B /* itoa.c in Sources */ = {isa = PBXBuildFile; fileRef = D49EB86017054CB800F2BF9B /* itoa.c */; }; - D49EB89617054CB800F2BF9B /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D49EB86217054CB800F2BF9B /* main.cpp */; }; D49EB89717054CB800F2BF9B /* Print.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D49EB86317054CB800F2BF9B /* Print.cpp */; }; D49EB89817054CB800F2BF9B /* Reset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D49EB86617054CB800F2BF9B /* Reset.cpp */; }; D49EB89917054CB800F2BF9B /* RingBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D49EB86817054CB800F2BF9B /* RingBuffer.cpp */; }; D49EB89A17054CB800F2BF9B /* Stream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D49EB86B17054CB800F2BF9B /* Stream.cpp */; }; - D49EB89B17054CB800F2BF9B /* syscalls_sam3.c in Sources */ = {isa = PBXBuildFile; fileRef = D49EB86E17054CB800F2BF9B /* syscalls_sam3.c */; settings = {COMPILER_FLAGS = "-D__SAM3X8H__"; }; }; D49EB89C17054CB800F2BF9B /* UARTClass.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D49EB87117054CB800F2BF9B /* UARTClass.cpp */; }; D49EB89D17054CB800F2BF9B /* USARTClass.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D49EB87417054CB800F2BF9B /* USARTClass.cpp */; }; D49EB89E17054CB800F2BF9B /* CDC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D49EB87717054CB800F2BF9B /* CDC.cpp */; }; @@ -427,6 +426,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + D4329639171A5564001611B6 /* syscalls_sam3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = syscalls_sam3.cpp; sourceTree = ""; }; + D432963B171A5577001611B6 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; D45710C71705334000EA19A8 /* keywords.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = keywords.txt; sourceTree = ""; }; D45710C81705334000EA19A8 /* MotatePins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MotatePins.h; sourceTree = ""; }; D45710C91705334000EA19A8 /* MotateTimers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MotateTimers.h; sourceTree = ""; }; @@ -437,7 +438,6 @@ D45710DA1705334100EA19A8 /* stepper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stepper.h; sourceTree = ""; }; D45711181705334100EA19A8 /* system.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = system.cpp; sourceTree = ""; }; D45711191705334100EA19A8 /* system.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = system.h; sourceTree = ""; }; - D457111A1705334100EA19A8 /* tinyg2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tinyg2.cpp; sourceTree = ""; }; D457111B1705334100EA19A8 /* tinyg2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tinyg2.h; sourceTree = ""; }; D457111D1705334100EA19A8 /* pins_arduino.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pins_arduino.h; sourceTree = ""; }; D457111E1705334100EA19A8 /* variant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = variant.cpp; sourceTree = ""; }; @@ -456,7 +456,6 @@ D49EB85F17054CB800F2BF9B /* IPAddress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IPAddress.h; sourceTree = ""; }; D49EB86017054CB800F2BF9B /* itoa.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = itoa.c; sourceTree = ""; }; D49EB86117054CB800F2BF9B /* itoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = itoa.h; sourceTree = ""; }; - D49EB86217054CB800F2BF9B /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; D49EB86317054CB800F2BF9B /* Print.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Print.cpp; sourceTree = ""; }; D49EB86417054CB800F2BF9B /* Print.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Print.h; sourceTree = ""; }; D49EB86517054CB800F2BF9B /* Printable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Printable.h; sourceTree = ""; }; @@ -468,7 +467,6 @@ D49EB86B17054CB800F2BF9B /* Stream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Stream.cpp; sourceTree = ""; }; D49EB86C17054CB800F2BF9B /* Stream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Stream.h; sourceTree = ""; }; D49EB86D17054CB800F2BF9B /* syscalls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = syscalls.h; sourceTree = ""; }; - D49EB86E17054CB800F2BF9B /* syscalls_sam3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = syscalls_sam3.c; sourceTree = ""; }; D49EB86F17054CB800F2BF9B /* Tone.cpp.disabled */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Tone.cpp.disabled; sourceTree = ""; }; D49EB87017054CB800F2BF9B /* Tone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tone.h; sourceTree = ""; }; D49EB87117054CB800F2BF9B /* UARTClass.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UARTClass.cpp; sourceTree = ""; }; @@ -3228,7 +3226,6 @@ D49EC3F717054FDF00F2BF9B /* SAM4S16C.svd */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = SAM4S16C.svd; sourceTree = ""; }; D49EC3F817054FDF00F2BF9B /* SAM4S8B.svd */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = SAM4S8B.svd; sourceTree = ""; }; D49EC3F917054FDF00F2BF9B /* SAM4S8C.svd */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = SAM4S8C.svd; sourceTree = ""; }; - D49EC3FA17054FDF00F2BF9B /* Version 2.10 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Version 2.10"; sourceTree = ""; }; D49EC3FF17054FDF00F2BF9B /* debug.mk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = debug.mk; sourceTree = ""; }; D49EC40017054FDF00F2BF9B /* gcc.mk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = gcc.mk; sourceTree = ""; }; D49EC40117054FDF00F2BF9B /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; @@ -3316,7 +3313,7 @@ children = ( D457117B17053EFA00EA19A8 /* Makefile */, D457111B1705334100EA19A8 /* tinyg2.h */, - D457111A1705334100EA19A8 /* tinyg2.cpp */, + D432963B171A5577001611B6 /* main.cpp */, D45710C61705334000EA19A8 /* motate */, D45710DA1705334100EA19A8 /* stepper.h */, D45710D91705334100EA19A8 /* stepper.cpp */, @@ -3377,7 +3374,6 @@ D49EB85F17054CB800F2BF9B /* IPAddress.h */, D49EB86017054CB800F2BF9B /* itoa.c */, D49EB86117054CB800F2BF9B /* itoa.h */, - D49EB86217054CB800F2BF9B /* main.cpp */, D49EB86317054CB800F2BF9B /* Print.cpp */, D49EB86417054CB800F2BF9B /* Print.h */, D49EB86517054CB800F2BF9B /* Printable.h */, @@ -3389,7 +3385,7 @@ D49EB86B17054CB800F2BF9B /* Stream.cpp */, D49EB86C17054CB800F2BF9B /* Stream.h */, D49EB86D17054CB800F2BF9B /* syscalls.h */, - D49EB86E17054CB800F2BF9B /* syscalls_sam3.c */, + D4329639171A5564001611B6 /* syscalls_sam3.cpp */, D49EB86F17054CB800F2BF9B /* Tone.cpp.disabled */, D49EB87017054CB800F2BF9B /* Tone.h */, D49EB87117054CB800F2BF9B /* UARTClass.cpp */, @@ -3439,7 +3435,6 @@ children = ( D49EB8AA17054FD500F2BF9B /* CMSIS */, D49EBE1F17054FDC00F2BF9B /* Device */, - D49EC3FA17054FDF00F2BF9B /* Version 2.10 */, ); path = CMSIS; sourceTree = ""; @@ -7808,7 +7803,6 @@ D457113517053C3A00EA19A8 /* stepper.h in Sources */, D457117017053C3A00EA19A8 /* system.cpp in Sources */, D457117117053C3A00EA19A8 /* system.h in Sources */, - D457117217053C3A00EA19A8 /* tinyg2.cpp in Sources */, D457117317053C3A00EA19A8 /* tinyg2.h in Sources */, D457117417053C3A00EA19A8 /* pins_arduino.h in Sources */, D457117517053C3A00EA19A8 /* variant.cpp in Sources */, @@ -7822,12 +7816,10 @@ D49EB89317054CB800F2BF9B /* iar_calls_sam3.c in Sources */, D49EB89417054CB800F2BF9B /* IPAddress.cpp in Sources */, D49EB89517054CB800F2BF9B /* itoa.c in Sources */, - D49EB89617054CB800F2BF9B /* main.cpp in Sources */, D49EB89717054CB800F2BF9B /* Print.cpp in Sources */, D49EB89817054CB800F2BF9B /* Reset.cpp in Sources */, D49EB89917054CB800F2BF9B /* RingBuffer.cpp in Sources */, D49EB89A17054CB800F2BF9B /* Stream.cpp in Sources */, - D49EB89B17054CB800F2BF9B /* syscalls_sam3.c in Sources */, D49EB89C17054CB800F2BF9B /* UARTClass.cpp in Sources */, D49EB89D17054CB800F2BF9B /* USARTClass.cpp in Sources */, D49EB89E17054CB800F2BF9B /* CDC.cpp in Sources */, @@ -8110,6 +8102,8 @@ D49EC5D217054FDF00F2BF9B /* uotghs_host.c in Sources */, D49EC5D317054FDF00F2BF9B /* usart.c in Sources */, D49EC5D417054FDF00F2BF9B /* wdt.c in Sources */, + D432963A171A5564001611B6 /* syscalls_sam3.cpp in Sources */, + D432963C171A5577001611B6 /* main.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/TinyG2/main.cpp b/TinyG2/main.cpp index 542dcb60..19b7aafe 100755 --- a/TinyG2/main.cpp +++ b/TinyG2/main.cpp @@ -8,12 +8,12 @@ //#define ARDUINO_MAIN #include "sam.h" -#include "Arduino.h" - -#include "tinyg2.h" +#include "Arduino.h" + +#include "tinyg2.h" #include "controller.h" #include "stepper.h" -#include "xio.h" +#include "xio.h" /* #include "system.h" @@ -31,64 +31,67 @@ #include "pwm.h" */ -#ifdef __cplusplus -extern "C"{ -#endif // __cplusplus +#ifdef __cplusplus +extern "C"{ +#endif // __cplusplus -/* -extern void SysTick_Handler( void ) -{ - // Increment tick count each ms - TimeTick_Increment() ; -} -*/ - -#define DEV_STDIN 0 -#define DEV_STDOUT 0 -#define DEV_STDERR 0 - -extern controller_t controller_state; // controller state structure +void _init() __attribute__ ((weak)); +void _init() {;} + +/* +extern void SysTick_Handler( void ) +{ + // Increment tick count each ms + TimeTick_Increment() ; +} +*/ + +#define DEV_STDIN 0 +#define DEV_STDOUT 0 +#define DEV_STDERR 0 + +extern controller_t controller_state; // controller state structure static void _application_init(void); - -/******************** Application Code ************************/ -//int indicator_led = 13; - -void setup( void ) -{ - pinMode(INDICATOR_LED, OUTPUT); + +/******************** Application Code ************************/ +//int indicator_led = 13; + +void setup( void ) +{ + pinMode(INDICATOR_LED, OUTPUT); SerialUSB.begin(115200); - _application_init(); -} - -void loop( void ) + _application_init(); +} + +void loop( void ) { controller_run( &controller_state ); // single pass through the controller -} - -/* - * \brief Main entry point of Arduino application - */ -int main( void ) -{ - init(); - delay(1); - USBDevice.attach(); - setup(); - - for (;;) - { - loop(); -// if (serialEventRun) serialEventRun(); - } - return 0; -} - +} + +/* + * \brief Main entry point of Arduino application + */ +int main( void ) +{ + init(); + delay(1); + USBDevice.attach(); + setup(); + + for (;;) + { + loop(); +// if (serialEventRun) serialEventRun(); + } + return 0; +} + static void _application_init(void) { // There are a lot of dependencies in the order of these inits. // Don't change the ordering unless you understand this. - controller_init( &controller_state, DEV_STDIN, DEV_STDOUT, DEV_STDERR ); + controller_init( &controller_state, DEV_STDIN, DEV_STDOUT, DEV_STDERR ); st_init(); // stepper subsystem - must precede gpio_init() /* @@ -140,6 +143,6 @@ void tg_reset(void) // software hard reset using the watchdog timer // while (true); // loops for about 15ms then resets } -#ifdef __cplusplus -} -#endif // __cplusplus +#ifdef __cplusplus +} +#endif // __cplusplus diff --git a/TinyG2/platform/atmel_sam.mk b/TinyG2/platform/atmel_sam.mk index 31e38f30..f6302b04 100644 --- a/TinyG2/platform/atmel_sam.mk +++ b/TinyG2/platform/atmel_sam.mk @@ -86,7 +86,7 @@ DEVICE_PATH = $(SAM_PATH)/$(SERIES)/source SAM_SOURCE_DIRS += $(DEVICE_PATH) SAM_SOURCE_DIRS += $(DEVICE_PATH)/$(GCC_TOOLCHAIN) -$(eval $(call CREATE_DEVICE_LIBRARY,SAM,cmsis_sam)) +DEVICE_RULES = $(call CREATE_DEVICE_LIBRARY,SAM,cmsis_sam) # Flags DEVICE_INCLUDE_DIRS += "$(CMSIS_PATH)" From 8f4b7fd27b99cdad01232e83effe10ab67f2c71e Mon Sep 17 00:00:00 2001 From: Robert Giseburt Date: Tue, 16 Apr 2013 00:12:41 -0500 Subject: [PATCH 04/14] Cleanup compiling some. Make VERBOSE=2 much more readable. --- TinyG2/Makefile | 22 ++++++++++++++++------ TinyG2/due-raspberrypi.gdb | 2 +- TinyG2/platform/atmel_sam.mk | 4 ++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/TinyG2/Makefile b/TinyG2/Makefile index 87344e84..afa6d2bd 100644 --- a/TinyG2/Makefile +++ b/TinyG2/Makefile @@ -216,6 +216,7 @@ FIRST_LINK_OBJECTS = $(addsuffix .o,$(basename $(FIRST_LINK_SOURCES))) OUTPUT := $(BIN)/$(OUTPUT_BIN) INCLUDES = $(patsubst %,-I%,$(DEVICE_INCLUDE_DIRS) $(USER_INCLUDE_DIRS)) +LIBS = $(patsubst %,-l%,$(DEVICE_LIBS) $(USER_LIBS)) LIBDIR = $(patsubst %,-L%,$(DEVICE_LIB_DIRS) $(USER_LIB_DIRS)) CFLAGS += -g $(OPTIMIZATION) $(INCLUDES) @@ -224,12 +225,21 @@ ASFLAGS += -g $(OPTIMIZATION) $(INCLUDES) -D__ASSEMBLY__ ifeq ($(VERBOSE),2) -$(warning INCLUDES: $(DEVICE_INCLUDE_DIRS) $(USER_INCLUDE_DIRS)) -$(warning LIBRARIES: $(DEVICE_LIB_DIRS) $(USER_LIB_DIRS)) -$(warning SOURCE DIRECTORIES: $(SOURCE_DIRS)) -$(warning C SOURCES: $(C_SOURCES)) -$(warning C++ SOURCES: $(CXX_SOURCES)) -$(warning LINK FIRST SOURCES: $(FIRST_LINK_SOURCES)) +define NEWLINE_ONLY + + +endef +define NEWLINE_TAB + + +endef + +$(info DEVICE_INCLUDE_DIRS+USER_INCLUDE_DIRS:$(patsubst %,$(NEWLINE_TAB)%,$(DEVICE_INCLUDE_DIRS) $(USER_INCLUDE_DIRS))) +$(info $(NEWLINE_ONLY)DEVICE_LIB_DIRS+USER_LIB_DIRS: $(patsubst %,$(NEWLINE_TAB)%,$(DEVICE_LIB_DIRS) $(USER_LIB_DIRS))) +$(info $(NEWLINE_ONLY)SOURCE_DIRS: $(patsubst %,$(NEWLINE_TAB)%,$(SOURCE_DIRS))) +$(info $(NEWLINE_ONLY)C_SOURCES: $(patsubst %,$(NEWLINE_TAB)%,$(C_SOURCES))) +$(info $(NEWLINE_ONLY)CXX_SOURCES: $(patsubst %,$(NEWLINE_TAB)%,$(CXX_SOURCES))) +$(info $(NEWLINE_ONLY)FIRST_LINK_SOURCES: $(patsubst %,$(NEWLINE_TAB)%,$(FIRST_LINK_SOURCES))) endif diff --git a/TinyG2/due-raspberrypi.gdb b/TinyG2/due-raspberrypi.gdb index 17472a5a..f5cba970 100644 --- a/TinyG2/due-raspberrypi.gdb +++ b/TinyG2/due-raspberrypi.gdb @@ -3,4 +3,4 @@ set remote hardware-breakpoint-limit 6 set remote hardware-watchpoint-limit 4 #target extended-remote raspberrypi:3333 -target extended-remote | ssh pi@raspberrypi -C 'sudo openocd -c "gdb_port pipe; log_output openocd.log" -s /usr/share/openocd/ -f board/raspberrypi-due.tcl' \ No newline at end of file +target extended-remote | ssh pi@raspberrypi -C 'sudo openocd -c "gdb_port pipe; log_output openocd.log" -s /usr/share/openocd/ -f board/raspberrypi-due.tcl' diff --git a/TinyG2/platform/atmel_sam.mk b/TinyG2/platform/atmel_sam.mk index f6302b04..64d071a9 100644 --- a/TinyG2/platform/atmel_sam.mk +++ b/TinyG2/platform/atmel_sam.mk @@ -93,9 +93,9 @@ DEVICE_INCLUDE_DIRS += "$(CMSIS_PATH)" DEVICE_INCLUDE_DIRS += "$(SAM_PATH)" DEVICE_INCLUDE_DIRS += "$(SAM_PATH)/$(SERIES)/include" -LIBS += -lgcc -lc +DEVICE_LIBS = gcc c -LIB_PATH += -L=/lib/thumb2 +# DEVICE_LIB_DIRS = /lib/thumb2 #LIB_PATH += -L"$(realpath $(DEVICE_PATH)/$(GCC_TOOLCHAIN))" # FIXME: Assumes all sams are Dues From fa1a16775fbea2e5c19e683a596076da34a3a953 Mon Sep 17 00:00:00 2001 From: Robert Giseburt Date: Tue, 16 Apr 2013 01:15:42 -0500 Subject: [PATCH 05/14] Got Motate pins back up. --- TinyG2/TinyG2.xcodeproj/project.pbxproj | 58 ++++++++++++++++----- TinyG2/controller.h | 20 +++---- TinyG2/stepper.cpp | 69 +++++++------------------ TinyG2/system.h | 20 +++---- 4 files changed, 83 insertions(+), 84 deletions(-) diff --git a/TinyG2/TinyG2.xcodeproj/project.pbxproj b/TinyG2/TinyG2.xcodeproj/project.pbxproj index 52eb6fe2..4a9dc1f8 100644 --- a/TinyG2/TinyG2.xcodeproj/project.pbxproj +++ b/TinyG2/TinyG2.xcodeproj/project.pbxproj @@ -9,6 +9,11 @@ /* Begin PBXBuildFile section */ D432963A171A5564001611B6 /* syscalls_sam3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D4329639171A5564001611B6 /* syscalls_sam3.cpp */; }; D432963C171A5577001611B6 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D432963B171A5577001611B6 /* main.cpp */; }; + D4329648171D1B00001611B6 /* config_app.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D432963D171D1B00001611B6 /* config_app.cpp */; }; + D4329649171D1B00001611B6 /* config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D432963F171D1B00001611B6 /* config.cpp */; }; + D432964A171D1B00001611B6 /* controller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D4329641171D1B00001611B6 /* controller.cpp */; }; + D432964B171D1B00001611B6 /* json_parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D4329643171D1B00001611B6 /* json_parser.cpp */; }; + D432964C171D1B00001611B6 /* xio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D4329646171D1B00001611B6 /* xio.cpp */; }; D457112F17053C3A00EA19A8 /* MotatePins.h in Sources */ = {isa = PBXBuildFile; fileRef = D45710C81705334000EA19A8 /* MotatePins.h */; }; D457113017053C3A00EA19A8 /* MotateTimers.h in Sources */ = {isa = PBXBuildFile; fileRef = D45710C91705334000EA19A8 /* MotateTimers.h */; }; D457113117053C3A00EA19A8 /* AvrPins.h in Sources */ = {isa = PBXBuildFile; fileRef = D45710D61705334100EA19A8 /* AvrPins.h */; }; @@ -428,6 +433,17 @@ /* Begin PBXFileReference section */ D4329639171A5564001611B6 /* syscalls_sam3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = syscalls_sam3.cpp; sourceTree = ""; }; D432963B171A5577001611B6 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; + D432963D171D1B00001611B6 /* config_app.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = config_app.cpp; sourceTree = ""; }; + D432963E171D1B00001611B6 /* config_app.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config_app.h; sourceTree = ""; }; + D432963F171D1B00001611B6 /* config.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = config.cpp; sourceTree = ""; }; + D4329640171D1B00001611B6 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = ""; }; + D4329641171D1B00001611B6 /* controller.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = controller.cpp; sourceTree = ""; }; + D4329642171D1B00001611B6 /* controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = controller.h; sourceTree = ""; }; + D4329643171D1B00001611B6 /* json_parser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = json_parser.cpp; sourceTree = ""; }; + D4329644171D1B00001611B6 /* json_parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = json_parser.h; sourceTree = ""; }; + D4329645171D1B00001611B6 /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; + D4329646171D1B00001611B6 /* xio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xio.cpp; sourceTree = ""; }; + D4329647171D1B00001611B6 /* xio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xio.h; sourceTree = ""; }; D45710C71705334000EA19A8 /* keywords.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = keywords.txt; sourceTree = ""; }; D45710C81705334000EA19A8 /* MotatePins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MotatePins.h; sourceTree = ""; }; D45710C91705334000EA19A8 /* MotateTimers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MotateTimers.h; sourceTree = ""; }; @@ -3311,20 +3327,31 @@ D45710B7170532AC00EA19A8 = { isa = PBXGroup; children = ( - D457117B17053EFA00EA19A8 /* Makefile */, - D457111B1705334100EA19A8 /* tinyg2.h */, - D432963B171A5577001611B6 /* main.cpp */, - D45710C61705334000EA19A8 /* motate */, - D45710DA1705334100EA19A8 /* stepper.h */, - D45710D91705334100EA19A8 /* stepper.cpp */, - D45711191705334100EA19A8 /* system.h */, - D45711181705334100EA19A8 /* system.cpp */, - D49EB8A917054FD500F2BF9B /* CMSIS */, - D49EC3FB17054FDF00F2BF9B /* platform */, - D49EB85517054CB800F2BF9B /* arduino */, - D457111C1705334100EA19A8 /* variants */, - D49EC5D51705FC1100F2BF9B /* bin */, D49EB85417054C4000F2BF9B /* index */, + D457117B17053EFA00EA19A8 /* Makefile */, + D432963F171D1B00001611B6 /* config.cpp */, + D432963D171D1B00001611B6 /* config_app.cpp */, + D4329641171D1B00001611B6 /* controller.cpp */, + D4329643171D1B00001611B6 /* json_parser.cpp */, + D432963B171A5577001611B6 /* main.cpp */, + D45710D91705334100EA19A8 /* stepper.cpp */, + D45711181705334100EA19A8 /* system.cpp */, + D4329646171D1B00001611B6 /* xio.cpp */, + D4329640171D1B00001611B6 /* config.h */, + D432963E171D1B00001611B6 /* config_app.h */, + D4329642171D1B00001611B6 /* controller.h */, + D4329644171D1B00001611B6 /* json_parser.h */, + D45710DA1705334100EA19A8 /* stepper.h */, + D45711191705334100EA19A8 /* system.h */, + D457111B1705334100EA19A8 /* tinyg2.h */, + D4329645171D1B00001611B6 /* util.h */, + D4329647171D1B00001611B6 /* xio.h */, + D49EB85517054CB800F2BF9B /* arduino */, + D49EC5D51705FC1100F2BF9B /* bin */, + D49EB8A917054FD500F2BF9B /* CMSIS */, + D45710C61705334000EA19A8 /* motate */, + D49EC3FB17054FDF00F2BF9B /* platform */, + D457111C1705334100EA19A8 /* variants */, ); sourceTree = ""; }; @@ -8104,6 +8131,11 @@ D49EC5D417054FDF00F2BF9B /* wdt.c in Sources */, D432963A171A5564001611B6 /* syscalls_sam3.cpp in Sources */, D432963C171A5577001611B6 /* main.cpp in Sources */, + D4329648171D1B00001611B6 /* config_app.cpp in Sources */, + D4329649171D1B00001611B6 /* config.cpp in Sources */, + D432964A171D1B00001611B6 /* controller.cpp in Sources */, + D432964B171D1B00001611B6 /* json_parser.cpp in Sources */, + D432964C171D1B00001611B6 /* xio.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/TinyG2/controller.h b/TinyG2/controller.h index a739184b..096c2187 100755 --- a/TinyG2/controller.h +++ b/TinyG2/controller.h @@ -17,8 +17,8 @@ * You should have received a copy of the GNU General Public License * along with TinyG If not, see . * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, @@ -28,9 +28,9 @@ #ifndef _CONTROLLER_H_ #define _CONTROLLER_H_ -#ifdef __cplusplus -extern "C"{ -#endif // __cplusplus +#ifdef __cplusplus +extern "C"{ +#endif // __cplusplus #define TG_FLAG_PROMPTS_bm (1<<0) // prompt enabled if set #define INPUT_BUFFER_LEN 255 // text buffer size (255 max) @@ -39,7 +39,7 @@ extern "C"{ #define STATUS_MESSAGE_LEN 32 // status message string storage allocation #define APPLICATION_MESSAGE_LEN 64 // application message string storage allocation -#define LED_NORMAL_COUNTER 1000 // blink rate for normal operation +#define LED_NORMAL_COUNTER 100000 // blink rate for normal operation #define LED_ALARM_COUNTER 1000 // blink rate for alarm state typedef struct controllerState { // main TG controller struct @@ -63,15 +63,15 @@ typedef struct controllerState { // main TG controller struct uint8_t saved_buf[SAVED_BUFFER_LEN];// save the input buffer uint16_t magic_end; } controller_t; -extern controller_t controller_state; // controller state structure +extern controller_t controller_state; // controller state structure void controller_init(controller_t *cs, uint8_t std_in, uint8_t std_out, uint8_t std_err); void controller_reset(controller_t *cs); void controller_run(controller_t *cs); -#ifdef __cplusplus -} -#endif +#ifdef __cplusplus +} +#endif #endif // _CONTROLLER_H_ diff --git a/TinyG2/stepper.cpp b/TinyG2/stepper.cpp index c9b31d13..2582dfff 100755 --- a/TinyG2/stepper.cpp +++ b/TinyG2/stepper.cpp @@ -4,8 +4,8 @@ * * Copyright (c) 2013 Alden S. Hart Jr. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, @@ -145,7 +145,6 @@ #include "motatePins.h" using namespace Motate; -/* // Setup a stepper template to hold our pins template @@ -154,11 +153,12 @@ struct Stepper { OutputPin dir; // enable ?? }; -Stepper x_motor; -Stepper y_motor; -Stepper z_motor; -OutputPin<8> enable; +Stepper motor_1; +Stepper motor_2; +Stepper motor_3; +OutputPin enable; +/* These conflict: Pin5 dir_1(kOutput); // direction channel 1 Pin6 dir_2(kOutput); // direction channel 2 Pin7 dir_3(kOutput); // direction channel 3 @@ -280,38 +280,6 @@ static inline void pinOutput(int pin, int val) g_APinDescription[pin].pPort->PIO_CODR = g_APinDescription[pin].ulPin; } -void ISR_Handler_DDA(void) -{ - dummy = REG_SR_DDA; // read SR to clear interrupt condition -/* - if ((st.m[MOTOR_1].counter += st.m[MOTOR_1].steps) > 0) { - st.m[MOTOR_1].counter -= st.timer_ticks_X_substeps; - x_motor.step.set(); // turn step bit on - } - if ((st.m[MOTOR_2].counter += st.m[MOTOR_2].steps) > 0) { - st.m[MOTOR_2].counter -= st.timer_ticks_X_substeps; - y_motor.step.set(); - } - if ((st.m[MOTOR_3].counter += st.m[MOTOR_3].steps) > 0) { - st.m[MOTOR_3].counter -= st.timer_ticks_X_substeps; - z_motor.step.set(); - } - x_motor.step.clear(); - y_motor.step.clear(); - z_motor.step.clear(); - -// if (temp == LOW) { -// temp = HIGH; -// } else { -// temp = LOW; -// } -// digitalWrite(3,temp); -*/ -} - -// _load_move(); -//} - /* * ISR - DDA timer interrupt routine - service ticks from DDA timer * @@ -319,7 +287,6 @@ void ISR_Handler_DDA(void) * it's faster than using indexed timer and port accesses. I checked. * Even when -0s or -03 is used. */ -/* void ISR_Handler_DDA(void) { dummy = REG_SR_DDA; // read SR to clear interrupt condition @@ -329,29 +296,29 @@ void ISR_Handler_DDA(void) if ((st.m[MOTOR_1].counter += st.m[MOTOR_1].steps) > 0) { st.m[MOTOR_1].counter -= st.timer_ticks_X_substeps; - step_1.set(); // turn step bit on + motor_1.step.set(); // turn step bit on // m1_flag++; } if ((st.m[MOTOR_2].counter += st.m[MOTOR_2].steps) > 0) { st.m[MOTOR_2].counter -= st.timer_ticks_X_substeps; - step_2.set(); + motor_2.step.set(); // m2_flag++; } if ((st.m[MOTOR_3].counter += st.m[MOTOR_3].steps) > 0) { st.m[MOTOR_3].counter -= st.timer_ticks_X_substeps; - step_3.set(); + motor_3.step.set(); // m3_flag++; } // if (m1_flag != false) { step_1.clear();} // if (m2_flag != false) { step_2.clear();} // if (m3_flag != false) { step_3.clear();} - step_1.clear(); - step_2.clear(); - step_3.clear(); -*/ -/* + motor_1.step.clear(); + motor_2.step.clear(); + motor_3.step.clear(); + if (--st.timer_ticks_downcount == 0) { // end move -// enable.set(); // disable DDA timer + enable.set(); // disable DDA timer +/* // power-down motors if this feature is enabled if (cfg.m[MOTOR_1].power_mode == true) { PORT_MOTOR_1_VPORT.OUT |= MOTOR_ENABLE_BIT_bm; @@ -366,9 +333,9 @@ void ISR_Handler_DDA(void) PORT_MOTOR_4_VPORT.OUT |= MOTOR_ENABLE_BIT_bm; } _load_move(); // load the next move - } */ -//} + } +} /* * st_disable() - stop the steppers. Requires re-init to recover diff --git a/TinyG2/system.h b/TinyG2/system.h index 6205bbf3..0405a1c2 100755 --- a/TinyG2/system.h +++ b/TinyG2/system.h @@ -27,7 +27,7 @@ #ifndef system_h #define system_h -//#include "motatePins.h" +#include "motatePins.h" //using namespace Motate; void sys_init(void); // master hardware init @@ -44,15 +44,15 @@ void sys_init(void); // master hardware init /**** Resource Assignment via Motate ****/ -/* -Motate::pin_number x_step_pin_num = 2; -Motate::pin_number y_step_pin_num = 3; -Motate::pin_number z_step_pin_num = 4; -Motate::pin_number x_dir_pin_num = 5; -Motate::pin_number y_dir_pin_num = 6; -Motate::pin_number z_dir_pin_num = 7; -Motate::pin_number enable_pin_num = 8; -*/ + +Motate::pin_number motor_1_step_pin_num = 2; +Motate::pin_number motor_2_step_pin_num = 3; +Motate::pin_number motor_3_step_pin_num = 4; +Motate::pin_number motor_1_dir_pin_num = 5; +Motate::pin_number motor_2_dir_pin_num = 6; +Motate::pin_number motor_3_dir_pin_num = 7; +Motate::pin_number enable_pin_num = 8; + /**** Resource Assignment **** * This section describes what modules use resources such as timers, pins, etc. * Base addresses and channels are setup here, see detailed setup may be found From f3c253813da82ab7423b672e9ba66163930b5c29 Mon Sep 17 00:00:00 2001 From: Robert Giseburt Date: Wed, 17 Apr 2013 00:38:30 -0500 Subject: [PATCH 06/14] Added changes to the Makefile and .cppproj files to make them play nice nice. --- .gitignore | 3 ++- TinyG2/Makefile | 31 +++++++++++++++++++++++++------ TinyG2/TinyG2.cppproj | 23 ++++++++++++++++------- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index d3a276c8..a5f5e5dd 100755 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ build/ bin/ *.xcodeproj/project.xcworkspace/xcuserdata/rob.xcuserdatad/UserInterfaceState.xcuserstate .DS_Store -TcfTransactionLog.csv \ No newline at end of file +TcfTransactionLog.csv +TinyG2/TinyG2.elf \ No newline at end of file diff --git a/TinyG2/Makefile b/TinyG2/Makefile index afa6d2bd..68b2eead 100644 --- a/TinyG2/Makefile +++ b/TinyG2/Makefile @@ -47,6 +47,8 @@ CPPFLAGS := # List ASM source files here ASRC = +DEFAULT_MEMORY = flash + # --------------------------------------------------------------------------------------- # C Flags (NOT CPP Flags) @@ -171,6 +173,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy GDB = $(CROSS_COMPILE)gdb NM = $(CROSS_COMPILE)nm RM = rm +CP = cp # --------------------------------------------------------------------------------------- @@ -195,7 +198,7 @@ ASFLAGS = # Linker Flags LDFLAGS = $(LIBS) $(USER_LIBS) -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -LDFLAGS += -nostartfiles +LDFLAGS += -nostartfiles -mcpu=cortex-m3 #LD_OPTIONAL=-Wl,--print-gc-sections -Wl,--stats @@ -219,9 +222,9 @@ INCLUDES = $(patsubst %,-I%,$(DEVICE_INCLUDE_DIRS) $(USER_INCLUDE_DIRS)) LIBS = $(patsubst %,-l%,$(DEVICE_LIBS) $(USER_LIBS)) LIBDIR = $(patsubst %,-L%,$(DEVICE_LIB_DIRS) $(USER_LIB_DIRS)) -CFLAGS += -g $(OPTIMIZATION) $(INCLUDES) -CPPFLAGS += -g $(OPTIMIZATION) $(INCLUDES) -ASFLAGS += -g $(OPTIMIZATION) $(INCLUDES) -D__ASSEMBLY__ +CFLAGS += -g3 $(OPTIMIZATION) $(INCLUDES) +CPPFLAGS += -g3 $(OPTIMIZATION) $(INCLUDES) +ASFLAGS += -g3 $(OPTIMIZATION) $(INCLUDES) -D__ASSEMBLY__ ifeq ($(VERBOSE),2) @@ -248,7 +251,7 @@ endif #------------------------------------------------------------------------------- -all: $(BIN) $(OBJ) $(MEMORIES) +all: $(BIN) $(OBJ) $(DEFAULT_MEMORY) $(PROJECT).elf REQUIRED_DIRS := $(BIN) $(OBJ) $(DEPDIR) @@ -260,6 +263,11 @@ MK_DIRS = $(shell \ $(eval $(DEVICE_RULES)) + +#------------------------------------------------------------------------------- +# Per-Memory Rules Block +#------------------------------------------------------------------------------- + define RULES OUTDIR = $(OBJ)/$(1) REQUIRED_DIRS += $(OUTDIR) @@ -323,7 +331,18 @@ endef #$(foreach MEMORY, $(MEMORIES), $(warning $(call RULES,$(MEMORY)))) $(foreach MEMORY, $(MEMORIES), $(eval $(call RULES,$(MEMORY)))) + +#------------------------------------------------------------------------------- +# Default $(PROJECT).elf, and clean +#------------------------------------------------------------------------------- + +$(PROJECT).elf: $(OUTPUT_BIN)_$(DEFAULT_MEMORY).elf + $(CP) $< $@ + +$(PROJECT).map: $(OUTPUT_BIN)_$(DEFAULT_MEMORY).map + $(CP) $< $@ + clean: - -$(RM) -fR $(OBJ) $(BIN) + -$(RM) -fR $(OBJ) $(BIN) $(PROJECT).elf # *** EOF *** \ No newline at end of file diff --git a/TinyG2/TinyG2.cppproj b/TinyG2/TinyG2.cppproj index 79dde068..a69a8719 100755 --- a/TinyG2/TinyG2.cppproj +++ b/TinyG2/TinyG2.cppproj @@ -1,4 +1,4 @@ - + 2.0 @@ -18,8 +18,7 @@ Native true false - - + exception_table 1 3.5.0 JTAG @@ -27,10 +26,10 @@ com.atmel.avrdbg.tool.samice SAM-ICE - 000028011884 + 000028014010 127.0.0.1 - 1854 + 1034 False @@ -66,8 +65,8 @@ 0 - False - Z:\Alden\Projects\proj64_ArduinoDue\g2\HW\Makefile + True + Makefile __SAM3X8E__ @@ -153,6 +152,11 @@ Default (-Wa,-g) + all TinyG2.elf COLOR=0 VERBOSE=1 + clean + + + @@ -227,6 +231,11 @@ Default (-Wa,-g) + True + + all TinyG2.elf COLOR=0 + clean + Makefile From 67fc82654ebce1250d45dc877020251d4f1a8734 Mon Sep 17 00:00:00 2001 From: "alden.hart" Date: Wed, 17 Apr 2013 06:31:27 -0400 Subject: [PATCH 07/14] Alden changes to cppproj, controller.cpp and xio.cpp/.h during compile testing --- TinyG2/TinyG2.cppproj | 15 ++++++++------- TinyG2/controller.cpp | 11 +++++++---- TinyG2/xio.cpp | 2 +- TinyG2/xio.h | 2 +- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/TinyG2/TinyG2.cppproj b/TinyG2/TinyG2.cppproj index a69a8719..3fd4574f 100755 --- a/TinyG2/TinyG2.cppproj +++ b/TinyG2/TinyG2.cppproj @@ -18,28 +18,29 @@ Native true false - exception_table + + 1 3.5.0 - JTAG + SWD com.atmel.avrdbg.tool.samice com.atmel.avrdbg.tool.samice SAM-ICE - 000028014010 + 000028011884 127.0.0.1 - 1034 + 2366 False - JTAG + SWD - 0 + 4000000 1000000 150000 false - true + false 0 0 0 diff --git a/TinyG2/controller.cpp b/TinyG2/controller.cpp index b8e402a4..6b5878ae 100755 --- a/TinyG2/controller.cpp +++ b/TinyG2/controller.cpp @@ -202,11 +202,14 @@ static status_t _command_dispatch(controller_t *cs) } return (STAT_BUFFER_FULL); */ +/* + status_t status; // read input line or return if not a completed line -// if ((status = read_line(cs->in_buf, &cs->linelen, sizeof(cs->in_buf))) != STAT_OK) { -// return (status); // Note that STAT_EAGAIN, STAT_BUFFER_FULL etc. will just flow through -// } -// write (cs->in_buf, cs->linelen); + if ((status = read_line(cs->in_buf, &cs->linelen, sizeof(cs->in_buf))) != STAT_OK) { + return (status); // Note that STAT_EAGAIN, STAT_BUFFER_FULL etc. will just flow through + } + write (cs->in_buf, cs->linelen); +*/ return (STAT_OK); } diff --git a/TinyG2/xio.cpp b/TinyG2/xio.cpp index 813a9eb9..c4e62a88 100755 --- a/TinyG2/xio.cpp +++ b/TinyG2/xio.cpp @@ -39,7 +39,7 @@ int read_char (void) * STAT_FILE_SIZE_EXCEEDED returned if the starting index exceeds the size. */ -status_t read_line (uint8_t *buffer, uint8_t *index, size_t size) +status_t read_line (uint8_t *buffer, uint16_t *index, size_t size) { if (*index >= size) { return (STAT_FILE_SIZE_EXCEEDED);} diff --git a/TinyG2/xio.h b/TinyG2/xio.h index 92c89921..2ed974bb 100755 --- a/TinyG2/xio.h +++ b/TinyG2/xio.h @@ -20,7 +20,7 @@ #define _FDEV_EOF -2 int read_char (void); -status_t read_line (uint8_t *buffer, uint8_t *index, size_t size); +status_t read_line (uint8_t *buffer, uint16_t *index, size_t size); size_t write(uint8_t *buffer, size_t size); /* Some useful ASCII definitions */ From 72732d29dcf934c897572d0d62f27ce9778d7523 Mon Sep 17 00:00:00 2001 From: Robert Giseburt Date: Wed, 17 Apr 2013 10:25:58 -0500 Subject: [PATCH 08/14] Now supporting symbolic debugging in AS6.1, compiled via Makefile. I was also able to compile on OS X (with yagarto-4.7.2), and debug the generated TinyG2.elf file using Atmel Studio 6.1. I added the Reference directory with a Makefile to gather reference code. This currently only contains newlib-1.20, and is used for symbolic debugging only. To download and prepare all of the reference code, just: cd Reference make --- Extras/.gitignore | 2 - Reference/.gitignore | 1 + Reference/Makefile | 22 + TinyG2/Debug/Makefile | 606 ------------------------ TinyG2/Debug/makedep.mk | 128 ----- TinyG2/TinyG2.cppproj | 17 +- TinyG2/TinyG2.xcodeproj/project.pbxproj | 2 +- 7 files changed, 35 insertions(+), 743 deletions(-) delete mode 100644 Extras/.gitignore create mode 100644 Reference/.gitignore create mode 100644 Reference/Makefile delete mode 100755 TinyG2/Debug/Makefile delete mode 100755 TinyG2/Debug/makedep.mk diff --git a/Extras/.gitignore b/Extras/.gitignore deleted file mode 100644 index 02babe23..00000000 --- a/Extras/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -newlib-1.20.0/ -newlib-1.20.0.tar.gz diff --git a/Reference/.gitignore b/Reference/.gitignore new file mode 100644 index 00000000..4ab513ce --- /dev/null +++ b/Reference/.gitignore @@ -0,0 +1 @@ +newlib* diff --git a/Reference/Makefile b/Reference/Makefile new file mode 100644 index 00000000..b13ee63e --- /dev/null +++ b/Reference/Makefile @@ -0,0 +1,22 @@ +## In order to download and decompress the reference coded *useful* for symbolic debugging, +## Just call "make" from this directory. + +# Program paths +WGET=wget +TAR=tar xzvf +TOUCH=touch + +# Newlib locations +NEWLIB_VERSION=1.20.0 +NEWLIB_URL=ftp://sources.redhat.com/pub/newlib/newlib-$(NEWLIB_VERSION).tar.gz +NEWLIB_DIRECTORY=./newlib-$(NEWLIB_VERSION)/ + + +# Rules +all: $(NEWLIB_DIRECTORY) + +$(NEWLIB_DIRECTORY): | newlib-$(NEWLIB_VERSION).tar.gz + $(TAR) $| + +newlib-$(NEWLIB_VERSION).tar.gz: + $(WGET) $(NEWLIB_URL) \ No newline at end of file diff --git a/TinyG2/Debug/Makefile b/TinyG2/Debug/Makefile deleted file mode 100755 index c04655e0..00000000 --- a/TinyG2/Debug/Makefile +++ /dev/null @@ -1,606 +0,0 @@ -################################################################################ -# Automatically-generated file. Do not edit! -################################################################################ - -SHELL := cmd.exe -RM := rm -rf - -USER_OBJS := - -LIBS := -PROJ := - -O_SRCS := -C_SRCS := -S_SRCS := -S_UPPER_SRCS := -OBJ_SRCS := -ASM_SRCS := -PREPROCESSING_SRCS := -OBJS := -OBJS_AS_ARGS := -C_DEPS := -C_DEPS_AS_ARGS := -EXECUTABLES := -OUTPUT_FILE_PATH := -OUTPUT_FILE_PATH_AS_ARGS := -AVR_APP_PATH :=$$$AVR_APP_PATH$$$ -QUOTE := " -ADDITIONAL_DEPENDENCIES:= -OUTPUT_FILE_DEP:= -LIB_DEP:= - -# Every subdirectory with source files must be described here -SUBDIRS := \ -../arduino/USB \ -../cmsis/ \ -../cmsis/linkerScripts/ \ -../cmsis/src/ \ -../arduino \ -../motate \ -../motate/utility \ -../platform/arm \ -../platform/arm/lib \ -../platform/arm/include \ -../platform \ -../platform/atmel_sam \ -../platform/atmel_sam/libsam \ -../platform/atmel_sam/libsam/include \ -../platform/atmel_sam/libsam/source \ -../variants - - -# Add inputs and outputs from these tool invocations to the build variables -C_SRCS += \ -../arduino/cortex_handlers.c \ -../arduino/cxxabi-compat.cpp \ -../arduino/hooks.c \ -../arduino/iar_calls_sam3.c \ -../arduino/IPAddress.cpp \ -../arduino/itoa.c \ -../arduino/Print.cpp \ -../arduino/Reset.cpp \ -../arduino/RingBuffer.cpp \ -../arduino/Stream.cpp \ -../arduino/syscalls_sam3.cpp \ -../arduino/UARTClass.cpp \ -../arduino/USARTClass.cpp \ -../arduino/USB/CDC.cpp \ -../arduino/USB/HID.cpp \ -../arduino/USB/USBCore.cpp \ -../arduino/WInterrupts.c \ -../arduino/wiring.c \ -../arduino/wiring_analog.c \ -../arduino/wiring_digital.c \ -../arduino/wiring_pulse.cpp \ -../arduino/wiring_shift.c \ -../arduino/WMath.cpp \ -../arduino/WString.cpp \ -../cmsis/src/startup_sam3xa.c \ -../cmsis/src/system_sam3xa.c \ -../config.cpp \ -../config_app.cpp \ -../controller.cpp \ -../json_parser.cpp \ -../main.cpp \ -../platform/atmel_sam/libsam/source/adc.c \ -../platform/atmel_sam/libsam/source/adc12_sam3u.c \ -../platform/atmel_sam/libsam/source/can.c \ -../platform/atmel_sam/libsam/source/dacc.c \ -../platform/atmel_sam/libsam/source/efc.c \ -../platform/atmel_sam/libsam/source/emac.c \ -../platform/atmel_sam/libsam/source/gpbr.c \ -../platform/atmel_sam/libsam/source/interrupt_sam_nvic.c \ -../platform/atmel_sam/libsam/source/pio.c \ -../platform/atmel_sam/libsam/source/pmc.c \ -../platform/atmel_sam/libsam/source/pwmc.c \ -../platform/atmel_sam/libsam/source/rstc.c \ -../platform/atmel_sam/libsam/source/rtc.c \ -../platform/atmel_sam/libsam/source/rtt.c \ -../platform/atmel_sam/libsam/source/spi.c \ -../platform/atmel_sam/libsam/source/ssc.c \ -../platform/atmel_sam/libsam/source/tc.c \ -../platform/atmel_sam/libsam/source/timetick.c \ -../platform/atmel_sam/libsam/source/trng.c \ -../platform/atmel_sam/libsam/source/twi.c \ -../platform/atmel_sam/libsam/source/udp.c \ -../platform/atmel_sam/libsam/source/udphs.c \ -../platform/atmel_sam/libsam/source/uotghs.c \ -../platform/atmel_sam/libsam/source/uotghs_device.c \ -../platform/atmel_sam/libsam/source/uotghs_host.c \ -../platform/atmel_sam/libsam/source/usart.c \ -../platform/atmel_sam/libsam/source/wdt.c \ -../stepper.cpp \ -../system.cpp \ -../variants/variant.cpp \ -../xio.cpp - - -PREPROCESSING_SRCS += - - -ASM_SRCS += - - -OBJS += \ -arduino/cortex_handlers.o \ -arduino/cxxabi-compat.o \ -arduino/hooks.o \ -arduino/iar_calls_sam3.o \ -arduino/IPAddress.o \ -arduino/itoa.o \ -arduino/Print.o \ -arduino/Reset.o \ -arduino/RingBuffer.o \ -arduino/Stream.o \ -arduino/syscalls_sam3.o \ -arduino/UARTClass.o \ -arduino/USARTClass.o \ -arduino/USB/CDC.o \ -arduino/USB/HID.o \ -arduino/USB/USBCore.o \ -arduino/WInterrupts.o \ -arduino/wiring.o \ -arduino/wiring_analog.o \ -arduino/wiring_digital.o \ -arduino/wiring_pulse.o \ -arduino/wiring_shift.o \ -arduino/WMath.o \ -arduino/WString.o \ -cmsis/src/startup_sam3xa.o \ -cmsis/src/system_sam3xa.o \ -config.o \ -config_app.o \ -controller.o \ -json_parser.o \ -main.o \ -platform/atmel_sam/libsam/source/adc.o \ -platform/atmel_sam/libsam/source/adc12_sam3u.o \ -platform/atmel_sam/libsam/source/can.o \ -platform/atmel_sam/libsam/source/dacc.o \ -platform/atmel_sam/libsam/source/efc.o \ -platform/atmel_sam/libsam/source/emac.o \ -platform/atmel_sam/libsam/source/gpbr.o \ -platform/atmel_sam/libsam/source/interrupt_sam_nvic.o \ -platform/atmel_sam/libsam/source/pio.o \ -platform/atmel_sam/libsam/source/pmc.o \ -platform/atmel_sam/libsam/source/pwmc.o \ -platform/atmel_sam/libsam/source/rstc.o \ -platform/atmel_sam/libsam/source/rtc.o \ -platform/atmel_sam/libsam/source/rtt.o \ -platform/atmel_sam/libsam/source/spi.o \ -platform/atmel_sam/libsam/source/ssc.o \ -platform/atmel_sam/libsam/source/tc.o \ -platform/atmel_sam/libsam/source/timetick.o \ -platform/atmel_sam/libsam/source/trng.o \ -platform/atmel_sam/libsam/source/twi.o \ -platform/atmel_sam/libsam/source/udp.o \ -platform/atmel_sam/libsam/source/udphs.o \ -platform/atmel_sam/libsam/source/uotghs.o \ -platform/atmel_sam/libsam/source/uotghs_device.o \ -platform/atmel_sam/libsam/source/uotghs_host.o \ -platform/atmel_sam/libsam/source/usart.o \ -platform/atmel_sam/libsam/source/wdt.o \ -stepper.o \ -system.o \ -variants/variant.o \ -xio.o - - -OBJS_AS_ARGS += \ -arduino/cortex_handlers.o \ -arduino/cxxabi-compat.o \ -arduino/hooks.o \ -arduino/iar_calls_sam3.o \ -arduino/IPAddress.o \ -arduino/itoa.o \ -arduino/Print.o \ -arduino/Reset.o \ -arduino/RingBuffer.o \ -arduino/Stream.o \ -arduino/syscalls_sam3.o \ -arduino/UARTClass.o \ -arduino/USARTClass.o \ -arduino/USB/CDC.o \ -arduino/USB/HID.o \ -arduino/USB/USBCore.o \ -arduino/WInterrupts.o \ -arduino/wiring.o \ -arduino/wiring_analog.o \ -arduino/wiring_digital.o \ -arduino/wiring_pulse.o \ -arduino/wiring_shift.o \ -arduino/WMath.o \ -arduino/WString.o \ -cmsis/src/startup_sam3xa.o \ -cmsis/src/system_sam3xa.o \ -config.o \ -config_app.o \ -controller.o \ -json_parser.o \ -main.o \ -platform/atmel_sam/libsam/source/adc.o \ -platform/atmel_sam/libsam/source/adc12_sam3u.o \ -platform/atmel_sam/libsam/source/can.o \ -platform/atmel_sam/libsam/source/dacc.o \ -platform/atmel_sam/libsam/source/efc.o \ -platform/atmel_sam/libsam/source/emac.o \ -platform/atmel_sam/libsam/source/gpbr.o \ -platform/atmel_sam/libsam/source/interrupt_sam_nvic.o \ -platform/atmel_sam/libsam/source/pio.o \ -platform/atmel_sam/libsam/source/pmc.o \ -platform/atmel_sam/libsam/source/pwmc.o \ -platform/atmel_sam/libsam/source/rstc.o \ -platform/atmel_sam/libsam/source/rtc.o \ -platform/atmel_sam/libsam/source/rtt.o \ -platform/atmel_sam/libsam/source/spi.o \ -platform/atmel_sam/libsam/source/ssc.o \ -platform/atmel_sam/libsam/source/tc.o \ -platform/atmel_sam/libsam/source/timetick.o \ -platform/atmel_sam/libsam/source/trng.o \ -platform/atmel_sam/libsam/source/twi.o \ -platform/atmel_sam/libsam/source/udp.o \ -platform/atmel_sam/libsam/source/udphs.o \ -platform/atmel_sam/libsam/source/uotghs.o \ -platform/atmel_sam/libsam/source/uotghs_device.o \ -platform/atmel_sam/libsam/source/uotghs_host.o \ -platform/atmel_sam/libsam/source/usart.o \ -platform/atmel_sam/libsam/source/wdt.o \ -stepper.o \ -system.o \ -variants/variant.o \ -xio.o - - -C_DEPS += \ -arduino/cortex_handlers.d \ -arduino/cxxabi-compat.d \ -arduino/hooks.d \ -arduino/iar_calls_sam3.d \ -arduino/IPAddress.d \ -arduino/itoa.d \ -arduino/Print.d \ -arduino/Reset.d \ -arduino/RingBuffer.d \ -arduino/Stream.d \ -arduino/syscalls_sam3.d \ -arduino/UARTClass.d \ -arduino/USARTClass.d \ -arduino/USB/CDC.d \ -arduino/USB/HID.d \ -arduino/USB/USBCore.d \ -arduino/WInterrupts.d \ -arduino/wiring.d \ -arduino/wiring_analog.d \ -arduino/wiring_digital.d \ -arduino/wiring_pulse.d \ -arduino/wiring_shift.d \ -arduino/WMath.d \ -arduino/WString.d \ -cmsis/src/startup_sam3xa.d \ -cmsis/src/system_sam3xa.d \ -config.d \ -config_app.d \ -controller.d \ -json_parser.d \ -main.d \ -platform/atmel_sam/libsam/source/adc.d \ -platform/atmel_sam/libsam/source/adc12_sam3u.d \ -platform/atmel_sam/libsam/source/can.d \ -platform/atmel_sam/libsam/source/dacc.d \ -platform/atmel_sam/libsam/source/efc.d \ -platform/atmel_sam/libsam/source/emac.d \ -platform/atmel_sam/libsam/source/gpbr.d \ -platform/atmel_sam/libsam/source/interrupt_sam_nvic.d \ -platform/atmel_sam/libsam/source/pio.d \ -platform/atmel_sam/libsam/source/pmc.d \ -platform/atmel_sam/libsam/source/pwmc.d \ -platform/atmel_sam/libsam/source/rstc.d \ -platform/atmel_sam/libsam/source/rtc.d \ -platform/atmel_sam/libsam/source/rtt.d \ -platform/atmel_sam/libsam/source/spi.d \ -platform/atmel_sam/libsam/source/ssc.d \ -platform/atmel_sam/libsam/source/tc.d \ -platform/atmel_sam/libsam/source/timetick.d \ -platform/atmel_sam/libsam/source/trng.d \ -platform/atmel_sam/libsam/source/twi.d \ -platform/atmel_sam/libsam/source/udp.d \ -platform/atmel_sam/libsam/source/udphs.d \ -platform/atmel_sam/libsam/source/uotghs.d \ -platform/atmel_sam/libsam/source/uotghs_device.d \ -platform/atmel_sam/libsam/source/uotghs_host.d \ -platform/atmel_sam/libsam/source/usart.d \ -platform/atmel_sam/libsam/source/wdt.d \ -stepper.d \ -system.d \ -variants/variant.d \ -xio.d - - -C_DEPS_AS_ARGS += \ -arduino/cortex_handlers.d \ -arduino/cxxabi-compat.d \ -arduino/hooks.d \ -arduino/iar_calls_sam3.d \ -arduino/IPAddress.d \ -arduino/itoa.d \ -arduino/Print.d \ -arduino/Reset.d \ -arduino/RingBuffer.d \ -arduino/Stream.d \ -arduino/syscalls_sam3.d \ -arduino/UARTClass.d \ -arduino/USARTClass.d \ -arduino/USB/CDC.d \ -arduino/USB/HID.d \ -arduino/USB/USBCore.d \ -arduino/WInterrupts.d \ -arduino/wiring.d \ -arduino/wiring_analog.d \ -arduino/wiring_digital.d \ -arduino/wiring_pulse.d \ -arduino/wiring_shift.d \ -arduino/WMath.d \ -arduino/WString.d \ -cmsis/src/startup_sam3xa.d \ -cmsis/src/system_sam3xa.d \ -config.d \ -config_app.d \ -controller.d \ -json_parser.d \ -main.d \ -platform/atmel_sam/libsam/source/adc.d \ -platform/atmel_sam/libsam/source/adc12_sam3u.d \ -platform/atmel_sam/libsam/source/can.d \ -platform/atmel_sam/libsam/source/dacc.d \ -platform/atmel_sam/libsam/source/efc.d \ -platform/atmel_sam/libsam/source/emac.d \ -platform/atmel_sam/libsam/source/gpbr.d \ -platform/atmel_sam/libsam/source/interrupt_sam_nvic.d \ -platform/atmel_sam/libsam/source/pio.d \ -platform/atmel_sam/libsam/source/pmc.d \ -platform/atmel_sam/libsam/source/pwmc.d \ -platform/atmel_sam/libsam/source/rstc.d \ -platform/atmel_sam/libsam/source/rtc.d \ -platform/atmel_sam/libsam/source/rtt.d \ -platform/atmel_sam/libsam/source/spi.d \ -platform/atmel_sam/libsam/source/ssc.d \ -platform/atmel_sam/libsam/source/tc.d \ -platform/atmel_sam/libsam/source/timetick.d \ -platform/atmel_sam/libsam/source/trng.d \ -platform/atmel_sam/libsam/source/twi.d \ -platform/atmel_sam/libsam/source/udp.d \ -platform/atmel_sam/libsam/source/udphs.d \ -platform/atmel_sam/libsam/source/uotghs.d \ -platform/atmel_sam/libsam/source/uotghs_device.d \ -platform/atmel_sam/libsam/source/uotghs_host.d \ -platform/atmel_sam/libsam/source/usart.d \ -platform/atmel_sam/libsam/source/wdt.d \ -stepper.d \ -system.d \ -variants/variant.d \ -xio.d - - -OUTPUT_FILE_PATH +=TinyG2.elf - -OUTPUT_FILE_PATH_AS_ARGS +=TinyG2.elf - -ADDITIONAL_DEPENDENCIES:= - -OUTPUT_FILE_DEP:= ./makedep.mk - -LIB_DEP+= - -# AVR32/GNU C Compiler - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -arduino/%.o: ../arduino/%.c - @echo Building file: $< - @echo Invoking: ARM/GNU C Compiler : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" - @echo Finished building: $< - -arduino/%.o: ../arduino/%.cpp - @echo Building file: $< - @echo Invoking: ARM/GNU C Compiler : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -fno-rtti -fno-exceptions -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -fpermissive -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" - @echo Finished building: $< - -arduino/USB/%.o: ../arduino/USB/%.cpp - @echo Building file: $< - @echo Invoking: ARM/GNU C Compiler : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -fno-rtti -fno-exceptions -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -fpermissive -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" - @echo Finished building: $< - -cmsis/src/%.o: ../cmsis/src/%.c - @echo Building file: $< - @echo Invoking: ARM/GNU C Compiler : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" - @echo Finished building: $< - -./%.o: .././%.cpp - @echo Building file: $< - @echo Invoking: ARM/GNU C Compiler : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -fno-rtti -fno-exceptions -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -fpermissive -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" - @echo Finished building: $< - -platform/atmel_sam/libsam/source/%.o: ../platform/atmel_sam/libsam/source/%.c - @echo Building file: $< - @echo Invoking: ARM/GNU C Compiler : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" - @echo Finished building: $< - -variants/%.o: ../variants/%.cpp - @echo Building file: $< - @echo Invoking: ARM/GNU C Compiler : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe$(QUOTE) -mthumb -D__SAM3X8E__ -DF_CPU=84000000UL -I"..\cmsis" -I"..\cmsis\CMSIS\Include" -I"..\cmsis\Device\ATMEL" -I"..\cmsis\Device\ATMEL\sam3xa\include" -I"..\arduino" -I"..\Arduino\USB" -I"..\variants" -I"..\motate" -I"..\platform\atmel_sam\libsam" -I"..\platform\atmel_sam\libsam\include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\CMSIS\Include" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL" -I"C:\PROGRA~1\Atmel\ATMELT~1\ARMGCC~1\Native\472~1.87\CMSIS_~1\Device\ATMEL\sam3xa\include" -O0 -ffunction-sections -fno-rtti -fno-exceptions -mlong-calls -g3 -Wall -mcpu=cortex-m3 -c -fpermissive -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o"$@" "$<" - @echo Finished building: $< - - - -# AVR32/GNU Preprocessing Assembler - - - -# AVR32/GNU Assembler - - - - -ifneq ($(MAKECMDGOALS),clean) -ifneq ($(strip $(C_DEPS)),) --include $(C_DEPS) -endif -endif - -# Add inputs and outputs from these tool invocations to the build variables - -# All Target -all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES) - -$(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP) $(LIB_DEP) - @echo Building target: $@ - @echo Invoking: ARM/GNU Linker : - $(QUOTE)C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-g++.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="TinyG2.map" -Wl,--start-group -lm -Wl,--end-group -L"../cmsis/linkerScripts" -Wl,--gc-sections -mcpu=cortex-m3 -Tsam3x8e_flash.ld - @echo Finished building target: $@ - "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-objcopy.exe" -O binary "TinyG2.elf" "TinyG2.bin" - "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature "TinyG2.elf" "TinyG2.hex" - "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O binary "TinyG2.elf" "TinyG2.eep" || exit 0 - "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-objdump.exe" -h -S "TinyG2.elf" > "TinyG2.lss" - "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature "TinyG2.elf" "TinyG2.srec" - "C:\Program Files\Atmel\Atmel Toolchain\ARM GCC\Native\4.7.2.87\arm-gnu-toolchain\bin\arm-none-eabi-size.exe" "TinyG2.elf" - - - - - - -# Other Targets -clean: - -$(RM) $(OBJS_AS_ARGS)$(C_DEPS_AS_ARGS) $(EXECUTABLES) - rm -rf "TinyG2.elf" "TinyG2.a" "TinyG2.hex" "TinyG2.bin" "TinyG2.lss" "TinyG2.eep" "TinyG2.map" "TinyG2.srec" - \ No newline at end of file diff --git a/TinyG2/Debug/makedep.mk b/TinyG2/Debug/makedep.mk deleted file mode 100755 index d0750e3b..00000000 --- a/TinyG2/Debug/makedep.mk +++ /dev/null @@ -1,128 +0,0 @@ -################################################################################ -# Automatically-generated file. Do not edit or delete the file -################################################################################ - -arduino\cortex_handlers.c - -arduino\cxxabi-compat.cpp - -arduino\hooks.c - -arduino\iar_calls_sam3.c - -arduino\IPAddress.cpp - -arduino\itoa.c - -arduino\Print.cpp - -arduino\Reset.cpp - -arduino\RingBuffer.cpp - -arduino\Stream.cpp - -arduino\syscalls_sam3.cpp - -arduino\UARTClass.cpp - -arduino\USARTClass.cpp - -arduino\USB\CDC.cpp - -arduino\USB\HID.cpp - -arduino\USB\USBCore.cpp - -arduino\WInterrupts.c - -arduino\wiring.c - -arduino\wiring_analog.c - -arduino\wiring_digital.c - -arduino\wiring_pulse.cpp - -arduino\wiring_shift.c - -arduino\WMath.cpp - -arduino\WString.cpp - -cmsis\src\startup_sam3xa.c - -cmsis\src\system_sam3xa.c - -config.cpp - -config_app.cpp - -controller.cpp - -json_parser.cpp - -main.cpp - -platform\atmel_sam\libsam\source\adc.c - -platform\atmel_sam\libsam\source\adc12_sam3u.c - -platform\atmel_sam\libsam\source\can.c - -platform\atmel_sam\libsam\source\dacc.c - -platform\atmel_sam\libsam\source\efc.c - -platform\atmel_sam\libsam\source\emac.c - -platform\atmel_sam\libsam\source\gpbr.c - -platform\atmel_sam\libsam\source\interrupt_sam_nvic.c - -platform\atmel_sam\libsam\source\pio.c - -platform\atmel_sam\libsam\source\pmc.c - -platform\atmel_sam\libsam\source\pwmc.c - -platform\atmel_sam\libsam\source\rstc.c - -platform\atmel_sam\libsam\source\rtc.c - -platform\atmel_sam\libsam\source\rtt.c - -platform\atmel_sam\libsam\source\spi.c - -platform\atmel_sam\libsam\source\ssc.c - -platform\atmel_sam\libsam\source\tc.c - -platform\atmel_sam\libsam\source\timetick.c - -platform\atmel_sam\libsam\source\trng.c - -platform\atmel_sam\libsam\source\twi.c - -platform\atmel_sam\libsam\source\udp.c - -platform\atmel_sam\libsam\source\udphs.c - -platform\atmel_sam\libsam\source\uotghs.c - -platform\atmel_sam\libsam\source\uotghs_device.c - -platform\atmel_sam\libsam\source\uotghs_host.c - -platform\atmel_sam\libsam\source\usart.c - -platform\atmel_sam\libsam\source\wdt.c - -stepper.cpp - -system.cpp - -variants\variant.cpp - -xio.cpp - diff --git a/TinyG2/TinyG2.cppproj b/TinyG2/TinyG2.cppproj index 3fd4574f..dc73fd80 100755 --- a/TinyG2/TinyG2.cppproj +++ b/TinyG2/TinyG2.cppproj @@ -26,17 +26,18 @@ com.atmel.avrdbg.tool.samice com.atmel.avrdbg.tool.samice - SAM-ICE - 000028011884 + J-Link + + 127.0.0.1 - 2366 + 1151 False SWD - 4000000 + 0 1000000 150000 false @@ -45,6 +46,7 @@ 0 0 0 + 0 @@ -153,7 +155,7 @@ Default (-Wa,-g) - all TinyG2.elf COLOR=0 VERBOSE=1 + TinyG2.elf COLOR=0 VERBOSE=1 clean @@ -234,7 +236,7 @@ True - all TinyG2.elf COLOR=0 + TinyG2.elf COLOR=0 VERBOSE=1 clean Makefile @@ -697,6 +699,9 @@ compile + + compile + \ No newline at end of file diff --git a/TinyG2/TinyG2.xcodeproj/project.pbxproj b/TinyG2/TinyG2.xcodeproj/project.pbxproj index 4a9dc1f8..945574e7 100644 --- a/TinyG2/TinyG2.xcodeproj/project.pbxproj +++ b/TinyG2/TinyG2.xcodeproj/project.pbxproj @@ -458,7 +458,7 @@ D457111D1705334100EA19A8 /* pins_arduino.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pins_arduino.h; sourceTree = ""; }; D457111E1705334100EA19A8 /* variant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = variant.cpp; sourceTree = ""; }; D457111F1705334100EA19A8 /* variant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = variant.h; sourceTree = ""; }; - D457117B17053EFA00EA19A8 /* Makefile */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.sh; }; + D457117B17053EFA00EA19A8 /* Makefile */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile; sourceTree = ""; usesTabs = 1; xcLanguageSpecificationIdentifier = xcode.lang.sh; }; D49EB85417054C4000F2BF9B /* index */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = index; sourceTree = BUILT_PRODUCTS_DIR; }; D49EB85617054CB800F2BF9B /* Arduino.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Arduino.h; sourceTree = ""; }; D49EB85717054CB800F2BF9B /* binary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = binary.h; sourceTree = ""; }; From 4492bd16b836a61821536d9d96188711b27b78c9 Mon Sep 17 00:00:00 2001 From: Robert Giseburt Date: Wed, 17 Apr 2013 15:48:46 -0500 Subject: [PATCH 09/14] Complete rewrote the Sam Motate::Port32 code. Also grabbed other progress updates from Motate project. --- TinyG2/motate/MotateTimers.h | 234 +++++------------------- TinyG2/motate/utility/AvrPins.h | 21 ++- TinyG2/motate/utility/AvrTimers.h | 55 ++++++ TinyG2/motate/utility/SamPins.h | 291 ++++++++++++++++-------------- TinyG2/motate/utility/SamTimers.h | 131 ++++++++++++++ 5 files changed, 407 insertions(+), 325 deletions(-) create mode 100644 TinyG2/motate/utility/AvrTimers.h create mode 100644 TinyG2/motate/utility/SamTimers.h diff --git a/TinyG2/motate/MotateTimers.h b/TinyG2/motate/MotateTimers.h index 55cfdf5f..b628fd55 100755 --- a/TinyG2/motate/MotateTimers.h +++ b/TinyG2/motate/MotateTimers.h @@ -1,5 +1,5 @@ /* - MotatePins.hpp - Library for the Arduino-compatible Motate system + MotateTimers.hpp - Library for the Arduino-compatible Motate system http://tinkerin.gs/ Copyright (c) 2012 Robert Giseburt @@ -23,200 +23,52 @@ #ifndef MOTATETIMERS_H_ONCE #define MOTATETIMERS_H_ONCE -#include -#include #include -namespace Motate { - template - struct Timer { - // This space intentionally left blank. - }; +/************************************************ + * + * Timers are not quite as time-critical as pins, so we can relax (a *little*) + * on optimizing the hell out of them. + * + * The exception being the interrupts, which MUST be bare-metal speed. + * + ************************************************/ - template<> - struct Timer<0> { - static const int8_t number = 0; - - enum TimeMode { - Normal = 0, - PCPWM_FF = 1, - CTC = 2, - FastPWM_255 = 3, - Reserved0 = 4, - PCPWM_A = 5, - Reserved1 = 6, - FastPWM_A = 7, - }; - - enum PrescaleValues { - TimerOff = 0, - NoPrescale = 1, - ClockBy_8 = 2, - ClockBy_64 = 3, - ClockBy_256 = 4, - ClockBy_1024 = 5, - ExternalT0Falling = 6, - ExternalT0Rising = 7, - }; - - enum InterruptValues { - disabled = 0, - overflow = 1, - compareMatchA = 2, - compareMatchB = 4, - }; - - struct modeType { - Timer *parent; +/* Timers have a simple pattern: Timer, which contains one or more Channels. + * Timers control the Mode (Up, Up-Down, Capture) and Frequency, and the Channels control + * the ouput (pin change, interrupt) as well as the duty cycle. + * Some processors share a master Timer among many Channels (AVR, XMega), where others + * have completely independent timers (Atmel Sam ARM). In the latter case, we still honor the + * Timer -> Channel relationship int he API, except it's simply a one-to-one relationship. + */ - modeType(Timer *parentIn) : parent(parentIn) {}; - void set(Timer<0>::TimeMode x) { - switch (x) { - case Normal: - TCCR0A &= ~(_BV(WGM00) | _BV(WGM01)); - TCCR0B &= ~_BV(WGM02); - break; - case PCPWM_FF: - TCCR0A |= _BV(WGM00); - TCCR0A &= ~_BV(WGM01); - TCCR0B &= ~_BV(WGM02); - break; - case CTC: - TCCR0A &= ~_BV(WGM00); - TCCR0A |= _BV(WGM01); - TCCR0B &= ~_BV(WGM02); - break; - case FastPWM_255: - TCCR0A |= _BV(WGM00) | _BV(WGM01); - TCCR0B &= ~_BV(WGM02); - break; - case Reserved0: - break; - case PCPWM_A: - TCCR0A |= _BV(WGM00); - TCCR0A &= ~_BV(WGM01); - TCCR0B |= _BV(WGM02); - break; - case Reserved1: - break; - case FastPWM_A: - TCCR0A |= _BV(WGM00) | _BV(WGM01); - TCCR0B |= _BV(WGM02); - break; - } - }; - Timer<0>::TimeMode operator=(Timer<0>::TimeMode x) { - set(x); - return x; - }; - operator Timer<0>::TimeMode() { - return static_cast::TimeMode>( - (uint8_t)(TCCR0A & (_BV(WGM00) | _BV(WGM01))) | (uint8_t)((TCCR0B & _BV(WGM02)) >> 1) - ); - }; - }; - modeType mode; - - struct prescalerType { - Timer *parent; - - prescalerType(Timer *parentIn) : parent(parentIn) {}; - void set(Timer<0>::PrescaleValues x) { - TCCR0B = (TCCR0B & 0b11111000) | (uint8_t)x; - }; - Timer<0>::PrescaleValues operator=(Timer<0>::PrescaleValues x) { - set(x); - return x; - }; - operator Timer<0>::PrescaleValues() { - return static_cast::PrescaleValues>( - (uint8_t)(TCCR0B & 0b00000111) - ); - }; - }; - prescalerType prescale; - - struct counterAType { - Timer *parent; - - counterAType(Timer *parentIn) : parent(parentIn) {}; - void set(int8_t x) { - OCR0A = x; - }; - uint8_t operator=(uint8_t x) { - set(x); - return x; - }; - operator uint8_t() { - return OCR0A; - }; - }; - counterAType counterA; - - struct counterBType { - Timer *parent; - - counterBType(Timer *parentIn) : parent(parentIn) {}; - void set(int8_t x) { - OCR0B = x; - }; - uint8_t operator=(uint8_t x) { - set(x); - return x; - }; - operator uint8_t() { - return OCR0B; - }; - }; - counterBType counterB; - - struct interruptsType { - Timer *parent; - - interruptsType(Timer *parentIn) : parent(parentIn) {}; - void set(uint8_t x) { - TIMSK0 = x; - }; - - uint8_t add(InterruptValues x) { - TIMSK0 |= x; - }; - - uint8_t remove(InterruptValues x) { - TIMSK0 &= ~x; - }; - - - // Set it... - InterruptValues operator=(InterruptValues x) { - set((uint8_t)x); - return x; - }; - - uint8_t operator=(uint8_t x) { - set(x); - return x; - }; - - // Add to it... - uint8_t operator+=(InterruptValues x) { - return add(x); - }; - - uint8_t operator-=(InterruptValues x) { - return remove(x); - }; - - operator uint8_t() { - return TIMSK0 & 0b00000111; - }; - }; - interruptsType interrupts; - - Timer<0>() : mode(this), prescale(this), counterA(this), counterB(this), interrupts(this) {}; - }; - typedef Timer<0> Timer0; - static Timer<0> timer0; +namespace Motate { } // namespace Motate + +/**************************************** + These defines allow masking of *some* (non-neccessary) functionality that is + not available on all architectures: + MOTATE_AVR_COMPATIBILITY -- only present functionality that is also on the AVR architecture + MOTATE_AVRX_COMPATIBILITY -- only present functionality that is also on the AVR XMEGA architecture + MOTATE_SAM_COMPATIBILITY -- only present functionality that is also on the SAM architecture +****************************************/ + +#ifdef __AVR_XMEGA__ + +#include + +#else + +#ifdef __AVR__ +#include +#endif + +#endif + +#ifdef __SAM3X8E__ +#include +#endif + + #endif /* end of include guard: MOTATETIMERS_H_ONCE */ \ No newline at end of file diff --git a/TinyG2/motate/utility/AvrPins.h b/TinyG2/motate/utility/AvrPins.h index b3528561..a7bd1fd9 100755 --- a/TinyG2/motate/utility/AvrPins.h +++ b/TinyG2/motate/utility/AvrPins.h @@ -83,6 +83,25 @@ namespace Motate { static const int8_t number = -1; static const uint8_t portLetter = 0; static const uint8_t mask = 0; + + Pin() {}; + Pin(const PinMode type, const PinOptions options = kNormal) {}; + void operator=(const bool value) {}; + operator bool() { return 0; }; + + void init(const PinMode type, const uint16_t options = kNormal, const bool fromConstructor=false) {}; + void setMode(const PinMode type, const bool fromConstructor=false) {}; + PinMode getMode() {}; + void setOptions(const uint16_t options, const bool fromConstructor=false) {}; + uint16_t getOptions() { return kNormal; }; + void set() {}; + void clear() {}; + void write(const bool value) {}; + void toggle() {}; + uint8_t get() { return 0; }; + uint8_t getInputValue() { return 0; }; + uint8_t getOutputValue() { return 0; }; + static uint8_t maskForPort(const uint8_t otherPortLetter) { return 0x00; }; @@ -477,7 +496,7 @@ namespace Motate { }; - void set(uint8_t in_value) { + void write(uint8_t in_value) { uint8_t port_value = 0x00; // Port<> handles reading the port and setting the masked pins #define _MOTATE_PINHOLDER_CHECKANDSETPIN(portLetter, bitNumber, bitMask) \ if (PinBit ## bitNumber.maskForPort(port ## portLetter.letter) &&\ diff --git a/TinyG2/motate/utility/AvrTimers.h b/TinyG2/motate/utility/AvrTimers.h new file mode 100644 index 00000000..ca650b2a --- /dev/null +++ b/TinyG2/motate/utility/AvrTimers.h @@ -0,0 +1,55 @@ +/* + utility/AvrPins.hpp - Library for the Arduino-compatible Motate system + http://tinkerin.gs/ + + Copyright (c) 2012 Robert Giseburt + + This file is part of the Motate Library. + + The Motate Library is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + The Motate Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with the Motate Library. If not, see . +*/ + +#ifndef AVRTIMERS_H_ONCE +#define AVRTIMERS_H_ONCE + +#include +#include + +namespace Motate { + enum TimerMode { + kTimerUp = 0, + kTimerUpToMatch = 1, + kTimerUpDown = 2, + kTimerInputCapture = 3, + }; + + enum TimerChannelOutputOptions { + kOutputDisconnected = 0, + kToggleOnMatch = 1 + kClearOnMatch = 2, + kSetOnMatch = 3, + }; + + enum TimerChannelInterruptOptions { + kInterruptsOff = 0, + kInterruptOnMatchA = 1<<0, + kInterruptOnMatchB = 1<<1; + kInterruptOnOverflow = 1<<2, + kSetOnMatch = 1<<3, + }; + + + +} +#endif /* end of include guard: AVRTIMERS_H_ONCE */ \ No newline at end of file diff --git a/TinyG2/motate/utility/SamPins.h b/TinyG2/motate/utility/SamPins.h index 76df851b..30316d90 100755 --- a/TinyG2/motate/utility/SamPins.h +++ b/TinyG2/motate/utility/SamPins.h @@ -61,9 +61,14 @@ namespace Motate { template struct Port32 { - static const uint8_t letter = (uint8_t) portLetter; - static Pio* portPtr; - static uint32_t pmcId; + static const uint8_t letter = 0; // NULL stub! + + static Pio* portPtr() { + return NULL; + }; + static const uint32_t pmcId() { + return 0; + }; void setModes(const uintPort_t value, const uintPort_t mask = 0xffffffff) { // stub @@ -108,9 +113,24 @@ namespace Motate { static const int8_t number = -1; static const uint8_t portLetter = 0; static const uint32_t mask = 0; - static uint32_t maskForPort(const uint8_t otherPortLetter) { - return 0x00; - }; + Pin() {}; + Pin(const PinMode type, const PinOptions options = kNormal) {}; + void operator=(const bool value) {}; + operator bool() { return 0; }; + + void init(const PinMode type, const uint16_t options = kNormal, const bool fromConstructor=false) {}; + void setMode(const PinMode type, const bool fromConstructor=false) {}; + PinMode getMode() { return kUnchanged; }; + void setOptions(const uint16_t options, const bool fromConstructor=false) {}; + uint16_t getOptions() { return kNormal; }; + void set() {}; + void clear() {}; + void write(const bool value) {}; + void toggle() {}; + uint8_t get() { return 0; }; + uint8_t getInputValue() { return 0; }; + uint8_t getOutputValue() { return 0; }; + static uint32_t maskForPort(const uint8_t otherPortLetter) { return 0; }; bool isNull() { return true; }; }; @@ -159,7 +179,6 @@ namespace Motate { static const int8_t number = pinNum;\ static const uint8_t portLetter = (uint8_t) registerChar;\ static const uint32_t mask = (1u << registerPin);\ - static Pio* portPtr;\ static Port32 port;\ \ Pin() {};\ @@ -176,11 +195,11 @@ namespace Motate { void setMode(const PinMode type, const bool fromConstructor=false) {\ switch (type) {\ case kOutput:\ - portPtr->PIO_OER = mask ;\ - portPtr->PIO_PER = mask ;\ + (*PIO ## registerLetter).PIO_OER = mask ;\ + (*PIO ## registerLetter).PIO_PER = mask ;\ /* if all pins are output, disable PIO Controller clocking, reduce power consumption */\ if (!fromConstructor) {\ - if ( portPtr->PIO_OSR == 0xffffffff )\ + if ( (*PIO ## registerLetter).PIO_OSR == 0xffffffff )\ {\ port.disablePeripheralClock();\ }\ @@ -188,62 +207,62 @@ namespace Motate { break;\ case kInput:\ port.enablePeripheralClock();\ - portPtr->PIO_ODR = mask ;\ - portPtr->PIO_PER = mask ;\ + (*PIO ## registerLetter).PIO_ODR = mask ;\ + (*PIO ## registerLetter).PIO_PER = mask ;\ break;\ default:\ break;\ }\ };\ PinMode getMode() {\ - return (portPtr->PIO_OSR & mask) ? kOutput : kInput;\ + return ((*PIO ## registerLetter).PIO_OSR & mask) ? kOutput : kInput;\ };\ void setOptions(const uint16_t options, const bool fromConstructor=false) {\ if (kPullUp & options)\ {\ - portPtr->PIO_PUER = mask ;\ + (*PIO ## registerLetter).PIO_PUER = mask ;\ }\ else\ {\ - portPtr->PIO_PUDR = mask ;\ + (*PIO ## registerLetter).PIO_PUDR = mask ;\ }\ if (kWiredAnd & options)\ {/*kDriveLowOnly - Enable Multidrive*/\ - portPtr->PIO_MDER = mask ;\ + (*PIO ## registerLetter).PIO_MDER = mask ;\ }\ else\ {\ - portPtr->PIO_MDDR = mask ;\ + (*PIO ## registerLetter).PIO_MDDR = mask ;\ }\ if (kDeglitch & options)\ {\ - portPtr->PIO_IFER = mask ;\ - portPtr->PIO_SCIFSR = mask ;\ + (*PIO ## registerLetter).PIO_IFER = mask ;\ + (*PIO ## registerLetter).PIO_SCIFSR = mask ;\ }\ else\ {\ if (kDebounce & options)\ {\ - portPtr->PIO_IFER = mask ;\ - portPtr->PIO_DIFSR = mask ;\ + (*PIO ## registerLetter).PIO_IFER = mask ;\ + (*PIO ## registerLetter).PIO_DIFSR = mask ;\ }\ else\ {\ - portPtr->PIO_IFDR = mask ;\ + (*PIO ## registerLetter).PIO_IFDR = mask ;\ }\ }\ };\ uint16_t getOptions() {\ - return ((portPtr->PIO_PUSR & mask) ? kPullUp : 0)\ - | ((portPtr->PIO_MDSR & mask) ? kWiredAnd : 0)\ - | ((portPtr->PIO_IFSR & mask) ? \ - ((portPtr->PIO_IFDGSR & mask) ? kDebounce : kDeglitch) : 0);\ + return (((*PIO ## registerLetter).PIO_PUSR & mask) ? kPullUp : 0)\ + | (((*PIO ## registerLetter).PIO_MDSR & mask) ? kWiredAnd : 0)\ + | (((*PIO ## registerLetter).PIO_IFSR & mask) ? \ + (((*PIO ## registerLetter).PIO_IFDGSR & mask) ? kDebounce : kDeglitch) : 0);\ };\ void set() {\ - portPtr->PIO_SODR = mask;\ + (*PIO ## registerLetter).PIO_SODR = mask;\ };\ void clear() {\ - portPtr->PIO_CODR = mask;\ + (*PIO ## registerLetter).PIO_CODR = mask;\ };\ void write(const bool value) {\ if (!value)\ @@ -252,126 +271,132 @@ namespace Motate { set();\ };\ void toggle() {\ - portPtr->PIO_ODSR ^= mask;\ + (*PIO ## registerLetter).PIO_ODSR ^= mask;\ };\ uint8_t get() { /* WARNING: This will fail if the peripheral clock is disabled for this pin!!! Use getOutputValue() instead. */\ - return portPtr->PIO_PDSR & mask;\ + return (*PIO ## registerLetter).PIO_PDSR & mask;\ };\ uint8_t getInputValue() {\ - return portPtr->PIO_PDSR & mask;\ + return (*PIO ## registerLetter).PIO_PDSR & mask;\ };\ uint8_t getOutputValue() {\ - return portPtr->PIO_OSR & mask;\ + return (*PIO ## registerLetter).PIO_OSR & mask;\ };\ bool isNull() { return false; };\ static uint32_t maskForPort(const uint8_t otherPortLetter) {\ return portLetter == otherPortLetter ? mask : 0x00u;\ };\ };\ - Pio* Pin::portPtr = (PIO ## registerLetter);\ - Port32 Pin::port;\ typedef Pin Pin ## pinNum;\ static Pin ## pinNum pin ## pinNum; #define _MAKE_MOTATE_PORT32(registerLetter, registerChar)\ - template <> inline void Port32::enablePeripheralClock() {\ - if (pmcId < 32) {\ - uint32_t id_mask = 1u << ( pmcId );\ - if ((PMC->PMC_PCSR0 & id_mask) != id_mask) {\ - PMC->PMC_PCER0 = id_mask;\ - }\ - } else {\ - uint32_t id_mask = 1u << ( pmcId - 32 );\ - if ((PMC->PMC_PCSR1 & id_mask) != id_mask) {\ - PMC->PMC_PCER1 = id_mask;\ - }\ - }\ - };\ - template <> inline void Port32::disablePeripheralClock() {\ - if (pmcId < 32) {\ - uint32_t id_mask = 1u << ( pmcId );\ - if ((PMC->PMC_PCSR0 & id_mask) == id_mask) {\ - PMC->PMC_PCDR0 = id_mask;\ - }\ - } else {\ - uint32_t id_mask = 1u << ( pmcId-32 );\ - if ((PMC->PMC_PCSR1 & id_mask) == id_mask) {\ - PMC->PMC_PCDR1 = id_mask;\ - }\ - }\ - };\ - template <> inline void Port32::setModes(const uintPort_t value, const uintPort_t mask) {\ - portPtr->PIO_ODR = ~value & mask ;\ - portPtr->PIO_OER = value & mask ;\ - portPtr->PIO_PER = mask ;\ - /* if all pins are output, disable PIO Controller clocking, reduce power consumption */\ - if ( portPtr->PIO_OSR == 0xffffffff )\ - {\ - disablePeripheralClock();\ - } else {\ - enablePeripheralClock();\ - }\ - };\ - template <> inline void Port32::setOptions(const uint16_t options, const uintPort_t mask) {\ - if (kPullUp & options)\ - {\ - portPtr->PIO_PUER = mask ;\ - }\ - else\ - {\ - portPtr->PIO_PUDR = mask ;\ - }\ - if (kWiredAnd & options)\ - {/*kDriveLowOnly - Enable Multidrive*/\ - portPtr->PIO_MDER = mask ;\ - }\ - else\ - {\ - portPtr->PIO_MDDR = mask ;\ - }\ - if (kDeglitch & options)\ - {\ - portPtr->PIO_IFER = mask ;\ - portPtr->PIO_SCIFSR = mask ;\ - }\ - else\ - {\ - if (kDebounce & options)\ - {\ - portPtr->PIO_IFER = mask ;\ - portPtr->PIO_DIFSR = mask ;\ - }\ - else\ - {\ - portPtr->PIO_IFDR = mask ;\ - }\ - }\ - };\ - template <> inline void Port32::set(const uintPort_t value) {\ - portPtr->PIO_SODR = value;\ - };\ - template <> inline void Port32::clear(const uintPort_t value) {\ - portPtr->PIO_CODR = value;\ - };\ - template <> inline void Port32::write(const uintPort_t value) {\ - portPtr->PIO_OWER = 0xffffffff;/*Enable all registers for writing thru ODSR*/\ - portPtr->PIO_ODSR = value;\ - portPtr->PIO_OWDR = 0xffffffff;/*Disable all registers for writing thru ODSR*/\ - };\ - template <> inline void Port32::write(const uintPort_t value, const uintPort_t mask) {\ - portPtr->PIO_OWER = mask;/*Enable masked registers for writing thru ODSR*/\ - portPtr->PIO_ODSR = value;\ - portPtr->PIO_OWDR = mask;/*Disable masked registers for writing thru ODSR*/\ - };\ - template <> inline uintPort_t Port32::getInputValues(const uintPort_t mask) {\ - return portPtr->PIO_PDSR & mask;\ - };\ - template <> inline uintPort_t Port32::getOutputValues(const uintPort_t mask) {\ - return portPtr->PIO_OSR & mask;\ - };\ - template <> Pio* Port32::portPtr = ( PIO ## registerLetter );\ - template <> uint32_t Port32::pmcId = ( ID_PIO ## registerLetter );\ + template <>\ + struct Port32 {\ + static const uint8_t letter = (uint8_t) registerChar;\ + void enablePeripheralClock() {\ + if (pmcId() < 32) {\ + uint32_t id_mask = 1u << ( pmcId() );\ + if ((PMC->PMC_PCSR0 & id_mask) != id_mask) {\ + PMC->PMC_PCER0 = id_mask;\ + }\ + } else {\ + uint32_t id_mask = 1u << ( pmcId() - 32 );\ + if ((PMC->PMC_PCSR1 & id_mask) != id_mask) {\ + PMC->PMC_PCER1 = id_mask;\ + }\ + }\ + };\ + void disablePeripheralClock() {\ + if (pmcId() < 32) {\ + uint32_t id_mask = 1u << ( pmcId() );\ + if ((PMC->PMC_PCSR0 & id_mask) == id_mask) {\ + PMC->PMC_PCDR0 = id_mask;\ + }\ + } else {\ + uint32_t id_mask = 1u << ( pmcId()-32 );\ + if ((PMC->PMC_PCSR1 & id_mask) == id_mask) {\ + PMC->PMC_PCDR1 = id_mask;\ + }\ + }\ + };\ + void setModes(const uintPort_t value, const uintPort_t mask) {\ + (*PIO ## registerLetter).PIO_ODR = ~value & mask ;\ + (*PIO ## registerLetter).PIO_OER = value & mask ;\ + (*PIO ## registerLetter).PIO_PER = mask ;\ + /* if all pins are output, disable PIO Controller clocking, reduce power consumption */\ + if ( (*PIO ## registerLetter).PIO_OSR == 0xffffffff )\ + {\ + disablePeripheralClock();\ + } else {\ + enablePeripheralClock();\ + }\ + };\ + void setOptions(const uint16_t options, const uintPort_t mask) {\ + if (kPullUp & options)\ + {\ + (*PIO ## registerLetter).PIO_PUER = mask ;\ + }\ + else\ + {\ + (*PIO ## registerLetter).PIO_PUDR = mask ;\ + }\ + if (kWiredAnd & options)\ + {/*kDriveLowOnly - Enable Multidrive*/\ + (*PIO ## registerLetter).PIO_MDER = mask ;\ + }\ + else\ + {\ + (*PIO ## registerLetter).PIO_MDDR = mask ;\ + }\ + if (kDeglitch & options)\ + {\ + (*PIO ## registerLetter).PIO_IFER = mask ;\ + (*PIO ## registerLetter).PIO_SCIFSR = mask ;\ + }\ + else\ + {\ + if (kDebounce & options)\ + {\ + (*PIO ## registerLetter).PIO_IFER = mask ;\ + (*PIO ## registerLetter).PIO_DIFSR = mask ;\ + }\ + else\ + {\ + (*PIO ## registerLetter).PIO_IFDR = mask ;\ + }\ + }\ + };\ + void set(const uintPort_t value) {\ + (*PIO ## registerLetter).PIO_SODR = value;\ + };\ + void clear(const uintPort_t value) {\ + (*PIO ## registerLetter).PIO_CODR = value;\ + };\ + void write(const uintPort_t value) {\ + (*PIO ## registerLetter).PIO_OWER = 0xffffffff;/*Enable all registers for writing thru ODSR*/\ + (*PIO ## registerLetter).PIO_ODSR = value;\ + (*PIO ## registerLetter).PIO_OWDR = 0xffffffff;/*Disable all registers for writing thru ODSR*/\ + };\ + void write(const uintPort_t value, const uintPort_t mask) {\ + (*PIO ## registerLetter).PIO_OWER = mask;/*Enable masked registers for writing thru ODSR*/\ + (*PIO ## registerLetter).PIO_ODSR = value;\ + (*PIO ## registerLetter).PIO_OWDR = mask;/*Disable masked registers for writing thru ODSR*/\ + };\ + uintPort_t getInputValues(const uintPort_t mask) {\ + return (*PIO ## registerLetter).PIO_PDSR & mask;\ + };\ + uintPort_t getOutputValues(const uintPort_t mask) {\ + return (*PIO ## registerLetter).PIO_OSR & mask;\ + };\ + Pio* portPtr() {\ + return (PIO ## registerLetter);\ + };\ + const uint32_t pmcId() {\ + return ID_PIO ## registerLetter;\ + };\ + };\ typedef Port32 Port ## registerLetter;\ static Port ## registerLetter port ## registerLetter; @@ -616,7 +641,7 @@ namespace Motate { }; - void set(uint32_t in_value) { + void write(uint32_t in_value) { uint32_t port_value = 0x00; // Port<> handles reading the port and setting the masked pins #define _MOTATE_PH32_PINHOLDER_CHECKANDSETPIN(portLetter, bitNumber, bitMask) \ if (PinBit ## bitNumber.maskForPort(Port ## portLetter::letter) &&\ @@ -724,7 +749,7 @@ namespace Motate { }; - void set(uint8_t in_value) { + void write(uint8_t in_value) { uint32_t port_value = 0; // Port<> handles reading the port and setting the masked pins #define _MOTATE_PH8_PINHOLDER_CHECKANDSETPIN(portLetter, bitNumber, bitMask) \ if (PinBit ## bitNumber.maskForPort(Port ## portLetter::letter) &&\ diff --git a/TinyG2/motate/utility/SamTimers.h b/TinyG2/motate/utility/SamTimers.h new file mode 100644 index 00000000..db5bbf2b --- /dev/null +++ b/TinyG2/motate/utility/SamTimers.h @@ -0,0 +1,131 @@ +/* + utility/AvrPins.hpp - Library for the Arduino-compatible Motate system + http://tinkerin.gs/ + + Copyright (c) 2012 Robert Giseburt + + This file is part of the Motate Library. + + The Motate Library is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + The Motate Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with the Motate Library. If not, see . +*/ + +#ifndef AVRTIMERS_H_ONCE +#define AVRTIMERS_H_ONCE + +#include "sam.h" + +/* Sam hardware timers have three channels each. Each channel is actually an + * independent timer, so we have a little nomenclature clash. + * + * Sam Timer != Motate::Timer!!! + * + * A Sam Timer CHANNEL is actually the portion that a Motate::Timer controls + * direcly. Each SAM CHANNEL has two Motate:Timers (A and B). + * (Actually, the Quadrature Decoder and Block Control can mix them up some, + * but we ignore that.) + * So, for the Sam, we have to maintain the same interface, and treat each + * channel as an independent timer. + */ + +namespace Motate { + enum TimerMode { + /* InputCapture mode (WAVE = 0) */ + kTimerInputCapture = 0, + /* InputCapture mode (WAVE = 0), counts up to RC */ + kTimerInputCaptureToMatch = 0 | TC_CMR_CPCTRG, + + /* Waveform select, Up to 0xFFFFFFFF */ + kTimerUp = TC_CMR_WAVE | TC_CMR_WAVSEL_UP, + /* Waveform select, Up to RC */ + kTimerUpToMatch = TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC, + /* Waveform select, Up to 0xFFFFFFFF, then Down */ + kTimerUpDown = TC_CMR_WAVE | TC_CMR_WAVSEL_UPDOWN, + /* Waveform select, Up to RC, then Down */ + kTimerUpDownToMatch = TC_CMR_WAVE | TC_CMR_WAVSEL_UPDOWN_RC, + }; + + enum TimerChannelOutputOptions { + kOutputDisconnected = 0, + kToggleOnMatch = 1 + kClearOnMatch = 2, + kSetOnMatch = 3, + }; + + enum TimerChannelInterruptOptions { + kInterruptsOff = 0, + kInterruptOnMatch = 1<<1; + kInterruptOnOverflow = 1<<2, + kSetOnMatch = 1<<3, // ??? + }; + + template + struct Timer { + static Tc *tc; + static TcChannel *tcChan; + + /* ################################################################### * + /* # WARNING # * + /* # WARNING: Sam channels (tcChan) DO NOT map to Motate Channels!?! # * + /* # WARNING (u been warned) # * + /* ################################################################### */ + + Timer() : init() {}; + + void init() { + /* Unlock this thing */ + unlock(); + } + + void unlock() { + tc->TC_WPMR = TC_WPMR_WPEN | TC_WPMR_WPKEY(0x54494D); + } + + /* WHOA!! Only do this if you know what you're doing!! */ + void lock() { + tc->TC_WPMR = TC_WPMR_WPEN | TC_WPMR_WPKEY(0x54494D); + } + + bool setModeAndFrequency(const TimerMode mode, const uint32_t freq) { + /* Prepare to be able to make changes: *? + /* Disable TC clock */ + tcChan->TC_CCR = TC_CCR_CLKDIS ; + /* Disable interrupts */ + tcChan->TC_IDR = 0xFFFFFFFF ; + /* Clear status register */ + tcChan->TC_SR ; + + /* Setup clock "prescaler" */ + /* Divisors: TC1: 2, TC2: 8, TC3: 32, TC4: 128, TC5: ???! */ + /* For now, we don't support TC5. */ + + // Grab the SystemCoreClock value, in case it's volatile. + uint32_t masterClock = SystemCoreClock; + + if (freq < ((masterClock / 128) / 0x10000) && freq > (masterClock / 128)) { + + } + + + /* Set mode */ + tcChan->TC_CMR = mode; + }; + uint8_t getOutputValues(const uint8_t mask = 0xff) { + // stub + return 0; + }; + }; + + +} +#endif /* end of include guard: AVRTIMERS_H_ONCE */ \ No newline at end of file From c6345ff76dd15d6c8c6a00ad2c91405cefe1c785 Mon Sep 17 00:00:00 2001 From: Robert Giseburt Date: Wed, 17 Apr 2013 15:49:18 -0500 Subject: [PATCH 10/14] Enable (dis-disable) floating-point printf from newlib, where available. --- TinyG2/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TinyG2/Makefile b/TinyG2/Makefile index 68b2eead..f6eb8bda 100644 --- a/TinyG2/Makefile +++ b/TinyG2/Makefile @@ -69,7 +69,7 @@ CFLAGS += -Wunreachable-code #CFLAGS += -Wconversion # To reduce application size use only integer printf function. -CFLAGS += -Dprintf=iprintf +#CFLAGS += -Dprintf=iprintf # --------------------------------------------------------------------------------------- # CPP Flags @@ -87,7 +87,7 @@ CPPFLAGS += -Wredundant-decls -Winline -Wlong-long #CPPFLAGS += -Wconversion # To reduce application size use only integer printf function. -CPPFLAGS += -Dprintf=iprintf +#CPPFLAGS += -Dprintf=iprintf # Default is to compile more quielty. # To show actual commands: make [options] VERBOSE=1 From bb69ef849a96772c43627a7c172a7d0ebd9d53f2 Mon Sep 17 00:00:00 2001 From: Robert Giseburt Date: Wed, 17 Apr 2013 15:49:41 -0500 Subject: [PATCH 11/14] Switch back to JTAG from SWD. (Fickle little beast.) --- TinyG2/TinyG2.cppproj | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/TinyG2/TinyG2.cppproj b/TinyG2/TinyG2.cppproj index dc73fd80..e418d1b2 100755 --- a/TinyG2/TinyG2.cppproj +++ b/TinyG2/TinyG2.cppproj @@ -18,35 +18,33 @@ Native true false - - + exception_table 1 3.5.0 - SWD + JTAG com.atmel.avrdbg.tool.samice com.atmel.avrdbg.tool.samice - J-Link - - + SAM-ICE + 000028014010 127.0.0.1 - 1151 + 1180 False - SWD + JTAG 0 1000000 150000 false - false + true 0 0 0 0 - 0 + 8500000 From 01c49bd11ec6452564bdce08d369264a80ee568a Mon Sep 17 00:00:00 2001 From: Robert Giseburt Date: Wed, 17 Apr 2013 16:05:38 -0500 Subject: [PATCH 12/14] Move IndicatorLed over to Motate, and blink every second. Using GetTickCount() to grab the actual system tick value (in milliseconds, currently), and offset from there. (Currently SAM-specific.) Also use the built-in hardware pin toggle (where available). --- TinyG2/controller.cpp | 28 +++++++++++++--------------- TinyG2/controller.h | 3 +-- TinyG2/main.cpp | 4 +--- TinyG2/tinyg2.h | 5 ++++- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/TinyG2/controller.cpp b/TinyG2/controller.cpp index 6b5878ae..79fb586d 100755 --- a/TinyG2/controller.cpp +++ b/TinyG2/controller.cpp @@ -17,8 +17,8 @@ * You should have received a copy of the GNU General Public License * along with TinyG If not, see . * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, @@ -51,9 +51,9 @@ #include "help.h" */ -#ifdef __cplusplus -extern "C"{ -#endif +#ifdef __cplusplus +extern "C"{ +#endif controller_t controller_state; // controller state structure @@ -171,7 +171,7 @@ static void _controller_HSM(controller_t *cs) static status_t _command_dispatch(controller_t *cs) { -// printf("printf test2 %d %f...\n", 10, 10.003); + printf("printf test2 %d %f...\n", 10, 10.003); int c; if ((c = SerialUSB.read()) != -1) { // read is non-blocking @@ -270,10 +270,9 @@ static status_t _command_dispatch(controller_t *cs) static status_t _normal_idler( controller_t *cs ) { - if (--(cs->led_counter) < 0) { - cs->led_counter = LED_NORMAL_COUNTER; - cs->led_state ^= 1; - digitalWrite(INDICATOR_LED, cs->led_state); + if (GetTickCount() > cs->led_counter) { + cs->led_counter += LED_NORMAL_COUNTER; + IndicatorLed.toggle(); } return (STAT_OK); } @@ -292,8 +291,7 @@ static uint8_t _alarm_idler( controller *cs ) if (--(cs->led_counter) < 0) { cs->led_counter = LED_ALARM_COUNTER; - cs->led_state ^= 1; - digitalWrite(INDICATOR_LED, cs->led_state); + IndicatorLed.toggle(); } return (TG_EAGAIN); // EAGAIN prevents any other actions from running } @@ -334,6 +332,6 @@ uint8_t _system_assertions() } */ -#ifdef __cplusplus -} -#endif // __cplusplus +#ifdef __cplusplus +} +#endif // __cplusplus diff --git a/TinyG2/controller.h b/TinyG2/controller.h index 096c2187..ba84cbc7 100755 --- a/TinyG2/controller.h +++ b/TinyG2/controller.h @@ -39,7 +39,7 @@ extern "C"{ #define STATUS_MESSAGE_LEN 32 // status message string storage allocation #define APPLICATION_MESSAGE_LEN 64 // application message string storage allocation -#define LED_NORMAL_COUNTER 100000 // blink rate for normal operation +#define LED_NORMAL_COUNTER 1000 // blink rate for normal operation #define LED_ALARM_COUNTER 1000 // blink rate for alarm state typedef struct controllerState { // main TG controller struct @@ -54,7 +54,6 @@ typedef struct controllerState { // main TG controller struct uint8_t network_mode; // 0=master, 1=repeater, 2=slave uint16_t linelen; // length of currently processing line uint16_t linemax; // size of input buffer or some other size - uint8_t led_state; // 0=off, 1=on int32_t led_counter; // a convenience for flashing an LED uint32_t nvm_base_addr; // NVM base address uint32_t nvm_profile_base; // NVM base address of current profile diff --git a/TinyG2/main.cpp b/TinyG2/main.cpp index 858476d8..47ad0d25 100755 --- a/TinyG2/main.cpp +++ b/TinyG2/main.cpp @@ -51,13 +51,11 @@ extern void SysTick_Handler( void ) #define DEV_STDERR 0 static void _application_init(void); - + /******************** Application Code ************************/ -//int indicator_led = 13; void setup( void ) { - pinMode(INDICATOR_LED, OUTPUT); SerialUSB.begin(115200); _application_init(); } diff --git a/TinyG2/tinyg2.h b/TinyG2/tinyg2.h index 5060e90a..beab3cee 100755 --- a/TinyG2/tinyg2.h +++ b/TinyG2/tinyg2.h @@ -29,6 +29,8 @@ #include #include +#include + #include "Arduino.h" // NOTE: This header requires be included previously @@ -72,7 +74,8 @@ void tg_setup(void); * TinyG application-specific prototypes, defines and globals */ #define MAGICNUM 0x12EF // used for memory integrity assertions -#define INDICATOR_LED 13 +Motate::pin_number indicator_led_pin_num = 13; +static Motate::OutputPin IndicatorLed; #define AXES 6 // number of axes supported in this version #define MOTORS 4 // number of motors on the board From 84629af82c23791b87050ed52ceb188047c4d4d7 Mon Sep 17 00:00:00 2001 From: Robert Giseburt Date: Wed, 17 Apr 2013 16:06:20 -0500 Subject: [PATCH 13/14] Support OPTIMIZATION=s on the make line. Also configured the cppproj to use that when compiling for "Release." --- TinyG2/Makefile | 8 ++++---- TinyG2/TinyG2.cppproj | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/TinyG2/Makefile b/TinyG2/Makefile index f6eb8bda..c342e3b4 100644 --- a/TinyG2/Makefile +++ b/TinyG2/Makefile @@ -39,7 +39,7 @@ USER_LIBS = # Define optimisation level here #OPTIMIZATION = -Os -OPTIMIZATION = -O0 +OPTIMIZATION ?= 0 CFLAGS := CPPFLAGS := @@ -222,9 +222,9 @@ INCLUDES = $(patsubst %,-I%,$(DEVICE_INCLUDE_DIRS) $(USER_INCLUDE_DIRS)) LIBS = $(patsubst %,-l%,$(DEVICE_LIBS) $(USER_LIBS)) LIBDIR = $(patsubst %,-L%,$(DEVICE_LIB_DIRS) $(USER_LIB_DIRS)) -CFLAGS += -g3 $(OPTIMIZATION) $(INCLUDES) -CPPFLAGS += -g3 $(OPTIMIZATION) $(INCLUDES) -ASFLAGS += -g3 $(OPTIMIZATION) $(INCLUDES) -D__ASSEMBLY__ +CFLAGS += -g3 -O$(OPTIMIZATION) $(INCLUDES) +CPPFLAGS += -g3 -O$(OPTIMIZATION) $(INCLUDES) +ASFLAGS += -g3 -O$(OPTIMIZATION) $(INCLUDES) -D__ASSEMBLY__ ifeq ($(VERBOSE),2) diff --git a/TinyG2/TinyG2.cppproj b/TinyG2/TinyG2.cppproj index e418d1b2..f5b2674a 100755 --- a/TinyG2/TinyG2.cppproj +++ b/TinyG2/TinyG2.cppproj @@ -234,7 +234,7 @@ True - TinyG2.elf COLOR=0 VERBOSE=1 + TinyG2.elf COLOR=0 VERBOSE=1 OPTIMIZATION=s clean Makefile From 65a461ace10642d925c27f0e3f426f96c9a8f7b8 Mon Sep 17 00:00:00 2001 From: Robert Giseburt Date: Thu, 18 Apr 2013 09:13:33 -0500 Subject: [PATCH 14/14] Making the motor move. --- TinyG2/stepper.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/TinyG2/stepper.cpp b/TinyG2/stepper.cpp index 2582dfff..fc00cb5a 100755 --- a/TinyG2/stepper.cpp +++ b/TinyG2/stepper.cpp @@ -270,6 +270,9 @@ void stepper_init() NVIC_EnableIRQ(TC_IRQn_DDA); pmc_enable_periph_clk(TC_ID_DDA); TC_Start(TC_BLOCK_DDA, TC_CHANNEL_DDA); + + // DEBUG -- rg + _load_move(); } static inline void pinOutput(int pin, int val) @@ -316,9 +319,10 @@ void ISR_Handler_DDA(void) motor_2.step.clear(); motor_3.step.clear(); - if (--st.timer_ticks_downcount == 0) { // end move - enable.set(); // disable DDA timer /* + if (--st.timer_ticks_downcount == 0) { // end move + st_disable(); // disable DDA timer + // power-down motors if this feature is enabled if (cfg.m[MOTOR_1].power_mode == true) { PORT_MOTOR_1_VPORT.OUT |= MOTOR_ENABLE_BIT_bm; @@ -333,8 +337,8 @@ void ISR_Handler_DDA(void) PORT_MOTOR_4_VPORT.OUT |= MOTOR_ENABLE_BIT_bm; } _load_move(); // load the next move -*/ } +*/ } /* @@ -426,8 +430,13 @@ void _load_move() // sps.move_type = MOVE_TYPE_ALINE; sps.move_type = true; sps.timer_ticks = 100000; - sps.timer_ticks_X_substeps = 1000; + sps.timer_ticks_X_substeps = 1000000; sps.timer_period = 64000; + + st.m[MOTOR_1].steps = 90000; + st.m[MOTOR_1].counter = -sps.timer_ticks; + st.timer_ticks_X_substeps = sps.timer_ticks_X_substeps; + /* // handle aline loads first (most common case) NB: there are no more lines, only alines // if (sps.move_type == MOVE_TYPE_ALINE) {