Closed explicite closed 3 years ago
For some reason, CI is failing right now ... I'm not quite sure why, maybe you can take a look and check whether this is also happening for you locally?
make: *** No rule to make target 'src/devices/atmega4809/mod.rs', needed by 'atmega4809'. Stop.
From CI and on local machine.
Should I run svd2rust on svd and then copy mod.rs?
Ah, I see. I think the issue is that you must add a patch/atmega4809.yaml
file for the Makefile to work right now ...
patch/atmega4809.yaml
added. I was able to define ports from common. make
pass. Still spot some problems with keaywords on rs
error: expected identifier, found keyword `async`
--> src/devices/atmega4809/tcb0/ctrlb.rs:248:12
|
248 | pub fn async(&self) -> ASYNC_R {
| ^^^^^ expected identifier, found keyword
|
help: you can escape reserved keywords to use them as identifiers
|
248 | pub fn r#async(&self) -> ASYNC_R {
| ^^^^^^^
Will try to dig into patching.
Newer versions (built from git) of svd2rust
automatically sanitize names that are keywords in rust. But using those is currently blocked on Rahix/atdf2svd#13 ...
@Rahix make
pass with common patch for ports
. Should I fix something more in https://github.com/Rahix/atdf2svd?
Looks like we need to release it and then I can back to this and refine patches.
I just released version 0.2.0 of atdf2svd
so you're good to go! I recommend working with the git version of svd2rust
as well
I started with AC. Still not sure what is the logic. @Rahix do we have any guide for this?
First diff which I spotted are modes for AC. From read-write
we moved to read-only
The right version is the patched one so the move was from read-only
to read-write
actually.
I'd take a look at the patches in common/
and check if the changes that are done in each one also look necessary for ATmega4809
. If yes, include the patch. Similarly for the timers, but you'll have to check which type of timers are used in your MCU.
Don't worry about patching everything from the get-go. If all the common patches which apply are included, this is already a pretty good foundation and hopefully enough to make a HAL implementation work.
Only common/ports.yaml
works without any changes. For rest I need to create custom patches. Should this be done with mcu suffix or in nested dir?
common/usart.yaml
svdtools.patch.MissingRegisterError: Could not find USART0:UCSR?A
common/as.yaml
svdtools.patch.MissingPeripheralError: Could not find AC
common/adc.yaml
svdtools.patch.MissingPeripheralError: Could not find ADC
common/spi.yaml
svdtools.patch.MissingRegisterError: Could not find SPI0:SPSR
common/twi.yaml
svdtools.patch.MissingRegisterError: Could not find TWI0:TWCR
common/usart.yaml
svdtools.patch.MissingRegisterError: Could not find USART0:UCSR?A
common/wdt.yaml
svdtools.patch.MissingRegisterError: Could not find WDT:WDTCSR,WDTCR
hmm, I'd create a subdir atmega_0x/
.
But it looks like the peripherals differ substantially from the ones we currently have on the other MCUs. So it's probably not directly obvious what needs to be patches unless you want to go through the datasheet line by line ...
I'd actually keep patching to a minimun for now, and check back later, while doing the HAL implementation to see where changes are necessary.
Thanks a lot!
Scaffold for #62