Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

machine/atmega328pb: refactor to actually support this chip #4016

Merged
merged 1 commit into from
Dec 2, 2023

Conversation

ysoldak
Copy link
Contributor

@ysoldak ysoldak commented Nov 29, 2023

This fixes support for atmega328pb chip, code for which does not actually compile now.

The reason is pb variant has two of I2C and SPI interfaces compared with other atmega chips that only have one of each. This results in respective registers naming mismatch and compilation failure.

Also, PWM support for pb variant was implemented only rudimentary, this PR fixes that too.


Adding atmega328pb.json target file (see in this PR) and running a simple compilation results in multiple errors this PR fixes.

$ tinygo build -size short -o test.hex -target=atmega328pb examples/blinkm
# machine
/Users/yursol/Private/code/tinygo/src/machine/machine_atmega328pb.go:46:11: undefined: PWM
/Users/yursol/Private/code/tinygo/src/machine/machine_atmega328pb.go:58:11: undefined: PWM
/Users/yursol/Private/code/tinygo/src/machine/machine_atmega328pb.go:97:8: undefined: PB5
...
/Users/yursol/Private/code/tinygo/src/machine/machine_atmega328pb.go:109:8: undefined: PE2
/Users/yursol/Private/code/tinygo/src/machine/machine_atmega.go:40:6: undefined: avr.TWSR
/Users/yursol/Private/code/tinygo/src/machine/machine_atmega.go:40:24: undefined: avr.TWSR_TWPS0
/Users/yursol/Private/code/tinygo/src/machine/machine_atmega.go:40:41: undefined: avr.TWSR_TWPS1
/Users/yursol/Private/code/tinygo/src/machine/machine_atmega.go:46:6: undefined: avr.TWBR
...
/Users/yursol/Private/code/tinygo/src/machine/machine_atmega.go:176:10: undefined: CPUFrequency
/Users/yursol/Private/code/tinygo/src/machine/machine_atmega.go:263:22: undefined: CPUFrequency
/Users/yursol/Private/code/tinygo/src/machine/machine_atmega.go:267:22: undefined: avr.SPCR_SPR0
/Users/yursol/Private/code/tinygo/src/machine/machine_atmega.go:267:38: undefined: avr.SPCR_SPR1
/Users/yursol/Private/code/tinygo/src/machine/machine_atmega.go:269:22: undefined: avr.SPCR_SPR1
...
/Users/yursol/Private/code/tinygo/src/machine/machine_atmega328pb.go:78:7: undefined: PB2
/Users/yursol/Private/code/tinygo/src/machine/machine_atmega328pb.go:83:7: undefined: PB3

@ysoldak ysoldak changed the title machine/atmega328pb: refactor to enable extra uart machine/atmega328pb: refactor to actually support this chip Nov 29, 2023
@ysoldak ysoldak marked this pull request as ready for review November 29, 2023 22:17
@deadprogram
Copy link
Member

Passed the HCI tests, so merging. Thanks @ysoldak

@deadprogram deadprogram merged commit 6420e90 into tinygo-org:dev Dec 2, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants