From 8325f2a53dc60409dca9d01d2204ad3939e2e9db Mon Sep 17 00:00:00 2001 From: Ron Evans Date: Mon, 19 Nov 2018 09:00:27 +0100 Subject: [PATCH] reelboard: support Reel Board (nrf52840 dev board) Signed-off-by: Ron Evans --- .travis.yml | 2 ++ Makefile | 8 ++++++++ docs/targets.rst | 2 ++ src/machine/board_reelboard.go | 35 ++++++++++++++++++++++++++++++++++ targets/reelboard.json | 7 +++++++ 5 files changed, 54 insertions(+) create mode 100644 src/machine/board_reelboard.go create mode 100644 targets/reelboard.json diff --git a/.travis.yml b/.travis.yml index e97ee4d8..76e63bce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,5 +27,7 @@ script: - tinygo build -o blinky1.nrf51d.elf -target=pca10031 examples/blinky1 - tinygo build -o blinky1.stm32.elf -target=bluepill examples/blinky1 - tinygo build -o blinky1.avr.o -target=arduino examples/blinky1 # TODO: avr-as/avr-gcc doesn't work + - tinygo build -o blinky1.reel.elf -target=reelboard examples/blinky1 + - tinygo build -o blinky2.reel.elf -target=reelboard examples/blinky2 - tinygo build -o blinky1.pca10056.elf -target=pca10056 examples/blinky1 - tinygo build -o blinky2.pca10056.elf -target=pca10056 examples/blinky2 diff --git a/Makefile b/Makefile index 01d0f625..2eacb156 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,11 @@ else ifeq ($(TARGET),microbit) OBJCOPY = arm-none-eabi-objcopy TGOFLAGS += -target $(TARGET) +else ifeq ($(TARGET),reelboard) +# reel board +OBJCOPY = arm-none-eabi-objcopy +TGOFLAGS += -target $(TARGET) + else ifeq ($(TARGET),bluepill) # "blue pill" development board # See: https://wiki.stm32duino.com/index.php?title=Blue_Pill @@ -48,6 +53,9 @@ ifeq ($(TARGET),pca10040) flash-%: build/%.hex nrfjprog -f nrf52 --sectorerase --program $< --reset else ifeq ($(TARGET),microbit) +flash-%: build/%.hex + openocd -f interface/cmsis-dap.cfg -f target/nrf51.cfg -c 'program $< reset exit' +else ifeq ($(TARGET),reelboard) flash-%: build/%.hex openocd -f interface/cmsis-dap.cfg -f target/nrf51.cfg -c 'program $< reset exit' else ifeq ($(TARGET),arduino) diff --git a/docs/targets.rst b/docs/targets.rst index 04cbfffd..0a091c24 100644 --- a/docs/targets.rst +++ b/docs/targets.rst @@ -38,6 +38,8 @@ technology (LLVM) as the proprietary ARM compiler for code generation. `_) * `nRF52840-MDK `_ (`nRF52840 `_) + * `reel board `_ (`nRF52840 + `_) * `Nordic PCA10056 `_ (`nRF52840 `_) * `QEMU `_ (`LM3S6965 diff --git a/src/machine/board_reelboard.go b/src/machine/board_reelboard.go new file mode 100644 index 00000000..db9abaa1 --- /dev/null +++ b/src/machine/board_reelboard.go @@ -0,0 +1,35 @@ +// +build reelboard + +package machine + +const HasLowFrequencyCrystal = true + +// LEDs on the reel board +const ( + LED = LED1 + LED1 = LED_YELLOW + LED2 = LED_RED + LED3 = LED_GREEN + LED4 = LED_BLUE + LED_RED = 11 + LED_GREEN = 12 + LED_BLUE = 41 + LED_YELLOW = 13 +) + +// User "a" button on the reel board +const ( + BUTTON = 7 +) + +// UART pins +const ( + UART_TX_PIN = 6 + UART_RX_PIN = 8 +) + +// I2C pins +const ( + SDA_PIN = 26 + SCL_PIN = 27 +) diff --git a/targets/reelboard.json b/targets/reelboard.json new file mode 100644 index 00000000..208e8213 --- /dev/null +++ b/targets/reelboard.json @@ -0,0 +1,7 @@ +{ + "inherits": ["nrf52840"], + "build-tags": ["reelboard"], + "flash": "openocd -f interface/cmsis-dap.cfg -f target/nrf51.cfg -c 'program {hex} reset exit'", + "ocd-daemon": ["openocd", "-f", "interface/cmsis-dap.cfg", "-f", "target/nrf51.cfg"], + "gdb-initial-cmds": ["target remote :3333", "monitor halt", "load", "monitor reset", "c"] +}