diff options
author | Matt Schultz <[email protected]> | 2022-08-27 21:31:12 -0500 |
---|---|---|
committer | Ron Evans <[email protected]> | 2022-08-28 10:16:52 +0200 |
commit | ef912a132d20f000e4cd7fef7c698a762ba928e0 (patch) | |
tree | f27644baf327003ced7ab81bc64362230bb3635a | |
parent | fb603a471cb556c47bfa8d8dabd7923fbfc32891 (diff) | |
download | tinygo-ef912a132d20f000e4cd7fef7c698a762ba928e0.tar.gz tinygo-ef912a132d20f000e4cd7fef7c698a762ba928e0.zip |
machine: Add support for Adafruit QT2040 board.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | src/machine/board_trinkey_qt2040.go | 63 | ||||
-rw-r--r-- | targets/trinkey-qt2040-boot-stage2.S | 17 | ||||
-rw-r--r-- | targets/trinkey-qt2040.json | 11 | ||||
-rw-r--r-- | targets/trinkey-qt2040.ld | 10 |
6 files changed, 105 insertions, 1 deletions
@@ -597,6 +597,8 @@ endif @$(MD5SUM) test.hex $(TINYGO) build -size short -o test.hex -target=challenger-rp2040 examples/blinky1 @$(MD5SUM) test.hex + $(TINYGO) build -size short -o test.hex -target=trinkey-qt2040 examples/adc_rp2040 + @$(MD5SUM) test.hex # test pwm $(TINYGO) build -size short -o test.hex -target=itsybitsy-m0 examples/pwm @$(MD5SUM) test.hex @@ -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 90 microcontroller boards are currently supported: +The following 91 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) @@ -67,6 +67,7 @@ The following 90 microcontroller boards are currently supported: * [Adafruit PyPortal](https://www.adafruit.com/product/4116) * [Adafruit QT Py](https://www.adafruit.com/product/4600) * [Adafruit Trinket M0](https://www.adafruit.com/product/3500) +* [Adafruit Trinkey QT2040](https://adafruit.com/product/5056) * [Arduino Mega 1280](https://www.arduino.cc/en/Main/arduinoBoardMega/) * [Arduino Mega 2560](https://store.arduino.cc/arduino-mega-2560-rev3) * [Arduino MKR1000](https://store.arduino.cc/arduino-mkr1000-wifi) diff --git a/src/machine/board_trinkey_qt2040.go b/src/machine/board_trinkey_qt2040.go new file mode 100644 index 000000000..3a582fa87 --- /dev/null +++ b/src/machine/board_trinkey_qt2040.go @@ -0,0 +1,63 @@ +//go:build trinkey_qt2040 +// +build trinkey_qt2040 + +// This file contains the pin mappings for the Adafruit Trinkey QT2040 board. +// +// The Trinkey QT2040 is a small development board based on the RP2040 which +// plugs into a USB A port. The board has a minimal pinout: an integrated +// NeoPixel LED and a STEMMA QT I2C port. +// +// - Product: https://www.adafruit.com/product/5056 +// - Overview: https://learn.adafruit.com/adafruit-trinkey-qt2040 +// - Pinouts: https://learn.adafruit.com/adafruit-trinkey-qt2040/pinouts +// - Datasheets: https://learn.adafruit.com/adafruit-trinkey-qt2040/downloads + +package machine + +// Onboard crystal oscillator frequency, in MHz +const xoscFreq = 12 // MHz + +// Onboard LEDs +const ( + NEOPIXEL = GPIO27 + WS2812 = NEOPIXEL +) + +// I2C pins +const ( + I2C0_SDA_PIN = GPIO16 + I2C0_SCL_PIN = GPIO17 + + I2C1_SDA_PIN = NoPin + I2C1_SCL_PIN = NoPin +) + +// SPI pins +const ( + SPI0_SCK_PIN = NoPin + SPI0_SDO_PIN = NoPin + SPI0_SDI_PIN = NoPin + + SPI1_SCK_PIN = NoPin + SPI1_SDO_PIN = NoPin + SPI1_SDI_PIN = NoPin +) + +// UART pins +const ( + UART0_TX_PIN = NoPin + UART0_RX_PIN = NoPin + UART_TX_PIN = UART0_TX_PIN + UART_RX_PIN = UART0_RX_PIN +) + +// USB identifiers +const ( + usb_STRING_PRODUCT = "Trinkey QT2040" + usb_STRING_MANUFACTURER = "Adafruit" +) + +var ( + usb_VID uint16 = 0x239a + usb_PID uint16 = 0x8109 +) diff --git a/targets/trinkey-qt2040-boot-stage2.S b/targets/trinkey-qt2040-boot-stage2.S new file mode 100644 index 000000000..5683979d5 --- /dev/null +++ b/targets/trinkey-qt2040-boot-stage2.S @@ -0,0 +1,17 @@ +// Adafruit Trinkey QT2040 Stage 2 Bootloader + +// +// This file defines the parameters specific to the flash-chip found +// on the Adafruit Trinkey QT2040. The generic implementation is in +// rp2040-boot-stage2.S +// + +#define BOARD_PICO_FLASH_SPI_CLKDIV 4 +#define BOARD_CMD_READ 0xe7 +#define BOARD_QUAD_OK 1 +#define BOARD_QUAD_ENABLE_STATUS_BYTE 2 +#define BOARD_QUAD_ENABLE_BIT_MASK 2 +#define BOARD_SPLIT_STATUS_WRITE 1 +#define BOARD_WAIT_CYCLES 2 + +#include "rp2040-boot-stage2.S" diff --git a/targets/trinkey-qt2040.json b/targets/trinkey-qt2040.json new file mode 100644 index 000000000..4a47bcd3a --- /dev/null +++ b/targets/trinkey-qt2040.json @@ -0,0 +1,11 @@ +{ + "inherits": [ + "rp2040" + ], + "serial-port": ["acm:239a:8109"], + "build-tags": ["trinkey_qt2040"], + "linkerscript": "targets/trinkey-qt2040.ld", + "extra-files": [ + "targets/trinkey-qt2040-boot-stage2.S" + ] +} diff --git a/targets/trinkey-qt2040.ld b/targets/trinkey-qt2040.ld new file mode 100644 index 000000000..d97942f5c --- /dev/null +++ b/targets/trinkey-qt2040.ld @@ -0,0 +1,10 @@ + +MEMORY +{ + /* Reserve exactly 256 bytes at start of flash for second stage bootloader */ + BOOT2_TEXT (rx) : ORIGIN = 0x10000000, LENGTH = 256 + FLASH_TEXT (rx) : ORIGIN = 0x10000000 + 256, LENGTH = 8192K - 256 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k +} + +INCLUDE "targets/rp2040.ld"
\ No newline at end of file |