Skip to content

Commit 2040e7a

Browse files
authored
Merge pull request #32 from jeanthom/master
Add support for Olimex STM32-H103 courtesy of @jeanthom.
2 parents 013a47d + 2189eca commit 2040e7a

4 files changed

Lines changed: 137 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ To build other targets, you can override the
1919
|`BLUEPILL` | Cheap dev board | https://stm32duinoforum.com/forum/wiki_subdomain/index_title_Blue_Pill.html |
2020
|`MAPLEMINI` | LeafLabs Maple Mini board and clone derivatives | https://stm32duinoforum.com/forum/wiki_subdomain/index_title_Maple_Mini.html |
2121
|`STLINK` | STLink/v2 hardware clones | https://wiki.paparazziuav.org/wiki/STLink#Clones |
22+
|`OLIMEXSTM32H103` | Olimex STM32-H103 | https://www.olimex.com/Products/ARM/ST/STM32-H103/ |
2223

2324
For each of the above targets, there are three variants that can be added to the target name:
2425

release.Makefile

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@ BUILD_DIR ?= ./build
3232
all: dapboot-bluepill.bin \
3333
dapboot-maplemini.bin \
3434
dapboot-stlink.bin \
35+
dapboot-olimexstm32h103.bin \
3536
dapboot-bluepill-high.bin \
3637
dapboot-maplemini-high.bin \
3738
dapboot-stlink-high.bin \
39+
dapboot-olimexstm32h103-high.bin \
3840
dapboot-bluepill-high-128.bin \
3941
dapboot-maplemini-high-128.bin \
40-
dapboot-stlink-high-128.bin
42+
dapboot-stlink-high-128.bin \
43+
dapboot-olimexstm32h103-high-128.bin
4144

