From 1d38c24233b3c061cedf503bf44b1307bb0e1fa2 Mon Sep 17 00:00:00 2001
From: NIIBE Yutaka <gniibe@fsij.org>
Date: Thu, 30 Jul 2015 20:35:21 +0900
Subject: Add Nucleo

---
 AUTHORS                      |  2 ++
 ChangeLog                    |  7 ++++++-
 NEWS                         | 12 ++++++++++++
 board/board-st-nucleo-f103.h | 45 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100644 board/board-st-nucleo-f103.h

diff --git a/AUTHORS b/AUTHORS
index 1fbee18..b833a29 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -9,6 +9,8 @@ Kaz Kojima:
 Kenji Rikitake:
     Added ST Dongle support.
 	board/board-st-dongle.h
+    Added ST Nucleo F103 support.
+	board/board-st-nucleo-f103.h
 
 NIIBE Yutaka:
     Write the library:
diff --git a/ChangeLog b/ChangeLog
index 9597d37..7a58afe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
+2015-07-30  Niibe Yutaka  <gniibe@fsij.org>
+
+	* board/board-st-nucleo-f103.h: New.  Contributed by Kenji
+	Rikitake.
+
 2015-07-29  Niibe Yutaka  <gniibe@fsij.org>
 
-	* board/board-st-dongle.h: New.
+	* board/board-st-dongle.h: New.  Contributed by Kenji Rikitake.
 
 	* board/board-*.h (FLASH_PAGE_SIZE): Remove.
 
diff --git a/NEWS b/NEWS
index ade6ffa..45dfee4 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,18 @@
 NEWS - Noteworthy changes
 
 
+* Major changes in Chopstx 0.07
+
+  Released 2015-07-31
+
+** New board support: ST Nucleo F103
+It is contributed by Kenji Rikitake.
+
+** New board support: ST Dongle
+It is contributed by Kenji Rikitake.
+It's the ST-Link/V2-1 part of ST Nucleo F103.
+
+
 * Major changes in Chopstx 0.07
 
   Released 2015-07-15
diff --git a/board/board-st-nucleo-f103.h b/board/board-st-nucleo-f103.h
new file mode 100644
index 0000000..9bb2cc0
--- /dev/null
+++ b/board/board-st-nucleo-f103.h
@@ -0,0 +1,45 @@
+#define BOARD_NAME "ST Nucleo F103"
+#define BOARD_ID    0x9b87c16d
+
+/*
+ * Please add X3 and USB cable to ST Nucleo F103.
+ *
+ * Solder X3 XTAL of 8MHz (and put C33 and C34 of 22pF).  
+ * Solder the bridges for R35 and R37, since it's 0 ohm. 
+ *
+ * (Optional) Remove SB54 and SB55.
+ *
+ * At CN10, connect USB cable
+ *  Vbus RED   --> 10 NC   ----------> CN7 (6 E5V)
+ *  D+   GREEN --> 12 PA11 ---[1K5]--> CN6 (4 3V3)
+ *  D-   WHITE --> 14 PA12
+ *  GND  BLACK --> 20 GND
+ */
+
+#define STM32F10X_MD		/* Medium-density device */
+
+#define STM32_PLLXTPRE                  STM32_PLLXTPRE_DIV1
+#define STM32_PLLMUL_VALUE              9
+#define STM32_HSECLK                    8000000
+
+#define GPIO_LED_BASE   GPIOA_BASE
+#define GPIO_LED_SET_TO_EMIT            5
+#undef  GPIO_USB_BASE		/* No external DISCONNECT/RENUM circuit.  */
+#undef  GPIO_OTHER_BASE
+
+/*
+ * Port A setup.
+ * PA0  - input with pull-up.  AN0
+ * PA1  - input with pull-up.  AN1
+ * PA5  - Push pull output 50MHz (LED 1:ON 0:OFF)
+ * 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_LED_ODR            0xFFFFE7FF
+#define VAL_GPIO_LED_CRL            0x88388888      /*  PA7...PA0 */
+#define VAL_GPIO_LED_CRH            0x88811888      /* PA15...PA8 */
+
+#define RCC_ENR_IOP_EN      RCC_APB2ENR_IOPAEN
+#define RCC_RSTR_IOP_RST    RCC_APB2RSTR_IOPARST
-- 
cgit v1.2.3