Skip to content

Commit ba2c2cd

Browse files
Merge pull request #123 from jcw/master
Add generic STM32F103T[8B] variants, created by @jcw
2 parents 784c7be + dbd81d4 commit ba2c2cd

23 files changed

Lines changed: 1464 additions & 0 deletions

STM32F1/boards.txt

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,62 @@ genericSTM32F103R.menu.upload_method.BMPMethod.upload.tool=bmp_upload
272272
genericSTM32F103R.menu.upload_method.BMPMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
273273

274274

275+
###################### Generic STM32F103T ########################################
276+
277+
genericSTM32F103T.name=Generic STM32F103T series
278+
genericSTM32F103T.build.variant=generic_stm32f103t
279+
genericSTM32F103T.build.vect=VECT_TAB_ADDR=0x8000000
280+
genericSTM32F103T.build.core=maple
281+
genericSTM32F103T.build.board=GENERIC_STM32F103T
282+
genericSTM32F103T.upload.use_1200bps_touch=false
283+
genericSTM32F103T.upload.file_type=bin
284+
genericSTM32F103T.upload.auto_reset=true
285+
286+
## STM32F103TB -------------------------
287+
genericSTM32F103T.menu.device_variant.STM32F103TB=STM32F103TB (20k RAM. 128k Flash)
288+
genericSTM32F103T.menu.device_variant.STM32F103TB.build.cpu_flags=-DMCU_STM32F103TB
289+
genericSTM32F103T.menu.device_variant.STM32F103TB.build.ldscript=ld/jtag.ld
290+
genericSTM32F103T.menu.device_variant.STM32F103TB.upload.maximum_size=131072
291+
genericSTM32F103T.menu.device_variant.STM32F103TB.upload.ram.maximum_size=20480
292+
genericSTM32F103T.menu.device_variant.STM32F103TB.upload.flash.maximum_size=131072
293+
294+
295+
## STM32F103T8 -------------------------
296+
genericSTM32F103T.menu.device_variant.STM32F103T8=STM32F103T8 (20k RAM. 64k Flash)
297+
genericSTM32F103T.menu.device_variant.STM32F103T8.build.cpu_flags=-DMCU_STM32F103T8
298+
genericSTM32F103T.menu.device_variant.STM32F103T8.build.ldscript=ld/jtag_c8.ld
299+
genericSTM32F103T.menu.device_variant.STM32F103T8.upload.maximum_size=65536
300+
genericSTM32F103T.menu.device_variant.STM32F103T8.upload.ram.maximum_size=20480
301+
genericSTM32F103T.menu.device_variant.STM32F103T8.upload.flash.maximum_size=65536
302+
303+
#---------------------------- UPLOAD METHODS ---------------------------
304+
305+
genericSTM32F103T.menu.upload_method.DFUUploadMethod=STM32duino bootloader
306+
genericSTM32F103T.menu.upload_method.DFUUploadMethod.upload.protocol=maple_dfu
307+
genericSTM32F103T.menu.upload_method.DFUUploadMethod.upload.tool=maple_upload
308+
genericSTM32F103T.menu.upload_method.DFUUploadMethod.build.upload_flags=-DSERIAL_USB -DGENERIC_BOOTLOADER
309+
genericSTM32F103T.menu.upload_method.DFUUploadMethod.build.vect=VECT_TAB_ADDR=0x8002000
310+
genericSTM32F103T.menu.upload_method.DFUUploadMethod.build.ldscript=ld/bootloader_20.ld
311+
genericSTM32F103T.menu.upload_method.DFUUploadMethod.upload.usbID=1EAF:0003
312+
genericSTM32F103T.menu.upload_method.DFUUploadMethod.upload.altID=2
313+
314+
genericSTM32F103T.menu.upload_method.serialMethod=Serial
315+
genericSTM32F103T.menu.upload_method.serialMethod.upload.protocol=maple_serial
316+
genericSTM32F103T.menu.upload_method.serialMethod.upload.tool=serial_upload
317+
318+
319+
genericSTM32F103T.menu.upload_method.STLinkMethod=STLink
320+
genericSTM32F103T.menu.upload_method.STLinkMethod.upload.protocol=STLink
321+
genericSTM32F103T.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
322+
genericSTM32F103T.menu.upload_method.STLinkMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DSERIAL_USB -DGENERIC_BOOTLOADER
323+
324+
325+
genericSTM32F103T.menu.upload_method.BMPMethod=BMP (Black Magic Probe)
326+
genericSTM32F103T.menu.upload_method.BMPMethod.upload.protocol=gdb_bmp
327+
genericSTM32F103T.menu.upload_method.BMPMethod.upload.tool=bmp_upload
328+
genericSTM32F103T.menu.upload_method.BMPMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
329+
330+
275331
########################### Generic STM32F103V ###########################
276332

