-
Notifications
You must be signed in to change notification settings - Fork 7k
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
arch: Added initial OpenRISC port #83933
base: main
Are you sure you want to change the base?
Conversation
Hello @jhol, and thank you very much for your first pull request to the Zephyr project! |
@stffrdhrn Please feel free to comment. This work was the origin of the TTMR fix for Qemu. |
The tests will not be able to complete because the tool-chain does not have the |
@jhol please split into multiple commits, see https://docs.zephyrproject.org/latest/contribute/contributor_expectations.html#multiple-commits-on-a-single-pr for reference. |
This has now been done! |
v3 of the patch set makes the following changes:
|
v4 of the patch set makes the following changes:
|
v5 of the patch set makes the following changes:
|
PERFOPT_ALIGN is defined as ".balign 4" because .balign is available in the or1k GNU assembler. Signed-off-by: Joel Holdsworth <[email protected]>
A common set of macros: GTEXT(), GDATA(), WTEXT() and WDATA() is defined for Arm, Arm66, MIPS, Nios II, RISC-V and Xtensa. This patch adds OpenRISC to this set. Signed-off-by: Joel Holdsworth <[email protected]>
Existing versions of GEN_ABSOLUTE_SYM and GEN_ABSOLUTE_SYM_KCONFIG are defined for all supported architectures. This patch adds a definition of the same kind used for MIPS, Nios II, RISC-V and Xtensa. Signed-off-by: Joel Holdsworth <[email protected]>
The OpenRISC or1k-elf GCC compiler output format is named "elf32-or1k". This patch adds an OUTPUT_FORMAT linker macro for this platform. Signed-off-by: Joel Holdsworth <[email protected]>
Zephyr maps the start and end of the rodata section with variables using the __rodata_region_start and __rodata_region_end. This patch adopts this convention for the OpenRISC architecture. Signed-off-by: Joel Holdsworth <[email protected]>
This patch adds support for the OpenRISC 1000 (or1k) architecture: a MIPS-like open hardware ISA which was first introduced in 2000. The thread switching implementation uses the modern Zephyr thread "switch" architecture. Signed-off-by: Joel Holdsworth <[email protected]>
In OpenRISC 1000, the stack pointer is stored in the r1 register. This patch stores the offset of this value within in the thread structure into the thread info offsets. Signed-off-by: Joel Holdsworth <[email protected]>
The OpenRISC 1000 Tick Timer is tightly coupled to the or1k CPU core, and is explicitly designed to facilitate task scheduling and high-resolution timing. The timer is documented in Chapter 14 of the OpenRISC 1000 Architecture Manual: https://openrisc.io/or1k.html#__RefHeading__504849_595890882 Signed-off-by: Joel Holdsworth <[email protected]>
The Qemu emulator executable for the OpenRISC 1000 (or1k) architecture is named qemu-or1k. This patch adds this information to the qemu architecture suffix list. Signed-off-by: Joel Holdsworth <[email protected]>
Qemu includes support for the OpenRISC 1000 CPU architecture. This patch adds a Zephyr SoC definition which enables usage of this feature. The SoC definition closely mirrors the Qemu MIPS Malta SoC definition. Signed-off-by: Joel Holdsworth <[email protected]>
Qemu includes support for the OpenRISC 1000 CPU architecture. This patch adds a Zephyr virtual board definition which enables usage of this feature. The board definition closely mirrors the Qemu MIPS Malta board definition. Signed-off-by: Joel Holdsworth <[email protected]>
The OpenRISC CPU architecture is signified by the CONFIG_OPENRISC Kconfig option. This patch adds this information to the log database ARCHS table. Signed-off-by: Joel Holdsworth <[email protected]>
Adds the openrisc CPU architecture to the twister platform definitions. Signed-off-by: Joel Holdsworth <[email protected]>
The OpenRISC 1000 architecture can be tested through the qemu_or1k emulated SoC and board. Because this emulated device has minimal external hardware by default, this patch enables a minimal suite of tests covering core kernel features for the CPU architecture. When running the test suite, OpenRISC was found to require additional stack space to prevent an overflow. Therefore, a minimal additional amount of storage: 128-bytes, was added that was found in practice to allow tests to complete. Note that Qemu version 9.2.0 or newer is required so as to include the following commit: commit 3eb43aeb164f1f83c97ff693c7d464b49755110c Author: Joel Holdsworth <[email protected]> Date: Fri Jun 7 15:29:33 2024 -0700 hw/openrisc: Fixed undercounting of TTCR in continuous mode This fixes a bug in the implementation of the emulated OpenRISC Tick Timer which prevents the Zephyr OpenRISC port from task-scheduling properly. Signed-off-by: Joel Holdsworth <[email protected]>
The following west manifest projects have changed revision in this Pull Request:
Additional metadata changed:
⛔ DNM label due to: 1 project with metadata changes Note: This message is automatically posted and updated by the Manifest GitHub Action. |
Here is v8 of the patch-set with the following changes:
|
@npitre I applied your suggestion concerning Concerning the timer driver, it's not so clear to me what needs to happen here. To me, the OpenRISC timer driver doesn't look so very different from the Risc-V driver, but I'm happy to make any amendments. |
You may look at commit 0ea64b3 for explanation and the needed changes, Also, if your |
@jhol I managed to build the toolchain and qemu and was trying this PR. was able to build, but did not get any output from qemu:
picolibc did not work for me, not sure what is going on:
running qemu:
|
Thanks for testing. What version of qemu do you have?
|
9.2.1, you can also get it from here https://github.com/zephyrproject-rtos/sdk-ng/actions/runs/13472947957/artifacts/2635045345 (PR zephyrproject-rtos/sdk-ng#871) |
Awesome. I'll test it out when I have time in the coming days |
I've only been testing with the debian toolchain; haven't played with this one yet, and I haven't tried zephyr yet, just the picolibc test suite. |
{ | ||
ARG_UNUSED(type); | ||
|
||
__asm__("l.nop 13"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note in QEMU the openrisc virt
platform does provide reboot via the syscon-reboot
device. I guess we could add support for virt
later?
My mistake, this was already presented in my absence. |
Architecture WG 2025-02-18:
|
This patch adds support for the OpenRISC 1000 (or1k) architecture: a MIPS-like open hardware ISA which was first introduced in 2000.
This patch adds basic architecture support for the architecture, as well as a board and soc support for the Qemu virtual ork1ksim board.