@@ -215,58 +215,112 @@ fmt-check: ## Warn if any source needs reformatting
215215
216216gen-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
217217ifneq ($(RENESAS ) , 0)
218- gen-device : gen-device-renesas
218+ # Renesas is currently unused
219+ # gen-device: gen-device-renesas
219220endif
220221ifneq ($(STM32 ) , 0)
221222gen-device : gen-device-stm32
222223endif
223224
224- gen-device-avr :
225- @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
226- $(GO ) build -o ./build/gen-device-avr ./tools/gen-device-avr/
227- ./build/gen-device-avr lib/avr/packs/atmega src/device/avr/
228- ./build/gen-device-avr lib/avr/packs/tiny src/device/avr/
229- @GO111MODULE=off $(GO ) fmt ./src/device/avr
225+ build/gen-device-% : ./tools/gen-device-% /* .go
226+ $(GO ) build -o $@ ./tools/gen-device-$* /
230227
231- build/gen-device-svd : ./tools/gen-device-svd/* .go
232- $(GO ) build -o $@ ./tools/gen-device-svd/
228+ gen-device-avr : gen-device-atmega gen-device-attiny
233229
234- gen-device-esp : build/gen-device-svd
235- ./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/
236- ./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/
237- GO111MODULE=off $(GO ) fmt ./src/device/esp
230+ # ATmega
238231
239- gen-device-nrf : build/gen-device-svd
240- ./build/gen-device-svd -source=https://github.com/NordicSemiconductor/nrfx/tree/master/mdk lib/nrfx/mdk/ src/device/nrf/
241- GO111MODULE=off $(GO ) fmt ./src/device/nrf
232+ DEVICES_AVR_MEGA = 1280 1284P 2560 328PB 328P 32U4
242233
243- gen-device-nxp : build/gen-device-svd
244- ./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/NXP lib/cmsis-svd/data/NXP/ src/device/nxp/
245- GO111MODULE=off $(GO ) fmt ./src/device/nxp
234+ 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)
246235
247- gen-device-sam : build/gen-device-svd
248- ./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/Atmel lib/cmsis-svd/data/Atmel/ src/device/sam/
249- GO111MODULE=off $(GO ) fmt ./src/device/sam
236+ 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
237+ build/gen-device-avr $< src/device/avr/ATmega$* .go src/device/avr/ATmega$* .s src/device/avr/ATmega$* .ld
250238
251- gen-device-sifive : build/gen-device-svd
252- ./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/
253- GO111MODULE=off $(GO ) fmt ./src/device/sifive
239+ # ATtiny
254240
255- gen-device-kendryte : build/gen-device-svd
256- ./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/
257- GO111MODULE=off $(GO ) fmt ./src/device/kendryte
241+ DEVICES_AVR_TINY = 1616 85
258242
259- gen-device-stm32 : build/gen-device-svd
260- ./build/gen-device-svd -source=https://github.com/tinygo-org/stm32-svd lib/stm32-svd/svd src/device/stm32/
261- GO111MODULE=off $(GO ) fmt ./src/device/stm32
243+ 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)
262244
263- gen-device-rp : build/gen-device-svd
264- ./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/RaspberryPi lib/cmsis-svd/data/RaspberryPi/ src/device/rp/
265- GO111MODULE=off $(GO ) fmt ./src/device/rp
245+ 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
246+ build/gen-device-avr $< src/device/avr/ATtiny$* .go src/device/avr/ATtiny$* .s src/device/avr/ATtiny$* .ld
247+
248+ # Espressif
249+
250+ # Both Espressif and Espressif-Community define esp32.
251+ # The Espressif directory takes priority.
252+
253+ gen-device-esp : src/device/esp/esp32c3.go src/device/esp/esp32s3.go src/device/esp/esp32.go src/device/esp/esp8266.go
254+
255+ src/device/esp/% .go : lib/cmsis-svd/data/Espressif/% .svd build/gen-device-svd
256+ build/gen-device-svd -url=https://github.com/posborne/cmsis-svd/tree/master/data/Espressif -interrupts=software $< $@
257+
258+ src/device/esp/% .go : lib/cmsis-svd/data/Espressif-Community/% .svd build/gen-device-svd
259+ build/gen-device-svd -url=https://github.com/posborne/cmsis-svd/tree/master/data/Espressif-Community -interrupts=software $< $@
260+
261+ # NRF
262+
263+ DEVICES_NRF = 51 52833 52840 52
264+
265+ gen-device-nrf : $(foreach m,$(DEVICES_NRF ) ,src/device/nrf/nrf$(m ) .go src/device/nrf/nrf$(m ) .s)
266+
267+ src/device/nrf/nrf% .go src/device/nrf/nrf% .s : lib/nrfx/mdk/nrf% .svd build/gen-device-svd
268+ build/gen-device-svd -url=https://github.com/NordicSemiconductor/nrfx/tree/master/mdk -asm=src/device/nrf/nrf$* .s $< src/device/nrf/nrf$* .go
269+
270+ # NXP
271+
272+ DEVICES_NXP = MIMXRT1062 MK66F18
273+
274+ gen-device-nxp : $(foreach m,$(DEVICES_NXP ) ,src/device/nxp/$(m ) .go src/device/nxp/$(m ) .s)
275+
276+ src/device/nxp/% .go src/device/nxp/% .s : lib/cmsis-svd/data/NXP/% .svd build/gen-device-svd
277+ build/gen-device-svd -url=https://github.com/posborne/cmsis-svd/tree/master/data/NXP -asm=src/device/nxp/$* .s $< src/device/nxp/$* .go
278+
279+ # SAM
280+
281+ DEVICES_SAM = D21E18A D21G18A D51G19A D51J19A D51J20A D51P19A D51P20A D51J19A E51J19A E54P20A
282+
283+ gen-device-sam : $(foreach m,$(DEVICES_SAM ) ,src/device/sam/ATSAM$(m ) .go src/device/sam/ATSAM$(m ) .s)
284+
285+ src/device/sam/ATSAM% .go src/device/sam/ATSAM% .s : lib/cmsis-svd/data/Atmel/ATSAM% .svd build/gen-device-svd
286+ 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
287+
288+ # SiFive
289+
290+ DEVICES_SIFIVE = e310x
291+
292+ gen-device-sifive : $(foreach m,$(DEVICES_SIFIVE ) ,src/device/sifive/$(m ) .go)
293+
294+ src/device/sifive/% .go : lib/cmsis-svd/data/SiFive-Community/% .svd build/gen-device-svd
295+ build/gen-device-svd -url=https://github.com/posborne/cmsis-svd/tree/master/data/SiFive-Community -interrupts=software $< $@
296+
297+ # Kendryte
298+
299+ DEVICES_KENDRYTE = 210
300+
301+ gen-device-kendryte : $(foreach m,$(DEVICES_KENDRYTE ) ,src/device/kendryte/k$(m ) .go)
302+
303+ src/device/kendryte/k% .go : lib/cmsis-svd/data/Kendryte-Community/k% .svd build/gen-device-svd
304+ build/gen-device-svd -url=https://github.com/posborne/cmsis-svd/tree/master/data/Kendryte-Community -interrupts=software $< $@
305+
306+ # STM32
307+
308+ DEVICES_STM32 = f103 f405 f407 f469 f722 g0b1 l4r5 l0x1 l0x2 l4x2 l4x5 l4x6 l552 u585 wl5x_cm4 wle5
309+
310+ gen-device-stm32 : $(foreach m,$(DEVICES_STM32 ) ,src/device/stm32/stm32$(m ) .go src/device/stm32/stm32$(m ) .s)
311+
312+ src/device/stm32/stm32% .go src/device/stm32/stm32% .s : lib/stm32-svd/svd/stm32% .svd build/gen-device-svd
313+ build/gen-device-svd -url=https://github.com/tinygo-org/stm32-svd -asm=src/device/stm32/stm32$* .s $< src/device/stm32/stm32$* .go
314+
315+ # Raspberry Pi
316+
317+ DEVICES_RP = 2040 2350
318+
319+ gen-device-rp : $(foreach m,$(DEVICES_RP ) ,src/device/rp/rp$(m ) .go src/device/rp/rp$(m ) .s)
320+
321+ src/device/rp/rp% .go src/device/rp/rp% .s : lib/cmsis-svd/data/RaspberryPi/rp% .svd build/gen-device-svd
322+ 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
266323
267- gen-device-renesas : build/gen-device-svd
268- ./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/
269- GO111MODULE=off $(GO ) fmt ./src/device/renesas
270324
271325$(LLVM_PROJECTDIR ) /llvm :
272326 git clone -b tinygo_20.x --depth=1 https://github.com/tinygo-org/llvm-project $(LLVM_PROJECTDIR )
0 commit comments