diff --git a/Makefile b/Makefile index e2aeb5a0..4efe87d7 100644 --- a/Makefile +++ b/Makefile @@ -267,6 +267,10 @@ smoketest: @$(MD5SUM) test.hex $(TINYGO) build -size short -o test.hex -target=pca10056 examples/blinky2 @$(MD5SUM) test.hex + $(TINYGO) build -size short -o test.hex -target=pca10059 examples/blinky1 + @$(MD5SUM) test.hex + $(TINYGO) build -size short -o test.hex -target=pca10059 examples/blinky2 + @$(MD5SUM) test.hex $(TINYGO) build -size short -o test.hex -target=itsybitsy-m0 examples/blinky1 @$(MD5SUM) test.hex $(TINYGO) build -size short -o test.hex -target=feather-m0 examples/blinky1 @@ -396,6 +400,7 @@ endif $(TINYGO) build -size short -o test.hex -target=pca10040 -opt=0 ./testdata/stdlib.go @$(MD5SUM) test.hex + wasmtest: $(GO) test ./tests/wasm diff --git a/src/machine/board_nrf52840-mdk-usb-dongle.go b/src/machine/board_nrf52840-mdk-usb-dongle.go index 82402fbb..45d175ff 100644 --- a/src/machine/board_nrf52840-mdk-usb-dongle.go +++ b/src/machine/board_nrf52840-mdk-usb-dongle.go @@ -44,7 +44,7 @@ const ( // USB CDC identifiers const ( usb_STRING_PRODUCT = "Makerdiary nRF52840 MDK USB Dongle" - usb_STRING_MANUFACTURER = "Makerdiary" + usb_STRING_MANUFACTURER = "Nordic Semiconductor ASA" ) var ( diff --git a/src/machine/board_nrf52840-mdk.go b/src/machine/board_nrf52840-mdk.go index 7c7214a8..19c6cbfd 100644 --- a/src/machine/board_nrf52840-mdk.go +++ b/src/machine/board_nrf52840-mdk.go @@ -39,7 +39,7 @@ const ( // USB CDC identifiers const ( usb_STRING_PRODUCT = "Makerdiary nRF52840 MDK" - usb_STRING_MANUFACTURER = "Makerdiary" + usb_STRING_MANUFACTURER = "Nordic Semiconductor ASA" ) var ( diff --git a/src/machine/board_pca10059.go b/src/machine/board_pca10059.go new file mode 100644 index 00000000..fd70cd3b --- /dev/null +++ b/src/machine/board_pca10059.go @@ -0,0 +1,64 @@ +// +build pca10059 + +package machine + +// The PCA10040 has a low-frequency (32kHz) crystal oscillator on board. +const HasLowFrequencyCrystal = true + +// LEDs on the PCA10059 (nRF52840 dongle) +const ( + LED Pin = LED1 + LED1 Pin = 6 + LED2 Pin = 8 + LED3 Pin = (1 << 5) | 9 + LED4 Pin = 12 +) + +// Buttons on the PCA10059 (nRF52840 dongle) +const ( + BUTTON Pin = BUTTON1 + BUTTON1 Pin = (1 << 5) | 6 +) + +// ADC pins +const ( + ADC1 Pin = 2 + ADC2 Pin = 4 + ADC3 Pin = 29 + ADC4 Pin = 31 +) + +// UART pins +const ( + UART_TX_PIN Pin = NoPin + UART_RX_PIN Pin = NoPin +) + +// UART0 is the USB device +var ( + UART0 = USB +) + +// I2C pins (unused) +const ( + SDA_PIN = NoPin + SCL_PIN = NoPin +) + +// SPI pins (unused) +const ( + SPI0_SCK_PIN = NoPin + SPI0_SDO_PIN = NoPin + SPI0_SDI_PIN = NoPin +) + +// USB CDC identifiers +const ( + usb_STRING_PRODUCT = "nRF52840 Dongle" + usb_STRING_MANUFACTURER = "Nordic Semiconductor ASA" +) + +var ( + usb_VID uint16 = 0x1915 + usb_PID uint16 = 0xCAFE +) diff --git a/targets/pca10059.json b/targets/pca10059.json new file mode 100644 index 00000000..efab1b6e --- /dev/null +++ b/targets/pca10059.json @@ -0,0 +1,6 @@ +{ + "inherits": ["nrf52840"], + "build-tags": ["pca10059"], + "linkerscript": "targets/pca10059.ld", + "flash-command": "nrfutil pkg generate --hw-version 52 --sd-req 0x0 --application {hex} --application-version 1 /tmp/tinygo_$$.zip && nrfutil dfu usb-serial -pkg /tmp/tinygo_$$.zip -p {port} -b 115200 && rm -f /tmp/tinygo_$$.zip" +} diff --git a/targets/pca10059.ld b/targets/pca10059.ld new file mode 100644 index 00000000..18eb10de --- /dev/null +++ b/targets/pca10059.ld @@ -0,0 +1,10 @@ + +MEMORY +{ + FLASH_TEXT (rw) : ORIGIN = 0x00001000, LENGTH = 0xDF000 + RAM (xrw) : ORIGIN = 0x20000008, LENGTH = 0x3FFF8 +} + +_stack_size = 2K; + +INCLUDE "targets/arm.ld"