avr-device icon indicating copy to clipboard operation
avr-device copied to clipboard

ATxmega128A1 support

Open bidinzky opened this issue 3 years ago • 9 comments

Hello,

I tried to add support for the ATxmega128A1, but the ATxmega128A1.atdf I get errors while I execute make. e.g. size not found on <register-group name="CH0" name-in-module="DMA_CH"... Am I missing something?

bidinzky avatar Jul 24 '20 22:07 bidinzky

Can you paste the full error log please?

Rahix avatar Jul 25 '20 10:07 Rahix

Okay, from a quick glance it looks like this chip will need a few changed in atdf2svd ... There's some differences in the XML compared to the other files we've been working with so far.

Rahix avatar Jul 25 '20 10:07 Rahix

Can you paste the full error log please?

This is the first error when i try with the shipped Atxmega128A1.atdf. SVD2RUST ATxmega128A1 thread 'main' panicked at 'called Result::unwrap()on anErrvalue: Malformed XML. 1:1 Unexpected end of stream: no root element found', C:\Users\binde\.cargo\registry\src\github.com-1ecc6299db9ec823\svd2rust-0.17.0\src/main.rs:96:34 note: run withRUST_BACKTRACE=1environment variable to display a backtrace make: *** [Makefile:35: src/devices/ATxmega128A1/mod.full.rs] Error 101

If i format the XML i get the Error: ATDF2SVD ATxmega128A1 Error: Missing attribute "caption" on <instance name="GPIO" ...> make: *** [Makefile:19: svd/ATxmega128A1.bare.svd] Error 1

bidinzky avatar Jul 25 '20 12:07 bidinzky

The missing "caption" error should be easy to fix. The size not found ones are a bit more difficult. It looks like the structure in your ATDF file is different from what I've seen so far; the current code does not know how to handle that correctly. If I understood the file correctly, the peripheral 'modules' are split into multiple XML elements which we somehow need to recombine in atdf2svd. We'll have to take a closer look what exactly needs to be done ...

Rahix avatar Jul 25 '20 13:07 Rahix

Îs there any kind of definition for the atdf and what is needed for svd? If so i can maybe try add it myself.

bidinzky avatar Jul 25 '20 16:07 bidinzky

Not that I know of :/ We worked backwards from the files and guessed how things are supposed to fit together.

If you want to take a stab at adding support for your file to atdf2svd, I would suggest cross-referencing the code with a working file (e.g. ATmega32U4) and then see where the differences are in your file. The goal is to fill the structs in chip.rs with values from the atdf file.

I would suggest we open a tracking issue in atdf2svd and I'll also take a look and post there if I have ideas.

Rahix avatar Jul 25 '20 16:07 Rahix

I think I found (at least one) culprit: https://github.com/Rahix/atdf2svd/issues/4

Rahix avatar Jul 25 '20 16:07 Rahix

I've pushed some commits to atfd2svd which should now at least allow building something. But most of that is workarounds which means that the generated SVD files is missing some register definitions and, for your case, also doesn't contain interrupt definitions.

Rahix avatar Jul 25 '20 19:07 Rahix

Not that I know of :/ We worked backwards from the files and guessed how things are supposed to fit together.

If you want to take a stab at adding support for your file to atdf2svd, I would suggest cross-referencing the code with a working file (e.g. ATmega32U4) and then see where the differences are in your file. The goal is to fill the structs in chip.rs with values from the atdf file.

I would suggest we open a tracking issue in atdf2svd and I'll also take a look and post there if I have ideas.

I will look into it when i have some spare time maybe i can help. But i guess the progress should be tracked on atdf2svd via https://github.com/Rahix/atdf2svd/issues/4.

bidinzky avatar Jul 29 '20 11:07 bidinzky