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

avr-specs should probably use ISA rather than MCU model #342

Closed
rmsc opened this issue Sep 29, 2022 · 3 comments
Closed

avr-specs should probably use ISA rather than MCU model #342

rmsc opened this issue Sep 29, 2022 · 3 comments

Comments

@rmsc
Copy link

rmsc commented Sep 29, 2022

I am trying to add support for the attiny202 and similar devices. It turns out avr-gcc doesn't recognize --mmcu=attiny202, and instead required me to use --mmcu=avrxmega3, which is the MCU's ISA.

Looking at the relevant avr-gcc manual, it seems to me that specifying the ISA is all that's needed. Allowing the user to specify the MCU model seems to be just a convenience, and was probably just forgotten in the case of the latest attiny devices.

Looking at what is actually changed between avr-specs, I believe it would be a lot easier to maintain at most 17 json spec files (the current number of ISAs), rather than one file per MCU.

The specs are only needed for the rustc target, and are currently decoupled from the device selection using features.

I can submit a PR with these changes, just please let me know if it makes sense.

@Rahix
Copy link
Owner

Rahix commented Sep 30, 2022

Hi,

IIRC, this setting also influences which linker-script is used. As we don't currently specify one ourselves but instead rely on avr-gcc/avr-ld's linker scripts, this is important. The linker script will e.g. influence how much SRAM/FLASH space the program may fill.

This is an artifact of how the avr-device crate currently works. When our dependency on avr-libc is dropped (ref Rahix/avr-device#76), I think this will also not be relevant anymore. At that point, I think we'd also be able to do the change you propose.

@rmsc
Copy link
Author

rmsc commented Sep 30, 2022

I see what you mean. I didn't realize that there were differences between the core avrxmega3 gcc spec and the device-specific ones.

The linking problem I'm experiencing with --mmcu=attiny202 may actually be a bug in avr-libc:
avrdudes/avr-libc#890

@rmsc rmsc closed this as completed Sep 30, 2022
@rmsc
Copy link
Author

rmsc commented Sep 30, 2022

Actually it's a different bug in avr-libc that was fixed after the current stable version was released:
avrdudes/avr-libc@f445c5c

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

No branches or pull requests

2 participants