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

Add support for Intel FPGA Nios V/g General Purpose Processor #59043

Merged
merged 4 commits into from Jun 17, 2023

Conversation

sweeaun
Copy link
Contributor

@sweeaun sweeaun commented Jun 8, 2023

This PR add support for Intel FPGA Nios V/g SoC and board, board system design is based on Intel FPGA Design Store Nios® V/g Hello World Example Design system.

More information about Intel FPGA Nios V/g and Hello World Example Design system can be obtained here:
https://www.intel.com/content/www/us/en/products/details/fpga/nios-processor/v.html
https://www.intel.com/content/www/us/en/design-example/776196/intel-arria-10-fpga-hello-world-design-on-nios-v-g-processor.html

For testing, it was verified with following samples:
hello_world
synchronization
philosophers

carlocaione
carlocaione previously approved these changes Jun 8, 2023
Comment on lines +49 to +53
To download the Zephyr Executable and Linkable Format .elf file, please use the niosv-download command within Nios V Command Shell environment.

.. code-block:: console

niosv-download -g <elf file>
Copy link
Member

Choose a reason for hiding this comment

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

a west runner should be implemented

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay. But suggest to have separate PR to support this.
I will study how west runner can works without niosv-download utility and can submit separate PR once it works for niosv_g and also niosv_m.

Copy link
Member

Choose a reason for hiding this comment

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

sure, it's ok, just noting to avoid adding more boards with custom flashing mechanisms. I think we should be consistent and offer a uniform user experience.

boards/riscv/niosv_g/niosv_g.dts Show resolved Hide resolved
boards/riscv/niosv_g/niosv_g.dts Show resolved Hide resolved
boards/riscv/niosv_g/niosv_g_defconfig Show resolved Hide resolved
CONFIG_PRINTK=y
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_UART_ALTERA_JTAG=y
Copy link
Member

Choose a reason for hiding this comment

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

redundant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, will remove this. Thanks.

gmarull
gmarull previously approved these changes Jun 9, 2023
@henrikbrixandersen
Copy link
Member

This needs rebasing after 8eeb5c9.

@sweeaun
Copy link
Contributor Author

sweeaun commented Jun 13, 2023

This needs rebasing after 8eeb5c9.

Rebase done. Thanks.

carlocaione
carlocaione previously approved these changes Jun 13, 2023
soc/riscv/riscv-privileged/niosv/Kconfig.soc Outdated Show resolved Hide resolved
dts/riscv/niosv/niosv-g.dtsi Show resolved Hide resolved
Add support for INTEL FPGA Nios V/g RISC-V based Processors.
Also amended SOC_NIOSV_M to use ATOMIC_OPERATIONS_BUILTIN.

Signed-off-by: Khor Swee Aun <swee.aun.khor@intel.com>
Add basic dts support for INTEL Nios V/g General Purpose Processor.

Signed-off-by: Khor Swee Aun <swee.aun.khor@intel.com>
Add board support for INTEL Nios V/g General Processor.

Signed-off-by: Khor Swee Aun <swee.aun.khor@intel.com>
Add code owner for INTEL FPGA Nios V/g dts, SoC and board.

Signed-off-by: Khor Swee Aun <swee.aun.khor@intel.com>
reg = <0>;
clock-frequency = <50000000>;

/* Platform interrupts IRQs index start from 16 */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Uhm, are you in this exact situation then? #59035

How are you dealing with this offset?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@carlocaione , I have to add the offset manual in device tree. Nice patch from you to enable this, hope it go in main line soon.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@carlocaione, wonder will that patch add offset to riscv machine timer as well? I don't think machine timer need add offset.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@sweeaun yeah, that is not going to work with this patch then. In my use-case the offset-ted lines are not practically usable anymore. What is your actual configuration? You have CLINT + CLIC?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. we do hart local interrupt and Platform-Level Interrupt Controller (PLIC).

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh ok, you have CLINT + PLIC. In that case I think that you can use CONFIG_2ND_LEVEL_INTERRUPTS to get rid of the 16 lines offset.

Copy link
Contributor Author

@sweeaun sweeaun Jun 15, 2023

Choose a reason for hiding this comment

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

Hi @carlocaione , our core doesn't have multiple level and only 1 level for all interrupts. Just that the interrupt 16 to 31 is named as platform interrupt which is not another level of interrupt controller. Sorry for confusion.
https://www.intel.com/content/www/us/en/docs/programmable/683632/23-1/interrupt-controller-91908.html
bit 3 is for software interrupt
bit 7 is for machine timer
bit[31:16] for platform interrupt

I don't think multi level interrupt configuration is needed in our case.

Copy link
Collaborator

Choose a reason for hiding this comment

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

interesting. Out of curiosity: how the platform is managing mcause? For example mcause for software interrupt is carrying the id 3 and 19 for the third platform interrupt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

software interrupt registered to irq 3
machine timer registred to irq 7
1st platform interrupt registered to irq 16
2nd platform interrupt registered to irq 17
3rd platform interrupt registered to irq 18
and so on...
In this system, we have jtag-uart connected to 1st platform interrupt. Thus the irq number is 16.
Not sure am I answered your question.

@nashif nashif merged commit d7141c9 into zephyrproject-rtos:main Jun 17, 2023
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: RISCV RISCV Architecture (32-bit & 64-bit)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants