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

drivers: rtc: sam: Missing function rtc_sam_validate_tm #81454

Closed
nandojve opened this issue Nov 15, 2024 · 0 comments · Fixed by #81456 or #81817 · May be fixed by #81818, #82097 or #82096
Closed

drivers: rtc: sam: Missing function rtc_sam_validate_tm #81454

nandojve opened this issue Nov 15, 2024 · 0 comments · Fixed by #81456 or #81817 · May be fixed by #81818, #82097 or #82096
Assignees
Labels
area: RTC Real Time Clock bug The issue is a bug, or the PR is fixing a bug
Milestone

Comments

@nandojve
Copy link
Member

nandojve commented Nov 15, 2024

Describe the bug

The #64939 introduced a few convenience functions like rtc_utils_validate_rtc_time. However the PR did not replace all occurrences which result on a build error.

See

if (rtc_sam_validate_tm(timeptr, mask) == false) {

Expected behavior

  • Drivers should be build with all options that are available by Zephyr to detect problems like this.
  • No warning: implicit declaration of function 'rtc_utils_validate_rtc_time'
  • One Atmel SAM board should be added to test coverage.
  • Tests must build the drivers with all options enabled.

Impact
User can not build board and need search for a solution.

Logs and console output

Patch

diff --git a/boards/atmel/sam/sam4e_xpro/sam4e_xpro.dts b/boards/atmel/sam/sam4e_xpro/sam4e_xpro.dts
index 253d5ba48d1..e731302e694 100644
--- a/boards/atmel/sam/sam4e_xpro/sam4e_xpro.dts
+++ b/boards/atmel/sam/sam4e_xpro/sam4e_xpro.dts
@@ -22,6 +22,7 @@
                wdog = &wdt;
                watchdog0 = &wdt;
                sdhc0 = &hsmci;
+               rtc = &rtc;
        };
 
        chosen {
@@ -128,6 +129,10 @@
        clock-frequency = <120000000>;
 };
 
