diff options
-rw-r--r-- | Makefile | 141 | ||||
-rw-r--r-- | support/ld/common.inc (renamed from support/ld/common_rom.inc) | 67 | ||||
-rw-r--r-- | support/ld/common_header.inc | 37 | ||||
-rw-r--r-- | support/ld/common_ram.inc | 188 | ||||
-rw-r--r-- | support/ld/maple/flash.ld | 5 | ||||
-rw-r--r-- | support/ld/maple/jtag.ld | 4 | ||||
-rw-r--r-- | support/ld/maple/ram.ld | 3 | ||||
-rw-r--r-- | support/ld/maple_RET6/flash.ld | 4 | ||||
-rw-r--r-- | support/ld/maple_RET6/jtag.ld | 4 | ||||
-rw-r--r-- | support/ld/maple_RET6/ram.ld | 3 | ||||
-rw-r--r-- | support/ld/maple_mini/flash.ld | 4 | ||||
-rw-r--r-- | support/ld/maple_mini/jtag.ld | 4 | ||||
-rw-r--r-- | support/ld/maple_mini/ram.ld | 3 | ||||
-rw-r--r-- | support/ld/maple_native/flash.ld | 4 | ||||
-rw-r--r-- | support/ld/maple_native/jtag.ld | 4 | ||||
-rw-r--r-- | support/ld/maple_native/ram.ld | 3 | ||||
-rw-r--r-- | support/make/target-config.mk | 56 | ||||
-rwxr-xr-x | support/scripts/copy-to-ide | 3 |
18 files changed, 213 insertions, 324 deletions
@@ -1,59 +1,11 @@ -.DEFAULT_GOAL := sketch - -# Valid BOARDs: maple, maple_native, ... -BOARD ?= maple -MEMORY_TARGET ?= flash - -# USB ID for DFU upload -VENDOR_ID := 1EAF -PRODUCT_ID := 0003 +# Try "make help" first -# Guess the MCU based on the BOARD (can be overridden ) -# FIXME the error LED config needs to be in wirish/ instead -ifeq ($(BOARD), maple) - MCU := STM32F103RB - PRODUCT_ID := 0003 - ERROR_LED_PORT := GPIOA - ERROR_LED_PIN := 5 - DENSITY := STM32_MEDIUM_DENSITY -endif -ifeq ($(BOARD), maple_native) - MCU := STM32F103ZE - PRODUCT_ID := 0003 - ERROR_LED_PORT := GPIOC - ERROR_LED_PIN := 15 - DENSITY := STM32_HIGH_DENSITY -endif -ifeq ($(BOARD), maple_mini) - MCU := STM32F103CB - PRODUCT_ID := 0003 - ERROR_LED_PORT := GPIOB - ERROR_LED_PIN := 1 - DENSITY := STM32_MEDIUM_DENSITY -endif -ifeq ($(BOARD), maple_RET6) - MCU := STM32F103RE - PRODUCT_ID := 0003 - ERROR_LED_PORT := GPIOA - ERROR_LED_PIN := 5 - DENSITY := STM32_HIGH_DENSITY -endif +.DEFAULT_GOAL := sketch -# Some target specific things -ifeq ($(MEMORY_TARGET), ram) - LDSCRIPT := $(BOARD)/ram.ld - VECT_BASE_ADDR := VECT_TAB_RAM -endif -ifeq ($(MEMORY_TARGET), flash) - LDSCRIPT := $(BOARD)/flash.ld - VECT_BASE_ADDR := VECT_TAB_FLASH -endif -ifeq ($(MEMORY_TARGET), jtag) - LDSCRIPT := $(BOARD)/jtag.ld - VECT_BASE_ADDR := VECT_TAB_BASE -endif +## +## Useful paths, constants, etc. +## -# Useful paths ifeq ($(LIB_MAPLE_HOME),) SRCROOT := . else @@ -61,33 +13,66 @@ SRCROOT := $(LIB_MAPLE_HOME) endif BUILD_PATH = build LIBMAPLE_PATH := $(SRCROOT)/libmaple +WIRISH_PATH := $(SRCROOT)/wirish SUPPORT_PATH := $(SRCROOT)/support +# Support files for linker +LDDIR := $(SUPPORT_PATH)/ld +# Support files for this Makefile +MAKEDIR := $(SUPPORT_PATH)/make + +# USB ID for DFU upload +VENDOR_ID := 1EAF +PRODUCT_ID := 0003 + +## +## Target-specific configuration. This determines some compiler and +## linker options/flags. +## + +# Try "make help" for more information on BOARD and MEMORY_TARGET; +# these default to a Maple Flash build. +BOARD ?= maple +MEMORY_TARGET ?= flash + +# $(BOARD)- and $(MEMORY_TARGET)-specific configuration +include $(MAKEDIR)/target-config.mk + +## +## Compilation flags +## -# Compilation flags. -# FIXME remove the ERROR_LED config GLOBAL_FLAGS := -D$(VECT_BASE_ADDR) \ -DBOARD_$(BOARD) -DMCU_$(MCU) \ -DERROR_LED_PORT=$(ERROR_LED_PORT) \ -DERROR_LED_PIN=$(ERROR_LED_PIN) \ - -D$(DENSITY) + -D$(DENSITY) GLOBAL_CFLAGS := -Os -g3 -gdwarf-2 -mcpu=cortex-m3 -mthumb -march=armv7-m \ -nostdlib -ffunction-sections -fdata-sections \ -Wl,--gc-sections $(GLOBAL_FLAGS) GLOBAL_CXXFLAGS := -fno-rtti -fno-exceptions -Wall $(GLOBAL_FLAGS) GLOBAL_ASFLAGS := -mcpu=cortex-m3 -march=armv7-m -mthumb \ -x assembler-with-cpp $(GLOBAL_FLAGS) - -LDDIR := $(SUPPORT_PATH)/ld LDFLAGS = -T$(LDDIR)/$(LDSCRIPT) -L$(LDDIR) \ -mcpu=cortex-m3 -mthumb -Xlinker \ --gc-sections --print-gc-sections --march=armv7-m -Wall -# Set up build rules and some useful templates +## +## Build rules and useful templates +## + include $(SUPPORT_PATH)/make/build-rules.mk include $(SUPPORT_PATH)/make/build-templates.mk -# Set all submodules here -LIBMAPLE_MODULES := $(SRCROOT)/libmaple +## +## Set all submodules here +## + +# Try to keep LIBMAPLE_MODULES a simply-expanded variable +ifeq ($(LIBMAPLE_MODULES),) + LIBMAPLE_MODULES := $(SRCROOT)/libmaple +else + LIBMAPLE_MODULES += $(SRCROOT)/libmaple +endif LIBMAPLE_MODULES += $(SRCROOT)/wirish # Official libraries: LIBMAPLE_MODULES += $(SRCROOT)/libraries/Servo @@ -97,10 +82,14 @@ LIBMAPLE_MODULES += $(SRCROOT)/libraries/Wire # Experimental libraries: LIBMAPLE_MODULES += $(SRCROOT)/libraries/FreeRTOS -# call each module rules.mk +# Call each module's rules.mk: $(foreach m,$(LIBMAPLE_MODULES),$(eval $(call LIBMAPLE_MODULE_template,$(m)))) -# Main target +## +## Targets +## + +# main target include $(SRCROOT)/build-targets.mk .PHONY: install sketch clean help debug cscope tags ctags ram flash jtag doxygen mrproper @@ -114,13 +103,13 @@ UPLOAD_flash := $(SUPPORT_PATH)/scripts/reset.py && \ $(DFU) -a1 -d $(VENDOR_ID):$(PRODUCT_ID) -D $(BUILD_PATH)/$(BOARD).bin -R UPLOAD_jtag := $(OPENOCD_WRAPPER) flash -# conditionally upload to whatever the last build was +# Conditionally upload to whatever the last build was install: INSTALL_TARGET = $(shell cat $(BUILD_PATH)/build-type 2>/dev/null) install: $(BUILD_PATH)/$(BOARD).bin @echo Install target: $(INSTALL_TARGET) $(UPLOAD_$(INSTALL_TARGET)) -# Force a rebuild if the maple target changed +# Force a rebuild if the target changed PREV_BUILD_TYPE = $(shell cat $(BUILD_PATH)/build-type 2>/dev/null) build-check: ifneq ($(PREV_BUILD_TYPE), $(MEMORY_TARGET)) @@ -140,20 +129,24 @@ help: @echo " libmaple Makefile help" @echo " ----------------------" @echo " " - @echo " Be sure to set BOARD if not compiling for Maple (e.g." - @echo " use BOARD=maple_mini for mini, etc.)" + @echo " Programming targets:" + @echo " sketch: Compile for BOARD to MEMORY_TARGET (default)." + @echo " install: Compile and upload code over USB, using Maple bootloader" @echo " " - @echo " Compile targets (default MEMORY_TARGET=flash):" + @echo " You *must* set BOARD if not compiling for Maple (e.g." + @echo " use BOARD=maple_mini for mini, etc.), and MEMORY_TARGET" + @echo " if not compiling to Flash." + @echo " " + @echo " Valid BOARDs:" + @echo " maple, maple_mini, maple_RET6, maple_native" + @echo " " + @echo " Valid MEMORY_TARGETs (default=flash):" @echo " ram: Compile sketch code to ram" @echo " flash: Compile sketch code to flash" - @echo " jtag: Compile sketch code to jtag" - @echo " sketch: Compile sketch code to target MEMORY_TARGET" - @echo " " - @echo " Programming targets:" - @echo " install: Upload code to target" + @echo " jtag: Compile sketch code for jtag; overwrites bootloader" @echo " " @echo " Other targets:" - @echo " debug: Start an openocd gdb server, port 3333" + @echo " debug: Start OpenOCD gdb server on port 3333, telnet on port 4444" @echo " clean: Remove all build and object files" @echo " help: Show this message" @echo " doxygen: Build Doxygen HTML and XML documentation" diff --git a/support/ld/common_rom.inc b/support/ld/common.inc index 7182a4d..b53c4f6 100644 --- a/support/ld/common_rom.inc +++ b/support/ld/common.inc @@ -1,17 +1,53 @@ /* - * Linker script for Flash (ROM) builds. + * Linker script for libmaple. * * Original author "lanchon" from ST forums, with modifications by LeafLabs. */ -INCLUDE common_header.inc +OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") +ENTRY(_start) +SEARCH_DIR(.) + +/* + * Link against libgcc, libc, and libm + */ +GROUP(libgcc.a libc.a libm.a) + +/* These force the linker to search for particular symbols from + * the start of the link process and thus ensure the user's + * overrides are picked up + */ +INCLUDE names.inc + +/* STM32 vector table. See stm32_vector_table.S */ +EXTERN(__cs3_stm32_vector_table) + +/* libcs3 C start function. See cs3.h */ +EXTERN(__cs3_start_c) + +/* main entry point */ +EXTERN(main) + +/* Initial stack pointer value. */ +EXTERN(__cs3_stack) +PROVIDE(__cs3_stack = __cs3_region_start_ram + LENGTH(ram)); + +/* Reset vector and chip reset entry point. See start.S */ +EXTERN(_start) +PROVIDE(__cs3_reset = _start); + +/* Heap boundaries, for libmaple */ +EXTERN(_lm_heap_start); +EXTERN(_lm_heap_end); SECTIONS { + /* TODO pull out rodata and stick into separate sections */ .text : { + __text_start = .; /* - * STM32 vector table + * STM32 vector table. Leave this here. Yes, really. */ *(.stm32.interrupt_vector) @@ -23,8 +59,6 @@ SECTIONS *(.gnu.warning) *(.glue_7t) *(.glue_7) *(.vfp11_veneer) - *(.rodata .rodata.* .gnu.linkonce.r.*) - *(.ARM.extab* .gnu.linkonce.armextab.*) *(.gcc_except_table) *(.eh_frame_hdr) @@ -77,13 +111,21 @@ SECTIONS } > REGION_TEXT /* + * Read-only data + */ + .rodata : + { + *(.rodata .rodata.* .gnu.linkonce.r.*) + } > REGION_RODATA + + /* * .ARM.exidx exception unwinding; mandated by ARM's C++ ABI */ __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > REGION_TEXT + } > REGION_RODATA __exidx_end = .; /* @@ -101,19 +143,18 @@ SECTIONS .USER_FLASH : { *(.USER_FLASH) - } > rom + } > REGION_RODATA /* * .data */ .data : { - __cs3_region_start_ram = .; + __cs3_region_start_ram = DEFINED(_FLASH_BUILD) ? . : __text_start; *(.got.plt) *(.got) *(.data .data.* .gnu.linkonce.d.*) - /* * Heap: Linker scripts may choose a custom heap by overriding * _lm_heap_start and _lm_heap_end. Otherwise, the heap is in @@ -144,8 +185,12 @@ SECTIONS * Constants needed for the pieces of CS3 we use during * board startup; see libcs3_stm32_src/. */ - __cs3_region_init_ram = LOADADDR (.data); - __cs3_region_init_size_ram = _edata - ADDR (.data); + __cs3_region_init_ram = (DEFINED(_FLASH_BUILD) ? + LOADADDR(.data) : + LOADADDR(.text)); + __cs3_region_init_size_ram = (DEFINED(_FLASH_BUILD) ? + _edata - ADDR(.data) : + _edata - ADDR(.text)); __cs3_region_zero_size_ram = _end - _edata; __cs3_region_num = 1; diff --git a/support/ld/common_header.inc b/support/ld/common_header.inc deleted file mode 100644 index 1d11ba0..0000000 --- a/support/ld/common_header.inc +++ /dev/null @@ -1,37 +0,0 @@ -/* "Preamble" for linker scripts (such as common_rom.inc) */ - -OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") -ENTRY(_start) -SEARCH_DIR(.) - -/* - * Link against libgcc, libc, and libm - */ -GROUP(libgcc.a libc.a libm.a) - -/* These force the linker to search for particular symbols from - * the start of the link process and thus ensure the user's - * overrides are picked up - */ -INCLUDE names.inc - -/* STM32 vector table. See stm32_vector_table.S */ -EXTERN(__cs3_stm32_vector_table) - -/* libcs3 C start function. See cs3.h */ -EXTERN(__cs3_start_c) - -/* main entry point */ -EXTERN(main) - -/* Initial stack pointer value. */ -EXTERN(__cs3_stack) -PROVIDE(__cs3_stack = __cs3_region_start_ram + LENGTH(ram)); - -/* Reset vector and chip reset entry point. See start.S */ -EXTERN(_start) -PROVIDE(__cs3_reset = _start); - -/* Heap boundaries, for libmaple */ -EXTERN(_lm_heap_start); -EXTERN(_lm_heap_end); diff --git a/support/ld/common_ram.inc b/support/ld/common_ram.inc deleted file mode 100644 index ea51a9f..0000000 --- a/support/ld/common_ram.inc +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Linker script for RAM builds. - * - * Original author "lanchon" from ST forums, with modifications by LeafLabs. - */ - -INCLUDE common_header.inc - -SECTIONS -{ - .text : - { - CREATE_OBJECT_SYMBOLS - __cs3_region_start_ram = .; - - /* - * STM32 vector table - */ - __cs3_interrupt_vector = __cs3_stm32_vector_table; - *(.cs3.interrupt_vector) - /* Make sure we pulled in an interrupt vector. */ - ASSERT (. != __cs3_stm32_vector_table, "No interrupt vector"); - - /* - * Program code and vague linking - */ - *(.text .text.* .gnu.linkonce.t.*) - *(.plt) - *(.gnu.warning) - *(.glue_7t) *(.glue_7) *(.vfp11_veneer) - - *(.rodata .rodata.* .gnu.linkonce.r.*) - - *(.ARM.extab* .gnu.linkonce.armextab.*) - *(.gcc_except_table) - *(.eh_frame_hdr) - *(.eh_frame) - - . = 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); - __cs3_regions = .; - LONG (0) - LONG (__cs3_region_init_ram) - LONG (__cs3_region_start_ram) - LONG (__cs3_region_init_size_ram) - LONG (__cs3_region_zero_size_ram) - } > REGION_TEXT - - /* - * .ARM.exidx exception unwinding - */ - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > REGION_TEXT - __exidx_end = .; - - /* - * End of text - */ - .text.align : - { - . = ALIGN(8); - _etext = .; - } > REGION_TEXT - - .cs3.rom : - { - __cs3_region_start_rom = .; - *(.rom) - . = ALIGN (8); - } > ram - - .cs3.rom.bss : - { - *(.rom.b) - . = ALIGN (8); - } > ram - - /* __cs3_region_end_rom is deprecated */ - __cs3_region_end_rom = __cs3_region_start_rom + LENGTH(ram); - __cs3_region_size_rom = LENGTH(ram); - __cs3_region_init_rom = LOADADDR (.cs3.rom); - __cs3_region_init_size_rom = SIZEOF(.cs3.rom); - __cs3_region_zero_size_rom = SIZEOF(.cs3.rom.bss); - - /* - * Start of data - */ - .data : - { - KEEP(*(.jcr)) - *(.got.plt) *(.got) - *(.shdata) - *(.data .data.* .gnu.linkonce.d.*) - *(.ram) - . = ALIGN (8); - _edata = .; - } > REGION_DATA - - .bss : - { - *(.shbss) - *(.bss .bss.* .gnu.linkonce.b.*) - *(COMMON) - *(.ram.b) - . = ALIGN (8); - _end = .; - __end = .; - } > REGION_BSS - - /* __cs3_region_end_ram is deprecated */ - __cs3_region_end_ram = __cs3_region_start_ram + LENGTH(ram); - __cs3_region_size_ram = LENGTH(ram); - __cs3_region_init_ram = LOADADDR (.text); - __cs3_region_init_size_ram = _edata - ADDR (.text); - __cs3_region_zero_size_ram = _end - _edata; - __cs3_region_num = 1; - - /* - * Debugging sections - */ - .stab 0 (NOLOAD) : { *(.stab) } - .stabstr 0 (NOLOAD) : { *(.stabstr) } - /* DWARF debug sections. - * Symbols in the DWARF debugging sections are relative to the beginning - * of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - - .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } - .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) } - /DISCARD/ : { *(.note.GNU-stack) } -} diff --git a/support/ld/maple/flash.ld b/support/ld/maple/flash.ld index e9ff4b4..8a179f7 100644 --- a/support/ld/maple/flash.ld +++ b/support/ld/maple/flash.ld @@ -19,8 +19,11 @@ GROUP(libcs3_stm32_med_density.a) REGION_ALIAS("REGION_TEXT", rom); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", rom); /* * Define the rest of the sections */ -INCLUDE common_rom.inc +_FLASH_BUILD = 1; + +INCLUDE common.inc diff --git a/support/ld/maple/jtag.ld b/support/ld/maple/jtag.ld index ed8cc1c..365068f 100644 --- a/support/ld/maple/jtag.ld +++ b/support/ld/maple/jtag.ld @@ -20,8 +20,10 @@ GROUP(libcs3_stm32_med_density.a) REGION_ALIAS("REGION_TEXT", rom); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", rom); /* * Define the rest of the sections */ -INCLUDE common_rom.inc +_FLASH_BUILD = 1; +INCLUDE common.inc diff --git a/support/ld/maple/ram.ld b/support/ld/maple/ram.ld index 09bcb33..6f237c3 100644 --- a/support/ld/maple/ram.ld +++ b/support/ld/maple/ram.ld @@ -19,8 +19,9 @@ GROUP(libcs3_stm32_med_density.a) REGION_ALIAS("REGION_TEXT", ram); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", ram); /* * Define the rest of the sections */ -INCLUDE common_ram.inc +INCLUDE common.inc diff --git a/support/ld/maple_RET6/flash.ld b/support/ld/maple_RET6/flash.ld index 524ed71..4cf9c4b 100644 --- a/support/ld/maple_RET6/flash.ld +++ b/support/ld/maple_RET6/flash.ld @@ -14,5 +14,7 @@ GROUP(libcs3_stm32_high_density.a) REGION_ALIAS("REGION_TEXT", rom); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", rom); -INCLUDE common_rom.inc +_FLASH_BUILD = 1; +INCLUDE common.inc diff --git a/support/ld/maple_RET6/jtag.ld b/support/ld/maple_RET6/jtag.ld index 3a8e41f..6055dfb 100644 --- a/support/ld/maple_RET6/jtag.ld +++ b/support/ld/maple_RET6/jtag.ld @@ -14,5 +14,7 @@ GROUP(libcs3_stm32_high_density.a) REGION_ALIAS("REGION_TEXT", rom); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", rom); -INCLUDE common_rom.inc +_FLASH_BUILD = 1; +INCLUDE common.inc diff --git a/support/ld/maple_RET6/ram.ld b/support/ld/maple_RET6/ram.ld index 787eb31..a4c273b 100644 --- a/support/ld/maple_RET6/ram.ld +++ b/support/ld/maple_RET6/ram.ld @@ -14,5 +14,6 @@ GROUP(libcs3_stm32_high_density.a) REGION_ALIAS("REGION_TEXT", ram); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", ram); -INCLUDE common_ram.inc +INCLUDE common.inc diff --git a/support/ld/maple_mini/flash.ld b/support/ld/maple_mini/flash.ld index 37d765e..ab03207 100644 --- a/support/ld/maple_mini/flash.ld +++ b/support/ld/maple_mini/flash.ld @@ -19,8 +19,10 @@ GROUP(libcs3_stm32_med_density.a) REGION_ALIAS("REGION_TEXT", rom); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", rom); /* * Define the rest of the sections */ -INCLUDE common_rom.inc +_FLASH_BUILD = 1; +INCLUDE common.inc diff --git a/support/ld/maple_mini/jtag.ld b/support/ld/maple_mini/jtag.ld index a26e1b6..2f9cf31 100644 --- a/support/ld/maple_mini/jtag.ld +++ b/support/ld/maple_mini/jtag.ld @@ -20,8 +20,10 @@ GROUP(libcs3_stm32_med_density.a) REGION_ALIAS("REGION_TEXT", rom); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", rom); /* * Define the rest of the sections */ -INCLUDE common_rom.inc +_FLASH_BUILD = 1; +INCLUDE common.inc diff --git a/support/ld/maple_mini/ram.ld b/support/ld/maple_mini/ram.ld index 3bf33c9..0ba0252 100644 --- a/support/ld/maple_mini/ram.ld +++ b/support/ld/maple_mini/ram.ld @@ -19,8 +19,9 @@ GROUP(libcs3_stm32_med_density.a) REGION_ALIAS("REGION_TEXT", ram); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", ram); /* * Define the rest of the sections */ -INCLUDE common_ram.inc +INCLUDE common.inc diff --git a/support/ld/maple_native/flash.ld b/support/ld/maple_native/flash.ld index 20326e4..b6e10f8 100644 --- a/support/ld/maple_native/flash.ld +++ b/support/ld/maple_native/flash.ld @@ -16,10 +16,12 @@ GROUP(libcs3_stm32_high_density.a) REGION_ALIAS("REGION_TEXT", rom); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", rom); /* Specify heap boundary addresses on the external SRAM chip */ _lm_heap_start = 0x60000000; _lm_heap_end = 0x60100000; -INCLUDE common_rom.inc +_FLASH_BUILD = 1; +INCLUDE common.inc diff --git a/support/ld/maple_native/jtag.ld b/support/ld/maple_native/jtag.ld index 73157de..9af2a11 100644 --- a/support/ld/maple_native/jtag.ld +++ b/support/ld/maple_native/jtag.ld @@ -17,9 +17,11 @@ GROUP(libcs3_stm32_high_density.a) REGION_ALIAS("REGION_TEXT", rom); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", rom); /* Specify heap boundary addresses on the external SRAM chip */ _lm_heap_start = 0x60000000; _lm_heap_end = 0x60100000; -INCLUDE common_rom.inc +_FLASH_BUILD = 1; +INCLUDE common.inc diff --git a/support/ld/maple_native/ram.ld b/support/ld/maple_native/ram.ld index d38e43c..7264316 100644 --- a/support/ld/maple_native/ram.ld +++ b/support/ld/maple_native/ram.ld @@ -16,9 +16,10 @@ GROUP(libcs3_stm32_high_density.a) REGION_ALIAS("REGION_TEXT", ram); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", ram); /* Specify heap boundary addresses on the external SRAM chip */ _lm_heap_start = 0x60000000; _lm_heap_end = 0x60100000; -INCLUDE common_ram.inc +INCLUDE common.inc diff --git a/support/make/target-config.mk b/support/make/target-config.mk new file mode 100644 index 0000000..a30a5da --- /dev/null +++ b/support/make/target-config.mk @@ -0,0 +1,56 @@ +# Board-specific configuration values. Flash and SRAM sizes in bytes. + +ifeq ($(BOARD), maple) + MCU := STM32F103RB + PRODUCT_ID := 0003 + ERROR_LED_PORT := GPIOA + ERROR_LED_PIN := 5 + DENSITY := STM32_MEDIUM_DENSITY + FLASH_SIZE := 131072 + SRAM_SIZE := 20480 +endif + +ifeq ($(BOARD), maple_native) + MCU := STM32F103ZE + PRODUCT_ID := 0003 + ERROR_LED_PORT := GPIOC + ERROR_LED_PIN := 15 + DENSITY := STM32_HIGH_DENSITY + FLASH_SIZE := 524288 + SRAM_SIZE := 65536 +endif + +ifeq ($(BOARD), maple_mini) + MCU := STM32F103CB + PRODUCT_ID := 0003 + ERROR_LED_PORT := GPIOB + ERROR_LED_PIN := 1 + DENSITY := STM32_MEDIUM_DENSITY + FLASH_SIZE := 131072 + SRAM_SIZE := 20480 +endif + +ifeq ($(BOARD), maple_RET6) + MCU := STM32F103RE + PRODUCT_ID := 0003 + ERROR_LED_PORT := GPIOA + ERROR_LED_PIN := 5 + DENSITY := STM32_HIGH_DENSITY + FLASH_SIZE := 524288 + SRAM_SIZE := 65536 +endif + +# Memory target-specific configuration values + +ifeq ($(MEMORY_TARGET), ram) + LDSCRIPT := $(BOARD)/ram.ld + VECT_BASE_ADDR := VECT_TAB_RAM +endif +ifeq ($(MEMORY_TARGET), flash) + LDSCRIPT := $(BOARD)/flash.ld + VECT_BASE_ADDR := VECT_TAB_FLASH +endif +ifeq ($(MEMORY_TARGET), jtag) + LDSCRIPT := $(BOARD)/jtag.ld + VECT_BASE_ADDR := VECT_TAB_BASE +endif diff --git a/support/scripts/copy-to-ide b/support/scripts/copy-to-ide index 08cb9e3..f7029a5 100755 --- a/support/scripts/copy-to-ide +++ b/support/scripts/copy-to-ide @@ -24,8 +24,7 @@ LMAPLE_SRC="LICENSE ./wirish/comm/*.h ./wirish/boards/*.h ./wirish/boards/*.cpp - ./support/ld/common_ram.inc - ./support/ld/common_rom.inc + ./support/ld/common.inc ./support/ld/libcs3_stm32_high_density.a ./support/ld/libcs3_stm32_med_density.a ./support/ld/maple |