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

Minimal support for RA8M1 #17

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

thaoluonguw
Copy link

Add minimal support for RA8M1. Implementation refers from Flexible Software Package (FSP) v5.3.0

This is the initial hal support for RA MCU family series.
The hal layer support for RA will base on RA FSP.

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
Signed-off-by: Quy Tran <quy.tran.pz@renesas.com>
Signed-off-by: Thao Luong <thao.luong.uw@renesas.com>
IRQ priority on Zephyr have offset, disable the priority
setting for IRQ in FSP HAL layer so that priority setting
will not be override when Open() API is called

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
Update RA FSP to version 5.3.0

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
Copy link

@KhiemNguyenT KhiemNguyenT left a comment

Choose a reason for hiding this comment

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

I reviewed the patches. It's OK to me.

@@ -0,0 +1,100 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to include all drivers licensed as BSD.

Copy link
Author

Choose a reason for hiding this comment

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

@soburi : I am sorry, but I haven't understood your comment... we add license as BSD for all RA drivers in this repository.

Copy link
Member

Choose a reason for hiding this comment

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

I think you have included only the files that will be needed in the most recent commit.
Rather than adding them to hal each time according to the main source of zephyr, I think it is a good idea to include all driver sources that may be supported in the future at this point.
(And it looks like that possible file is released as BSD.)

Copy link
Author

Choose a reason for hiding this comment

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

@soburi : (Cc @KhiemNguyenT) Adding all driver sources at once can cause adding un-used codes which are not our planning, we will support phase to phase for easy control and maintain.

Copy link
Member

@soburi soburi May 27, 2024

Choose a reason for hiding this comment

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

As far as I know, that method is not a common management method for zephyr hals, so I cannot recommend it.
From my experience, it is better to have a management policy that does not require updating the hal too frequently.

Choose a reason for hiding this comment

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

@ydamigos we shall work on incremental update, as long as there's no violation to common policy. Some implementation takes time to get agreement but it does not block on-going activity, let's keep it separated.

Copy link
Contributor

Choose a reason for hiding this comment

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

@KhiemNguyenT
Regarding HAL is usually updated in bulk according to the update of the source code from which it is imported.
I expect that will be easier to maintain in the future even if it contains unused files. We will just copy/paste every new FSP release.
Regarding the "extra" HAL for covering the missing Zephyr API
The incremental updates make sense.

Choose a reason for hiding this comment

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

@ydamigos HAL updating in bulk will be applied in future. For now, we would like to focus on essential HAL drivers and address the comments on the code in-use.

Copy link
Contributor

Choose a reason for hiding this comment

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

@KhiemNguyenT That's fine for me.

Copy link
Member

Choose a reason for hiding this comment

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

@KhiemNguyenT
This is not blocking so let's go ahead with this.

@@ -0,0 +1,448 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to include all files licensed as BSD here as well.
(I think it would be desirable to only update when a new version of fsp is released.)

Copy link
Author

Choose a reason for hiding this comment

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

@soburi : Did you mean we create only one file and describe information about license (BSD) for all?

Copy link
Member

Choose a reason for hiding this comment

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

No, it's not.

I think it is good to add other SoC files for future support, not only RA8M1.
The fsp includes files other than BSD, so I wrote it with a meaning of other than that.
(I want to use it for migrating RA4M1.)

Zephyr convention requires an SPDX identifier for all files.
So, All files probably have license notices.

Copy link
Author

Choose a reason for hiding this comment

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

@soburi : (Cc @KhiemNguyenT): We have plan to support RA4M1 in 2nd half of this year. So, drivers for RA4M1 will come soon. We are looking forward to your contribution at that time too.

Zephyr convention requires an SPDX identifier for all files.
So, All files probably have license notices.

Thanks for your reminding me. I nearly forgot.

@@ -0,0 +1,40 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

I think these are based on files generated by FSP tools.
How about creating a module/hal_renesas_fsp directory on the zephyr side and placing it there?
(Also, I think it would be easier to manage if only fsp releases were included)

Copy link
Contributor

Choose a reason for hiding this comment

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

@soburi Thanks for your feedback.
I agree with you but a second module looks like an overkill to me. I would prefer if we followed the following structure:

.
├── fsp
│   ├── ra
│   └── any other family
├── smartbond
└── zephyr
    ├── blobs
    ├── fsp_cfg
    │  	├── ra
    │  	└── any other family
    └── any other folder/file that will help us use FSP with Zephyr

@thaoluonguw @KhiemNguyenT @ioannis-karachalios Your thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

I also agree that a second module would be an overkill.

Copy link
Member

Choose a reason for hiding this comment

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

@thaoluonguw @ioannis-karachalios

I got it. Let's go with the method you suggested.