+&rtc {
+       status = "okay";
+};
+
 &afec0 {
        status = "okay";
 
diff --git a/drivers/rtc/rtc_sam0.c b/drivers/rtc/rtc_sam0.c

1- Default option

$> west build -b sam4e_xpro tests/drivers/rtc/rtc_api
...
/home/gfbudke/zephyr/mainline/zephyr/drivers/rtc/rtc_sam.c: In function 'rtc_sam_set_time':
/home/gfbudke/zephyr/mainline/zephyr/drivers/rtc/rtc_sam.c:99:13: warning: implicit declaration of function 'rtc_utils_validate_rtc_time' [-Wimplicit-function-declaration]
   99 |         if (rtc_utils_validate_rtc_time(timeptr, RTC_SAM_TIME_MASK) == false) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
[133/133] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       34797 B         1 MB      3.32%
             RAM:        5824 B       128 KB      4.44%
        IDT_LIST:          0 GB        32 KB      0.00%

2- With CONFIG_RTC_ALARM=y

$> west build -b sam4e_xpro tests/drivers/rtc/rtc_api -DCONFIG_RTC_ALARM=y
...
[128/135] Building C object zephyr/drivers/rtc/CMakeFiles/drivers__rtc.dir/rtc_sam.c.obj
/home/gfbudke/zephyr/mainline/zephyr/drivers/rtc/rtc_sam.c: In function 'rtc_sam_set_time':
/home/gfbudke/zephyr/mainline/zephyr/drivers/rtc/rtc_sam.c:99:13: warning: implicit declaration of function 'rtc_utils_validate_rtc_time' [-Wimplicit-function-declaration]
   99 |         if (rtc_utils_validate_rtc_time(timeptr, RTC_SAM_TIME_MASK) == false) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/gfbudke/zephyr/mainline/zephyr/drivers/rtc/rtc_sam.c: In function 'rtc_sam_alarm_set_time':
/home/gfbudke/zephyr/mainline/zephyr/drivers/rtc/rtc_sam.c:361:13: warning: implicit declaration of function 'rtc_sam_validate_tm' [-Wimplicit-function-declaration]
  361 |         if (rtc_sam_validate_tm(timeptr, mask) == false) {
      |             ^~~~~~~~~~~~~~~~~~~
[130/135] Linking C executable zephyr/zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/gfbudke/zephyr/mainline/zephyr/build/zephyr/zephyr_pre0.map 
: && ccache /home/gfbudke/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc  -gdwarf-4 -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/gfbudke/zephyr/mainline/zephyr/build/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/libarch__arm__core.a  zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a  zephyr/arch/arch/arm/core/mpu/libarch__arm__core__mpu.a  zephyr/lib/libc/picolibc/liblib__libc__picolibc.a  zephyr/lib/libc/common/liblib__libc__common.a  zephyr/subsys/testsuite/ztest/libsubsys__testsuite__ztest.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  zephyr/drivers/rtc/libdrivers__rtc.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  zephyr/drivers/watchdog/libdrivers__watchdog.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L/home/gfbudke/zephyr/mainline/zephyr/build/zephyr  zephyr/arch/common/libisr_tables.a  -mcpu=cortex-m4  -mthumb  -mabi=aapcs  -mfp16-format=ieee  -mtp=soft  -fuse-ld=bfd  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn  -Wl,-no-pie  -specs=picolibc.specs  -DPICOLIBC_LONG_LONG_PRINTF_SCANF -L"/home/gfbudke/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m/nofp" -lc -lgcc && cd /home/gfbudke/zephyr/mainline/zephyr/build/zephyr && /usr/bin/cmake -E true
/home/gfbudke/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/rtc/libdrivers__rtc.a(rtc_sam.c.obj): in function `rtc_sam_alarm_set_time':
/home/gfbudke/zephyr/mainline/zephyr/drivers/rtc/rtc_sam.c:361: undefined reference to `rtc_sam_validate_tm'
/home/gfbudke/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/gfbudke/zephyr/mainline/zephyr/drivers/rtc/rtc_sam.c:361: undefined reference to `rtc_sam_validate_tm'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/gfbudke/zephyr/mainline/zephyr/build

Environment (please complete the following information):

  • OS: Linux
  • Toolchain: Latest
  • Commit: Mainline

Additional Information:

I recommend take a look on other drivers to avoid same miskate and ensure that no warnings are present.

CC: @bjarki-andreasen

@nandojve nandojve added the bug The issue is a bug, or the PR is fixing a bug label Nov 15, 2024
@nandojve nandojve added this to the v4.0.0 milestone Nov 15, 2024
@henrikbrixandersen henrikbrixandersen added the area: RTC Real Time Clock label Nov 15, 2024
nandojve added a commit to nandojve/zephyr that referenced this issue Nov 15, 2024
The zephyrproject-rtos#64939 introduced a few convenience function like
rtc_utils_validate_rtc_time. However the PR did not replace all
occurrences which result on a build error. This add the missing
header include to remove a building warning and replace the old
function by the new one.

Fixes zephyrproject-rtos#81454

Signed-off-by: Gerson Fernando Budke <[email protected]>
nandojve added a commit to nandojve/zephyr that referenced this issue Nov 17, 2024
The zephyrproject-rtos#81456 fixed the driver issue related to issue zephyrproject-rtos#81454. This add
the RTC configurations on sam_v71_xult board to enable test coverage.

Fixes zephyrproject-rtos#81454

Signed-off-by: Gerson Fernando Budke <[email protected]>
JA-NXP pushed a commit to nxp-upstream/zephyr that referenced this issue Nov 19, 2024
The zephyrproject-rtos#64939 introduced a few convenience function like
rtc_utils_validate_rtc_time. However the PR did not replace all
occurrences which result on a build error. This add the missing
header include to remove a building warning and replace the old
function by the new one.

Fixes zephyrproject-rtos#81454

Signed-off-by: Gerson Fernando Budke <[email protected]>
nandojve added a commit to nandojve/zephyr that referenced this issue Nov 23, 2024
The zephyrproject-rtos#81456 fixed the driver issue related to issue zephyrproject-rtos#81454. This add
the RTC configurations on sam_v71_xult board to enable test coverage.

Fixes zephyrproject-rtos#81454

Signed-off-by: Gerson Fernando Budke <[email protected]>
nandojve added a commit to nandojve/zephyr that referenced this issue Nov 23, 2024
The zephyrproject-rtos#81456 fixed the driver issue related to issue zephyrproject-rtos#81454. This add
the RTC configurations on sam_v71_xult board to enable test coverage.

Fixes zephyrproject-rtos#81454

Signed-off-by: Gerson Fernando Budke <[email protected]>
zephyrbot pushed a commit that referenced this issue Nov 23, 2024
The #64939 introduced a few convenience function like
rtc_utils_validate_rtc_time. However the PR did not replace all
occurrences which result on a build error. This add the missing
header include to remove a building warning and replace the old
function by the new one.

Fixes #81454

Signed-off-by: Gerson Fernando Budke <[email protected]>
(cherry picked from commit d71d4c0)
kartben pushed a commit that referenced this issue Nov 27, 2024
The #81456 fixed the driver issue related to issue #81454. This add
the RTC configurations on sam_v71_xult board to enable test coverage.

Fixes #81454

Signed-off-by: Gerson Fernando Budke <[email protected]>
zephyrbot pushed a commit that referenced this issue Nov 27, 2024
The #81456 fixed the driver issue related to issue #81454. This add
the RTC configurations on sam_v71_xult board to enable test coverage.

Fixes #81454

Signed-off-by: Gerson Fernando Budke <[email protected]>
(cherry picked from commit cffb66f)
zephyrbot pushed a commit that referenced this issue Nov 27, 2024
The #81456 fixed the driver issue related to issue #81454. This add
the RTC configurations on sam_v71_xult board to enable test coverage.

Fixes #81454

Signed-off-by: Gerson Fernando Budke <[email protected]>
(cherry picked from commit cffb66f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment