aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOlivier Fauchon <[email protected]>2021-12-09 00:22:09 +0100
committerRon Evans <[email protected]>2021-12-13 16:02:00 +0100
commit93ac7cec0d131e651dcfd79e3d068f6f50d2af89 (patch)
tree2d399055636bab6645234f30914df9edf6bc69f0
parentb4503c1e372f3a1eb4fc429a17ef5b0e102b6d42 (diff)
downloadtinygo-93ac7cec0d131e651dcfd79e3d068f6f50d2af89.tar.gz
tinygo-93ac7cec0d131e651dcfd79e3d068f6f50d2af89.zip
stm32/stm32wlx: Add support for stm32wl55_cm4
board/stm32: Add support for GNSE (Generic Node Sensor Edition) Thanks to @jamestait for his help on GNSE port
-rw-r--r--README.md3
-rw-r--r--src/crypto/rand/rand_baremetal.go4
-rw-r--r--src/machine/board_gnse.go58
-rw-r--r--src/machine/i2c.go4
-rw-r--r--src/machine/machine_stm32_exti_syscfg.go4
-rw-r--r--src/machine/machine_stm32_exti_syscfg_noenable.go4
-rw-r--r--src/machine/machine_stm32_gpio_reva.go4
-rw-r--r--src/machine/machine_stm32_gpio_revb_mp.go4
-rw-r--r--src/machine/machine_stm32wlx.go (renamed from src/machine/machine_stm32wle5.go)4
-rw-r--r--src/runtime/runtime_stm32wlx.go (renamed from src/runtime/runtime_stm32wle5.go)4
-rw-r--r--targets/gnse.json12
-rw-r--r--targets/nucleo-wl55jc.json3
-rw-r--r--targets/stm32wl5x_cm4.json8
-rw-r--r--targets/stm32wle5.json6
-rw-r--r--targets/stm32wlx.ld (renamed from targets/stm32wle5.ld)0
15 files changed, 100 insertions, 22 deletions
diff --git a/README.md b/README.md
index 74aed7f3c..8d132cac1 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@ See the [getting started instructions](https://tinygo.org/getting-started/) for
You can compile TinyGo programs for microcontrollers, WebAssembly and Linux.
-The following 74 microcontroller boards are currently supported:
+The following 75 microcontroller boards are currently supported:
* [Adafruit Circuit Playground Bluefruit](https://www.adafruit.com/product/4333)
* [Adafruit Circuit Playground Express](https://www.adafruit.com/product/3333)
@@ -119,6 +119,7 @@ The following 74 microcontroller boards are currently supported:
* [ST Micro STM32F103XX "Bluepill"](https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill)
* [ST Micro STM32F407 "Discovery"](https://www.st.com/en/evaluation-tools/stm32f4discovery.html)
* [X9 Pro smartwatch](https://github.com/curtpw/nRF5x-device-reverse-engineering/tree/master/X9-nrf52832-activity-tracker/)
+* [The Things Industries Generic Node Sensor Edition](https://www.genericnode.com/docs/sensor-edition/)
For more information, see [this list of boards](https://tinygo.org/microcontrollers/). Pull requests for additional support are welcome!
diff --git a/src/crypto/rand/rand_baremetal.go b/src/crypto/rand/rand_baremetal.go
index 3fe4cae7f..b5f8bc211 100644
--- a/src/crypto/rand/rand_baremetal.go
+++ b/src/crypto/rand/rand_baremetal.go
@@ -1,5 +1,5 @@
-//go:build stm32wle5
-// +build stm32wle5
+//go:build stm32wlx
+// +build stm32wlx
package rand
diff --git a/src/machine/board_gnse.go b/src/machine/board_gnse.go
new file mode 100644
index 000000000..efe27073a
--- /dev/null
+++ b/src/machine/board_gnse.go
@@ -0,0 +1,58 @@
+//go:build gnse
+// +build gnse
+
+package machine
+
+import (
+ "device/stm32"
+ "runtime/interrupt"
+)
+
+const (
+ LED_RED = PB5
+ LED_GREEN = PB6
+ LED_BLUE = PB7
+ LED1 = LED_RED // Red
+ LED2 = LED_GREEN // Green
+ LED3 = LED_BLUE // Blue
+ LED = LED_GREEN // Default
+
+ BUTTON = PB3
+
+ // SPI0
+ SPI0_NSS_PIN = PA4
+ SPI0_SCK_PIN = PA5
+ SPI0_SDO_PIN = PA6
+ SPI0_SDI_PIN = PA7
+
+ //MCU USART2
+ UART2_RX_PIN = PA3
+ UART2_TX_PIN = PA2
+
+ // DEFAULT USART
+ UART_RX_PIN = UART2_RX_PIN
+ UART_TX_PIN = UART2_TX_PIN
+)
+
+var (
+ // STM32 UART2 is connected to the embedded STLINKV3 Virtual Com Port
+ UART0 = &_UART0
+ _UART0 = UART{
+ Buffer: NewRingBuffer(),
+ Bus: stm32.USART2,
+ TxAltFuncSelector: 7,
+ RxAltFuncSelector: 7,
+ }
+
+ DefaultUART = UART0
+
+ // SPI
+ SPI3 = SPI{
+ Bus: stm32.SPI3,
+ }
+)
+
+func init() {
+ // Enable UARTs Interrupts
+ UART0.Interrupt = interrupt.New(stm32.IRQ_USART2, _UART0.handleInterrupt)
+}
diff --git a/src/machine/i2c.go b/src/machine/i2c.go
index 737e7a4c8..d7a0deca1 100644
--- a/src/machine/i2c.go
+++ b/src/machine/i2c.go
@@ -1,5 +1,5 @@
-//go:build atmega || nrf || sam || (stm32 && !stm32wle5) || fe310 || k210 || rp2040
-// +build atmega nrf sam stm32,!stm32wle5 fe310 k210 rp2040
+//go:build atmega || nrf || sam || (stm32 && !stm32wlx) || fe310 || k210 || rp2040
+// +build atmega nrf sam stm32,!stm32wlx fe310 k210 rp2040
package machine
diff --git a/src/machine/machine_stm32_exti_syscfg.go b/src/machine/machine_stm32_exti_syscfg.go
index 3b3680aed..7e4666cf4 100644
--- a/src/machine/machine_stm32_exti_syscfg.go
+++ b/src/machine/machine_stm32_exti_syscfg.go
@@ -1,5 +1,5 @@
-//go:build stm32 && !stm32f1 && !stm32l5 && !stm32wle5
-// +build stm32,!stm32f1,!stm32l5,!stm32wle5
+//go:build stm32 && !stm32f1 && !stm32l5 && !stm32wlx
+// +build stm32,!stm32f1,!stm32l5,!stm32wlx
package machine
diff --git a/src/machine/machine_stm32_exti_syscfg_noenable.go b/src/machine/machine_stm32_exti_syscfg_noenable.go
index 576d77ae7..d6fa06e27 100644
--- a/src/machine/machine_stm32_exti_syscfg_noenable.go
+++ b/src/machine/machine_stm32_exti_syscfg_noenable.go
@@ -1,5 +1,5 @@
-//go:build stm32wle5
-// +build stm32wle5
+//go:build stm32wlx
+// +build stm32wlx
package machine
diff --git a/src/machine/machine_stm32_gpio_reva.go b/src/machine/machine_stm32_gpio_reva.go
index 19b683865..1712986aa 100644
--- a/src/machine/machine_stm32_gpio_reva.go
+++ b/src/machine/machine_stm32_gpio_reva.go
@@ -1,5 +1,5 @@
-//go:build stm32 && !stm32l4 && !stm32l5 && !stm32wle5
-// +build stm32,!stm32l4,!stm32l5,!stm32wle5
+//go:build stm32 && !stm32l4 && !stm32l5 && !stm32wlx
+// +build stm32,!stm32l4,!stm32l5,!stm32wlx
package machine
diff --git a/src/machine/machine_stm32_gpio_revb_mp.go b/src/machine/machine_stm32_gpio_revb_mp.go
index a8d058fb3..0eb91989a 100644
--- a/src/machine/machine_stm32_gpio_revb_mp.go
+++ b/src/machine/machine_stm32_gpio_revb_mp.go
@@ -1,5 +1,5 @@
-//go:build stm32wle5
-// +build stm32wle5
+//go:build stm32wlx
+// +build stm32wlx
package machine
diff --git a/src/machine/machine_stm32wle5.go b/src/machine/machine_stm32wlx.go
index 639923257..7824451a5 100644
--- a/src/machine/machine_stm32wle5.go
+++ b/src/machine/machine_stm32wlx.go
@@ -1,5 +1,5 @@
-//go:build stm32wle5
-// +build stm32wle5
+//go:build stm32wlx
+// +build stm32wlx
package machine
diff --git a/src/runtime/runtime_stm32wle5.go b/src/runtime/runtime_stm32wlx.go
index 671ffd656..9f389f0f7 100644
--- a/src/runtime/runtime_stm32wle5.go
+++ b/src/runtime/runtime_stm32wlx.go
@@ -1,5 +1,5 @@
-//go:build stm32wle5
-// +build stm32wle5
+//go:build stm32wlx
+// +build stm32wlx
package runtime
diff --git a/targets/gnse.json b/targets/gnse.json
new file mode 100644
index 000000000..5453c7f9a
--- /dev/null
+++ b/targets/gnse.json
@@ -0,0 +1,12 @@
+{
+ "inherits": [
+ "stm32wl5x_cm4"
+ ],
+ "build-tags": [
+ "gnse"
+ ],
+ "serial": "uart",
+ "flash-method": "openocd",
+ "openocd-interface": "stlink",
+ "openocd-target": "stm32wlx"
+}
diff --git a/targets/nucleo-wl55jc.json b/targets/nucleo-wl55jc.json
index c8b2356d2..3e4f8ca1b 100644
--- a/targets/nucleo-wl55jc.json
+++ b/targets/nucleo-wl55jc.json
@@ -1,12 +1,11 @@
{
"inherits": [
- "stm32wle5"
+ "stm32wl5x_cm4"
],
"build-tags": [
"nucleowl55jc"
],
"serial": "uart",
- "linkerscript": "targets/stm32wle5.ld",
"flash-method": "openocd",
"openocd-interface": "stlink",
"openocd-target": "stm32wlx"
diff --git a/targets/stm32wl5x_cm4.json b/targets/stm32wl5x_cm4.json
new file mode 100644
index 000000000..00d8bbb82
--- /dev/null
+++ b/targets/stm32wl5x_cm4.json
@@ -0,0 +1,8 @@
+{
+ "inherits": ["cortex-m4"],
+ "build-tags": [ "stm32wl5x_cm4","stm32wlx", "stm32"],
+ "extra-files": [
+ "src/device/stm32/stm32wl5x_cm4.s"
+ ],
+ "linkerscript": "targets/stm32wlx.ld"
+}
diff --git a/targets/stm32wle5.json b/targets/stm32wle5.json
index ac3b8bcea..f24f28f2e 100644
--- a/targets/stm32wle5.json
+++ b/targets/stm32wle5.json
@@ -1,8 +1,8 @@
{
"inherits": ["cortex-m4"],
- "build-tags": ["stm32wle5", "stm32"],
+ "build-tags": [ "stm32wle5","stm32wlx", "stm32"],
"extra-files": [
"src/device/stm32/stm32wle5.s"
],
- "linkerscript": "targets/stm32wle5.ld"
-} \ No newline at end of file
+ "linkerscript": "targets/stm32wlx.ld"
+}
diff --git a/targets/stm32wle5.ld b/targets/stm32wlx.ld
index 59b616903..59b616903 100644
--- a/targets/stm32wle5.ld
+++ b/targets/stm32wlx.ld