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

boards/mpfs-icicle-kit: add initial support (RV64IMAC core) #16994

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

dylad
Copy link
Member

@dylad dylad commented Oct 15, 2021

Contribution description

This is a draft PR which adds support for the Microchip PolarFire SoC (MPFS) Icicle kit Engineering Sample board. This board features a quad RV64GC core + one RV64IMAC (and a whole FPGA fabric). Only the single RV64IMAC (Our first 64bits MCU !) support is added by this PR as the idea is to let Linux runs on the quad RV64GC alongside RIOT on the single RV64IMAC.

You can find more informations for the board on microchip/microsemi website and the SoC documentation is available here

This PR also adds a basic support for 64bits RISC-V architecture and the PLIC controller.
In the current state, only UART, GPIO and timer peripherals (all w/ IRQ support) are implemented. Others peripherals should be added in followup PR.

I used the baremetal SDK as RIOT pkg to include vendor files and lowlevel drivers, except interruptions management which is done by RIOT PLIC driver. (MPFS SDK link)

SoftConsole environment can be downloaded here but registration is required.

SoftConsole is not really needed but it provides the custom openOCD needed for the flashing part.
It will not longer be needed if openOCD support is upstreamed.

A lot of documentation is missing, but the board is an "usable shape". I'd like to use this draft PR to discuss some specific points like 64bits architecture for RIOT.

All comments and feedbacks are very welcome.

Testing procedure

Beware that make flash is currently unsupported as the openOCD fork provided by SoftConsole environment (the default Eclipse environment for baremetal development provided by Microchip) currently doesn't implement the flash driver. There is an additionnal tool that can be used for flashing the eNVM but I didn't find time to look at it yet.
For now, RIOT only runs on the onboard LIM memory which is volatile. (One of the many reasons, this PR is a draft). Thus, in order to test any application, please use make debug for now. This command uses the combo openOCD/GDB to load the binary to the LIM memory.
It is also needed to use the openOCD provided by SoftConsole for now. (I hope everything will be upstream at some point).
Regarding the toolchain, standard riscv-unknown-elf-gcc can be used in theory but I didn't test it as I am using the riscv-unknown-elf-gcc toolchain provided by the SoftConsole envinronment.

Example make command for flashing tests/shell on mpfs-icicle-kit-es LIM memory.
OPENOCD=/path/to/openocd/bin/openocd make BOARD=mpfs-icicle-kit-es -C tests/shell debug

Please expect (a lot of) compilations errors with tests/ and examples/ applications because of "cast from pointer to integer of different size". This is because we heavily use int to cast void argument (like callback argument). I made some fixes for a few tests application but I don't think this subject should be handled by this PR. Thus, it should be fix in another set of PRs.

Issues/PRs references

None.

Many thanks to @polarfire-soc for providing me this awesome board !

@dylad dylad added State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Type: new feature The issue requests / The PR implemements a new feature for RIOT Area: boards Area: Board ports Platform: RISC-V Platform: This PR/issue effects RISC-V-based platforms Area: cpu Area: CPU/MCU ports labels Oct 15, 2021
@dylad dylad requested a review from bergzand October 15, 2021 19:03
@github-actions github-actions bot added Area: build system Area: Build system Area: doc Area: Documentation Area: Kconfig Area: Kconfig integration Area: pkg Area: External package ports Area: sys Area: System Area: tests Area: tests and testing framework labels Oct 15, 2021
@stale
Copy link

stale bot commented Apr 19, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Apr 19, 2022
@stale stale bot closed this Jun 12, 2022
@dylad dylad reopened this Jun 12, 2022
@stale stale bot removed the State: stale State: The issue / PR has no activity for >185 days label Jun 12, 2022
@dylad dylad added the State: don't stale State: Tell state-bot to ignore this issue label Jun 12, 2022
bors bot added a commit that referenced this pull request Mar 4, 2023
19341: Picolibc updates r=benpicco a=keith-packard

### Contribution description

Minor updates to picolibc support for newer versions of picolibc, including 1.8.


### Testing procedure

Here's the current build result for a board I happen to have on my bench right now:

```
$ make -C examples/blinky BOARD=nucleo-f103rb FEATURES_REQUIRED=picolibc
...
/home/keithp/src/RIOT/sys/picolibc_syscalls_default/syscalls.c:319:1: error: unknown type name '_READ_WRITE_RETURN_TYPE'
  319 | _READ_WRITE_RETURN_TYPE read(int fd, void *dest, size_t count)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/home/keithp/src/RIOT/sys/picolibc_syscalls_default/syscalls.c:351:1: error: unknown type name '_READ_WRITE_RETURN_TYPE'
  351 | _READ_WRITE_RETURN_TYPE write(int fd, const void *src, size_t count)
      | ^~~~~~~~~~~~~~~~~~~~~~~
...
```

### Description of changes

 1. Fix the read/write return values (Picolibc 1.8 uses POSIX standard types now)
 2. Add new symbols to linker scripts (Picolibc needs help dealing with TLS alignment)
 3. Align stack and thread local storage block during thread setup.


19345: cpu/riscv_common: convert to uword_t usage r=benpicco a=dylad

### Contribution description

This PR makes use of `uword_t` type in a few places in `cpu/riscv_common`.
This should not have any effect on produced binaries.

### Testing procedure

CI should be enough. 

### Issues/PRs references
Quickly adapt from #16994. It will help for 64 bits support one day ;)



Co-authored-by: Keith Packard <[email protected]>
Co-authored-by: Dylan Laduranty <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Area: build system Area: Build system Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: Kconfig Area: Kconfig integration Area: pkg Area: External package ports Area: sys Area: System Area: tests Area: tests and testing framework Platform: RISC-V Platform: This PR/issue effects RISC-V-based platforms State: don't stale State: Tell state-bot to ignore this issue State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant