aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBCG <[email protected]>2024-02-12 04:37:19 -0500
committerGitHub <[email protected]>2024-02-12 10:37:19 +0100
commit828b9614c2f956c62f02311cc1a196a4bf1d4514 (patch)
tree6c584165e8c1d8db036a40abcc82b92fa28c3d12
parentf5e933cd4d418b0dffdbc4e795a417026ced778a (diff)
downloadtinygo-828b9614c2f956c62f02311cc1a196a4bf1d4514.tar.gz
tinygo-828b9614c2f956c62f02311cc1a196a4bf1d4514.zip
nrf52840: generic board support (#4121)
machine/nrf52840: generic board support
-rw-r--r--GNUmakefile2
-rw-r--r--src/machine/board_nrf52840_generic.go25
-rw-r--r--src/machine/machine_nrf52840_lfxtal_false.go5
-rw-r--r--src/machine/machine_nrf52840_lfxtal_true.go5
-rw-r--r--targets/nrf52840-s140v6-uf2-generic.json5
5 files changed, 42 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile
index bf23397df..431090d13 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -684,6 +684,8 @@ endif
@$(MD5SUM) test.hex
$(TINYGO) build -size short -o test.hex -target=feather-nrf52840 examples/usb-midi
@$(MD5SUM) test.hex
+ $(TINYGO) build -size short -o test.hex -target=nrf52840-s140v6-uf2-generic examples/serial
+ @$(MD5SUM) test.hex
ifneq ($(STM32), 0)
$(TINYGO) build -size short -o test.hex -target=bluepill examples/blinky1
@$(MD5SUM) test.hex
diff --git a/src/machine/board_nrf52840_generic.go b/src/machine/board_nrf52840_generic.go
new file mode 100644
index 000000000..1cf30e2cf
--- /dev/null
+++ b/src/machine/board_nrf52840_generic.go
@@ -0,0 +1,25 @@
+//go:build nrf52840 && nrf52840_generic
+
+package machine
+
+var (
+ LED = NoPin
+ SDA_PIN = NoPin
+ SCL_PIN = NoPin
+ UART_TX_PIN = NoPin
+ UART_RX_PIN = NoPin
+ SPI0_SCK_PIN = NoPin
+ SPI0_SDO_PIN = NoPin
+ SPI0_SDI_PIN = NoPin
+
+ // https://pid.codes/org/TinyGo/
+ usb_VID uint16 = 0x1209
+ usb_PID uint16 = 0x9090
+
+ usb_STRING_MANUFACTURER = "TinyGo"
+ usb_STRING_PRODUCT = "nRF52840 Generic board"
+)
+
+var (
+ DefaultUART = UART0
+)
diff --git a/src/machine/machine_nrf52840_lfxtal_false.go b/src/machine/machine_nrf52840_lfxtal_false.go
new file mode 100644
index 000000000..ba38a3264
--- /dev/null
+++ b/src/machine/machine_nrf52840_lfxtal_false.go
@@ -0,0 +1,5 @@
+//go:build nrf52840 && nrf52840_lfxtal_false
+
+package machine
+
+const HasLowFrequencyCrystal = false
diff --git a/src/machine/machine_nrf52840_lfxtal_true.go b/src/machine/machine_nrf52840_lfxtal_true.go
new file mode 100644
index 000000000..4bef553b0
--- /dev/null
+++ b/src/machine/machine_nrf52840_lfxtal_true.go
@@ -0,0 +1,5 @@
+//go:build nrf52840 && ((nrf52840_generic && !nrf52840_lfxtal_false) || nrf52840_lfxtal_true)
+
+package machine
+
+const HasLowFrequencyCrystal = true
diff --git a/targets/nrf52840-s140v6-uf2-generic.json b/targets/nrf52840-s140v6-uf2-generic.json
new file mode 100644
index 000000000..034f59339
--- /dev/null
+++ b/targets/nrf52840-s140v6-uf2-generic.json
@@ -0,0 +1,5 @@
+{
+ "inherits": ["nrf52840", "nrf52840-s140v6-uf2"],
+ "build-tags": ["nrf52840_generic"],
+ "serial-port": ["1209:9090"]
+}