diff --git a/Motate b/Motate index 0300c25d..f73eb8ee 160000 --- a/Motate +++ b/Motate @@ -1 +1 @@ -Subproject commit 0300c25d0c8225bbd85df00d2f8fe543bc37c7b5 +Subproject commit f73eb8ee8431c7edfe5cd598c314102b6af6955e diff --git a/g2core/board/G2v9.mk b/g2core/board/G2v9.mk index a99f333c..d9337954 100755 --- a/g2core/board/G2v9.mk +++ b/g2core/board/G2v9.mk @@ -14,15 +14,15 @@ # BOARDs for use directly from the make command line (with default settings) or by the CONFIGS above. ifeq ("$(BOARD)","g2v9i") - BASE_BOARD=g2v9 - DEVICE_DEFINES += MOTATE_BOARD="G2v9i" - DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE} + BASE_BOARD=g2v9 + DEVICE_DEFINES += MOTATE_BOARD="G2v9i" + DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE} endif ifeq ("$(BOARD)","g2v9k") - BASE_BOARD=g2v9 - DEVICE_DEFINES += MOTATE_BOARD="G2v9k" - DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE} + BASE_BOARD=g2v9 + DEVICE_DEFINES += MOTATE_BOARD="G2v9k" + DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE} endif @@ -30,19 +30,30 @@ endif # The general g2v9 BASE_BOARD. ifeq ("$(BASE_BOARD)","g2v9") - _BOARD_FOUND = 1 + _BOARD_FOUND = 1 - FIRST_LINK_SOURCES += $(sort $(wildcard ${MOTATE_PATH}/Atmel_sam_common/*.cpp)) $(sort $(wildcard ${MOTATE_PATH}/Atmel_sam3x/*.cpp)) + FIRST_LINK_SOURCES += $(sort $(wildcard ${MOTATE_PATH}/Atmel_sam_common/*.cpp)) $(sort $(wildcard ${MOTATE_PATH}/Atmel_sam3x/*.cpp)) - # Set CHIP and export it for GDB to see - CHIP = SAM3X8C - export CHIP - CHIP_LOWERCASE = sam3x8c + # Set CHIP and export it for GDB to see + CHIP = SAM3X8C + export CHIP + CHIP_LOWERCASE = sam3x8c - BOARD_PATH = ./board/G2v9 - SOURCE_DIRS += ${BOARD_PATH} device/step_dir_driver + BOARD_PATH = ./board/G2v9 + SOURCE_DIRS += ${BOARD_PATH} device/step_dir_driver - PLATFORM_BASE = ${MOTATE_PATH}/platform/atmel_sam + PLATFORM_BASE = ${MOTATE_PATH}/platform/atmel_sam + + include $(PLATFORM_BASE).mk + + ifeq ("$(BANTAM)", "1") + CUSTOM_LINKER_SCRIPT := board/G2v9/bantam-checksum-flash.ld + ALL_ADDITIONS += $(OUTPUT_BIN)-summed.bin +define ADDITIONAL_RECIPES +$(OUTPUT_BIN)-summed.bin: $(OUTPUT_BIN).bin + $(QUIET)printf "%08x" `cksum $(OUTPUT_BIN).bin | cut -d' ' -f1` | xxd -r -p | dd of=$(OUTPUT_BIN)-summed.bin bs=1 count=4 seek=256 conv=notrunc + $(QUIET)printf "%08x" `ls -nl "$(OUTPUT_BIN).bin" | cut -d' ' -f5` | xxd -r -p | dd of=$(OUTPUT_BIN)-summed.bin bs=1 count=4 seek=260 conv=notrunc +endef +endif - include $(PLATFORM_BASE).mk endif diff --git a/g2core/board/G2v9/bantam-checksum-flash.ld b/g2core/board/G2v9/bantam-checksum-flash.ld new file mode 100644 index 00000000..423a2d5f --- /dev/null +++ b/g2core/board/G2v9/bantam-checksum-flash.ld @@ -0,0 +1,170 @@ +/** + * \file + * + * \brief Flash Linker script for SAM. + * + * Copyright (c) 2011-2013 Atmel Corporation. All rights reserved. + * + * \asf_license_start + * + * \page License + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an + * Atmel microcontroller product. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * \asf_license_stop + * + */ + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00080000, LENGTH = 0x00080000 /* Flash, 512K */ + sram0 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00010000 /* sram0, 64K */ + sram1 (rwx) : ORIGIN = 0x20080000, LENGTH = 0x00008000 /* sram1, 32K */ + ram (rwx) : ORIGIN = 0x20070000, LENGTH = 0x00018000 /* sram, 96K */ +/* ram (rwx) : ORIGIN = ORIGIN( sram1 )-LENGTH( sram0 ), LENGTH = LENGTH( sram0 )+LENGTH( sram1 ) */ /* sram, 96K */ +} + +/* The stack size used by the application. NOTE: you need to adjust */ +__stack_size__ = DEFINED(__stack_size__) ? __stack_size__ : 0x2000; +__ram_end__ = ORIGIN(ram) + LENGTH(ram) - 4; + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + + /* "CNCFORALL!!!" is our magic to identify a valid firmware image */ + BYTE(0x43) BYTE(0x4e) BYTE(0x43) BYTE(0x46) BYTE(0x4f) BYTE(0x52) BYTE(0x41) BYTE(0x4c) BYTE(0x4c) BYTE(0x21) BYTE(0x21) BYTE(0x21) + /* CRC32 goes here */ + LONG(0x54545454) + /* Length of binary goes here */ + LONG(0x47474747) + + *(.text .text.* .gnu.linkonce.t.*) + *(.hot_func .hot_func.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(0x4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.hot_data .hot_data.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + /* .bss section which is used for uninitialized data */ + .bss ALIGN(4) (NOLOAD) : + { + . = ALIGN(4); + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + /* stack section */ + .stack (NOLOAD): + { + . = ALIGN(8); + _sstack = .; + . = . + __stack_size__; + . = ALIGN(8); + _estack = .; + } > ram + + . = ALIGN(4); + _end = . ; +} diff --git a/g2core/boards.mk b/g2core/boards.mk index 30ad7d4c..3f612b1a 100644 --- a/g2core/boards.mk +++ b/g2core/boards.mk @@ -37,6 +37,7 @@ endif ifeq ("$(CONFIG)","Othermill") ifeq ("$(BOARD)","NONE") BOARD=g2v9k + BANTAM=1 endif SETTINGS_FILE="settings_othermill.h" endif @@ -44,6 +45,7 @@ endif ifeq ("$(CONFIG)","OthermillPro") ifeq ("$(BOARD)","NONE") BOARD=g2v9k + BANTAM=1 endif SETTINGS_FILE="settings_othermill_pro.h" endif