mirror of https://github.com/tinygo-org/tinygo.git
Ayke van Laethem
6 years ago
10 changed files with 139 additions and 22 deletions
@ -0,0 +1,32 @@ |
|||||
|
// +build nrf,microbit
|
||||
|
|
||||
|
package machine |
||||
|
|
||||
|
// The micro:bit does not have a 32kHz crystal on board.
|
||||
|
const HasLowFrequencyCrystal = false |
||||
|
|
||||
|
// Buttons on the micro:bit (A and B)
|
||||
|
const ( |
||||
|
BUTTON = BUTTON1 |
||||
|
BUTTON1 = 5 |
||||
|
BUTTON2 = 11 |
||||
|
) |
||||
|
|
||||
|
// UART pins
|
||||
|
const ( |
||||
|
UART_TX_PIN = 24 |
||||
|
UART_RX_PIN = 25 |
||||
|
) |
||||
|
|
||||
|
// ADC pins
|
||||
|
const ( |
||||
|
ADC0 = 0 |
||||
|
ADC1 = 1 |
||||
|
ADC2 = 2 |
||||
|
) |
||||
|
|
||||
|
// I2C pins
|
||||
|
const ( |
||||
|
SDA_PIN = 20 |
||||
|
SCL_PIN = 19 |
||||
|
) |
@ -0,0 +1,17 @@ |
|||||
|
// +build nrf51
|
||||
|
|
||||
|
package machine |
||||
|
|
||||
|
import ( |
||||
|
"device/nrf" |
||||
|
) |
||||
|
|
||||
|
// Get peripheral and pin number for this GPIO pin.
|
||||
|
func (p GPIO) getPortPin() (*nrf.GPIO_Type, uint8) { |
||||
|
return nrf.GPIO, p.Pin |
||||
|
} |
||||
|
|
||||
|
//go:export UART0_IRQHandler
|
||||
|
func handleUART0() { |
||||
|
UART0.handleInterrupt() |
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
{ |
||||
|
"llvm-target": "armv6m-none-eabi", |
||||
|
"build-tags": ["microbit", "nrf51822", "nrf51", "nrf", "arm", "js", "wasm"], |
||||
|
"linker": "arm-none-eabi-gcc", |
||||
|
"pre-link-args": [ |
||||
|
"-nostdlib", |
||||
|
"-nostartfiles", |
||||
|
"-mcpu=cortex-m0", |
||||
|
"-mthumb", |
||||
|
"-T", "targets/nrf51.ld", |
||||
|
"-Wl,--gc-sections", |
||||
|
"-fno-exceptions", "-fno-unwind-tables", |
||||
|
"-ffunction-sections", "-fdata-sections", |
||||
|
"-Os", |
||||
|
"-DNRF51", |
||||
|
"-Ilib/CMSIS/CMSIS/Include", |
||||
|
"lib/nrfx/mdk/system_nrf51.c", |
||||
|
"src/device/nrf/nrf51.s" |
||||
|
], |
||||
|
"objcopy": "arm-none-eabi-objcopy", |
||||
|
"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": "arm-none-eabi-gdb", |
||||
|
"gdb-initial-cmds": ["target remote :3333", "monitor halt", "load", "monitor reset", "c"] |
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
|
||||
|
MEMORY |
||||
|
{ |
||||
|
FLASH_TEXT (rw) : ORIGIN = 0x00000000, LENGTH = 256K /* .text */ |
||||
|
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 16K |
||||
|
} |
||||
|
|
||||
|
_stack_size = 2K; |
||||
|
|
||||
|
INCLUDE "targets/arm.ld" |
Loading…
Reference in new issue