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 Arduino UNO R4 #60760

Merged
merged 8 commits into from Nov 1, 2023

Conversation

soburi
Copy link
Member

@soburi soburi commented Jul 25, 2023

Adds support for Arduino UNO R4.

I have verified that hello_world, blinky, and button sample work with this PR.

We can flash and debug with the cmsis-dap adapter and pyOCD.
But not supporting flash program with dfu-util, because Arduino IDE use not standard version of dfu-util.

To avoid complicating initial code for supporting the SoC,
I have implemented only the bare minimum for now.

We can't use FSP that the BSP Renesas provides is not an OSS license (It doesn't allow execution outside of Renesas SoCs).
I write this PR entirely from scratch, so it is not dependent on FSP.
But it is good to use FSP for reliability reasons if we can use it.

This PR is still remain some TODOs.
Because it still needs to complete implementing some functions (clock_control, pinctrl, etc.), mark them as TODO,
depending on it.

This PR changes R-Car UART driver to support RA UART.
But I don't have R-Car board, so I can't test it.

If Renesas plans to support Zephyr officially, I would prefer to follow that policy. (But that doesn't mean we can't proceed without it.)

@soburi soburi changed the title Add supporting Arduino UNO R4 (and FPB_RA6E1) Add support for Arduino UNO R4 (and FPB_RA6E1) Jul 25, 2023
@fabiobaltieri
Copy link
Member

If Renesas officially supports Zephyr, I would prefer to follow that policy. However if not so, proceeding on a community basis is necessary. Has anyone heard the intentions of Renesas?

There's a HAL already for SmartBond devices (https://github.com/zephyrproject-rtos/hal_renesas) and code for both that and R-Car.

@andrzej-kaczmarek @blauret @aaillet @lorc any idea if there's interest to have official support for RA family?

@lorc
Copy link
Collaborator

lorc commented Jul 27, 2023

My team is mostly interested in CortexA cores and virtualization, so I'm afraid no one from my side can help with this.

@blauret
Copy link
Contributor

blauret commented Jul 28, 2023

It's great initiative. Just a few comments:

  • Debugging is supported with JLink (See R7FA4M1AB) . You don't need the Renesas debug server. JLink is widely accepted debug option in the Zephyr environment.
  • For the licensing side of the FSP package, I'm not sure how it works but Platformio does provide and RA package. If think they figured a way to support that environment, it should be possible to comply with Zephyr community requirements.

My team is focused on the Smartbond devices. I'll try to reach out in the organization to see if someone can help. That said, it's en of July and it's summer holidays it could take some time.

@soburi soburi force-pushed the arduino_uno_r4 branch 3 times, most recently from 27041f5 to 00560d7 Compare July 29, 2023 13:31
@soburi
Copy link
Member Author

soburi commented Jul 30, 2023

@fabiobaltieri @lorc @blauret

Thank you for responses.

  • Debugging is supported with JLink (See R7FA4M1AB) . You don't need the Renesas debug server. JLink is widely accepted debug option in the Zephyr environment.

I misunderstood the need for Renesas-specific software for debugging.
I verify it can debug with JLink and pyOCD.
I made pyocd the default because cmsis-dap adapters are easy to obtain.

  • For the licensing side of the FSP package, I'm not sure how it works but Platformio does provide and RA package. If think they figured a way to support that environment, it should be possible to comply with Zephyr community requirements.

At a glance, RA package contains no FSP sources. FSP sources are in the separated repository framework-renesas-fsp.
So, It still needs consideration...

My team is mostly interested in CortexA cores and virtualization, so I'm afraid no one from my side can help with this.

My team is focused on the Smartbond devices. I'll try to reach out in the organization to see if someone can help.

Thanks a lot.
I know there are some things difficult in large organization.
Could you tell me any news (or rumor?) if you get in future.

That said, it's en of July and it's summer holidays it could take some time.

Have a nice holidays!

@aaillet
Copy link
Member

aaillet commented Jul 31, 2023

Hi,

I'm afraid that as people from other teams, I'm mainly focusing on my part, Cortex-R support for R-Car SoCs.

From my point of view, Smartbond code and HAL will not fit RA series as Smartbond is coming from a brand that Renesas bought. As this series was already existing before it's brand acquirement, I think it's not using Renesas IPs.

On the other hand, it may be possible to reuse R-CAR code if same IPs are used.

Concerning interest from Renesas to officially support Zephyr on RA/RZ this series, I'll ask my internal contact if plans are existing !

@soburi soburi changed the title Add support for Arduino UNO R4 (and FPB_RA6E1) Add support for Arduino UNO R4 Aug 1, 2023
@soburi soburi force-pushed the arduino_uno_r4 branch 7 times, most recently from 3cba69b to 1971b88 Compare August 2, 2023 11:35
@soburi
Copy link
Member Author

soburi commented Aug 2, 2023

@aaillet

Hi,

I'm afraid that as people from other teams, I'm mainly focusing on my part, Cortex-R support for R-Car SoCs.

Thank you for response.

From my point of view, Smartbond code and HAL will not fit RA series as Smartbond is coming from a brand that Renesas bought. As this series was already existing before it's brand acquirement, I think it's not using Renesas IPs.

