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

Peripherals #1

Open
21 of 23 tasks
Disasm opened this issue Apr 9, 2019 · 13 comments
Open
21 of 23 tasks

Peripherals #1

Disasm opened this issue Apr 9, 2019 · 13 comments
Labels
help wanted Extra attention is needed

Comments

@Disasm
Copy link
Member

Disasm commented Apr 9, 2019

@Disasm Disasm added the help wanted Extra attention is needed label Apr 9, 2019
@burrbull
Copy link
Contributor

As I understand it, you pull them out from SDK?

@Disasm
Copy link
Member Author

Disasm commented Apr 16, 2019

@burrbull SYSCTL and FPIOA were parsed from the SDK, but UARTHS and GPIOHS were taken from e310x with minimal changes.

@burrbull
Copy link
Contributor

Попробую I2C набрать.

@Disasm
Copy link
Member Author

Disasm commented Apr 16, 2019

@burrbull You can modify my script for this purpose. Automation makes process less boring and error-prone.

@burrbull
Copy link
Contributor

DMAC has 64-bit registers. Is it normal? As I see, svd2rust doesn't support 64.

@Disasm
Copy link
Member Author

Disasm commented Apr 19, 2019

@burrbull I'll try to figure out what to do with this, but if there is no way to declare 64-bit register, you can use two 32-bit registers with _lo and _hi siffixes or something like that.

@burrbull
Copy link
Contributor

Are you sure that writing a half of register is safe? I'm not.

@Disasm
Copy link
Member Author

Disasm commented Apr 20, 2019

I'm not sure either. I see at least one major problem: such half-accesses may be forbidden in hardware, but this behavior can be checked.

@laanwj
Copy link
Collaborator

laanwj commented May 4, 2019

DMAC has 64-bit registers. Is it normal? As I see, svd2rust doesn't support 64.

Ran into this too for the KPU (#14).

Are you sure that writing a half of register is safe? I'm not.

My experience is that it isn't. I don't know about 32 versus 64 bit but I ran into a problem where the C compiler would optimize accesses to 8-bit subfields of the FPIOA as byte writes which the hardware simply ignored (sipeed/LicheeDan_K210_examples#3).

Edit: also, I expect this to interact badly with FIFO-like registers such as the layer argument FIFO for the KPU. Writing both halves separately, if not ignored completely, would likely fill two slots in the FIFO.

@laanwj
Copy link
Collaborator

laanwj commented May 20, 2019

PRs exist for:

This leaves:

  • FFT
  • SPI2 (slave)

and (but this one is going to be problematic as (AFAIK) no public documentation exists for it):

  • OTP

@Disasm
Copy link
Member Author

Disasm commented May 20, 2019

I have some reverse-engineering results for OTP, but they are far from usable at the moment. Maybe some experiments with it can give more information.

@laanwj
Copy link
Collaborator

laanwj commented May 20, 2019

I tried that for a bit but stopped short where I was afraid of bricking my chip 😄

@Disasm
Copy link
Member Author

Disasm commented May 20, 2019

No problem, I have three of these 😄

bors bot added a commit to rust-embedded/svd2rust that referenced this issue May 22, 2019
295: Add support for 64-bit registers r=therealprof a=Disasm

Some registers on K210 chip are 64-bit, so it's better to declare them as u64 in SVD for the reasons mentioned here: riscv-rust/k210-pac#1 (comment)
At the moment, svd2rust forbids 64-bit register declarations. This PR fixes this.

This change can cause silent bugs on platforms without 64-bit memory access operations due to the need for proper access sequence to 64-bit registers with two 32-bit accesses.

Closes #289

Co-authored-by: Vadim Kaushan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants