diff options
author | Daniel Esteban <[email protected]> | 2022-08-24 09:28:08 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2022-08-24 13:50:02 +0200 |
commit | aa13b5d83bc7d43db7197c2c1ebfb0cf32b81736 (patch) | |
tree | 457e6594f1f333a044a161e0046395c7d1e1a660 | |
parent | 12d63d96420c582b5dffc2bea58e6569022d155d (diff) | |
download | tinygo-aa13b5d83bc7d43db7197c2c1ebfb0cf32b81736.tar.gz tinygo-aa13b5d83bc7d43db7197c2c1ebfb0cf32b81736.zip |
Add Pimoroni's Tufty2040 board
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | src/machine/board_tufty2040.go | 105 | ||||
-rw-r--r-- | targets/tufty2040.json | 11 | ||||
-rw-r--r-- | targets/tufty2040.ld | 10 |
5 files changed, 130 insertions, 1 deletions
@@ -589,6 +589,8 @@ endif @$(MD5SUM) test.hex $(TINYGO) build -size short -o test.hex -target=badger2040 examples/blinky1 @$(MD5SUM) test.hex + $(TINYGO) build -size short -o test.hex -target=tufty2040 examples/blinky1 + @$(MD5SUM) test.hex $(TINYGO) build -size short -o test.hex -target=thingplus-rp2040 examples/blinky1 @$(MD5SUM) test.hex $(TINYGO) build -size short -o test.hex -target=xiao-rp2040 examples/blinky1 @@ -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 88 microcontroller boards are currently supported: +The following 89 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) @@ -108,6 +108,7 @@ The following 88 microcontroller boards are currently supported: * [Particle Xenon](https://docs.particle.io/datasheets/discontinued/xenon-datasheet/) * [Phytec reel board](https://www.phytec.eu/product-eu/internet-of-things/reelboard/) * [Pimoroni Badger2040](https://shop.pimoroni.com/products/badger-2040) +* [Pimoroni Tufty2040](https://shop.pimoroni.com/products/tufty-2040) * [PineTime DevKit](https://www.pine64.org/pinetime/) * [PJRC Teensy 3.6](https://www.pjrc.com/store/teensy36.html) * [PJRC Teensy 4.0](https://www.pjrc.com/store/teensy40.html) diff --git a/src/machine/board_tufty2040.go b/src/machine/board_tufty2040.go new file mode 100644 index 000000000..c45c12f7d --- /dev/null +++ b/src/machine/board_tufty2040.go @@ -0,0 +1,105 @@ +//go:build tufty2040 +// +build tufty2040 + +// This contains the pin mappings for the Badger 2040 Connect board. +// +// For more information, see: https://shop.pimoroni.com/products/tufty-2040 +// Also +// - Tufty 2040 schematic: https://cdn.shopify.com/s/files/1/0174/1800/files/tufty_schematic.pdf?v=1655385675 +// +package machine + +import ( + "device/rp" + "runtime/interrupt" +) + +const ( + LED Pin = GPIO25 + + BUTTON_A Pin = GPIO7 + BUTTON_B Pin = GPIO8 + BUTTON_C Pin = GPIO9 + BUTTON_UP Pin = GPIO22 + BUTTON_DOWN Pin = GPIO6 + BUTTON_USER Pin = GPIO23 + + LCD_BACKLIGHT Pin = GPIO2 + LCD_CS Pin = GPIO10 + LCD_DC Pin = GPIO11 + LCD_WR Pin = GPIO12 + LCD_RD Pin = GPIO13 + LCD_DB0 Pin = GPIO14 + LCD_DB1 Pin = GPIO15 + LCD_DB2 Pin = GPIO16 + LCD_DB3 Pin = GPIO17 + LCD_DB4 Pin = GPIO18 + LCD_DB5 Pin = GPIO19 + LCD_DB6 Pin = GPIO20 + LCD_DB7 Pin = GPIO21 + + VBUS_DETECT Pin = GPIO24 + BATTERY Pin = GPIO29 + USER_LED Pin = GPIO25 + LIGHT_SENSE Pin = GPIO26 + SENSOR_POWER Pin = GPIO27 +) + +// I2C pins +const ( + I2C0_SDA_PIN Pin = GPIO4 + I2C0_SCL_PIN Pin = GPIO5 + + I2C1_SDA_PIN Pin = NoPin + I2C1_SCL_PIN Pin = NoPin +) + +// SPI pins. +const ( + SPI0_SCK_PIN Pin = NoPin + SPI0_SDO_PIN Pin = NoPin + SPI0_SDI_PIN Pin = NoPin + + SPI1_SCK_PIN Pin = NoPin + SPI1_SDO_PIN Pin = NoPin + SPI1_SDI_PIN Pin = NoPin +) + +// Onboard crystal oscillator frequency, in MHz. +const ( + xoscFreq = 12 // MHz +) + +// USB CDC identifiers +const ( + usb_STRING_PRODUCT = "Tufty 2040" + usb_STRING_MANUFACTURER = "Pimoroni" +) + +var ( + usb_VID uint16 = 0x2e8a + usb_PID uint16 = 0x1002 +) + +// UART pins +const ( + UART0_TX_PIN = GPIO0 + UART0_RX_PIN = GPIO1 + UART_TX_PIN = UART0_TX_PIN + UART_RX_PIN = UART0_RX_PIN +) + +// UART on the RP2040 +var ( + UART0 = &_UART0 + _UART0 = UART{ + Buffer: NewRingBuffer(), + Bus: rp.UART0, + } +) + +var DefaultUART = UART0 + +func init() { + UART0.Interrupt = interrupt.New(rp.IRQ_UART0_IRQ, _UART0.handleInterrupt) +} diff --git a/targets/tufty2040.json b/targets/tufty2040.json new file mode 100644 index 000000000..c5123157c --- /dev/null +++ b/targets/tufty2040.json @@ -0,0 +1,11 @@ +{ + "inherits": [ + "rp2040" + ], + "serial-port": ["acm:2e8a:0003"], + "build-tags": ["tufty2040"], + "linkerscript": "targets/tufty2040.ld", + "extra-files": [ + "targets/pico-boot-stage2.S" + ] +} diff --git a/targets/tufty2040.ld b/targets/tufty2040.ld new file mode 100644 index 000000000..7e06d7a0a --- /dev/null +++ b/targets/tufty2040.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 = 1020K - 256 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k +} + +INCLUDE "targets/rp2040.ld" |