277333
genericSTM32F103V.name=Generic STM32F103V series
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
/******************************************************************************
2+
* The MIT License
3+
*
4+
* Copyright (c) 2011 LeafLabs, LLC.
5+
*
6+
* Permission is hereby granted, free of charge, to any person
7+
* obtaining a copy of this software and associated documentation
8+
* files (the "Software"), to deal in the Software without
9+
* restriction, including without limitation the rights to use, copy,
10+
* modify, merge, publish, distribute, sublicense, and/or sell copies
11+
* of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be
15+
* included in all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
* SOFTWARE.
25+
*****************************************************************************/
26+
27+
/**
28+
* &file wirish/boards/maple_mini/board.cpp
29+
* &author Marti Bolivar <mbolivar&leaflabs.com>
30+
* &brief Maple Mini board file.
31+
*/
32+
33+
#include <board/board.h>
34+
35+
#include <libmaple/gpio.h>
36+
#include <libmaple/timer.h>
37+
38+
/* Roger Clark. Added next to includes for changes to Serial */
39+
#include <libmaple/usart.h>
40+
#include <HardwareSerial.h>
41+
42+
#include <wirish_debug.h>
43+
#include <wirish_types.h>
44+
45+
/* Since we want the Serial Wire/JTAG pins as GPIOs, disable both SW
46+
* and JTAG debug support, unless configured otherwise. */
47+
void boardInit(void) {
48+
#ifndef CONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
49+
disableDebugPorts();
50+
#endif
51+
}
52+
53+
// Note. See the enum of pin names in board.h
54+
55+
extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS] = {
56+
57+
58+
{&gpioa, &timer2, &adc1, 0, 1, 0}, /* PA0 */
59+
{&gpioa, &timer2, &adc1, 1, 2, 1}, /* PA1 */
60+
{&gpioa, &timer2, &adc1, 2, 3, 2}, /* PA2 */
61+
{&gpioa, &timer2, &adc1, 3, 4, 3}, /* PA3 */
62+
{&gpioa, NULL, &adc1, 4, 0, 4}, /* PA4 */
63+
{&gpioa, NULL, &adc1, 5, 0, 5}, /* PA5 */
64+
{&gpioa, &timer3, &adc1, 6, 1, 6}, /* PA6 */
65+
{&gpioa, &timer3, &adc1, 7, 2, 7}, /* PA7 */
66+
{&gpioa, &timer1, NULL, 8, 1, ADCx}, /* PA8 */
67+
{&gpioa, &timer1, NULL, 9, 2, ADCx}, /* PA9 */
68+
{&gpioa, &timer1, NULL, 10, 3, ADCx}, /* PA10 */
69+
{&gpioa, &timer1, NULL, 11, 4, ADCx}, /* PA11 */
70+
{&gpioa, NULL, NULL, 12, 0, ADCx}, /* PA12 */
71+
{&gpioa, NULL, NULL, 13, 0, ADCx}, /* PA13 */
72+
{&gpioa, NULL, NULL, 14, 0, ADCx}, /* PA14 */
73+
{&gpioa, NULL, NULL, 15, 0, ADCx}, /* PA15 */
74+
75+
{&gpiob, &timer3, &adc1, 0, 3, 8}, /* PB0 */
76+
{&gpiob, &timer3, &adc1, 1, 4, 9}, /* PB1 */
77+
{&gpiob, NULL, NULL, 2, 0, ADCx}, /* PB2 */
78+
{&gpiob, NULL, NULL, 3, 0, ADCx}, /* PB3 */
79+
{&gpiob, NULL, NULL, 4, 0, ADCx}, /* PB4 */
80+
{&gpiob, NULL, NULL, 5, 0, ADCx}, /* PB5 */
81+
{&gpiob, &timer4, NULL, 6, 1, ADCx}, /* PB6 */
82+
{&gpiob, &timer4, NULL, 7, 2, ADCx}, /* PB7 */
83+
};
84+
85+
extern const uint8 boardPWMPins[BOARD_NR_PWM_PINS] __FLASH__ = {
86+
PB0, PA7, PA6, PA3, PA2, PA1, PA0, PB7, PB6, PA10, PA9, PA8
87+
};
88+
89+
extern const uint8 boardADCPins[BOARD_NR_ADC_PINS] __FLASH__ = {
90+
PB0, PA7, PA6 , PA5 , PA4 , PA3 , PA2 , PA1 , PA0
91+
};
92+
93+
// Note. These defines are not really used by generic boards. They are for Maple Serial USB
94+
#define USB_DP PA12
95+
#define USB_DM PA11
96+
97+
// NOte. These definitions are not really used for generic boards, they only relate to boards modified to behave like Maple boards
98+
extern const uint8 boardUsedPins[BOARD_NR_USED_PINS] __FLASH__ = {
99+
USB_DP, USB_DM
100+
};
101+
102+
103+
/*
104+
* Roger Clark
105+
*
106+
* 2015/05/28
107+
*
108+
* Moved definitions for Hardware Serial devices from HardwareSerial.cpp so that each board can define which Arduino "Serial" instance
109+
* Maps to which hardware serial port on the microprocessor
110+
*/
111+
112+
#ifdef SERIAL_USB
113+
DEFINE_HWSERIAL(Serial1, 1);
114+
115+
DEFINE_HWSERIAL(Serial2, 2);
116+
#else
117+
DEFINE_HWSERIAL(Serial, 1);
118+
119+
DEFINE_HWSERIAL(Serial1, 2);
120+
#endif
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/******************************************************************************
2+
* The MIT License
3+
*
4+
* Copyright (c) 2011 LeafLabs, LLC.
5+
*
6+
* Permission is hereby granted, free of charge, to any person
7+
* obtaining a copy of this software and associated documentation
8+
* files (the "Software"), to deal in the Software without
9+
* restriction, including without limitation the rights to use, copy,
10+
* modify, merge, publish, distribute, sublicense, and/or sell copies
11+
* of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be
15+
* included in all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
* SOFTWARE.
25+
*****************************************************************************/
26+
27+
/**
28+
* @file wirish/boards/maple_mini/include/board/board.h
29+
* @author Marti Bolivar <mbolivar@leaflabs.com>
30+
* @brief Maple Mini board header.
31+
*
32+
* See wirish/boards/maple/include/board/board.h for more information
33+
* on these definitions.
34+
*/
35+
36+
#ifndef _BOARD_GENERIC_STM32F103T_H_
37+
#define _BOARD_GENERIC_STM32F103T_H_
38+
39+
#define CYCLES_PER_MICROSECOND 72
40+
#define SYSTICK_RELOAD_VAL (F_CPU/1000) - 1 /* takes a cycle to reload */
41+
42+
#define BOARD_NR_USARTS 2
43+
#define BOARD_USART1_TX_PIN PA9
44+
#define BOARD_USART1_RX_PIN PA10
45+
#define BOARD_USART2_TX_PIN PA2
46+
#define BOARD_USART2_RX_PIN PA3
47+
48+
#define BOARD_NR_SPI 1
49+
#define BOARD_SPI1_NSS_PIN PA4
50+
#define BOARD_SPI1_MOSI_PIN PA7
51+
#define BOARD_SPI1_MISO_PIN PA6
52+
#define BOARD_SPI1_SCK_PIN PA5
53+
54+
#define BOARD_NR_GPIO_PINS 24
55+
#define BOARD_NR_PWM_PINS 12
56+
#define BOARD_NR_ADC_PINS 9
57+
#define BOARD_NR_USED_PINS 4
58+
59+
60+
#define BOARD_JTMS_SWDIO_PIN 22
61+
#define BOARD_JTCK_SWCLK_PIN 21
62+
#define BOARD_JTDI_PIN 20
63+
#define BOARD_JTDO_PIN 19
64+
#define BOARD_NJTRST_PIN 18
65+
66+
#define BOARD_USB_DISC_DEV GPIOA
67+
#define BOARD_USB_DISC_BIT 0
68+
69+
// Note this needs to match with the PIN_MAP array in board.cpp
70+
enum {
71+
PA0, PA1, PA2, PA3, PA4, PA5, PA6, PA7, PA8, PA9, PA10, PA11, PA12, PA13,PA14,PA15,
72+
PB0, PB1, PB2, PB3, PB4, PB5, PB6, PB7
73+
};
74+
75+
#endif
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* libmaple linker script for "Flash" builds.
3+
*
4+
* A Flash build puts .text (and .rodata) in Flash, and
5+
* .data/.bss/heap (of course) in SRAM, but offsets the sections by
6+
* enough space to store the Maple bootloader, which lives in low
7+
* Flash and uses low memory.
8+
*/
9+
10+
/*
11+
* This pulls in the appropriate MEMORY declaration from the right
12+
* subdirectory of stm32/mem/ (the environment must call ld with the
13+
* right include directory flags to make this happen). Boards can also
14+
* use this file to use any of libmaple's memory-related hooks (like
15+
* where the heap should live).
16+
*/
17+
MEMORY
18+
{
19+
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
20+
rom (rx) : ORIGIN = 0x08002000, LENGTH = 120K
21+
}
22+
23+
/* Provide memory region aliases for common.inc */
24+
REGION_ALIAS("REGION_TEXT", rom);
25+
REGION_ALIAS("REGION_DATA", ram);
26+
REGION_ALIAS("REGION_BSS", ram);
27+
REGION_ALIAS("REGION_RODATA", rom);
28+
29+
/* Let common.inc handle the real work. */
30+
INCLUDE common.inc

0 commit comments

Comments
 (0)