From 58858dacba8aed6721cd2e6ba6cafca494f2942e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 19 Nov 2016 18:35:50 +0200 Subject: [PATCH] Add support for Maple Mini Original and Maple Mini Bootloader 2.0 // Resolve #22 --- boards/maple.json | 17 +++++++---------- boards/maple_mini_b20.json | 26 ++++++++++++++++++++++++++ boards/maple_mini_origin.json | 26 ++++++++++++++++++++++++++ builder/frameworks/arduino.py | 13 ++++++------- 4 files changed, 65 insertions(+), 17 deletions(-) create mode 100644 boards/maple_mini_b20.json create mode 100644 boards/maple_mini_origin.json diff --git a/boards/maple.json b/boards/maple.json index 33212c5..24f82a8 100644 --- a/boards/maple.json +++ b/boards/maple.json @@ -9,21 +9,18 @@ ["0x1EAF", "0x0004"] ], "ldscript": "flash.ld", - "mcu": "stm32f103rb_maple", + "mcu": "stm32f103rb", "variant": "maple" }, "frameworks": ["arduino"], - "name": "Olimexino STM32 (Maple)", + "name": "Maple", "upload": { - "disable_flushing": false, - "maximum_ram_size": 17000, - "maximum_size": 108000, + "maximum_ram_size": 17408, + "maximum_size": 110592, "protocol": "dfu", "boot_version": 1, - "require_upload_port": true, - "use_1200bps_touch": false, - "wait_for_upload_port": false + "require_upload_port": true }, - "url": "https://www.olimex.com/Products/Duino/STM32/OLIMEXINO-STM32/", - "vendor": "Olimex" + "url": "http://www.leaflabs.com/maple/", + "vendor": "LeafLabs" } diff --git a/boards/maple_mini_b20.json b/boards/maple_mini_b20.json new file mode 100644 index 0000000..630326e --- /dev/null +++ b/boards/maple_mini_b20.json @@ -0,0 +1,26 @@ +{ + "build": { + "core": "maple", + "cpu": "cortex-m3", + "extra_flags": "-DARDUINO_MAPLE_MINI -DMCU_STM32F103CB", + "f_cpu": "72000000L", + "hwids": [ + ["0x1EAF", "0x0003"], + ["0x1EAF", "0x0004"] + ], + "ldscript": "flash.ld", + "mcu": "stm32f103cb", + "variant": "maple_mini" + }, + "frameworks": ["arduino"], + "name": "Maple Mini Bootloader 2.0", + "upload": { + "maximum_ram_size": 20480, + "maximum_size": 122880, + "protocol": "dfu", + "boot_version": 2, + "require_upload_port": true + }, + "url": "http://www.leaflabs.com/maple/", + "vendor": "LeafLabs" +} diff --git a/boards/maple_mini_origin.json b/boards/maple_mini_origin.json new file mode 100644 index 0000000..c2e59b1 --- /dev/null +++ b/boards/maple_mini_origin.json @@ -0,0 +1,26 @@ +{ + "build": { + "core": "maple", + "cpu": "cortex-m3", + "extra_flags": "-DARDUINO_MAPLE_MINI -DMCU_STM32F103CB", + "f_cpu": "72000000L", + "hwids": [ + ["0x1EAF", "0x0003"], + ["0x1EAF", "0x0004"] + ], + "ldscript": "flash.ld", + "mcu": "stm32f103cb", + "variant": "maple_mini" + }, + "frameworks": ["arduino"], + "name": "Maple Mini Original", + "upload": { + "maximum_ram_size": 17408, + "maximum_size": 110592, + "protocol": "dfu", + "boot_version": 1, + "require_upload_port": true + }, + "url": "http://www.leaflabs.com/maple/", + "vendor": "LeafLabs" +} diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index 8fad636..39800fc 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -77,19 +77,18 @@ for item in ("-nostartfiles", "-nostdlib"): if item in env['LINKFLAGS']: env['LINKFLAGS'].remove(item) -ld = board.get("build.ldscript") if env.subst("$UPLOAD_PROTOCOL") == "dfu": - if "stm32f103c" in board.get("build.mcu", ""): - ld = "bootloader_20.ld" - elif "stm32f103r" in board.get("build.mcu", ""): - ld = "bootloader.ld" - if "stm32f103rb_maple" in board.get("build.mcu", ""): + if board.id in ("maple", "maple_mini_origin"): env.Append(CPPDEFINES=["VECT_TAB_ADDR=0x8005000", "SERIAL_USB"]) else: env.Append(CPPDEFINES=[ "VECT_TAB_ADDR=0x8002000", "SERIAL_USB", "GENERIC_BOOTLOADER"]) - env.Replace(LDSCRIPT_PATH=ld) + + if "stm32f103r" in board.get("build.mcu", ""): + env.Replace(LDSCRIPT_PATH="bootloader.ld") + elif board.get("upload.boot_version", 0) == 2: + env.Replace(LDSCRIPT_PATH="bootloader_20.ld") else: env.Append(CPPDEFINES=["VECT_TAB_ADDR=0x8000000"])