Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 91 additions & 37 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -215,58 +215,112 @@ fmt-check: ## Warn if any source needs reformatting

gen-device: gen-device-avr gen-device-esp gen-device-nrf gen-device-sam gen-device-sifive gen-device-kendryte gen-device-nxp gen-device-rp ## Generate microcontroller-specific sources
ifneq ($(RENESAS), 0)
gen-device: gen-device-renesas
# Renesas is currently unused
#gen-device: gen-device-renesas
endif
ifneq ($(STM32), 0)
gen-device: gen-device-stm32
endif

gen-device-avr:
@if [ ! -e lib/avr/README.md ]; then echo "Submodules have not been downloaded. Please download them using:\n git submodule update --init"; exit 1; fi
$(GO) build -o ./build/gen-device-avr ./tools/gen-device-avr/
./build/gen-device-avr lib/avr/packs/atmega src/device/avr/
./build/gen-device-avr lib/avr/packs/tiny src/device/avr/
@GO111MODULE=off $(GO) fmt ./src/device/avr
build/gen-device-%: ./tools/gen-device-%/*.go
$(GO) build -o $@ ./tools/gen-device-$*/

build/gen-device-svd: ./tools/gen-device-svd/*.go
$(GO) build -o $@ ./tools/gen-device-svd/
gen-device-avr: gen-device-atmega gen-device-attiny

gen-device-esp: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/Espressif-Community -interrupts=software lib/cmsis-svd/data/Espressif-Community/ src/device/esp/
./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/Espressif -interrupts=software lib/cmsis-svd/data/Espressif/ src/device/esp/
GO111MODULE=off $(GO) fmt ./src/device/esp
# ATmega

gen-device-nrf: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/NordicSemiconductor/nrfx/tree/master/mdk lib/nrfx/mdk/ src/device/nrf/
GO111MODULE=off $(GO) fmt ./src/device/nrf
DEVICES_AVR_MEGA = 1280 1284P 2560 328PB 328P 32U4

gen-device-nxp: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/NXP lib/cmsis-svd/data/NXP/ src/device/nxp/
GO111MODULE=off $(GO) fmt ./src/device/nxp
gen-device-atmega: $(foreach m,$(DEVICES_AVR_MEGA),src/device/avr/ATmega$(m).go src/device/avr/ATmega$(m).s src/device/avr/ATmega$(m).ld)

gen-device-sam: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/Atmel lib/cmsis-svd/data/Atmel/ src/device/sam/
GO111MODULE=off $(GO) fmt ./src/device/sam
src/device/avr/ATmega%.go src/device/avr/ATmega%.s src/device/avr/ATmega%.ld: lib/avr/packs/atmega/ATmega%.atdf build/gen-device-avr
build/gen-device-avr $< src/device/avr/ATmega$*.go src/device/avr/ATmega$*.s src/device/avr/ATmega$*.ld

gen-device-sifive: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/SiFive-Community -interrupts=software lib/cmsis-svd/data/SiFive-Community/ src/device/sifive/
GO111MODULE=off $(GO) fmt ./src/device/sifive
# ATtiny

gen-device-kendryte: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/Kendryte-Community -interrupts=software lib/cmsis-svd/data/Kendryte-Community/ src/device/kendryte/
GO111MODULE=off $(GO) fmt ./src/device/kendryte
DEVICES_AVR_TINY = 1616 85

gen-device-stm32: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/tinygo-org/stm32-svd lib/stm32-svd/svd src/device/stm32/
GO111MODULE=off $(GO) fmt ./src/device/stm32
gen-device-attiny: $(foreach m,$(DEVICES_AVR_TINY),src/device/avr/ATtiny$(m).go src/device/avr/ATtiny$(m).s src/device/avr/ATtiny$(m).ld)

gen-device-rp: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/RaspberryPi lib/cmsis-svd/data/RaspberryPi/ src/device/rp/
GO111MODULE=off $(GO) fmt ./src/device/rp
src/device/avr/ATtiny%.go src/device/avr/ATtiny%.s src/device/avr/ATtiny%.ld: lib/avr/packs/tiny/ATtiny%.atdf build/gen-device-avr
build/gen-device-avr $< src/device/avr/ATtiny$*.go src/device/avr/ATtiny$*.s src/device/avr/ATtiny$*.ld

# Espressif

# Both Espressif and Espressif-Community define esp32.
# The Espressif directory takes priority.

gen-device-esp: src/device/esp/esp32c3.go src/device/esp/esp32s3.go src/device/esp/esp32.go src/device/esp/esp8266.go

src/device/esp/%.go: lib/cmsis-svd/data/Espressif/%.svd build/gen-device-svd
build/gen-device-svd -url=https://github.com/posborne/cmsis-svd/tree/master/data/Espressif -interrupts=software $< $@

src/device/esp/%.go: lib/cmsis-svd/data/Espressif-Community/%.svd build/gen-device-svd
build/gen-device-svd -url=https://github.com/posborne/cmsis-svd/tree/master/data/Espressif-Community -interrupts=software $< $@

# NRF

DEVICES_NRF = 51 52833 52840 52

gen-device-nrf: $(foreach m,$(DEVICES_NRF),src/device/nrf/nrf$(m).go src/device/nrf/nrf$(m).s)

src/device/nrf/nrf%.go src/device/nrf/nrf%.s: lib/nrfx/mdk/nrf%.svd build/gen-device-svd
build/gen-device-svd -url=https://github.com/NordicSemiconductor/nrfx/tree/master/mdk -asm=src/device/nrf/nrf$*.s $< src/device/nrf/nrf$*.go

# NXP

DEVICES_NXP = MIMXRT1062 MK66F18

gen-device-nxp: $(foreach m,$(DEVICES_NXP),src/device/nxp/$(m).go src/device/nxp/$(m).s)

src/device/nxp/%.go src/device/nxp/%.s: lib/cmsis-svd/data/NXP/%.svd build/gen-device-svd
build/gen-device-svd -url=https://github.com/posborne/cmsis-svd/tree/master/data/NXP -asm=src/device/nxp/$*.s $< src/device/nxp/$*.go

# SAM

DEVICES_SAM = D21E18A D21G18A D51G19A D51J19A D51J20A D51P19A D51P20A D51J19A E51J19A E54P20A

gen-device-sam: $(foreach m,$(DEVICES_SAM),src/device/sam/ATSAM$(m).go src/device/sam/ATSAM$(m).s)

src/device/sam/ATSAM%.go src/device/sam/ATSAM%.s: lib/cmsis-svd/data/Atmel/ATSAM%.svd build/gen-device-svd
build/gen-device-svd -url=https://github.com/posborne/cmsis-svd/tree/master/data/Atmel -asm=src/device/sam/ATSAM$*.s $< src/device/sam/ATSAM$*.go

# SiFive

DEVICES_SIFIVE = e310x

gen-device-sifive: $(foreach m,$(DEVICES_SIFIVE),src/device/sifive/$(m).go)

src/device/sifive/%.go: lib/cmsis-svd/data/SiFive-Community/%.svd build/gen-device-svd
build/gen-device-svd -url=https://github.com/posborne/cmsis-svd/tree/master/data/SiFive-Community -interrupts=software $< $@

# Kendryte

DEVICES_KENDRYTE = 210

gen-device-kendryte: $(foreach m,$(DEVICES_KENDRYTE),src/device/kendryte/k$(m).go)

src/device/kendryte/k%.go: lib/cmsis-svd/data/Kendryte-Community/k%.svd build/gen-device-svd
build/gen-device-svd -url=https://github.com/posborne/cmsis-svd/tree/master/data/Kendryte-Community -interrupts=software $< $@

# STM32

DEVICES_STM32 = f103 f405 f407 f469 f722 g0b1 l4r5 l0x1 l0x2 l4x2 l4x5 l4x6 l552 u585 wl5x_cm4 wle5

gen-device-stm32: $(foreach m,$(DEVICES_STM32),src/device/stm32/stm32$(m).go src/device/stm32/stm32$(m).s)

src/device/stm32/stm32%.go src/device/stm32/stm32%.s: lib/stm32-svd/svd/stm32%.svd build/gen-device-svd
build/gen-device-svd -url=https://github.com/tinygo-org/stm32-svd -asm=src/device/stm32/stm32$*.s $< src/device/stm32/stm32$*.go

# Raspberry Pi

DEVICES_RP = 2040 2350

gen-device-rp: $(foreach m,$(DEVICES_RP),src/device/rp/rp$(m).go src/device/rp/rp$(m).s)

src/device/rp/rp%.go src/device/rp/rp%.s: lib/cmsis-svd/data/RaspberryPi/rp%.svd build/gen-device-svd
build/gen-device-svd -url=https://github.com/posborne/cmsis-svd/tree/master/data/RaspberryPi -asm=src/device/rp/rp$*.s $< src/device/rp/rp$*.go

gen-device-renesas: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/cmsis-svd/cmsis-svd-data/tree/master/data/Renesas lib/cmsis-svd/data/Renesas/ src/device/renesas/
GO111MODULE=off $(GO) fmt ./src/device/renesas

$(LLVM_PROJECTDIR)/llvm:
git clone -b tinygo_20.x --depth=1 https://github.com/tinygo-org/llvm-project $(LLVM_PROJECTDIR)
Expand Down
Empty file added src/device/kendryte/.gitignore
Empty file.
Empty file added src/device/sifive/.gitignore
Empty file.
Empty file added src/device/stm32/.gitignore
Empty file.
4 changes: 2 additions & 2 deletions targets/atmega1280.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"ldflags": [
"--defsym=_stack_size=512"
],
"linkerscript": "src/device/avr/atmega1280.ld",
"linkerscript": "src/device/avr/ATmega1280.ld",
"extra-files": [
"targets/avr.S",
"src/device/avr/atmega1280.s"
"src/device/avr/ATmega1280.s"
]
}
4 changes: 2 additions & 2 deletions targets/atmega1284p.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"--defsym=_bootloader_size=0",
"--defsym=_stack_size=512"
],
"linkerscript": "src/device/avr/atmega1284p.ld",
"linkerscript": "src/device/avr/ATmega1284P.ld",
"extra-files": [
"targets/avr.S",
"src/device/avr/atmega1284p.s"
"src/device/avr/ATmega1284P.s"
],
"emulator": "simavr -m atmega1284p -f 20000000 {}"
}
4 changes: 2 additions & 2 deletions targets/atmega2560.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"ldflags": [
"--defsym=_stack_size=512"
],
"linkerscript": "src/device/avr/atmega2560.ld",
"linkerscript": "src/device/avr/ATmega2560.ld",
"extra-files": [
"targets/avr.S",
"src/device/avr/atmega2560.s"
"src/device/avr/ATmega2560.s"
]
}
4 changes: 2 additions & 2 deletions targets/atmega328p.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"cpu": "atmega328p",
"build-tags": ["atmega328p", "atmega", "avr5"],
"serial": "uart",
"linkerscript": "src/device/avr/atmega328p.ld",
"linkerscript": "src/device/avr/ATmega328P.ld",
"extra-files": [
"targets/avr.S",
"src/device/avr/atmega328p.s"
"src/device/avr/ATmega328P.s"
]
}
4 changes: 2 additions & 2 deletions targets/atmega328pb.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"--defsym=_stack_size=512"
],
"serial": "uart",
"linkerscript": "src/device/avr/atmega328pb.ld",
"linkerscript": "src/device/avr/ATmega328PB.ld",
"extra-files": [
"targets/avr.S",
"src/device/avr/atmega328pb.s"
"src/device/avr/ATmega328PB.s"
]
}
4 changes: 2 additions & 2 deletions targets/atmega32u4.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"cpu": "atmega32u4",
"build-tags": ["atmega32u4", "avr5"],
"serial": "none",
"linkerscript": "src/device/avr/atmega32u4.ld",
"linkerscript": "src/device/avr/ATmega32U4.ld",
"extra-files": [
"targets/avr.S",
"src/device/avr/atmega32u4.s"
"src/device/avr/ATmega32U4.s"
]
}
2 changes: 1 addition & 1 deletion targets/atsamd21e18a.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"serial": "usb",
"linkerscript": "targets/atsamd21.ld",
"extra-files": [
"src/device/sam/atsamd21e18a.s"
"src/device/sam/ATSAMD21E18A.s"
],
"openocd-transport": "swd",
"openocd-target": "at91samdXX"
Expand Down
2 changes: 1 addition & 1 deletion targets/atsamd21g18a.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"serial": "usb",
"linkerscript": "targets/atsamd21.ld",
"extra-files": [
"src/device/sam/atsamd21g18a.s"
"src/device/sam/ATSAMD21G18A.s"
],
"openocd-transport": "swd",
"openocd-target": "at91samdXX"
Expand Down
2 changes: 1 addition & 1 deletion targets/atsamd51g19a.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"build-tags": ["atsamd51g19a", "atsamd51g19", "atsamd51", "sam"],
"linkerscript": "targets/atsamd51.ld",
"extra-files": [
"src/device/sam/atsamd51g19a.s"
"src/device/sam/ATSAMD51G19A.s"
],
"openocd-transport": "swd",
"openocd-target": "atsame5x"
Expand Down
2 changes: 1 addition & 1 deletion targets/atsamd51j19a.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"build-tags": ["atsamd51j19a", "atsamd51j19", "atsamd51", "sam"],
"linkerscript": "targets/atsamd51.ld",
"extra-files": [
"src/device/sam/atsamd51j19a.s"
"src/device/sam/ATSAMD51J19A.s"
],
"openocd-transport": "swd",
"openocd-target": "atsame5x"
Expand Down
2 changes: 1 addition & 1 deletion targets/atsamd51j20a.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"build-tags": ["sam", "atsamd51", "atsamd51j20", "atsamd51j20a"],
"linkerscript": "targets/atsamd51j20a.ld",
"extra-files": [
"src/device/sam/atsamd51j20a.s"
"src/device/sam/ATSAMD51J20A.s"
],
"openocd-transport": "swd",
"openocd-target": "atsame5x"
Expand Down
2 changes: 1 addition & 1 deletion targets/atsamd51p19a.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"build-tags": ["atsamd51p19a", "atsamd51p19", "atsamd51", "sam"],
"linkerscript": "targets/atsamd51.ld",
"extra-files": [
"src/device/sam/atsamd51p19a.s"
"src/device/sam/ATSAMD51P19A.s"
],
"openocd-transport": "swd",
"openocd-target": "atsame5x"
Expand Down
2 changes: 1 addition & 1 deletion targets/atsamd51p20a.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"build-tags": ["sam", "atsamd51", "atsamd51p20", "atsamd51p20a"],
"linkerscript": "targets/atsamd51p20a.ld",
"extra-files": [
"src/device/sam/atsamd51p20a.s"
"src/device/sam/ATSAMD51P20A.s"
],
"openocd-transport": "swd",
"openocd-target": "atsame5x"
Expand Down
2 changes: 1 addition & 1 deletion targets/atsame51j19a.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"build-tags": ["atsame51j19a", "atsame51j19", "atsame51", "atsame5x", "sam"],
"linkerscript": "targets/atsame5xx19.ld",
"extra-files": [
"src/device/sam/atsame51j19a.s"
"src/device/sam/ATSAME51J19A.s"
],
"openocd-transport": "swd",
"openocd-target": "atsame5x"
Expand Down
2 changes: 1 addition & 1 deletion targets/atsame54p20a.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"build-tags": ["sam", "atsame5x", "atsame54", "atsame54p20", "atsame54p20a"],
"linkerscript": "targets/atsame5xx20-no-bootloader.ld",
"extra-files": [
"src/device/sam/atsame54p20a.s"
"src/device/sam/ATSAME54P20A.s"
],
"openocd-transport": "swd",
"openocd-target": "atsame5x"
Expand Down
4 changes: 2 additions & 2 deletions targets/attiny1616.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"cflags": [
"-D__AVR_ARCH__=103"
],
"linkerscript": "src/device/avr/attiny1616.ld",
"linkerscript": "src/device/avr/ATtiny1616.ld",
"extra-files": [
"src/device/avr/attiny1616.s"
"src/device/avr/ATtiny1616.s"
],
"flash-command": "pymcuprog write -f {hex} --erase --verify -d attiny1616 -t uart -u {port}"
}
4 changes: 2 additions & 2 deletions targets/attiny85.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"cflags": [
"-D__AVR_ARCH__=25"
],
"linkerscript": "src/device/avr/attiny85.ld",
"linkerscript": "src/device/avr/ATtiny85.ld",
"extra-files": [
"targets/avr.S",
"src/device/avr/attiny85.s"
"src/device/avr/ATtiny85.s"
]
}
3 changes: 1 addition & 2 deletions targets/teensy36.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
"serial": "uart",
"linkerscript": "targets/nxpmk66f18.ld",
"extra-files": [
"src/device/nxp/mk66f18.s",
"src/device/nxp/MK66F18.s",
"targets/teensy36.s"
],
"flash-command": "teensy_loader_cli -mmcu=mk66fx1m0 -v -w {hex}"
}

2 changes: 1 addition & 1 deletion targets/teensy40.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"automatic-stack-size": false,
"linkerscript": "targets/mimxrt1062-teensy40.ld",
"extra-files": [
"src/device/nxp/mimxrt1062.s",
"src/device/nxp/MIMXRT1062.s",
"targets/teensy40.s"
],
"flash-command": "teensy_loader_cli -mmcu=imxrt1062 -v -w {hex}"
Expand Down
2 changes: 1 addition & 1 deletion targets/teensy41.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"automatic-stack-size": false,
"linkerscript": "targets/mimxrt1062-teensy40.ld",
"extra-files": [
"src/device/nxp/mimxrt1062.s",
"src/device/nxp/MIMXRT1062.s",
"targets/teensy40.s"
],
"flash-command": "teensy_loader_cli -mmcu=imxrt1062 -v -w {hex}"
Expand Down
Loading
Loading