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

feat(Other): Enable building zephyr for risc-v targets #1051

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

MaureenHelm
Copy link
Contributor

Configures the zephyr build system to use the appropriate cmsis system startup and peripheral driver sources based on the target core architecture. The mxc lock driver is not implemented for risc-v and emits a build warning (which twister promotes to an error), therefore the zephyr build system is configured to build it only for arm.

Before this patch, we could only build zephyr for arm targets, but now we can build zephyr for arm or risc-v targets.

Checklist Before Requesting Review

  • PR Title follows correct guidelines.
  • Description of changes and all other relevant information.
  • (Optional) Link any related GitHub issues using a keyword
  • (Optional) Provide info on any relevant functional testing/validation. For API changes or significant features, this is not optional.

Configures the zephyr build system to use the appropriate cmsis system
startup and peripheral driver sources based on the target core
architecture. The mxc lock driver is not implemented for risc-v and
emits a build warning (which twister promotes to an error), therefore
the zephyr build system is configured to build it only for arm.

Before this patch, we could only build zephyr for arm targets, but now
we can build zephyr for arm or risc-v targets.

Signed-off-by: Maureen Helm <[email protected]>
@MaureenHelm
Copy link
Contributor Author

@Jake-Carter can you take a look?

Copy link
Contributor

@Jake-Carter Jake-Carter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaureenHelm @ozersa

MAX78000 and MAX78002 also have RISC-V cores and need similar modifications.

Also, the RISC-V core needs to be booted up by the ARM core, and by default the RISC-V JTAG is not enabled. In the MSDK we have a system for dynamically linking RISC-V application on top of some basic start-up code that runs in the ARM core (see RV_ARM_Loader and the implementation here).

The implementation isn't really straightforward and involves parsing the .map file for a custom symbol added in the linker script. Is there a similar mechanism planned for Zephyr?

@Jake-Carter
Copy link
Contributor

On RISC-V MXC_Lock implementation - we've had this in the TODO for a while. Let me know if we need to bump this up in priority.

@MaureenHelm
Copy link
Contributor Author

@MaureenHelm @ozersa

MAX78000 and MAX78002 also have RISC-V cores and need similar modifications.

MAX78000 and MAX78002 don't have Zephyr ports yet. Libraries/zephyr/MAX/Source/MAX78000/CMakeLists.txt doesn't exist so there's nothing there to modify yet.

Also, the RISC-V core needs to be booted up by the ARM core, and by default the RISC-V JTAG is not enabled. In the MSDK we have a system for dynamically linking RISC-V application on top of some basic start-up code that runs in the ARM core (see RV_ARM_Loader and the implementation here).

The implementation isn't really straightforward and involves parsing the .map file for a custom symbol added in the linker script. Is there a similar mechanism planned for Zephyr?

I've implemented a different mechanism using devicetree to define the RISC-V code region, similar to some other multicore SoC families in Zephyr. The SoC boot code on the ARM core gets the RISC-V boot address from the devicetree and sets the appropriate register. Applications can use a devicetree overlay to change the region from the default if desired.

@Jake-Carter Jake-Carter merged commit 1d180aa into analogdevicesinc:main Jul 8, 2024
9 checks passed
@MaureenHelm MaureenHelm deleted the zephyr-riscv branch July 8, 2024 20:37
EricB-ADI pushed a commit that referenced this pull request Aug 21, 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.

3 participants