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

riscv/k230: initial support w/ canmv230 #11379

Merged
merged 1 commit into from
Dec 17, 2023

Conversation

yf13
Copy link
Contributor

@yf13 yf13 commented Dec 13, 2023

The code is mainly derived from the NuttX qemu-rv/rv-virt codebase.

Major changes:

  • boards/Kconfig: add new BOARD_K230_CANMV
  • arch/risc-v/Kconfig: add new CHIP_K230
  • arch/risc-v/src/common/riscv_mtimer.c: use 32bit clint access for K230 chip

New additions:

  • arch/risc-v/include/k230/: k230 SoC definitions
  • arch/risc-v/src/k230/: k230 SoC sources
  • boards/risc-v/k230/canmv230/: CanMV-K230 board sources and configs
  • Documentation/platforms/risc-v/k230/: usage documents

Summary

Only FLAT build works now.

Impact

This involves RiscV common layer changes on MTIMER access, might impact other RiscV ports.

Testing

ostest passed for the following targets:

  • canmvk230/nsh
  • rv-vrit/nsh
  • rv-virt/nsh64

@xiaoxiang781216
Copy link
Contributor

xiaoxiang781216 commented Dec 13, 2023

@yf13 please run ./tools/refresh.sh canmv230/nsh to fix the ci error:

  Normalize canmv230/nsh
31d30
< CONFIG_DEBUG_ASSERTIONS=y
44d42
< CONFIG_LIBM_TOOLCHAIN=n
Saving the new configuration file

and the documentation error:
https://github.com/apache/nuttx/actions/runs/7190925897/job/19586147281?pr=11379

@yf13
Copy link
Contributor Author

yf13 commented Dec 13, 2023

@xiaoxiang781216 thanks for the comments!

Following the pattern of jjh7110/star64 documentations folder, I submitted updated version of documents.

The tools/refresh.sh scared me at first run as it asked too many questions. After reading the source and then tried with the --silent option, I noticed the defconfig was normalized. so I sent another update. Hope this is what you expected.

@xiaoxiang781216
Copy link
Contributor

@yf13 please squash your fix into the first patch

@yf13
Copy link
Contributor Author

yf13 commented Dec 13, 2023

@xiaoxiang781216 they are sqaushed, please check again. Thanks.

@yf13 yf13 changed the title arch/risc-v: Initial support for CanMV-k230 board risc-v: Initial support for CanMV-k230 board Dec 13, 2023
@xiaoxiang781216
Copy link
Contributor

please squash your patch into one.

@yf13
Copy link
Contributor Author

yf13 commented Dec 15, 2023

@xiaoxiang781216 they've been squashed.

@yf13 yf13 force-pushed the add-k230-support branch 3 times, most recently from e1f289a to 28ade70 Compare December 16, 2023 05:39
@yf13
Copy link
Contributor Author

yf13 commented Dec 16, 2023

@xiaoxiang781216 ARCH_RV_MMIO_BITS option has been used in riscv_mtimer.c, please let me know if there is anything else.

@yf13 yf13 requested a review from xiaoxiang781216 December 16, 2023 05:47
@yf13 yf13 force-pushed the add-k230-support branch 2 times, most recently from abbf438 to da3ff93 Compare December 17, 2023 03:01
The code is mainly derived from the NuttX qemu-rv/rv-virt codebase.

Major changes:

- boards/Kconfig:       add new BOARD_K230_CANMV
- arch/risc-v/Kconfig:  add new CHIP_K230 chip and ARCH_RV_MMIO_BITS
- arch/risc-v/src/common/riscv_mtimer.c: use ARCH_RV_MMIO_BITS to
                        select MMIO access width

New additions:

- arch/risc-v/include/k230/: k230 SoC definitions
- arch/risc-v/src/k230/:     k230 SoC sources
- boards/risc-v/k230/canmv230/:  CanMV-K230 board sources and configs
- Documentation/platforms/risc-v/k230/: simple doc

Note that only FLAT build works for canmv230 now.

This PR has changes in RiscV common layer thus may affect other RiscV ports
It changes the mtime/mtimecmp access control from using config ARCH_RV64 to
newly intorduced config ARCH_RV_MMIO_BITS.

Original design uses ARCH_RV64 to select 64bit MMIO in riscv_mtimer.c, this
can't cope with the situation with K230 --- it has ARCH_RV64 but only can do
32bit MMIO. So a new ARCH_RV_MMIO_BITS config has been introduced. Its value
depicts the MMIO width in bits. The MMIO_BITS defaults to 32/64 for RV32/
RV64 respectively. This allows the macro to replace current use of ARCH_RV64
in riscv_mtimer.c.

The new MMIO_BITS config is a derived one, and for RiscV chips with
equal CPU and MMIO widths there is no need to explicitly set it as the
default rule will do that. Only chips with different CPU and MMIO widths
need set it in Kconfig.

So by design this change should be safe but RiscV ports should be checked.

"ostest" verification has been done for:

- canmv230/nsh
- rv-vivt/nsh
- rv-virt/nsh64

configuration generation and manual check of derived RV_MMIO_BITS has been
done for:

- star64/nsh
- arty_a7/nsh
- bl602evb/nsh

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
@xiaoxiang781216 xiaoxiang781216 merged commit 75d0c29 into apache:master Dec 17, 2023
@yf13 yf13 changed the title risc-v: Initial support for CanMV-k230 board riscv/k230: initial support w/ canmv230 May 27, 2024
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

Successfully merging this pull request may close these issues.

2 participants