diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2015-07-13 16:45:32 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2015-07-13 16:45:32 +0900 |
commit | 3ba8234cecde90467fb75d72055fa0c226ed16df (patch) | |
tree | f6c184a72d8759a59b3b4db109fe1bfaab6d8032 | |
parent | 2bb0e0de5d7d25d0bb036e6ee9cc0c94b62375ec (diff) |
sys_board and stm32 primer2
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | board/board-cq-starm.h | 3 | ||||
-rw-r--r-- | board/board-fst-01-00.h | 3 | ||||
-rw-r--r-- | board/board-fst-01.h | 3 | ||||
-rw-r--r-- | board/board-maple-mini.h | 3 | ||||
-rw-r--r-- | board/board-olimex-stm32-h103.h | 3 | ||||
-rw-r--r-- | board/board-stbee-mini.h | 3 | ||||
-rw-r--r-- | board/board-stbee.h | 2 | ||||
-rw-r--r-- | board/board-stm32-primer2.h | 13 | ||||
-rw-r--r-- | board/board-stm8s-discovery.h | 3 | ||||
-rw-r--r-- | entry.c | 14 | ||||
-rw-r--r-- | example-cdc/sample.ld | 12 | ||||
-rw-r--r-- | example-cdc/sys.c | 5 | ||||
-rw-r--r-- | example-fsm-55/hacker-emblem.ld | 5 | ||||
-rw-r--r-- | example-fsm-55/sys.c | 4 | ||||
-rw-r--r-- | example-led/sample.ld | 5 | ||||
-rw-r--r-- | example-led/sys.c | 8 |
17 files changed, 82 insertions, 21 deletions
@@ -1,3 +1,17 @@ +2015-07-13 Kaz Kojima <kkojima@rr.iij4u.or.jp> + + * board/board-stm32-primer2.h: Update. + * entry.c (vector_table): Less or more. + +2015-07-13 Niibe Yutaka <gniibe@fsij.org> + + * board/board-*.h (BOARD_NAME): New. + (STM32F10X_MD): Define for medium-density devices. + * example-led/sys.c, sample.ld: Update. + * example-fsm-55/sys.c, hacker-emblem.ld: Update. + * example-cdc/sys.c (sys_board): New. + * example-cdc/sample.ld: Update. + 2015-07-08 Niibe Yutaka <gniibe@fsij.org> * VERSION: 0.06. diff --git a/board/board-cq-starm.h b/board/board-cq-starm.h index 980791f..54c53ff 100644 --- a/board/board-cq-starm.h +++ b/board/board-cq-starm.h @@ -1,4 +1,7 @@ +#define BOARD_NAME "CQ STARM" + #define FLASH_PAGE_SIZE 1024 +#define STM32F10X_MD /* Medium-density device */ #define STM32_PLLXTPRE STM32_PLLXTPRE_DIV1 #define STM32_PLLMUL_VALUE 9 diff --git a/board/board-fst-01-00.h b/board/board-fst-01-00.h index 5af9f56..30a9311 100644 --- a/board/board-fst-01-00.h +++ b/board/board-fst-01-00.h @@ -1,4 +1,7 @@ +#define BOARD_NAME "FST-01-00" + #define FLASH_PAGE_SIZE 1024 +#define STM32F10X_MD /* Medium-density device */ #define STM32_PLLXTPRE STM32_PLLXTPRE_DIV1 #define STM32_PLLMUL_VALUE 9 diff --git a/board/board-fst-01.h b/board/board-fst-01.h index efd4761..aecb9db 100644 --- a/board/board-fst-01.h +++ b/board/board-fst-01.h @@ -1,4 +1,7 @@ +#define BOARD_NAME "FST-01" + #define FLASH_PAGE_SIZE 1024 +#define STM32F10X_MD /* Medium-density device */ #define STM32_PLLXTPRE STM32_PLLXTPRE_DIV1 #define STM32_PLLMUL_VALUE 6 diff --git a/board/board-maple-mini.h b/board/board-maple-mini.h index 5e17118..5e19dee 100644 --- a/board/board-maple-mini.h +++ b/board/board-maple-mini.h @@ -1,4 +1,7 @@ +#define BOARD_NAME "Maple Mini" + #define FLASH_PAGE_SIZE 1024 +#define STM32F10X_MD /* Medium-density device */ #define STM32_PLLXTPRE STM32_PLLXTPRE_DIV1 #define STM32_PLLMUL_VALUE 9 diff --git a/board/board-olimex-stm32-h103.h b/board/board-olimex-stm32-h103.h index 4ad6bfc..26c3dd3 100644 --- a/board/board-olimex-stm32-h103.h +++ b/board/board-olimex-stm32-h103.h @@ -1,4 +1,7 @@ +#define BOARD_NAME "Olimex STM32-H103" + #define FLASH_PAGE_SIZE 1024 +#define STM32F10X_MD /* Medium-density device */ #define STM32_PLLXTPRE STM32_PLLXTPRE_DIV1 #define STM32_PLLMUL_VALUE 9 diff --git a/board/board-stbee-mini.h b/board/board-stbee-mini.h index 29afd6a..51aee57 100644 --- a/board/board-stbee-mini.h +++ b/board/board-stbee-mini.h @@ -1,4 +1,7 @@ +#define BOARD_NAME "STBee Mini" + #define FLASH_PAGE_SIZE 1024 +#define STM32F10X_MD /* Medium-density device */ #define STM32_PLLXTPRE STM32_PLLXTPRE_DIV1 #define STM32_PLLMUL_VALUE 6 diff --git a/board/board-stbee.h b/board/board-stbee.h index 8104b5c..c7835a0 100644 --- a/board/board-stbee.h +++ b/board/board-stbee.h @@ -1,3 +1,5 @@ +#define BOARD_NAME "STBee" + #define FLASH_PAGE_SIZE 2048 #define STM32_PLLXTPRE STM32_PLLXTPRE_DIV1 diff --git a/board/board-stm32-primer2.h b/board/board-stm32-primer2.h index 9f6cc67..2d56f90 100644 --- a/board/board-stm32-primer2.h +++ b/board/board-stm32-primer2.h @@ -1,3 +1,5 @@ +#define BOARD_NAME "STM32 Primer2" + #define FLASH_PAGE_SIZE 2048 #define STM32_PLLXTPRE STM32_PLLXTPRE_DIV1 @@ -5,7 +7,7 @@ #define STM32_HSECLK 12000000 #define GPIO_LED_BASE GPIOE_BASE -#define GPIO_LED_CLEAR_TO_EMIT 0 +#define GPIO_LED_SET_TO_EMIT 0 #define GPIO_USB_BASE GPIOD_BASE #define GPIO_USB_CLEAR_TO_ENABLE 3 #define GPIO_OTHER_BASE GPIOA_BASE @@ -14,12 +16,13 @@ * Port A setup. * PA0 - input with pull-up. AN0 * PA1 - input with pull-up. AN1 + * PA8 - Input with pull-down (PBUTTON). * PA11 - Push Pull output 10MHz 0 default (until USB enabled) (USBDM) * PA12 - Push Pull output 10MHz 0 default (until USB enabled) (USBDP) * ------------------------ Default * PAx - input with pull-up */ -#define VAL_GPIO_OTHER_ODR 0xFFFFE7FF +#define VAL_GPIO_OTHER_ODR 0xFFFFE6FF #define VAL_GPIO_OTHER_CRL 0x88888888 /* PA7...PA0 */ #define VAL_GPIO_OTHER_CRH 0x88811888 /* PA15...PA8 */ @@ -37,10 +40,14 @@ * Port E setup. * PE0 - Push pull output (LED 1:ON 0:OFF) * PE1 - Push pull output (LED 1:ON 0:OFF) + * PE3 - Input with pull-down (JOYSTICK L). + * PE4 - Input with pull-down (JOYSTICK R). + * PE5 - Input with pull-down (JOYSTICK U). + * PE6 - Input with pull-down (JOYSTICK D). * ------------------------ Default * PEx - input with pull-up */ -#define VAL_GPIO_LED_ODR 0xFFFFFFFF +#define VAL_GPIO_LED_ODR 0xFFFFFF87 #define VAL_GPIO_LED_CRL 0x88888833 /* PE7...PE0 */ #define VAL_GPIO_LED_CRH 0x88888888 /* PE15...PE8 */ diff --git a/board/board-stm8s-discovery.h b/board/board-stm8s-discovery.h index 79d1889..08942ef 100644 --- a/board/board-stm8s-discovery.h +++ b/board/board-stm8s-discovery.h @@ -1,4 +1,7 @@ +#define BOARD_NAME "STM8S Discovery" + #define FLASH_PAGE_SIZE 1024 +#define STM32F10X_MD /* Medium-density device */ #define STM32_PLLXTPRE STM32_PLLXTPRE_DIV1 #define STM32_PLLMUL_VALUE 9 @@ -196,8 +196,20 @@ handler vector_table[] __attribute__ ((section(".startup.vectors"))) = { /* ... and more. CAN, EXT9_5, TIMx, I2C, SPI, USART, EXT15_10 */ chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, - chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, + chx_handle_intr, chx_handle_intr, +#if !defined(__ARM_ARCH_6M__) + /* STM32F0 doesn't have more. */ + chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, +#endif +#if !defined(STM32F10X_MD) + /* High-density chips have more; RTCAlarm, USBWakeup, ... , DMA2_Channel4_5 */ + chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, + chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, + chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, + chx_handle_intr, chx_handle_intr, chx_handle_intr, chx_handle_intr, + chx_handle_intr, chx_handle_intr, chx_handle_intr, +#endif }; diff --git a/example-cdc/sample.ld b/example-cdc/sample.ld index 7675dbb..55ad7aa 100644 --- a/example-cdc/sample.ld +++ b/example-cdc/sample.ld @@ -25,15 +25,16 @@ SECTIONS { . = 0; - .sys : ALIGN(16) SUBALIGN(16) + .sys : ALIGN(16) SUBALIGN(8) { - _sys = .; - KEEP(*(.vectors)) + _sys = .; + KEEP(*(.vectors)) . = ALIGN(16); - *(.sys.version) + KEEP(*(.sys.version)) + KEEP(*(.sys.board)) build/sys.o(.text) build/sys.o(.text.*) - build/sys.o(.rodata) + build/sys.o(.rodata) build/sys.o(.rodata.*) . = ALIGN(1024); *(.sys.0) @@ -59,6 +60,7 @@ SECTIONS *(.glue_7t) *(.glue_7) *(.gcc*) + . = ALIGN(8); } > flash .ARM.extab : {*(.ARM.extab* .gnu.linkonce.armextab.*)} > flash diff --git a/example-cdc/sys.c b/example-cdc/sys.c index 0f0c1ac..19c31b1 100644 --- a/example-cdc/sys.c +++ b/example-cdc/sys.c @@ -415,7 +415,10 @@ handler vector[] __attribute__ ((section(".vectors"))) = { const uint8_t sys_version[8] __attribute__((section(".sys.version"))) = { 3*2+2, /* bLength */ - 0x03, /* bDescriptorType = USB_STRING_DESCRIPTOR_TYPE*/ + 0x03, /* bDescriptorType = USB_STRING_DESCRIPTOR_TYPE */ /* sys version: "2.0" */ '2', 0, '.', 0, '0', 0, }; + +const uint8_t __attribute__((section(".sys.board"))) +sys_board[] = BOARD_NAME; diff --git a/example-fsm-55/hacker-emblem.ld b/example-fsm-55/hacker-emblem.ld index bce4e00..7974b10 100644 --- a/example-fsm-55/hacker-emblem.ld +++ b/example-fsm-55/hacker-emblem.ld @@ -29,12 +29,13 @@ SECTIONS { . = 0; - .sys : ALIGN(16) SUBALIGN(16) + .sys : ALIGN(16) SUBALIGN(8) { _sys = .; KEEP(*(.vectors)) . = ALIGN(16); - *(.sys.version) + KEEP(*(.sys.version)) + KEEP(*(.sys.board)) build/sys.o(.text) build/sys.o(.text.*) build/sys.o(.rodata) diff --git a/example-fsm-55/sys.c b/example-fsm-55/sys.c index cd367d8..06af0c6 100644 --- a/example-fsm-55/sys.c +++ b/example-fsm-55/sys.c @@ -364,10 +364,10 @@ static void __attribute__ ((naked)) reset (void) { /* - * This code may not be at start of flash ROM, because of DFU. + * This code may not be at the start of flash ROM, because of DFU. * So, we take the address from PC. */ -#if __ARM_ARCH_6M__ +#if defined(__ARM_ARCH_6M__) asm volatile ("cpsid i\n\t" /* Mask all interrupts. */ "ldr r0, 1f\n\t" /* r0 = RAM start */ "mov r1, pc\n\t" /* r1 = (PC + 0x0400) & ~0x03ff */ diff --git a/example-led/sample.ld b/example-led/sample.ld index 07761e0..6934b9f 100644 --- a/example-led/sample.ld +++ b/example-led/sample.ld @@ -29,12 +29,13 @@ SECTIONS { . = 0; - .sys : ALIGN(16) SUBALIGN(16) + .sys : ALIGN(16) SUBALIGN(8) { _sys = .; KEEP(*(.vectors)) . = ALIGN(16); - *(.sys.version) + KEEP(*(.sys.version)) + KEEP(*(.sys.board)) build/sys.o(.text) build/sys.o(.text.*) build/sys.o(.rodata) diff --git a/example-led/sys.c b/example-led/sys.c index f8bfa58..06af0c6 100644 --- a/example-led/sys.c +++ b/example-led/sys.c @@ -363,8 +363,6 @@ nvic_system_reset (void) static void __attribute__ ((naked)) reset (void) { - extern const unsigned long *FT0, *FT1, *FT2; - /* * This code may not be at the start of flash ROM, because of DFU. * So, we take the address from PC. @@ -391,6 +389,7 @@ reset (void) "1: .word 0x20000000" : /* no output */ : /* no input */ : "memory"); #else + extern const unsigned long *FT0, *FT1, *FT2; asm volatile ("cpsid i\n\t" /* Mask all interrupts. */ "ldr r0, 1f\n\t" /* r0 = SCR */ "mov r1, pc\n\t" /* r1 = (PC + 0x1000) & ~0x0fff */ @@ -406,12 +405,11 @@ reset (void) ".align 2\n" "1: .word 0xe000ed00" : /* no output */ : /* no input */ : "memory"); -#endif - - /* Never reach here. */ /* Artificial entry to refer FT0, FT1, and FT2. */ asm volatile ("" : : "r" (FT0), "r" (FT1), "r" (FT2)); +#endif + /* Never reach here. */ } typedef void (*handler)(void); |