all: add Arduino Nano support
Этот коммит содержится в:
родитель
e830acadf3
коммит
aeb2e6f70a
5 изменённых файлов: 54 добавлений и 12 удалений
2
Makefile
2
Makefile
|
@ -265,6 +265,8 @@ smoketest:
|
|||
ifneq ($(AVR), 0)
|
||||
$(TINYGO) build -size short -o test.hex -target=arduino examples/blinky1
|
||||
@$(MD5SUM) test.hex
|
||||
$(TINYGO) build -size short -o test.hex -target=arduino-nano examples/blinky1
|
||||
@$(MD5SUM) test.hex
|
||||
$(TINYGO) build -size short -o test.hex -target=digispark examples/blinky1
|
||||
@$(MD5SUM) test.hex
|
||||
endif
|
||||
|
|
27
src/machine/board_arduino_nano.go
Обычный файл
27
src/machine/board_arduino_nano.go
Обычный файл
|
@ -0,0 +1,27 @@
|
|||
// +build arduino_nano
|
||||
|
||||
package machine
|
||||
|
||||
// Return the current CPU frequency in hertz.
|
||||
func CPUFrequency() uint32 {
|
||||
return 16000000
|
||||
}
|
||||
|
||||
// LED on the Arduino
|
||||
const LED Pin = 13
|
||||
|
||||
// ADC on the Arduino
|
||||
const (
|
||||
ADC0 Pin = 0
|
||||
ADC1 Pin = 1
|
||||
ADC2 Pin = 2
|
||||
ADC3 Pin = 3
|
||||
ADC4 Pin = 4 // Used by TWI for SDA
|
||||
ADC5 Pin = 5 // Used by TWI for SCL
|
||||
)
|
||||
|
||||
// UART pins
|
||||
const (
|
||||
UART_TX_PIN Pin = 1
|
||||
UART_RX_PIN Pin = 0
|
||||
)
|
9
targets/arduino-nano.json
Обычный файл
9
targets/arduino-nano.json
Обычный файл
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"inherits": ["atmega328p"],
|
||||
"build-tags": ["arduino_nano"],
|
||||
"ldflags": [
|
||||
"-Wl,--defsym=_bootloader_size=512",
|
||||
"-Wl,--defsym=_stack_size=512"
|
||||
],
|
||||
"flash-command": "avrdude -c arduino -p atmega328p -b 57600 -P {port} -U flash:w:{hex}:i"
|
||||
}
|
|
@ -1,19 +1,9 @@
|
|||
{
|
||||
"inherits": ["avr"],
|
||||
"llvm-target": "avr-atmel-none",
|
||||
"cpu": "atmega328p",
|
||||
"build-tags": ["arduino", "atmega328p", "atmega", "avr5"],
|
||||
"cflags": [
|
||||
"-mmcu=atmega328p"
|
||||
],
|
||||
"inherits": ["atmega328p"],
|
||||
"build-tags": ["arduino"],
|
||||
"ldflags": [
|
||||
"-Wl,--defsym=_bootloader_size=512",
|
||||
"-Wl,--defsym=_stack_size=512"
|
||||
],
|
||||
"linkerscript": "src/device/avr/atmega328p.ld",
|
||||
"extra-files": [
|
||||
"targets/avr.S",
|
||||
"src/device/avr/atmega328p.s"
|
||||
],
|
||||
"flash-command": "avrdude -c arduino -p atmega328p -P {port} -U flash:w:{hex}:i"
|
||||
}
|
||||
|
|
14
targets/atmega328p.json
Обычный файл
14
targets/atmega328p.json
Обычный файл
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"inherits": ["avr"],
|
||||
"llvm-target": "avr-atmel-none",
|
||||
"cpu": "atmega328p",
|
||||
"build-tags": ["atmega328p", "atmega", "avr5"],
|
||||
"cflags": [
|
||||
"-mmcu=atmega328p"
|
||||
],
|
||||
"linkerscript": "src/device/avr/atmega328p.ld",
|
||||
"extra-files": [
|
||||
"targets/avr.S",
|
||||
"src/device/avr/atmega328p.s"
|
||||
]
|
||||
}
|
Загрузка…
Создание таблицы
Сослаться в новой задаче