4245
clean:
4346
$(Q)$(RM) $(BUILD_DIR)/*.bin
@@ -66,6 +69,12 @@ dapboot-maplemini.bin: | $(BUILD_DIR)
6669
$(Q)$(MAKE) TARGET=MAPLEMINI -C src/
6770
$(Q)cp src/dapboot.bin $(BUILD_DIR)/$(@)
6871

72+
dapboot-olimexstm32h103.bin: | $(BUILD_DIR)
73+
@printf " BUILD $(@)\n"
74+
$(Q)$(MAKE) TARGET=OLIMEXSTM32H103 -C src/ clean
75+
$(Q)$(MAKE) TARGET=OLIMEXSTM32H103 -C src/
76+
$(Q)cp src/dapboot.bin $(BUILD_DIR)/$(@)
77+
6978
dapboot-bluepill-high.bin: | $(BUILD_DIR)
7079
@printf " BUILD $(@)\n"
7180
$(Q)$(MAKE) TARGET=BLUEPILL_HIGH -C src/ clean
@@ -84,6 +93,12 @@ dapboot-maplemini-high.bin: | $(BUILD_DIR)
8493
$(Q)$(MAKE) TARGET=MAPLEMINI_HIGH -C src/
8594
$(Q)cp src/dapboot.bin $(BUILD_DIR)/$(@)
8695

96+
dapboot-olimexstm32h103-high.bin: | $(BUILD_DIR)
97+
@printf " BUILD $(@)\n"
98+
$(Q)$(MAKE) TARGET=OLIMEXSTM32H103_HIGH -C src/ clean
99+
$(Q)$(MAKE) TARGET=OLIMEXSTM32H103_HIGH -C src/
100+
$(Q)cp src/dapboot.bin $(BUILD_DIR)/$(@)
101+
87102
dapboot-bluepill-high-128.bin: | $(BUILD_DIR)
88103
@printf " BUILD $(@)\n"
89104
$(Q)$(MAKE) TARGET=BLUEPILL_HIGH_128 -C src/ clean
@@ -101,3 +116,9 @@ dapboot-maplemini-high-128.bin: | $(BUILD_DIR)
101116
$(Q)$(MAKE) TARGET=MAPLEMINI_HIGH_128 -C src/ clean
102117
$(Q)$(MAKE) TARGET=MAPLEMINI_HIGH_128 -C src/
103118
$(Q)cp src/dapboot.bin $(BUILD_DIR)/$(@)
119+
120+
dapboot-olimexstm32h103-high-128.bin: | $(BUILD_DIR)
121+
@printf " BUILD $(@)\n"
122+
$(Q)$(MAKE) TARGET=OLIMEXSTM32H103_HIGH_128 -C src/ clean
123+
$(Q)$(MAKE) TARGET=OLIMEXSTM32H103_HIGH_128 -C src/
124+
$(Q)cp src/dapboot.bin $(BUILD_DIR)/$(@)
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*
2+
* Copyright (c) 2021, Jean THOMAS
3+
*
4+
* Permission to use, copy, modify, and/or distribute this software
5+
* for any purpose with or without fee is hereby granted, provided
6+
* that the above copyright notice and this permission notice
7+
* appear in all copies.
8+
*
9+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10+
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11+
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12+
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
13+
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14+
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
15+
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16+
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17+
*/
18+
19+
#ifndef CONFIG_H_INCLUDED
20+
#define CONFIG_H_INCLUDED
21+
22+
#ifndef APP_BASE_ADDRESS
23+
#define APP_BASE_ADDRESS (0x08000000 + BOOTLOADER_OFFSET)
24+
#endif
25+
#ifndef FLASH_PAGE_SIZE
26+
#define FLASH_PAGE_SIZE 1024
27+
#endif
28+
#ifndef DFU_UPLOAD_AVAILABLE
29+
#define DFU_UPLOAD_AVAILABLE 1
30+
#endif
31+
#ifndef DFU_DOWNLOAD_AVAILABLE
32+
#define DFU_DOWNLOAD_AVAILABLE 1
33+
#endif
34+
35+
#ifndef HAVE_LED
36+
#define HAVE_LED 1
37+
#endif
38+
#ifndef LED_GPIO_PORT
39+
#define LED_GPIO_PORT GPIOC
40+
#endif
41+
#ifndef LED_GPIO_PIN
42+
#define LED_GPIO_PIN GPIO12
43+
#endif
44+
#ifndef LED_OPEN_DRAIN
45+
#define LED_OPEN_DRAIN 1
46+
#endif
47+
48+
/* "BUT" button on on PA0, pulled high by R18 */
49+
#ifndef HAVE_BUTTON
50+
#define HAVE_BUTTON 1
51+
#endif
52+
#ifndef BUTTON_ACTIVE_HIGH
53+
#define BUTTON_ACTIVE_HIGH 0
54+
#endif
55+
#ifndef BUTTON_GPIO_PORT
56+
#define BUTTON_GPIO_PORT GPIOA
57+
#endif
58+
#ifndef BUTTON_GPIO_PIN
59+
#define BUTTON_GPIO_PIN GPIO0
60+
#endif
61+
#ifndef BUTTON_USES_PULL
62+
#define BUTTON_USES_PULL 0
63+
#endif
64+
#ifndef BUTTON_SAMPLE_DELAY_CYCLES
65+
#define BUTTON_SAMPLE_DELAY_CYCLES 1440000
66+
#endif
67+
68+
#ifndef HAVE_USB_PULLUP_CONTROL
69+
#define HAVE_USB_PULLUP_CONTROL 1
70+
#endif
71+
#ifndef USB_PULLUP_GPIO_PORT
72+
#define USB_PULLUP_GPIO_PORT GPIOC
73+
#endif
74+
#ifndef USB_PULLUP_GPIO_PIN
75+
#define USB_PULLUP_GPIO_PIN GPIO11
76+
#endif
77+
#ifndef USB_PULLUP_ACTIVE_HIGH
78+
#define USB_PULLUP_ACTIVE_HIGH 0
79+
#endif
80+
#ifndef USB_PULLUP_OPEN_DRAIN
81+
#define USB_PULLUP_OPEN_DRAIN 1
82+
#endif
83+
84+
#ifndef USES_GPIOA
85+
#define USES_GPIOA 1
86+
#endif
87+
#ifndef USES_GPIOB
88+
#define USES_GPIOB 0
89+
#endif
90+
#ifndef USES_GPIOC
91+
#define USES_GPIOC 1
92+
#endif
93+
94+
#endif

src/targets.mk

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,26 @@ ifeq ($(TARGET),STLINK_HIGH_128)
8080
ARCH = STM32F1
8181
DEFS += -DBOOTLOADER_HIGH
8282
endif
83+
ifeq ($(TARGET),OLIMEXSTM32H103)
84+
TARGET_COMMON_DIR := ./stm32f103
85+
TARGET_SPEC_DIR := ./stm32f103/olimexstm32h103
86+
LDSCRIPT := ./stm32f103/stm32f103x8.ld
87+
ARCH = STM32F1
88+
endif
89+
ifeq ($(TARGET),OLIMEXSTM32H103_HIGH)
90+
TARGET_COMMON_DIR := ./stm32f103
91+
TARGET_SPEC_DIR := ./stm32f103/olimexstm32h103
92+
LDSCRIPT := ./stm32f103/stm32f103x8_high.ld
93+
ARCH = STM32F1
94+
DEFS += -DBOOTLOADER_HIGH
95+
endif
96+
ifeq ($(TARGET),OLIMEXSTM32H103_HIGH_128)
97+
TARGET_COMMON_DIR := ./stm32f103
98+
TARGET_SPEC_DIR := ./stm32f103/olimexstm32h103
99+
LDSCRIPT := ./stm32f103/stm32f103xb_high.ld
100+
ARCH = STM32F1
101+
DEFS += -DBOOTLOADER_HIGH
102+
endif
83103
ifeq ($(TARGET),STM32L1_GENERIC)
84104
TARGET_COMMON_DIR := ./stm32l1
85105
TARGET_SPEC_DIR := ./stm32l1/generic

0 commit comments

Comments
 (0)