diff options
author | Ayke van Laethem <[email protected]> | 2023-05-18 00:13:43 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2023-05-20 21:18:02 +0200 |
commit | 2fb866ca86e16d527e0c1413d8cf1093e217b4c2 (patch) | |
tree | 0ce0e32100df626f571c2bbe4674505df5a09bca /tools/gen-device-avr | |
parent | 4d11d552db47f55147eb171bfa4e35ce33de267d (diff) | |
download | tinygo-2fb866ca86e16d527e0c1413d8cf1093e217b4c2.tar.gz tinygo-2fb866ca86e16d527e0c1413d8cf1093e217b4c2.zip |
avr: add attiny1616 support
This is just support for the chip, no boards are currently supported.
However, you can use this target on a custom board.
Notes:
- This required a new runtime and machine implementation, because the
hardware is actually very different (and much nicer than older
AVRs!).
- I had to update gen-device-avr to support this chip. This also
affects the generated output of other AVRs, but I checked all chips
we support and there shouldn't be any backwards incompatible
changes.
- I did not implement peripherals like UART, I2C, SPI, etc because I
don't need them. That is left to do in the future.
You can flash these chips with only a UART and a 1kOhm resistor, which
is really nice (no special hardware needed). Here is the program I've
used for this purpose: https://pypi.org/project/pymcuprog/
Diffstat (limited to 'tools/gen-device-avr')
-rwxr-xr-x | tools/gen-device-avr/gen-device-avr.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/gen-device-avr/gen-device-avr.go b/tools/gen-device-avr/gen-device-avr.go index c660f8ca7..de32e3ed9 100755 --- a/tools/gen-device-avr/gen-device-avr.go +++ b/tools/gen-device-avr/gen-device-avr.go @@ -333,6 +333,15 @@ func readATDF(path string) (*Device, error) { } } + // Flash that is mapped into the data address space (attiny10, attiny1616, + // etc). + mappedFlashStart := int64(0) + for _, name := range []string{"MAPPED_PROGMEM", "MAPPED_FLASH"} { + if segment, ok := memorySizes["data"].Segments[name]; ok { + mappedFlashStart = segment.start + } + } + flashSize, err := strconv.ParseInt(memorySizes["prog"].Size, 0, 32) if err != nil { return nil, err @@ -379,6 +388,7 @@ func readATDF(path string) (*Device, error) { "flashSize": int(flashSize), "ramStart": ramStart, "ramSize": ramSize, + "mappedFlashStart": mappedFlashStart, "numInterrupts": len(device.Interrupts), }, interrupts: interrupts, @@ -629,6 +639,9 @@ func writeLD(outdir string, device *Device) error { /* Generated by gen-device-avr.go from {{.file}}, see {{.descriptorSource}} */ __flash_size = 0x{{printf "%x" .flashSize}}; +{{if .mappedFlashStart -}} +__mapped_flash_start = 0x{{printf "%x" .mappedFlashStart}}; +{{end -}} __ram_start = 0x{{printf "%x" .ramStart}}; __ram_size = 0x{{printf "%x" .ramSize}}; __num_isrs = {{.numInterrupts}}; |