diff --git a/README.md b/README.md index 74aed7f3..8d132cac 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 3fe4cae7..b5f8bc21 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 00000000..efe27073 --- /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 737e7a4c..d7a0deca 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 3b3680ae..7e4666cf 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 576d77ae..d6fa06e2 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 19b68386..1712986a 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 a8d058fb..0eb91989 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 similarity index 99% rename from src/machine/machine_stm32wle5.go rename to src/machine/machine_stm32wlx.go index 63992325..7824451a 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 similarity index 98% rename from src/runtime/runtime_stm32wle5.go rename to src/runtime/runtime_stm32wlx.go index 671ffd65..9f389f0f 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 00000000..5453c7f9 --- /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 c8b2356d..3e4f8ca1 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 00000000..00d8bbb8 --- /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 ac3b8bce..f24f28f2 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 similarity index 100% rename from targets/stm32wle5.ld rename to targets/stm32wlx.ld