duynguyenxa and others added 2 commits May 14, 2024 09:54
Update include path for mcu from CONFIG_SOC to
CONFIG_SOC_SERIES because Zephyr repository
changing the RA8 MCU grouping

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
Move cfg files from zephyr OS to hal_renesas

Signed-off-by: Thao Luong <thao.luong.uw@renesas.com>
#define BSP_MCU_FEATURE_SET ('A')
#define BSP_ROM_SIZE_BYTES (2064384)
#define BSP_RAM_SIZE_BYTES (917504)
#define BSP_DATA_FLASH_SIZE_BYTES (12288)
Copy link
Contributor

Choose a reason for hiding this comment

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

We could pull the values from DT.

Copy link
Author

Choose a reason for hiding this comment

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

@ydamigos : These values are dummy now. This file is necessary building with fsp only. We would like to keep it in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

@thaoluonguw We could keep the file but please remove unused macros. We use only BSP_PACKAGE_PINS. Let's just leave this one only.

Copy link
Member

Choose a reason for hiding this comment

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

Now, We can use substring function in Kconfig.
Some definitions can be calculate from P/N.

@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0

add_subdirectory_ifdef(CONFIG_SOC_FAMILY_RENESAS_SMARTBOND smartbond)
add_subdirectory_ifdef(CONFIG_HAS_RENESAS_RA_FSP ra)
Copy link
Contributor

Choose a reason for hiding this comment

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

Add an empty line at the end.

/***********************************************************************************************************************
* Private global variables and functions
**********************************************************************************************************************/
// *UNCRUSTIFY-ON*
Copy link
Member

@soburi soburi May 28, 2024

Choose a reason for hiding this comment

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

If you delete it, please delete it in a balanced manner.

In the original code, this line was paired with

// *UNCRUSTIFY-OFF*

There are the following differences when compared with fsp, but is it necessary to delete them?


@@ -26,15 +26,5 @@
 /***********************************************************************************************************************
  * Private global variables and functions
  **********************************************************************************************************************/
-
-// *UNCRUSTIFY-OFF*
-#define BSP_FEATURE_GPT_AD_DIRECT_START_CHANNEL_MASK  (0xFF)
-#define BSP_FEATURE_GPT_AD_DIRECT_START_SUPPORTED     (0x1)
-#define BSP_FEATURE_GPT_GPTE_CHANNEL_MASK             (0)
-#define BSP_FEATURE_GPT_GPTE_SUPPORTED                (0)
-#define BSP_FEATURE_GPT_GPTEH_CHANNEL_MASK            (0)
-#define BSP_FEATURE_GPT_GPTEH_SUPPORTED               (0)
-#define BSP_FEATURE_GPT_OPS_CHANNEL_MASK              (0x1)
-#define BSP_FEATURE_GPT_OPS_SUPPORTED                 (0x1)

* SPDX-License-Identifier: BSD-3-Clause
*/

#ifndef BSP_MCU_DEVICE_PN_CFG_H_
Copy link
Member

Choose a reason for hiding this comment

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

It's an incomplete guard condition.

* SPDX-License-Identifier: BSD-3-Clause
*/

#ifndef ZEPHYR_SOC_RENESAS_RA_COMMON_BSP_CFG_H_
Copy link
Member

Choose a reason for hiding this comment

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

Please use the same macro name policy for guard conditions.
It doesn't necessarily have to be the zephyr rules here, but
If you want to follow Zephyr's policy, please do the same for other files.

zephyr_include_directories(${include_dirs})
zephyr_library_sources(${srcs})

message(${CONFIG_SOC_SERIES})
Copy link
Member

Choose a reason for hiding this comment

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

I think this log is not very meaningful. It is better to delete it.

Comment on lines +20 to +34
#ifndef BSP_CLOCK_CFG_MAIN_OSC_POPULATED
#define BSP_CLOCK_CFG_MAIN_OSC_POPULATED (1)
#endif
#ifndef BSP_CLOCK_CFG_MAIN_OSC_CLOCK_SOURCE
#define BSP_CLOCK_CFG_MAIN_OSC_CLOCK_SOURCE (0)
#endif
#ifndef BSP_CLOCK_CFG_SUBCLOCK_DRIVE
#define BSP_CLOCK_CFG_SUBCLOCK_DRIVE (0)
#endif
#ifndef BSP_CLOCK_CFG_SUBCLOCK_POPULATED
#define BSP_CLOCK_CFG_SUBCLOCK_POPULATED (1)
#endif
#ifndef BSP_CLOCK_CFG_SUBCLOCK_STABILIZATION_MS
#define BSP_CLOCK_CFG_SUBCLOCK_STABILIZATION_MS 1000
#endif
Copy link
Member

Choose a reason for hiding this comment

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

These definitions are board depended.
must refer to the devicetree configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants