From 13e27c1dc51721b861aa5a4016832d4ecdfcd607 Mon Sep 17 00:00:00 2001 From: Roger Clark Date: Wed, 6 May 2015 03:02:10 +1000 Subject: [PATCH] Renamed generic_stm32f103rxx and generic_stm32f103zxx to remove th e xx at the end to match changes to boards.txt --- .../board.cpp | 0 .../board/board.h | 0 .../ld/common.inc | 440 +++++++++--------- .../ld/extra_libs.inc | 14 +- .../ld/flash.ld | 52 +-- .../ld/jtag.ld | 62 +-- .../ld/mem-flash.inc | 10 +- .../ld/mem-jtag.inc | 10 +- .../ld/mem-ram.inc | 8 +- .../ld/ram.ld | 50 +- .../ld/stm32f103re-bootloader.ld | 0 .../ld/stm32f103re.ld | 0 .../ld/vector_symbols.inc | 156 +++---- .../pins_arduino.h | 2 +- .../variant.h | 24 +- .../wirish/boards.cpp | 0 .../wirish/boards_setup.cpp | 0 .../wirish/start.S | 114 ++--- .../wirish/start_c.c | 190 ++++---- .../wirish/syscalls.c | 352 +++++++------- .../board.cpp | 0 .../board/board.h | 0 .../ld/common.inc | 440 +++++++++--------- .../ld/extra_libs.inc | 14 +- .../ld/stm32f103zc.ld | 0 .../ld/stm32f103zd.ld | 0 .../ld/stm32f103ze.ld | 0 .../ld/vector_symbols.inc | 156 +++---- .../pins_arduino.h | 2 +- .../variant.h | 24 +- .../wirish/boards.cpp | 0 .../wirish/boards_setup.cpp | 0 .../wirish/start.S | 114 ++--- .../wirish/start_c.c | 190 ++++---- .../wirish/syscalls.c | 352 +++++++------- 35 files changed, 1388 insertions(+), 1388 deletions(-) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103r}/board.cpp (100%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103r}/board/board.h (100%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103r}/ld/common.inc (96%) rename STM32F1/variants/{generic_stm32f103zxx => generic_stm32f103r}/ld/extra_libs.inc (96%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103r}/ld/flash.ld (97%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103r}/ld/jtag.ld (97%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103r}/ld/mem-flash.inc (95%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103r}/ld/mem-jtag.inc (95%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103r}/ld/mem-ram.inc (95%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103r}/ld/ram.ld (97%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103r}/ld/stm32f103re-bootloader.ld (100%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103r}/ld/stm32f103re.ld (100%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103r}/ld/vector_symbols.inc (95%) rename STM32F1/variants/{generic_stm32f103zxx => generic_stm32f103r}/pins_arduino.h (50%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103r}/variant.h (91%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103r}/wirish/boards.cpp (100%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103r}/wirish/boards_setup.cpp (100%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103r}/wirish/start.S (97%) rename STM32F1/variants/{generic_stm32f103zxx => generic_stm32f103r}/wirish/start_c.c (97%) rename STM32F1/variants/{generic_stm32f103zxx => generic_stm32f103r}/wirish/syscalls.c (95%) rename STM32F1/variants/{generic_stm32f103zxx => generic_stm32f103z}/board.cpp (100%) rename STM32F1/variants/{generic_stm32f103zxx => generic_stm32f103z}/board/board.h (100%) rename STM32F1/variants/{generic_stm32f103zxx => generic_stm32f103z}/ld/common.inc (96%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103z}/ld/extra_libs.inc (96%) rename STM32F1/variants/{generic_stm32f103zxx => generic_stm32f103z}/ld/stm32f103zc.ld (100%) rename STM32F1/variants/{generic_stm32f103zxx => generic_stm32f103z}/ld/stm32f103zd.ld (100%) rename STM32F1/variants/{generic_stm32f103zxx => generic_stm32f103z}/ld/stm32f103ze.ld (100%) rename STM32F1/variants/{generic_stm32f103zxx => generic_stm32f103z}/ld/vector_symbols.inc (95%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103z}/pins_arduino.h (50%) rename STM32F1/variants/{generic_stm32f103zxx => generic_stm32f103z}/variant.h (91%) rename STM32F1/variants/{generic_stm32f103zxx => generic_stm32f103z}/wirish/boards.cpp (100%) rename STM32F1/variants/{generic_stm32f103zxx => generic_stm32f103z}/wirish/boards_setup.cpp (100%) rename STM32F1/variants/{generic_stm32f103zxx => generic_stm32f103z}/wirish/start.S (97%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103z}/wirish/start_c.c (97%) rename STM32F1/variants/{generic_stm32f103rxx => generic_stm32f103z}/wirish/syscalls.c (95%) diff --git a/STM32F1/variants/generic_stm32f103rxx/board.cpp b/STM32F1/variants/generic_stm32f103r/board.cpp similarity index 100% rename from STM32F1/variants/generic_stm32f103rxx/board.cpp rename to STM32F1/variants/generic_stm32f103r/board.cpp diff --git a/STM32F1/variants/generic_stm32f103rxx/board/board.h b/STM32F1/variants/generic_stm32f103r/board/board.h similarity index 100% rename from STM32F1/variants/generic_stm32f103rxx/board/board.h rename to STM32F1/variants/generic_stm32f103r/board/board.h diff --git a/STM32F1/variants/generic_stm32f103rxx/ld/common.inc b/STM32F1/variants/generic_stm32f103r/ld/common.inc similarity index 96% rename from STM32F1/variants/generic_stm32f103rxx/ld/common.inc rename to STM32F1/variants/generic_stm32f103r/ld/common.inc index e086a58..0c2b6a4 100644 --- a/STM32F1/variants/generic_stm32f103rxx/ld/common.inc +++ b/STM32F1/variants/generic_stm32f103r/ld/common.inc @@ -1,220 +1,220 @@ -/* - * Linker script for libmaple. - * - * Original author "lanchon" from ST forums, with modifications by LeafLabs. - */ - -OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") - -/* - * Configure other libraries we want in the link. - * - * libgcc, libc, and libm are common across supported toolchains. - * However, some toolchains require additional archives which aren't - * present everywhere (e.g. ARM's gcc-arm-embedded releases). - * - * To hack around this, we let the build system specify additional - * archives by putting the right extra_libs.inc (in a directory under - * toolchains/) in our search path. - */ -GROUP(libgcc.a libc.a libm.a) -INCLUDE extra_libs.inc - -/* - * These force the linker to search for vector table symbols. - * - * These symbols vary by STM32 family (and also within families). - * It's up to the build system to configure the link's search path - * properly for the target MCU. - */ -INCLUDE vector_symbols.inc - -/* STM32 vector table. */ -EXTERN(__stm32_vector_table) - -/* C runtime initialization function. */ -EXTERN(start_c) - -/* main entry point */ -EXTERN(main) - -/* Initial stack pointer value. */ -EXTERN(__msp_init) -PROVIDE(__msp_init = ORIGIN(ram) + LENGTH(ram)); - -/* Reset vector and chip reset entry point */ -EXTERN(__start__) -ENTRY(__start__) -PROVIDE(__exc_reset = __start__); - -/* Heap boundaries, for libmaple */ -EXTERN(_lm_heap_start); -EXTERN(_lm_heap_end); - -SECTIONS -{ - .text : - { - __text_start__ = .; - /* - * STM32 vector table. Leave this here. Yes, really. - */ - *(.stm32.interrupt_vector) - - /* - * Program code and vague linking - */ - *(.text .text.* .gnu.linkonce.t.*) - *(.plt) - *(.gnu.warning) - *(.glue_7t) *(.glue_7) *(.vfp11_veneer) - - *(.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)) - } > REGION_TEXT - - /* - * End of text - */ - .text.align : - { - . = ALIGN(8); - __text_end__ = .; - } > REGION_TEXT - - /* - * .ARM.exidx exception unwinding; mandated by ARM's C++ ABI - */ - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > REGION_RODATA - __exidx_end = .; - - /* - * .data - */ - .data : - { - __data_start__ = .; - LONG(0) - . = ALIGN(8); - - *(.got.plt) *(.got) - *(.data .data.* .gnu.linkonce.d.*) - - . = ALIGN(8); - __data_end__ = .; - } > REGION_DATA AT> REGION_RODATA - - /* - * Read-only data - */ - .rodata : - { - *(.rodata .rodata.* .gnu.linkonce.r.*) - /* .USER_FLASH: We allow users to allocate into Flash here */ - *(.USER_FLASH) - /* ROM image configuration; for C startup */ - . = ALIGN(4); - _lm_rom_img_cfgp = .; - LONG(LOADADDR(.data)); - /* - * Heap: Linker scripts may choose a custom heap by overriding - * _lm_heap_start and _lm_heap_end. Otherwise, the heap is in - * internal SRAM, beginning after .bss, and growing towards - * the stack. - * - * I'm shoving these here naively; there's probably a cleaner way - * to go about this. [mbolivar] - */ - _lm_heap_start = DEFINED(_lm_heap_start) ? _lm_heap_start : _end; - _lm_heap_end = DEFINED(_lm_heap_end) ? _lm_heap_end : __msp_init; - } > REGION_RODATA - - /* - * .bss - */ - .bss : - { - . = ALIGN(8); - __bss_start__ = .; - *(.bss .bss.* .gnu.linkonce.b.*) - *(COMMON) - . = ALIGN (8); - __bss_end__ = .; - _end = __bss_end__; - } > REGION_BSS - - /* - * 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) } -} +/* + * Linker script for libmaple. + * + * Original author "lanchon" from ST forums, with modifications by LeafLabs. + */ + +OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") + +/* + * Configure other libraries we want in the link. + * + * libgcc, libc, and libm are common across supported toolchains. + * However, some toolchains require additional archives which aren't + * present everywhere (e.g. ARM's gcc-arm-embedded releases). + * + * To hack around this, we let the build system specify additional + * archives by putting the right extra_libs.inc (in a directory under + * toolchains/) in our search path. + */ +GROUP(libgcc.a libc.a libm.a) +INCLUDE extra_libs.inc + +/* + * These force the linker to search for vector table symbols. + * + * These symbols vary by STM32 family (and also within families). + * It's up to the build system to configure the link's search path + * properly for the target MCU. + */ +INCLUDE vector_symbols.inc + +/* STM32 vector table. */ +EXTERN(__stm32_vector_table) + +/* C runtime initialization function. */ +EXTERN(start_c) + +/* main entry point */ +EXTERN(main) + +/* Initial stack pointer value. */ +EXTERN(__msp_init) +PROVIDE(__msp_init = ORIGIN(ram) + LENGTH(ram)); + +/* Reset vector and chip reset entry point */ +EXTERN(__start__) +ENTRY(__start__) +PROVIDE(__exc_reset = __start__); + +/* Heap boundaries, for libmaple */ +EXTERN(_lm_heap_start); +EXTERN(_lm_heap_end); + +SECTIONS +{ + .text : + { + __text_start__ = .; + /* + * STM32 vector table. Leave this here. Yes, really. + */ + *(.stm32.interrupt_vector) + + /* + * Program code and vague linking + */ + *(.text .text.* .gnu.linkonce.t.*) + *(.plt) + *(.gnu.warning) + *(.glue_7t) *(.glue_7) *(.vfp11_veneer) + + *(.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)) + } > REGION_TEXT + + /* + * End of text + */ + .text.align : + { + . = ALIGN(8); + __text_end__ = .; + } > REGION_TEXT + + /* + * .ARM.exidx exception unwinding; mandated by ARM's C++ ABI + */ + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > REGION_RODATA + __exidx_end = .; + + /* + * .data + */ + .data : + { + __data_start__ = .; + LONG(0) + . = ALIGN(8); + + *(.got.plt) *(.got) + *(.data .data.* .gnu.linkonce.d.*) + + . = ALIGN(8); + __data_end__ = .; + } > REGION_DATA AT> REGION_RODATA + + /* + * Read-only data + */ + .rodata : + { + *(.rodata .rodata.* .gnu.linkonce.r.*) + /* .USER_FLASH: We allow users to allocate into Flash here */ + *(.USER_FLASH) + /* ROM image configuration; for C startup */ + . = ALIGN(4); + _lm_rom_img_cfgp = .; + LONG(LOADADDR(.data)); + /* + * Heap: Linker scripts may choose a custom heap by overriding + * _lm_heap_start and _lm_heap_end. Otherwise, the heap is in + * internal SRAM, beginning after .bss, and growing towards + * the stack. + * + * I'm shoving these here naively; there's probably a cleaner way + * to go about this. [mbolivar] + */ + _lm_heap_start = DEFINED(_lm_heap_start) ? _lm_heap_start : _end; + _lm_heap_end = DEFINED(_lm_heap_end) ? _lm_heap_end : __msp_init; + } > REGION_RODATA + + /* + * .bss + */ + .bss : + { + . = ALIGN(8); + __bss_start__ = .; + *(.bss .bss.* .gnu.linkonce.b.*) + *(COMMON) + . = ALIGN (8); + __bss_end__ = .; + _end = __bss_end__; + } > REGION_BSS + + /* + * 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/STM32F1/variants/generic_stm32f103zxx/ld/extra_libs.inc b/STM32F1/variants/generic_stm32f103r/ld/extra_libs.inc similarity index 96% rename from STM32F1/variants/generic_stm32f103zxx/ld/extra_libs.inc rename to STM32F1/variants/generic_stm32f103r/ld/extra_libs.inc index dd2c84f..4413a53 100644 --- a/STM32F1/variants/generic_stm32f103zxx/ld/extra_libs.inc +++ b/STM32F1/variants/generic_stm32f103r/ld/extra_libs.inc @@ -1,7 +1,7 @@ -/* - * Extra archives needed by ARM's GCC ARM Embedded arm-none-eabi- - * releases (https://launchpad.net/gcc-arm-embedded/). - */ - -/* This is for the provided newlib. */ -GROUP(libnosys.a) +/* + * Extra archives needed by ARM's GCC ARM Embedded arm-none-eabi- + * releases (https://launchpad.net/gcc-arm-embedded/). + */ + +/* This is for the provided newlib. */ +GROUP(libnosys.a) diff --git a/STM32F1/variants/generic_stm32f103rxx/ld/flash.ld b/STM32F1/variants/generic_stm32f103r/ld/flash.ld similarity index 97% rename from STM32F1/variants/generic_stm32f103rxx/ld/flash.ld rename to STM32F1/variants/generic_stm32f103r/ld/flash.ld index 9e250cd..38a3023 100644 --- a/STM32F1/variants/generic_stm32f103rxx/ld/flash.ld +++ b/STM32F1/variants/generic_stm32f103r/ld/flash.ld @@ -1,26 +1,26 @@ -/* - * libmaple linker script for "Flash" builds. - * - * A Flash build puts .text (and .rodata) in Flash, and - * .data/.bss/heap (of course) in SRAM, but offsets the sections by - * enough space to store the Maple bootloader, which lives in low - * Flash and uses low memory. - */ - -/* - * This pulls in the appropriate MEMORY declaration from the right - * subdirectory of stm32/mem/ (the environment must call ld with the - * right include directory flags to make this happen). Boards can also - * use this file to use any of libmaple's memory-related hooks (like - * where the heap should live). - */ -INCLUDE mem-flash.inc - -/* Provide memory region aliases for common.inc */ -REGION_ALIAS("REGION_TEXT", rom); -REGION_ALIAS("REGION_DATA", ram); -REGION_ALIAS("REGION_BSS", ram); -REGION_ALIAS("REGION_RODATA", rom); - -/* Let common.inc handle the real work. */ -INCLUDE common.inc +/* + * libmaple linker script for "Flash" builds. + * + * A Flash build puts .text (and .rodata) in Flash, and + * .data/.bss/heap (of course) in SRAM, but offsets the sections by + * enough space to store the Maple bootloader, which lives in low + * Flash and uses low memory. + */ + +/* + * This pulls in the appropriate MEMORY declaration from the right + * subdirectory of stm32/mem/ (the environment must call ld with the + * right include directory flags to make this happen). Boards can also + * use this file to use any of libmaple's memory-related hooks (like + * where the heap should live). + */ +INCLUDE mem-flash.inc + +/* Provide memory region aliases for common.inc */ +REGION_ALIAS("REGION_TEXT", rom); +REGION_ALIAS("REGION_DATA", ram); +REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", rom); + +/* Let common.inc handle the real work. */ +INCLUDE common.inc diff --git a/STM32F1/variants/generic_stm32f103rxx/ld/jtag.ld b/STM32F1/variants/generic_stm32f103r/ld/jtag.ld similarity index 97% rename from STM32F1/variants/generic_stm32f103rxx/ld/jtag.ld rename to STM32F1/variants/generic_stm32f103r/ld/jtag.ld index 0612f95..62ae052 100644 --- a/STM32F1/variants/generic_stm32f103rxx/ld/jtag.ld +++ b/STM32F1/variants/generic_stm32f103r/ld/jtag.ld @@ -1,31 +1,31 @@ -/* - * libmaple linker script for "JTAG" builds. - * - * A "JTAG" build puts .text (and .rodata) in Flash, and - * .data/.bss/heap (of course) in SRAM, but links starting at the - * Flash and SRAM starting addresses (0x08000000 and 0x20000000 - * respectively). This will wipe out a Maple bootloader if there's one - * on the board, so only use this if you know what you're doing. - * - * Of course, a "JTAG" build is perfectly usable for upload over SWD, - * the system memory bootloader, etc. The name is just a historical - * artifact. - */ - -/* - * This pulls in the appropriate MEMORY declaration from the right - * subdirectory of stm32/mem/ (the environment must call ld with the - * right include directory flags to make this happen). Boards can also - * use this file to use any of libmaple's memory-related hooks (like - * where the heap should live). - */ -INCLUDE mem-jtag.inc - -/* Provide memory region aliases for common.inc */ -REGION_ALIAS("REGION_TEXT", rom); -REGION_ALIAS("REGION_DATA", ram); -REGION_ALIAS("REGION_BSS", ram); -REGION_ALIAS("REGION_RODATA", rom); - -/* Let common.inc handle the real work. */ -INCLUDE common.inc +/* + * libmaple linker script for "JTAG" builds. + * + * A "JTAG" build puts .text (and .rodata) in Flash, and + * .data/.bss/heap (of course) in SRAM, but links starting at the + * Flash and SRAM starting addresses (0x08000000 and 0x20000000 + * respectively). This will wipe out a Maple bootloader if there's one + * on the board, so only use this if you know what you're doing. + * + * Of course, a "JTAG" build is perfectly usable for upload over SWD, + * the system memory bootloader, etc. The name is just a historical + * artifact. + */ + +/* + * This pulls in the appropriate MEMORY declaration from the right + * subdirectory of stm32/mem/ (the environment must call ld with the + * right include directory flags to make this happen). Boards can also + * use this file to use any of libmaple's memory-related hooks (like + * where the heap should live). + */ +INCLUDE mem-jtag.inc + +/* Provide memory region aliases for common.inc */ +REGION_ALIAS("REGION_TEXT", rom); +REGION_ALIAS("REGION_DATA", ram); +REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", rom); + +/* Let common.inc handle the real work. */ +INCLUDE common.inc diff --git a/STM32F1/variants/generic_stm32f103rxx/ld/mem-flash.inc b/STM32F1/variants/generic_stm32f103r/ld/mem-flash.inc similarity index 95% rename from STM32F1/variants/generic_stm32f103rxx/ld/mem-flash.inc rename to STM32F1/variants/generic_stm32f103r/ld/mem-flash.inc index ddb8876..c21fe21 100644 --- a/STM32F1/variants/generic_stm32f103rxx/ld/mem-flash.inc +++ b/STM32F1/variants/generic_stm32f103r/ld/mem-flash.inc @@ -1,5 +1,5 @@ -MEMORY -{ - ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K - rom (rx) : ORIGIN = 0x08005000, LENGTH = 492K -} +MEMORY +{ + ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K + rom (rx) : ORIGIN = 0x08005000, LENGTH = 492K +} diff --git a/STM32F1/variants/generic_stm32f103rxx/ld/mem-jtag.inc b/STM32F1/variants/generic_stm32f103r/ld/mem-jtag.inc similarity index 95% rename from STM32F1/variants/generic_stm32f103rxx/ld/mem-jtag.inc rename to STM32F1/variants/generic_stm32f103r/ld/mem-jtag.inc index d3ed992..b960ac6 100644 --- a/STM32F1/variants/generic_stm32f103rxx/ld/mem-jtag.inc +++ b/STM32F1/variants/generic_stm32f103r/ld/mem-jtag.inc @@ -1,5 +1,5 @@ -MEMORY -{ - ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K - rom (rx) : ORIGIN = 0x08000000, LENGTH = 512K -} +MEMORY +{ + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K + rom (rx) : ORIGIN = 0x08000000, LENGTH = 512K +} diff --git a/STM32F1/variants/generic_stm32f103rxx/ld/mem-ram.inc b/STM32F1/variants/generic_stm32f103r/ld/mem-ram.inc similarity index 95% rename from STM32F1/variants/generic_stm32f103rxx/ld/mem-ram.inc rename to STM32F1/variants/generic_stm32f103r/ld/mem-ram.inc index 8601575..153b7c0 100644 --- a/STM32F1/variants/generic_stm32f103rxx/ld/mem-ram.inc +++ b/STM32F1/variants/generic_stm32f103r/ld/mem-ram.inc @@ -1,5 +1,5 @@ -MEMORY -{ - ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K - rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K +MEMORY +{ + ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K + rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K } \ No newline at end of file diff --git a/STM32F1/variants/generic_stm32f103rxx/ld/ram.ld b/STM32F1/variants/generic_stm32f103r/ld/ram.ld similarity index 97% rename from STM32F1/variants/generic_stm32f103rxx/ld/ram.ld rename to STM32F1/variants/generic_stm32f103r/ld/ram.ld index 34b468e..1ea7598 100644 --- a/STM32F1/variants/generic_stm32f103rxx/ld/ram.ld +++ b/STM32F1/variants/generic_stm32f103r/ld/ram.ld @@ -1,25 +1,25 @@ -/* - * libmaple linker script for RAM builds. - * - * A Flash build puts .text, .rodata, and .data/.bss/heap (of course) - * in SRAM, but offsets the sections by enough space to store the - * Maple bootloader, which uses low memory. - */ - -/* - * This pulls in the appropriate MEMORY declaration from the right - * subdirectory of stm32/mem/ (the environment must call ld with the - * right include directory flags to make this happen). Boards can also - * use this file to use any of libmaple's memory-related hooks (like - * where the heap should live). - */ -INCLUDE mem-ram.inc - -/* Provide memory region aliases for common.inc */ -REGION_ALIAS("REGION_TEXT", ram); -REGION_ALIAS("REGION_DATA", ram); -REGION_ALIAS("REGION_BSS", ram); -REGION_ALIAS("REGION_RODATA", ram); - -/* Let common.inc handle the real work. */ -INCLUDE common.inc +/* + * libmaple linker script for RAM builds. + * + * A Flash build puts .text, .rodata, and .data/.bss/heap (of course) + * in SRAM, but offsets the sections by enough space to store the + * Maple bootloader, which uses low memory. + */ + +/* + * This pulls in the appropriate MEMORY declaration from the right + * subdirectory of stm32/mem/ (the environment must call ld with the + * right include directory flags to make this happen). Boards can also + * use this file to use any of libmaple's memory-related hooks (like + * where the heap should live). + */ +INCLUDE mem-ram.inc + +/* Provide memory region aliases for common.inc */ +REGION_ALIAS("REGION_TEXT", ram); +REGION_ALIAS("REGION_DATA", ram); +REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", ram); + +/* Let common.inc handle the real work. */ +INCLUDE common.inc diff --git a/STM32F1/variants/generic_stm32f103rxx/ld/stm32f103re-bootloader.ld b/STM32F1/variants/generic_stm32f103r/ld/stm32f103re-bootloader.ld similarity index 100% rename from STM32F1/variants/generic_stm32f103rxx/ld/stm32f103re-bootloader.ld rename to STM32F1/variants/generic_stm32f103r/ld/stm32f103re-bootloader.ld diff --git a/STM32F1/variants/generic_stm32f103rxx/ld/stm32f103re.ld b/STM32F1/variants/generic_stm32f103r/ld/stm32f103re.ld similarity index 100% rename from STM32F1/variants/generic_stm32f103rxx/ld/stm32f103re.ld rename to STM32F1/variants/generic_stm32f103r/ld/stm32f103re.ld diff --git a/STM32F1/variants/generic_stm32f103rxx/ld/vector_symbols.inc b/STM32F1/variants/generic_stm32f103r/ld/vector_symbols.inc similarity index 95% rename from STM32F1/variants/generic_stm32f103rxx/ld/vector_symbols.inc rename to STM32F1/variants/generic_stm32f103r/ld/vector_symbols.inc index f8519bb..a40012a 100644 --- a/STM32F1/variants/generic_stm32f103rxx/ld/vector_symbols.inc +++ b/STM32F1/variants/generic_stm32f103r/ld/vector_symbols.inc @@ -1,78 +1,78 @@ -EXTERN(__msp_init) -EXTERN(__exc_reset) -EXTERN(__exc_nmi) -EXTERN(__exc_hardfault) -EXTERN(__exc_memmanage) -EXTERN(__exc_busfault) -EXTERN(__exc_usagefault) -EXTERN(__stm32reservedexception7) -EXTERN(__stm32reservedexception8) -EXTERN(__stm32reservedexception9) -EXTERN(__stm32reservedexception10) -EXTERN(__exc_svc) -EXTERN(__exc_debug_monitor) -EXTERN(__stm32reservedexception13) -EXTERN(__exc_pendsv) -EXTERN(__exc_systick) - -EXTERN(__irq_wwdg) -EXTERN(__irq_pvd) -EXTERN(__irq_tamper) -EXTERN(__irq_rtc) -EXTERN(__irq_flash) -EXTERN(__irq_rcc) -EXTERN(__irq_exti0) -EXTERN(__irq_exti1) -EXTERN(__irq_exti2) -EXTERN(__irq_exti3) -EXTERN(__irq_exti4) -EXTERN(__irq_dma1_channel1) -EXTERN(__irq_dma1_channel2) -EXTERN(__irq_dma1_channel3) -EXTERN(__irq_dma1_channel4) -EXTERN(__irq_dma1_channel5) -EXTERN(__irq_dma1_channel6) -EXTERN(__irq_dma1_channel7) -EXTERN(__irq_adc) -EXTERN(__irq_usb_hp_can_tx) -EXTERN(__irq_usb_lp_can_rx0) -EXTERN(__irq_can_rx1) -EXTERN(__irq_can_sce) -EXTERN(__irq_exti9_5) -EXTERN(__irq_tim1_brk) -EXTERN(__irq_tim1_up) -EXTERN(__irq_tim1_trg_com) -EXTERN(__irq_tim1_cc) -EXTERN(__irq_tim2) -EXTERN(__irq_tim3) -EXTERN(__irq_tim4) -EXTERN(__irq_i2c1_ev) -EXTERN(__irq_i2c1_er) -EXTERN(__irq_i2c2_ev) -EXTERN(__irq_i2c2_er) -EXTERN(__irq_spi1) -EXTERN(__irq_spi2) -EXTERN(__irq_usart1) -EXTERN(__irq_usart2) -EXTERN(__irq_usart3) -EXTERN(__irq_exti15_10) -EXTERN(__irq_rtcalarm) -EXTERN(__irq_usbwakeup) - -EXTERN(__irq_tim8_brk) -EXTERN(__irq_tim8_up) -EXTERN(__irq_tim8_trg_com) -EXTERN(__irq_tim8_cc) -EXTERN(__irq_adc3) -EXTERN(__irq_fsmc) -EXTERN(__irq_sdio) -EXTERN(__irq_tim5) -EXTERN(__irq_spi3) -EXTERN(__irq_uart4) -EXTERN(__irq_uart5) -EXTERN(__irq_tim6) -EXTERN(__irq_tim7) -EXTERN(__irq_dma2_channel1) -EXTERN(__irq_dma2_channel2) -EXTERN(__irq_dma2_channel3) -EXTERN(__irq_dma2_channel4_5) +EXTERN(__msp_init) +EXTERN(__exc_reset) +EXTERN(__exc_nmi) +EXTERN(__exc_hardfault) +EXTERN(__exc_memmanage) +EXTERN(__exc_busfault) +EXTERN(__exc_usagefault) +EXTERN(__stm32reservedexception7) +EXTERN(__stm32reservedexception8) +EXTERN(__stm32reservedexception9) +EXTERN(__stm32reservedexception10) +EXTERN(__exc_svc) +EXTERN(__exc_debug_monitor) +EXTERN(__stm32reservedexception13) +EXTERN(__exc_pendsv) +EXTERN(__exc_systick) + +EXTERN(__irq_wwdg) +EXTERN(__irq_pvd) +EXTERN(__irq_tamper) +EXTERN(__irq_rtc) +EXTERN(__irq_flash) +EXTERN(__irq_rcc) +EXTERN(__irq_exti0) +EXTERN(__irq_exti1) +EXTERN(__irq_exti2) +EXTERN(__irq_exti3) +EXTERN(__irq_exti4) +EXTERN(__irq_dma1_channel1) +EXTERN(__irq_dma1_channel2) +EXTERN(__irq_dma1_channel3) +EXTERN(__irq_dma1_channel4) +EXTERN(__irq_dma1_channel5) +EXTERN(__irq_dma1_channel6) +EXTERN(__irq_dma1_channel7) +EXTERN(__irq_adc) +EXTERN(__irq_usb_hp_can_tx) +EXTERN(__irq_usb_lp_can_rx0) +EXTERN(__irq_can_rx1) +EXTERN(__irq_can_sce) +EXTERN(__irq_exti9_5) +EXTERN(__irq_tim1_brk) +EXTERN(__irq_tim1_up) +EXTERN(__irq_tim1_trg_com) +EXTERN(__irq_tim1_cc) +EXTERN(__irq_tim2) +EXTERN(__irq_tim3) +EXTERN(__irq_tim4) +EXTERN(__irq_i2c1_ev) +EXTERN(__irq_i2c1_er) +EXTERN(__irq_i2c2_ev) +EXTERN(__irq_i2c2_er) +EXTERN(__irq_spi1) +EXTERN(__irq_spi2) +EXTERN(__irq_usart1) +EXTERN(__irq_usart2) +EXTERN(__irq_usart3) +EXTERN(__irq_exti15_10) +EXTERN(__irq_rtcalarm) +EXTERN(__irq_usbwakeup) + +EXTERN(__irq_tim8_brk) +EXTERN(__irq_tim8_up) +EXTERN(__irq_tim8_trg_com) +EXTERN(__irq_tim8_cc) +EXTERN(__irq_adc3) +EXTERN(__irq_fsmc) +EXTERN(__irq_sdio) +EXTERN(__irq_tim5) +EXTERN(__irq_spi3) +EXTERN(__irq_uart4) +EXTERN(__irq_uart5) +EXTERN(__irq_tim6) +EXTERN(__irq_tim7) +EXTERN(__irq_dma2_channel1) +EXTERN(__irq_dma2_channel2) +EXTERN(__irq_dma2_channel3) +EXTERN(__irq_dma2_channel4_5) diff --git a/STM32F1/variants/generic_stm32f103zxx/pins_arduino.h b/STM32F1/variants/generic_stm32f103r/pins_arduino.h similarity index 50% rename from STM32F1/variants/generic_stm32f103zxx/pins_arduino.h rename to STM32F1/variants/generic_stm32f103r/pins_arduino.h index 20b4474..43c2a86 100644 --- a/STM32F1/variants/generic_stm32f103zxx/pins_arduino.h +++ b/STM32F1/variants/generic_stm32f103r/pins_arduino.h @@ -1,2 +1,2 @@ -// API compatibility +// API compatibility #include "variant.h" \ No newline at end of file diff --git a/STM32F1/variants/generic_stm32f103rxx/variant.h b/STM32F1/variants/generic_stm32f103r/variant.h similarity index 91% rename from STM32F1/variants/generic_stm32f103rxx/variant.h rename to STM32F1/variants/generic_stm32f103r/variant.h index cc3e432..0358eb3 100644 --- a/STM32F1/variants/generic_stm32f103rxx/variant.h +++ b/STM32F1/variants/generic_stm32f103r/variant.h @@ -1,13 +1,13 @@ -#ifndef _VARIANT_ARDUINO_STM32_ -#define _VARIANT_ARDUINO_STM32_ - -#define digitalPinToPort(P) ( PIN_MAP[P].gpio_device ) -#define digitalPinToBitMask(P) ( BIT(PIN_MAP[P].gpio_bit) ) -#define portOutputRegister(port) ( &(port->regs->ODR) ) -#define portInputRegister(port) ( &(port->regs->IDR) ) - -#define portSetRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->BSRR) ) -#define portClearRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->BRR) ) - -#define portConfigRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->CRL) ) +#ifndef _VARIANT_ARDUINO_STM32_ +#define _VARIANT_ARDUINO_STM32_ + +#define digitalPinToPort(P) ( PIN_MAP[P].gpio_device ) +#define digitalPinToBitMask(P) ( BIT(PIN_MAP[P].gpio_bit) ) +#define portOutputRegister(port) ( &(port->regs->ODR) ) +#define portInputRegister(port) ( &(port->regs->IDR) ) + +#define portSetRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->BSRR) ) +#define portClearRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->BRR) ) + +#define portConfigRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->CRL) ) #endif /* _VARIANT_ARDUINO_STM32_ */ \ No newline at end of file diff --git a/STM32F1/variants/generic_stm32f103rxx/wirish/boards.cpp b/STM32F1/variants/generic_stm32f103r/wirish/boards.cpp similarity index 100% rename from STM32F1/variants/generic_stm32f103rxx/wirish/boards.cpp rename to STM32F1/variants/generic_stm32f103r/wirish/boards.cpp diff --git a/STM32F1/variants/generic_stm32f103rxx/wirish/boards_setup.cpp b/STM32F1/variants/generic_stm32f103r/wirish/boards_setup.cpp similarity index 100% rename from STM32F1/variants/generic_stm32f103rxx/wirish/boards_setup.cpp rename to STM32F1/variants/generic_stm32f103r/wirish/boards_setup.cpp diff --git a/STM32F1/variants/generic_stm32f103rxx/wirish/start.S b/STM32F1/variants/generic_stm32f103r/wirish/start.S similarity index 97% rename from STM32F1/variants/generic_stm32f103rxx/wirish/start.S rename to STM32F1/variants/generic_stm32f103r/wirish/start.S index 8b181aa..a04f222 100644 --- a/STM32F1/variants/generic_stm32f103rxx/wirish/start.S +++ b/STM32F1/variants/generic_stm32f103r/wirish/start.S @@ -1,57 +1,57 @@ -/****************************************************************************** - * The MIT License - * - * Copyright (c) 2011 LeafLabs, LLC. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * 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, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - *****************************************************************************/ - -/* - * This file is a modified version of a file obtained from - * CodeSourcery Inc. (now part of Mentor Graphics Corp.), in which the - * following text appeared: - * - * The authors hereby grant permission to use, copy, modify, distribute, - * and license this software and its documentation for any purpose, provided - * that existing copyright notices are retained in all copies and that this - * notice is included verbatim in any distributions. No written agreement, - * license, or royalty fee is required for any of the authorized uses. - * Modifications to this software may be copyrighted by their authors - * and need not follow the licensing terms described here, provided that - * the new terms are clearly indicated on the first page of each file where - * they apply. - */ - - .text - .code 16 - .thumb_func - - .globl __start__ - .type __start__, %function -__start__: - .fnstart - ldr r1,=__msp_init - mov sp,r1 - ldr r1,=start_c - bx r1 - .pool - .cantunwind - .fnend +/****************************************************************************** + * The MIT License + * + * Copyright (c) 2011 LeafLabs, LLC. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * 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, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + *****************************************************************************/ + +/* + * This file is a modified version of a file obtained from + * CodeSourcery Inc. (now part of Mentor Graphics Corp.), in which the + * following text appeared: + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + + .text + .code 16 + .thumb_func + + .globl __start__ + .type __start__, %function +__start__: + .fnstart + ldr r1,=__msp_init + mov sp,r1 + ldr r1,=start_c + bx r1 + .pool + .cantunwind + .fnend diff --git a/STM32F1/variants/generic_stm32f103zxx/wirish/start_c.c b/STM32F1/variants/generic_stm32f103r/wirish/start_c.c similarity index 97% rename from STM32F1/variants/generic_stm32f103zxx/wirish/start_c.c rename to STM32F1/variants/generic_stm32f103r/wirish/start_c.c index 655fefb..05df060 100644 --- a/STM32F1/variants/generic_stm32f103zxx/wirish/start_c.c +++ b/STM32F1/variants/generic_stm32f103r/wirish/start_c.c @@ -1,95 +1,95 @@ -/****************************************************************************** - * The MIT License - * - * Copyright (c) 2011 LeafLabs, LLC. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * 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, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - *****************************************************************************/ - -/* - * This file is a modified version of a file obtained from - * CodeSourcery Inc. (now part of Mentor Graphics Corp.), in which the - * following text appeared: - * - * Copyright (c) 2006, 2007 CodeSourcery Inc - * - * The authors hereby grant permission to use, copy, modify, distribute, - * and license this software and its documentation for any purpose, provided - * that existing copyright notices are retained in all copies and that this - * notice is included verbatim in any distributions. No written agreement, - * license, or royalty fee is required for any of the authorized uses. - * Modifications to this software may be copyrighted by their authors - * and need not follow the licensing terms described here, provided that - * the new terms are clearly indicated on the first page of each file where - * they apply. - */ - -#include - -extern void __libc_init_array(void); - -extern int main(int, char**, char**); - -extern void exit(int) __attribute__((noreturn, weak)); - -/* The linker must ensure that these are at least 4-byte aligned. */ -extern char __data_start__, __data_end__; -extern char __bss_start__, __bss_end__; - -struct rom_img_cfg { - int *img_start; -}; - -extern char _lm_rom_img_cfgp; - -void __attribute__((noreturn)) start_c(void) { - struct rom_img_cfg *img_cfg = (struct rom_img_cfg*)&_lm_rom_img_cfgp; - int *src = img_cfg->img_start; - int *dst = (int*)&__data_start__; - int exit_code; - - /* Initialize .data, if necessary. */ - if (src != dst) { - int *end = (int*)&__data_end__; - while (dst < end) { - *dst++ = *src++; - } - } - - /* Zero .bss. */ - dst = (int*)&__bss_start__; - while (dst < (int*)&__bss_end__) { - *dst++ = 0; - } - - /* Run initializers. */ - __libc_init_array(); - - /* Jump to main. */ - exit_code = main(0, 0, 0); - if (exit) { - exit(exit_code); - } - - /* If exit is NULL, make sure we don't return. */ - for (;;) - continue; -} +/****************************************************************************** + * The MIT License + * + * Copyright (c) 2011 LeafLabs, LLC. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * 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, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + *****************************************************************************/ + +/* + * This file is a modified version of a file obtained from + * CodeSourcery Inc. (now part of Mentor Graphics Corp.), in which the + * following text appeared: + * + * Copyright (c) 2006, 2007 CodeSourcery Inc + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include + +extern void __libc_init_array(void); + +extern int main(int, char**, char**); + +extern void exit(int) __attribute__((noreturn, weak)); + +/* The linker must ensure that these are at least 4-byte aligned. */ +extern char __data_start__, __data_end__; +extern char __bss_start__, __bss_end__; + +struct rom_img_cfg { + int *img_start; +}; + +extern char _lm_rom_img_cfgp; + +void __attribute__((noreturn)) start_c(void) { + struct rom_img_cfg *img_cfg = (struct rom_img_cfg*)&_lm_rom_img_cfgp; + int *src = img_cfg->img_start; + int *dst = (int*)&__data_start__; + int exit_code; + + /* Initialize .data, if necessary. */ + if (src != dst) { + int *end = (int*)&__data_end__; + while (dst < end) { + *dst++ = *src++; + } + } + + /* Zero .bss. */ + dst = (int*)&__bss_start__; + while (dst < (int*)&__bss_end__) { + *dst++ = 0; + } + + /* Run initializers. */ + __libc_init_array(); + + /* Jump to main. */ + exit_code = main(0, 0, 0); + if (exit) { + exit(exit_code); + } + + /* If exit is NULL, make sure we don't return. */ + for (;;) + continue; +} diff --git a/STM32F1/variants/generic_stm32f103zxx/wirish/syscalls.c b/STM32F1/variants/generic_stm32f103r/wirish/syscalls.c similarity index 95% rename from STM32F1/variants/generic_stm32f103zxx/wirish/syscalls.c rename to STM32F1/variants/generic_stm32f103r/wirish/syscalls.c index d5f2d9f..d42536c 100644 --- a/STM32F1/variants/generic_stm32f103zxx/wirish/syscalls.c +++ b/STM32F1/variants/generic_stm32f103r/wirish/syscalls.c @@ -1,176 +1,176 @@ -/****************************************************************************** - * The MIT License - * - * Copyright (c) 2010 Perry Hung. - * Copyright (c) 2011, 2012 LeafLabs, LLC. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * 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, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - *****************************************************************************/ - -/** - * @file wirish/syscalls.c - * @brief newlib stubs - * - * Low level system routines used by newlib for basic I/O and memory - * allocation. You can override most of these. - */ - -#include - -#include -#include -#include - -/* If CONFIG_HEAP_START (or CONFIG_HEAP_END) isn't defined, then - * assume _lm_heap_start (resp. _lm_heap_end) is appropriately set by - * the linker */ -#ifndef CONFIG_HEAP_START -extern char _lm_heap_start; -#define CONFIG_HEAP_START ((void *)&_lm_heap_start) -#endif -#ifndef CONFIG_HEAP_END -extern char _lm_heap_end; -#define CONFIG_HEAP_END ((void *)&_lm_heap_end) -#endif - -/* - * _sbrk -- Increment the program break. - * - * Get incr bytes more RAM (for use by the heap). malloc() and - * friends call this function behind the scenes. - */ -void *_sbrk(int incr) { - static void * pbreak = NULL; /* current program break */ - void * ret; - - if (pbreak == NULL) { - pbreak = CONFIG_HEAP_START; - } - - if ((CONFIG_HEAP_END - pbreak < incr) || - (pbreak - CONFIG_HEAP_START < -incr)) { - errno = ENOMEM; - return (void *)-1; - } - - ret = pbreak; - pbreak += incr; - return ret; -} - -__weak int _open(const char *path, int flags, ...) { - return 1; -} - -__weak int _close(int fd) { - return 0; -} - -__weak int _fstat(int fd, struct stat *st) { - st->st_mode = S_IFCHR; - return 0; -} - -__weak int _isatty(int fd) { - return 1; -} - -__weak int isatty(int fd) { - return 1; -} - -__weak int _lseek(int fd, off_t pos, int whence) { - return -1; -} - -__weak unsigned char getch(void) { - return 0; -} - - -__weak int _read(int fd, char *buf, size_t cnt) { - *buf = getch(); - - return 1; -} - -__weak void putch(unsigned char c) { -} - -__weak void cgets(char *s, int bufsize) { - char *p; - int c; - int i; - - for (i = 0; i < bufsize; i++) { - *(s+i) = 0; - } -// memset(s, 0, bufsize); - - p = s; - - for (p = s; p < s + bufsize-1;) { - c = getch(); - switch (c) { - case '\r' : - case '\n' : - putch('\r'); - putch('\n'); - *p = '\n'; - return; - - case '\b' : - if (p > s) { - *p-- = 0; - putch('\b'); - putch(' '); - putch('\b'); - } - break; - - default : - putch(c); - *p++ = c; - break; - } - } - return; -} - -__weak int _write(int fd, const char *buf, size_t cnt) { - int i; - - for (i = 0; i < cnt; i++) - putch(buf[i]); - - return cnt; -} - -/* Override fgets() in newlib with a version that does line editing */ -__weak char *fgets(char *s, int bufsize, void *f) { - cgets(s, bufsize); - return s; -} - -__weak void _exit(int exitcode) { - while (1) - ; -} +/****************************************************************************** + * The MIT License + * + * Copyright (c) 2010 Perry Hung. + * Copyright (c) 2011, 2012 LeafLabs, LLC. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * 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, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + *****************************************************************************/ + +/** + * @file wirish/syscalls.c + * @brief newlib stubs + * + * Low level system routines used by newlib for basic I/O and memory + * allocation. You can override most of these. + */ + +#include + +#include +#include +#include + +/* If CONFIG_HEAP_START (or CONFIG_HEAP_END) isn't defined, then + * assume _lm_heap_start (resp. _lm_heap_end) is appropriately set by + * the linker */ +#ifndef CONFIG_HEAP_START +extern char _lm_heap_start; +#define CONFIG_HEAP_START ((void *)&_lm_heap_start) +#endif +#ifndef CONFIG_HEAP_END +extern char _lm_heap_end; +#define CONFIG_HEAP_END ((void *)&_lm_heap_end) +#endif + +/* + * _sbrk -- Increment the program break. + * + * Get incr bytes more RAM (for use by the heap). malloc() and + * friends call this function behind the scenes. + */ +void *_sbrk(int incr) { + static void * pbreak = NULL; /* current program break */ + void * ret; + + if (pbreak == NULL) { + pbreak = CONFIG_HEAP_START; + } + + if ((CONFIG_HEAP_END - pbreak < incr) || + (pbreak - CONFIG_HEAP_START < -incr)) { + errno = ENOMEM; + return (void *)-1; + } + + ret = pbreak; + pbreak += incr; + return ret; +} + +__weak int _open(const char *path, int flags, ...) { + return 1; +} + +__weak int _close(int fd) { + return 0; +} + +__weak int _fstat(int fd, struct stat *st) { + st->st_mode = S_IFCHR; + return 0; +} + +__weak int _isatty(int fd) { + return 1; +} + +__weak int isatty(int fd) { + return 1; +} + +__weak int _lseek(int fd, off_t pos, int whence) { + return -1; +} + +__weak unsigned char getch(void) { + return 0; +} + + +__weak int _read(int fd, char *buf, size_t cnt) { + *buf = getch(); + + return 1; +} + +__weak void putch(unsigned char c) { +} + +__weak void cgets(char *s, int bufsize) { + char *p; + int c; + int i; + + for (i = 0; i < bufsize; i++) { + *(s+i) = 0; + } +// memset(s, 0, bufsize); + + p = s; + + for (p = s; p < s + bufsize-1;) { + c = getch(); + switch (c) { + case '\r' : + case '\n' : + putch('\r'); + putch('\n'); + *p = '\n'; + return; + + case '\b' : + if (p > s) { + *p-- = 0; + putch('\b'); + putch(' '); + putch('\b'); + } + break; + + default : + putch(c); + *p++ = c; + break; + } + } + return; +} + +__weak int _write(int fd, const char *buf, size_t cnt) { + int i; + + for (i = 0; i < cnt; i++) + putch(buf[i]); + + return cnt; +} + +/* Override fgets() in newlib with a version that does line editing */ +__weak char *fgets(char *s, int bufsize, void *f) { + cgets(s, bufsize); + return s; +} + +__weak void _exit(int exitcode) { + while (1) + ; +} diff --git a/STM32F1/variants/generic_stm32f103zxx/board.cpp b/STM32F1/variants/generic_stm32f103z/board.cpp similarity index 100% rename from STM32F1/variants/generic_stm32f103zxx/board.cpp rename to STM32F1/variants/generic_stm32f103z/board.cpp diff --git a/STM32F1/variants/generic_stm32f103zxx/board/board.h b/STM32F1/variants/generic_stm32f103z/board/board.h similarity index 100% rename from STM32F1/variants/generic_stm32f103zxx/board/board.h rename to STM32F1/variants/generic_stm32f103z/board/board.h diff --git a/STM32F1/variants/generic_stm32f103zxx/ld/common.inc b/STM32F1/variants/generic_stm32f103z/ld/common.inc similarity index 96% rename from STM32F1/variants/generic_stm32f103zxx/ld/common.inc rename to STM32F1/variants/generic_stm32f103z/ld/common.inc index e086a58..0c2b6a4 100644 --- a/STM32F1/variants/generic_stm32f103zxx/ld/common.inc +++ b/STM32F1/variants/generic_stm32f103z/ld/common.inc @@ -1,220 +1,220 @@ -/* - * Linker script for libmaple. - * - * Original author "lanchon" from ST forums, with modifications by LeafLabs. - */ - -OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") - -/* - * Configure other libraries we want in the link. - * - * libgcc, libc, and libm are common across supported toolchains. - * However, some toolchains require additional archives which aren't - * present everywhere (e.g. ARM's gcc-arm-embedded releases). - * - * To hack around this, we let the build system specify additional - * archives by putting the right extra_libs.inc (in a directory under - * toolchains/) in our search path. - */ -GROUP(libgcc.a libc.a libm.a) -INCLUDE extra_libs.inc - -/* - * These force the linker to search for vector table symbols. - * - * These symbols vary by STM32 family (and also within families). - * It's up to the build system to configure the link's search path - * properly for the target MCU. - */ -INCLUDE vector_symbols.inc - -/* STM32 vector table. */ -EXTERN(__stm32_vector_table) - -/* C runtime initialization function. */ -EXTERN(start_c) - -/* main entry point */ -EXTERN(main) - -/* Initial stack pointer value. */ -EXTERN(__msp_init) -PROVIDE(__msp_init = ORIGIN(ram) + LENGTH(ram)); - -/* Reset vector and chip reset entry point */ -EXTERN(__start__) -ENTRY(__start__) -PROVIDE(__exc_reset = __start__); - -/* Heap boundaries, for libmaple */ -EXTERN(_lm_heap_start); -EXTERN(_lm_heap_end); - -SECTIONS -{ - .text : - { - __text_start__ = .; - /* - * STM32 vector table. Leave this here. Yes, really. - */ - *(.stm32.interrupt_vector) - - /* - * Program code and vague linking - */ - *(.text .text.* .gnu.linkonce.t.*) - *(.plt) - *(.gnu.warning) - *(.glue_7t) *(.glue_7) *(.vfp11_veneer) - - *(.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)) - } > REGION_TEXT - - /* - * End of text - */ - .text.align : - { - . = ALIGN(8); - __text_end__ = .; - } > REGION_TEXT - - /* - * .ARM.exidx exception unwinding; mandated by ARM's C++ ABI - */ - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > REGION_RODATA - __exidx_end = .; - - /* - * .data - */ - .data : - { - __data_start__ = .; - LONG(0) - . = ALIGN(8); - - *(.got.plt) *(.got) - *(.data .data.* .gnu.linkonce.d.*) - - . = ALIGN(8); - __data_end__ = .; - } > REGION_DATA AT> REGION_RODATA - - /* - * Read-only data - */ - .rodata : - { - *(.rodata .rodata.* .gnu.linkonce.r.*) - /* .USER_FLASH: We allow users to allocate into Flash here */ - *(.USER_FLASH) - /* ROM image configuration; for C startup */ - . = ALIGN(4); - _lm_rom_img_cfgp = .; - LONG(LOADADDR(.data)); - /* - * Heap: Linker scripts may choose a custom heap by overriding - * _lm_heap_start and _lm_heap_end. Otherwise, the heap is in - * internal SRAM, beginning after .bss, and growing towards - * the stack. - * - * I'm shoving these here naively; there's probably a cleaner way - * to go about this. [mbolivar] - */ - _lm_heap_start = DEFINED(_lm_heap_start) ? _lm_heap_start : _end; - _lm_heap_end = DEFINED(_lm_heap_end) ? _lm_heap_end : __msp_init; - } > REGION_RODATA - - /* - * .bss - */ - .bss : - { - . = ALIGN(8); - __bss_start__ = .; - *(.bss .bss.* .gnu.linkonce.b.*) - *(COMMON) - . = ALIGN (8); - __bss_end__ = .; - _end = __bss_end__; - } > REGION_BSS - - /* - * 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) } -} +/* + * Linker script for libmaple. + * + * Original author "lanchon" from ST forums, with modifications by LeafLabs. + */ + +OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") + +/* + * Configure other libraries we want in the link. + * + * libgcc, libc, and libm are common across supported toolchains. + * However, some toolchains require additional archives which aren't + * present everywhere (e.g. ARM's gcc-arm-embedded releases). + * + * To hack around this, we let the build system specify additional + * archives by putting the right extra_libs.inc (in a directory under + * toolchains/) in our search path. + */ +GROUP(libgcc.a libc.a libm.a) +INCLUDE extra_libs.inc + +/* + * These force the linker to search for vector table symbols. + * + * These symbols vary by STM32 family (and also within families). + * It's up to the build system to configure the link's search path + * properly for the target MCU. + */ +INCLUDE vector_symbols.inc + +/* STM32 vector table. */ +EXTERN(__stm32_vector_table) + +/* C runtime initialization function. */ +EXTERN(start_c) + +/* main entry point */ +EXTERN(main) + +/* Initial stack pointer value. */ +EXTERN(__msp_init) +PROVIDE(__msp_init = ORIGIN(ram) + LENGTH(ram)); + +/* Reset vector and chip reset entry point */ +EXTERN(__start__) +ENTRY(__start__) +PROVIDE(__exc_reset = __start__); + +/* Heap boundaries, for libmaple */ +EXTERN(_lm_heap_start); +EXTERN(_lm_heap_end); + +SECTIONS +{ + .text : + { + __text_start__ = .; + /* + * STM32 vector table. Leave this here. Yes, really. + */ + *(.stm32.interrupt_vector) + + /* + * Program code and vague linking + */ + *(.text .text.* .gnu.linkonce.t.*) + *(.plt) + *(.gnu.warning) + *(.glue_7t) *(.glue_7) *(.vfp11_veneer) + + *(.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)) + } > REGION_TEXT + + /* + * End of text + */ + .text.align : + { + . = ALIGN(8); + __text_end__ = .; + } > REGION_TEXT + + /* + * .ARM.exidx exception unwinding; mandated by ARM's C++ ABI + */ + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > REGION_RODATA + __exidx_end = .; + + /* + * .data + */ + .data : + { + __data_start__ = .; + LONG(0) + . = ALIGN(8); + + *(.got.plt) *(.got) + *(.data .data.* .gnu.linkonce.d.*) + + . = ALIGN(8); + __data_end__ = .; + } > REGION_DATA AT> REGION_RODATA + + /* + * Read-only data + */ + .rodata : + { + *(.rodata .rodata.* .gnu.linkonce.r.*) + /* .USER_FLASH: We allow users to allocate into Flash here */ + *(.USER_FLASH) + /* ROM image configuration; for C startup */ + . = ALIGN(4); + _lm_rom_img_cfgp = .; + LONG(LOADADDR(.data)); + /* + * Heap: Linker scripts may choose a custom heap by overriding + * _lm_heap_start and _lm_heap_end. Otherwise, the heap is in + * internal SRAM, beginning after .bss, and growing towards + * the stack. + * + * I'm shoving these here naively; there's probably a cleaner way + * to go about this. [mbolivar] + */ + _lm_heap_start = DEFINED(_lm_heap_start) ? _lm_heap_start : _end; + _lm_heap_end = DEFINED(_lm_heap_end) ? _lm_heap_end : __msp_init; + } > REGION_RODATA + + /* + * .bss + */ + .bss : + { + . = ALIGN(8); + __bss_start__ = .; + *(.bss .bss.* .gnu.linkonce.b.*) + *(COMMON) + . = ALIGN (8); + __bss_end__ = .; + _end = __bss_end__; + } > REGION_BSS + + /* + * 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/STM32F1/variants/generic_stm32f103rxx/ld/extra_libs.inc b/STM32F1/variants/generic_stm32f103z/ld/extra_libs.inc similarity index 96% rename from STM32F1/variants/generic_stm32f103rxx/ld/extra_libs.inc rename to STM32F1/variants/generic_stm32f103z/ld/extra_libs.inc index dd2c84f..4413a53 100644 --- a/STM32F1/variants/generic_stm32f103rxx/ld/extra_libs.inc +++ b/STM32F1/variants/generic_stm32f103z/ld/extra_libs.inc @@ -1,7 +1,7 @@ -/* - * Extra archives needed by ARM's GCC ARM Embedded arm-none-eabi- - * releases (https://launchpad.net/gcc-arm-embedded/). - */ - -/* This is for the provided newlib. */ -GROUP(libnosys.a) +/* + * Extra archives needed by ARM's GCC ARM Embedded arm-none-eabi- + * releases (https://launchpad.net/gcc-arm-embedded/). + */ + +/* This is for the provided newlib. */ +GROUP(libnosys.a) diff --git a/STM32F1/variants/generic_stm32f103zxx/ld/stm32f103zc.ld b/STM32F1/variants/generic_stm32f103z/ld/stm32f103zc.ld similarity index 100% rename from STM32F1/variants/generic_stm32f103zxx/ld/stm32f103zc.ld rename to STM32F1/variants/generic_stm32f103z/ld/stm32f103zc.ld diff --git a/STM32F1/variants/generic_stm32f103zxx/ld/stm32f103zd.ld b/STM32F1/variants/generic_stm32f103z/ld/stm32f103zd.ld similarity index 100% rename from STM32F1/variants/generic_stm32f103zxx/ld/stm32f103zd.ld rename to STM32F1/variants/generic_stm32f103z/ld/stm32f103zd.ld diff --git a/STM32F1/variants/generic_stm32f103zxx/ld/stm32f103ze.ld b/STM32F1/variants/generic_stm32f103z/ld/stm32f103ze.ld similarity index 100% rename from STM32F1/variants/generic_stm32f103zxx/ld/stm32f103ze.ld rename to STM32F1/variants/generic_stm32f103z/ld/stm32f103ze.ld diff --git a/STM32F1/variants/generic_stm32f103zxx/ld/vector_symbols.inc b/STM32F1/variants/generic_stm32f103z/ld/vector_symbols.inc similarity index 95% rename from STM32F1/variants/generic_stm32f103zxx/ld/vector_symbols.inc rename to STM32F1/variants/generic_stm32f103z/ld/vector_symbols.inc index f8519bb..a40012a 100644 --- a/STM32F1/variants/generic_stm32f103zxx/ld/vector_symbols.inc +++ b/STM32F1/variants/generic_stm32f103z/ld/vector_symbols.inc @@ -1,78 +1,78 @@ -EXTERN(__msp_init) -EXTERN(__exc_reset) -EXTERN(__exc_nmi) -EXTERN(__exc_hardfault) -EXTERN(__exc_memmanage) -EXTERN(__exc_busfault) -EXTERN(__exc_usagefault) -EXTERN(__stm32reservedexception7) -EXTERN(__stm32reservedexception8) -EXTERN(__stm32reservedexception9) -EXTERN(__stm32reservedexception10) -EXTERN(__exc_svc) -EXTERN(__exc_debug_monitor) -EXTERN(__stm32reservedexception13) -EXTERN(__exc_pendsv) -EXTERN(__exc_systick) - -EXTERN(__irq_wwdg) -EXTERN(__irq_pvd) -EXTERN(__irq_tamper) -EXTERN(__irq_rtc) -EXTERN(__irq_flash) -EXTERN(__irq_rcc) -EXTERN(__irq_exti0) -EXTERN(__irq_exti1) -EXTERN(__irq_exti2) -EXTERN(__irq_exti3) -EXTERN(__irq_exti4) -EXTERN(__irq_dma1_channel1) -EXTERN(__irq_dma1_channel2) -EXTERN(__irq_dma1_channel3) -EXTERN(__irq_dma1_channel4) -EXTERN(__irq_dma1_channel5) -EXTERN(__irq_dma1_channel6) -EXTERN(__irq_dma1_channel7) -EXTERN(__irq_adc) -EXTERN(__irq_usb_hp_can_tx) -EXTERN(__irq_usb_lp_can_rx0) -EXTERN(__irq_can_rx1) -EXTERN(__irq_can_sce) -EXTERN(__irq_exti9_5) -EXTERN(__irq_tim1_brk) -EXTERN(__irq_tim1_up) -EXTERN(__irq_tim1_trg_com) -EXTERN(__irq_tim1_cc) -EXTERN(__irq_tim2) -EXTERN(__irq_tim3) -EXTERN(__irq_tim4) -EXTERN(__irq_i2c1_ev) -EXTERN(__irq_i2c1_er) -EXTERN(__irq_i2c2_ev) -EXTERN(__irq_i2c2_er) -EXTERN(__irq_spi1) -EXTERN(__irq_spi2) -EXTERN(__irq_usart1) -EXTERN(__irq_usart2) -EXTERN(__irq_usart3) -EXTERN(__irq_exti15_10) -EXTERN(__irq_rtcalarm) -EXTERN(__irq_usbwakeup) - -EXTERN(__irq_tim8_brk) -EXTERN(__irq_tim8_up) -EXTERN(__irq_tim8_trg_com) -EXTERN(__irq_tim8_cc) -EXTERN(__irq_adc3) -EXTERN(__irq_fsmc) -EXTERN(__irq_sdio) -EXTERN(__irq_tim5) -EXTERN(__irq_spi3) -EXTERN(__irq_uart4) -EXTERN(__irq_uart5) -EXTERN(__irq_tim6) -EXTERN(__irq_tim7) -EXTERN(__irq_dma2_channel1) -EXTERN(__irq_dma2_channel2) -EXTERN(__irq_dma2_channel3) -EXTERN(__irq_dma2_channel4_5) +EXTERN(__msp_init) +EXTERN(__exc_reset) +EXTERN(__exc_nmi) +EXTERN(__exc_hardfault) +EXTERN(__exc_memmanage) +EXTERN(__exc_busfault) +EXTERN(__exc_usagefault) +EXTERN(__stm32reservedexception7) +EXTERN(__stm32reservedexception8) +EXTERN(__stm32reservedexception9) +EXTERN(__stm32reservedexception10) +EXTERN(__exc_svc) +EXTERN(__exc_debug_monitor) +EXTERN(__stm32reservedexception13) +EXTERN(__exc_pendsv) +EXTERN(__exc_systick) + +EXTERN(__irq_wwdg) +EXTERN(__irq_pvd) +EXTERN(__irq_tamper) +EXTERN(__irq_rtc) +EXTERN(__irq_flash) +EXTERN(__irq_rcc) +EXTERN(__irq_exti0) +EXTERN(__irq_exti1) +EXTERN(__irq_exti2) +EXTERN(__irq_exti3) +EXTERN(__irq_exti4) +EXTERN(__irq_dma1_channel1) +EXTERN(__irq_dma1_channel2) +EXTERN(__irq_dma1_channel3) +EXTERN(__irq_dma1_channel4) +EXTERN(__irq_dma1_channel5) +EXTERN(__irq_dma1_channel6) +EXTERN(__irq_dma1_channel7) +EXTERN(__irq_adc) +EXTERN(__irq_usb_hp_can_tx) +EXTERN(__irq_usb_lp_can_rx0) +EXTERN(__irq_can_rx1) +EXTERN(__irq_can_sce) +EXTERN(__irq_exti9_5) +EXTERN(__irq_tim1_brk) +EXTERN(__irq_tim1_up) +EXTERN(__irq_tim1_trg_com) +EXTERN(__irq_tim1_cc) +EXTERN(__irq_tim2) +EXTERN(__irq_tim3) +EXTERN(__irq_tim4) +EXTERN(__irq_i2c1_ev) +EXTERN(__irq_i2c1_er) +EXTERN(__irq_i2c2_ev) +EXTERN(__irq_i2c2_er) +EXTERN(__irq_spi1) +EXTERN(__irq_spi2) +EXTERN(__irq_usart1) +EXTERN(__irq_usart2) +EXTERN(__irq_usart3) +EXTERN(__irq_exti15_10) +EXTERN(__irq_rtcalarm) +EXTERN(__irq_usbwakeup) + +EXTERN(__irq_tim8_brk) +EXTERN(__irq_tim8_up) +EXTERN(__irq_tim8_trg_com) +EXTERN(__irq_tim8_cc) +EXTERN(__irq_adc3) +EXTERN(__irq_fsmc) +EXTERN(__irq_sdio) +EXTERN(__irq_tim5) +EXTERN(__irq_spi3) +EXTERN(__irq_uart4) +EXTERN(__irq_uart5) +EXTERN(__irq_tim6) +EXTERN(__irq_tim7) +EXTERN(__irq_dma2_channel1) +EXTERN(__irq_dma2_channel2) +EXTERN(__irq_dma2_channel3) +EXTERN(__irq_dma2_channel4_5) diff --git a/STM32F1/variants/generic_stm32f103rxx/pins_arduino.h b/STM32F1/variants/generic_stm32f103z/pins_arduino.h similarity index 50% rename from STM32F1/variants/generic_stm32f103rxx/pins_arduino.h rename to STM32F1/variants/generic_stm32f103z/pins_arduino.h index 20b4474..43c2a86 100644 --- a/STM32F1/variants/generic_stm32f103rxx/pins_arduino.h +++ b/STM32F1/variants/generic_stm32f103z/pins_arduino.h @@ -1,2 +1,2 @@ -// API compatibility +// API compatibility #include "variant.h" \ No newline at end of file diff --git a/STM32F1/variants/generic_stm32f103zxx/variant.h b/STM32F1/variants/generic_stm32f103z/variant.h similarity index 91% rename from STM32F1/variants/generic_stm32f103zxx/variant.h rename to STM32F1/variants/generic_stm32f103z/variant.h index cc3e432..0358eb3 100644 --- a/STM32F1/variants/generic_stm32f103zxx/variant.h +++ b/STM32F1/variants/generic_stm32f103z/variant.h @@ -1,13 +1,13 @@ -#ifndef _VARIANT_ARDUINO_STM32_ -#define _VARIANT_ARDUINO_STM32_ - -#define digitalPinToPort(P) ( PIN_MAP[P].gpio_device ) -#define digitalPinToBitMask(P) ( BIT(PIN_MAP[P].gpio_bit) ) -#define portOutputRegister(port) ( &(port->regs->ODR) ) -#define portInputRegister(port) ( &(port->regs->IDR) ) - -#define portSetRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->BSRR) ) -#define portClearRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->BRR) ) - -#define portConfigRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->CRL) ) +#ifndef _VARIANT_ARDUINO_STM32_ +#define _VARIANT_ARDUINO_STM32_ + +#define digitalPinToPort(P) ( PIN_MAP[P].gpio_device ) +#define digitalPinToBitMask(P) ( BIT(PIN_MAP[P].gpio_bit) ) +#define portOutputRegister(port) ( &(port->regs->ODR) ) +#define portInputRegister(port) ( &(port->regs->IDR) ) + +#define portSetRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->BSRR) ) +#define portClearRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->BRR) ) + +#define portConfigRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->CRL) ) #endif /* _VARIANT_ARDUINO_STM32_ */ \ No newline at end of file diff --git a/STM32F1/variants/generic_stm32f103zxx/wirish/boards.cpp b/STM32F1/variants/generic_stm32f103z/wirish/boards.cpp similarity index 100% rename from STM32F1/variants/generic_stm32f103zxx/wirish/boards.cpp rename to STM32F1/variants/generic_stm32f103z/wirish/boards.cpp diff --git a/STM32F1/variants/generic_stm32f103zxx/wirish/boards_setup.cpp b/STM32F1/variants/generic_stm32f103z/wirish/boards_setup.cpp similarity index 100% rename from STM32F1/variants/generic_stm32f103zxx/wirish/boards_setup.cpp rename to STM32F1/variants/generic_stm32f103z/wirish/boards_setup.cpp diff --git a/STM32F1/variants/generic_stm32f103zxx/wirish/start.S b/STM32F1/variants/generic_stm32f103z/wirish/start.S similarity index 97% rename from STM32F1/variants/generic_stm32f103zxx/wirish/start.S rename to STM32F1/variants/generic_stm32f103z/wirish/start.S index 8b181aa..a04f222 100644 --- a/STM32F1/variants/generic_stm32f103zxx/wirish/start.S +++ b/STM32F1/variants/generic_stm32f103z/wirish/start.S @@ -1,57 +1,57 @@ -/****************************************************************************** - * The MIT License - * - * Copyright (c) 2011 LeafLabs, LLC. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * 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, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - *****************************************************************************/ - -/* - * This file is a modified version of a file obtained from - * CodeSourcery Inc. (now part of Mentor Graphics Corp.), in which the - * following text appeared: - * - * The authors hereby grant permission to use, copy, modify, distribute, - * and license this software and its documentation for any purpose, provided - * that existing copyright notices are retained in all copies and that this - * notice is included verbatim in any distributions. No written agreement, - * license, or royalty fee is required for any of the authorized uses. - * Modifications to this software may be copyrighted by their authors - * and need not follow the licensing terms described here, provided that - * the new terms are clearly indicated on the first page of each file where - * they apply. - */ - - .text - .code 16 - .thumb_func - - .globl __start__ - .type __start__, %function -__start__: - .fnstart - ldr r1,=__msp_init - mov sp,r1 - ldr r1,=start_c - bx r1 - .pool - .cantunwind - .fnend +/****************************************************************************** + * The MIT License + * + * Copyright (c) 2011 LeafLabs, LLC. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * 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, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + *****************************************************************************/ + +/* + * This file is a modified version of a file obtained from + * CodeSourcery Inc. (now part of Mentor Graphics Corp.), in which the + * following text appeared: + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + + .text + .code 16 + .thumb_func + + .globl __start__ + .type __start__, %function +__start__: + .fnstart + ldr r1,=__msp_init + mov sp,r1 + ldr r1,=start_c + bx r1 + .pool + .cantunwind + .fnend diff --git a/STM32F1/variants/generic_stm32f103rxx/wirish/start_c.c b/STM32F1/variants/generic_stm32f103z/wirish/start_c.c similarity index 97% rename from STM32F1/variants/generic_stm32f103rxx/wirish/start_c.c rename to STM32F1/variants/generic_stm32f103z/wirish/start_c.c index 655fefb..05df060 100644 --- a/STM32F1/variants/generic_stm32f103rxx/wirish/start_c.c +++ b/STM32F1/variants/generic_stm32f103z/wirish/start_c.c @@ -1,95 +1,95 @@ -/****************************************************************************** - * The MIT License - * - * Copyright (c) 2011 LeafLabs, LLC. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * 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, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - *****************************************************************************/ - -/* - * This file is a modified version of a file obtained from - * CodeSourcery Inc. (now part of Mentor Graphics Corp.), in which the - * following text appeared: - * - * Copyright (c) 2006, 2007 CodeSourcery Inc - * - * The authors hereby grant permission to use, copy, modify, distribute, - * and license this software and its documentation for any purpose, provided - * that existing copyright notices are retained in all copies and that this - * notice is included verbatim in any distributions. No written agreement, - * license, or royalty fee is required for any of the authorized uses. - * Modifications to this software may be copyrighted by their authors - * and need not follow the licensing terms described here, provided that - * the new terms are clearly indicated on the first page of each file where - * they apply. - */ - -#include - -extern void __libc_init_array(void); - -extern int main(int, char**, char**); - -extern void exit(int) __attribute__((noreturn, weak)); - -/* The linker must ensure that these are at least 4-byte aligned. */ -extern char __data_start__, __data_end__; -extern char __bss_start__, __bss_end__; - -struct rom_img_cfg { - int *img_start; -}; - -extern char _lm_rom_img_cfgp; - -void __attribute__((noreturn)) start_c(void) { - struct rom_img_cfg *img_cfg = (struct rom_img_cfg*)&_lm_rom_img_cfgp; - int *src = img_cfg->img_start; - int *dst = (int*)&__data_start__; - int exit_code; - - /* Initialize .data, if necessary. */ - if (src != dst) { - int *end = (int*)&__data_end__; - while (dst < end) { - *dst++ = *src++; - } - } - - /* Zero .bss. */ - dst = (int*)&__bss_start__; - while (dst < (int*)&__bss_end__) { - *dst++ = 0; - } - - /* Run initializers. */ - __libc_init_array(); - - /* Jump to main. */ - exit_code = main(0, 0, 0); - if (exit) { - exit(exit_code); - } - - /* If exit is NULL, make sure we don't return. */ - for (;;) - continue; -} +/****************************************************************************** + * The MIT License + * + * Copyright (c) 2011 LeafLabs, LLC. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * 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, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + *****************************************************************************/ + +/* + * This file is a modified version of a file obtained from + * CodeSourcery Inc. (now part of Mentor Graphics Corp.), in which the + * following text appeared: + * + * Copyright (c) 2006, 2007 CodeSourcery Inc + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include + +extern void __libc_init_array(void); + +extern int main(int, char**, char**); + +extern void exit(int) __attribute__((noreturn, weak)); + +/* The linker must ensure that these are at least 4-byte aligned. */ +extern char __data_start__, __data_end__; +extern char __bss_start__, __bss_end__; + +struct rom_img_cfg { + int *img_start; +}; + +extern char _lm_rom_img_cfgp; + +void __attribute__((noreturn)) start_c(void) { + struct rom_img_cfg *img_cfg = (struct rom_img_cfg*)&_lm_rom_img_cfgp; + int *src = img_cfg->img_start; + int *dst = (int*)&__data_start__; + int exit_code; + + /* Initialize .data, if necessary. */ + if (src != dst) { + int *end = (int*)&__data_end__; + while (dst < end) { + *dst++ = *src++; + } + } + + /* Zero .bss. */ + dst = (int*)&__bss_start__; + while (dst < (int*)&__bss_end__) { + *dst++ = 0; + } + + /* Run initializers. */ + __libc_init_array(); + + /* Jump to main. */ + exit_code = main(0, 0, 0); + if (exit) { + exit(exit_code); + } + + /* If exit is NULL, make sure we don't return. */ + for (;;) + continue; +} diff --git a/STM32F1/variants/generic_stm32f103rxx/wirish/syscalls.c b/STM32F1/variants/generic_stm32f103z/wirish/syscalls.c similarity index 95% rename from STM32F1/variants/generic_stm32f103rxx/wirish/syscalls.c rename to STM32F1/variants/generic_stm32f103z/wirish/syscalls.c index d5f2d9f..d42536c 100644 --- a/STM32F1/variants/generic_stm32f103rxx/wirish/syscalls.c +++ b/STM32F1/variants/generic_stm32f103z/wirish/syscalls.c @@ -1,176 +1,176 @@ -/****************************************************************************** - * The MIT License - * - * Copyright (c) 2010 Perry Hung. - * Copyright (c) 2011, 2012 LeafLabs, LLC. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * 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, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - *****************************************************************************/ - -/** - * @file wirish/syscalls.c - * @brief newlib stubs - * - * Low level system routines used by newlib for basic I/O and memory - * allocation. You can override most of these. - */ - -#include - -#include -#include -#include - -/* If CONFIG_HEAP_START (or CONFIG_HEAP_END) isn't defined, then - * assume _lm_heap_start (resp. _lm_heap_end) is appropriately set by - * the linker */ -#ifndef CONFIG_HEAP_START -extern char _lm_heap_start; -#define CONFIG_HEAP_START ((void *)&_lm_heap_start) -#endif -#ifndef CONFIG_HEAP_END -extern char _lm_heap_end; -#define CONFIG_HEAP_END ((void *)&_lm_heap_end) -#endif - -/* - * _sbrk -- Increment the program break. - * - * Get incr bytes more RAM (for use by the heap). malloc() and - * friends call this function behind the scenes. - */ -void *_sbrk(int incr) { - static void * pbreak = NULL; /* current program break */ - void * ret; - - if (pbreak == NULL) { - pbreak = CONFIG_HEAP_START; - } - - if ((CONFIG_HEAP_END - pbreak < incr) || - (pbreak - CONFIG_HEAP_START < -incr)) { - errno = ENOMEM; - return (void *)-1; - } - - ret = pbreak; - pbreak += incr; - return ret; -} - -__weak int _open(const char *path, int flags, ...) { - return 1; -} - -__weak int _close(int fd) { - return 0; -} - -__weak int _fstat(int fd, struct stat *st) { - st->st_mode = S_IFCHR; - return 0; -} - -__weak int _isatty(int fd) { - return 1; -} - -__weak int isatty(int fd) { - return 1; -} - -__weak int _lseek(int fd, off_t pos, int whence) { - return -1; -} - -__weak unsigned char getch(void) { - return 0; -} - - -__weak int _read(int fd, char *buf, size_t cnt) { - *buf = getch(); - - return 1; -} - -__weak void putch(unsigned char c) { -} - -__weak void cgets(char *s, int bufsize) { - char *p; - int c; - int i; - - for (i = 0; i < bufsize; i++) { - *(s+i) = 0; - } -// memset(s, 0, bufsize); - - p = s; - - for (p = s; p < s + bufsize-1;) { - c = getch(); - switch (c) { - case '\r' : - case '\n' : - putch('\r'); - putch('\n'); - *p = '\n'; - return; - - case '\b' : - if (p > s) { - *p-- = 0; - putch('\b'); - putch(' '); - putch('\b'); - } - break; - - default : - putch(c); - *p++ = c; - break; - } - } - return; -} - -__weak int _write(int fd, const char *buf, size_t cnt) { - int i; - - for (i = 0; i < cnt; i++) - putch(buf[i]); - - return cnt; -} - -/* Override fgets() in newlib with a version that does line editing */ -__weak char *fgets(char *s, int bufsize, void *f) { - cgets(s, bufsize); - return s; -} - -__weak void _exit(int exitcode) { - while (1) - ; -} +/****************************************************************************** + * The MIT License + * + * Copyright (c) 2010 Perry Hung. + * Copyright (c) 2011, 2012 LeafLabs, LLC. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * 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, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + *****************************************************************************/ + +/** + * @file wirish/syscalls.c + * @brief newlib stubs + * + * Low level system routines used by newlib for basic I/O and memory + * allocation. You can override most of these. + */ + +#include + +#include +#include +#include + +/* If CONFIG_HEAP_START (or CONFIG_HEAP_END) isn't defined, then + * assume _lm_heap_start (resp. _lm_heap_end) is appropriately set by + * the linker */ +#ifndef CONFIG_HEAP_START +extern char _lm_heap_start; +#define CONFIG_HEAP_START ((void *)&_lm_heap_start) +#endif +#ifndef CONFIG_HEAP_END +extern char _lm_heap_end; +#define CONFIG_HEAP_END ((void *)&_lm_heap_end) +#endif + +/* + * _sbrk -- Increment the program break. + * + * Get incr bytes more RAM (for use by the heap). malloc() and + * friends call this function behind the scenes. + */ +void *_sbrk(int incr) { + static void * pbreak = NULL; /* current program break */ + void * ret; + + if (pbreak == NULL) { + pbreak = CONFIG_HEAP_START; + } + + if ((CONFIG_HEAP_END - pbreak < incr) || + (pbreak - CONFIG_HEAP_START < -incr)) { + errno = ENOMEM; + return (void *)-1; + } + + ret = pbreak; + pbreak += incr; + return ret; +} + +__weak int _open(const char *path, int flags, ...) { + return 1; +} + +__weak int _close(int fd) { + return 0; +} + +__weak int _fstat(int fd, struct stat *st) { + st->st_mode = S_IFCHR; + return 0; +} + +__weak int _isatty(int fd) { + return 1; +} + +__weak int isatty(int fd) { + return 1; +} + +__weak int _lseek(int fd, off_t pos, int whence) { + return -1; +} + +__weak unsigned char getch(void) { + return 0; +} + + +__weak int _read(int fd, char *buf, size_t cnt) { + *buf = getch(); + + return 1; +} + +__weak void putch(unsigned char c) { +} + +__weak void cgets(char *s, int bufsize) { + char *p; + int c; + int i; + + for (i = 0; i < bufsize; i++) { + *(s+i) = 0; + } +// memset(s, 0, bufsize); + + p = s; + + for (p = s; p < s + bufsize-1;) { + c = getch(); + switch (c) { + case '\r' : + case '\n' : + putch('\r'); + putch('\n'); + *p = '\n'; + return; + + case '\b' : + if (p > s) { + *p-- = 0; + putch('\b'); + putch(' '); + putch('\b'); + } + break; + + default : + putch(c); + *p++ = c; + break; + } + } + return; +} + +__weak int _write(int fd, const char *buf, size_t cnt) { + int i; + + for (i = 0; i < cnt; i++) + putch(buf[i]); + + return cnt; +} + +/* Override fgets() in newlib with a version that does line editing */ +__weak char *fgets(char *s, int bufsize, void *f) { + cgets(s, bufsize); + return s; +} + +__weak void _exit(int exitcode) { + while (1) + ; +}