I got it. The smartbond HAL provide with Apache2 license.
There was no problem to integrate to zephyr. It is different with RA.

On the other hand, it may be possible to reuse R-CAR code if same IPs are used.

From this viewpoint, using BSP may not be suitable if making a standard driver between series.
At a glance, UART and CAN drivers seem to be able to be commonized between R-Car and RA.
Some register configurations are different, but these share the same basis.
(SCI has been used longly in Renesas SoC since the 8-bit MCU era, so there are many variations. I don't know whether it is good or not that one driver should support all of these, but it seems better to try to commonize them.)
I added support for the RA series UART with the R-Car UART driver.

Concerning interest from Renesas to officially support Zephyr on RA/RZ this series, I'll ask my internal contact if plans are existing !

Thanks a lot!
I am confident that the RA series and the UNO R4 are valuable for supporting it!

@soburi soburi marked this pull request as ready for review August 2, 2023 13:37
Comment on lines 18 to 23
property-allowlist:
- bias-disable
- bias-pull-up
- drive-open-drain
- input-enable
- drive-strength
Copy link
Member

Choose a reason for hiding this comment

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

where are these handled? I can't see them being referenced in pinctrl_soc.h

Copy link
Member Author

Choose a reason for hiding this comment

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

Not yet implemented these, but the reference manual says, these functions exist.
I am adding these for now as I will implement them in the near future.
Is it better not to enter it at this time?
ra4m1_pinconf

Copy link
Member

Choose a reason for hiding this comment

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

If they're not used, they shouldn't be allowed yet, this will create confusion to the users.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, I got it.
I removed it.

To avoid complicating the initial code for supporting the SoC,
I have implemented only the bare minimum for now.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
Comment on lines 16 to 17
include:
- name: pincfg-node.yaml
Copy link
Member

Choose a reason for hiding this comment

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

this should be removed entirely, none of the props are used right?

Copy link
Member Author

Choose a reason for hiding this comment

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

I had a little misunderstanding. I deleted it additionally.
Thank you for pointing it out.

Comment on lines 107 to 114
static int ra_icu_init(const struct device *dev)
{
ARG_UNUSED(dev);

return 0;
}

DEVICE_DT_INST_DEFINE(0, ra_icu_init, NULL, NULL, NULL, PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY,
Copy link
Member

Choose a reason for hiding this comment

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

just pass NULL to the init function, it;s now optional

Copy link
Member Author

Choose a reason for hiding this comment

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

I fixed as so.

reg = <0x40040020 0x20>;
gpio-controller;
#gpio-cells = <2>;
port-no = <1>;
Copy link
Member

Choose a reason for hiding this comment

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

why is this property needed? this is not hw description?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it is an index of gpio.
The index can be calculated from the address.
I replaced it with the calculated value.

Copy link
Member

Choose a reason for hiding this comment

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

fancy, you sure the new one is a good idea? it relies on the port memory space being contiguous (question for both of you @soburi @gmarull)

Copy link
Member Author

Choose a reason for hiding this comment

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

In the RA series, all GPIO ports use continuous addresses. Even if there is a dropout in the middle, the port number will not change, so calculation is possible.

CM4-based SoC uses 0x40040000 to 0x40040160 for ioport0 .. ioportb.
In the case of CM33-based SoC, it also uses 0x40080000 to 0x40080160.

Copy link
Member

Choose a reason for hiding this comment

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

In past situations, we've always restricted DT to the hardware description itself (port-no is needed here because of how software works, not because it describes hw uniquely).

Comment on lines 361 to 364
static int gpio_ra_init(const struct device *dev)
{
return 0;
}
Copy link
Member

Choose a reason for hiding this comment

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

ditto

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed it.

To avoid complicating the initial code for supporting the SoC,
I have implemented only the bare minimum for now.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
Add initial support for Renesas RA GPIO.

To avoid complicating the initial code for supporting the SoC,
I have implemented only the bare minimum for now.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
Adding initial support for Renesas RA UART.

To avoid complicating initial code for supporting the SoC,
I have implemented only the bare minimum for now.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
Add support for the Arduino UNO R4 Minima.
This board is the newest version of Arduino that uses Renesas RA4M1 SoC.

This commit provides only limited support to simplify the initial
support patch.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
Renesas RA always uses interrupt handlers dynamically.
But this test requires static vector tables.
So, it needs to exclude platforms that use Renesas RA.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
@eGit
Copy link

eGit commented Jan 25, 2024

What's keeping Zephyr from supporting Arduino Uno R3? Not enough RAM?

@soburi
Copy link
Member Author

soburi commented Jan 25, 2024

@eGit

What's keeping Zephyr from supporting Arduino Uno R3? Not enough RAM?

ZephyrRTOS intends 32bit/64bit MPUs. I think it may difficult to port 16bit/8bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ARM ARM (32-bit) Architecture area: Clock Control area: Devicetree Binding PR modifies or adds a Device Tree binding area: Flash area: GPIO area: Interrupt Controller area: Pinctrl area: UART Universal Asynchronous Receiver-Transmitter platform: Renesas RA Renesas Electronics Corporation, RA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants