From 0a8a5a155bd1ce56d663d7010d156f5dd3f19a72 Mon Sep 17 00:00:00 2001
From: Rbb666 <64397326+Rbb666@users.noreply.github.com>
Date: Thu, 25 Jan 2024 00:00:10 +0800
Subject: [PATCH] [bsp][ifx]fix set RTC time failed bug
Co-authored-by: Meco Man <920369182@qq.com>
---
bsp/Infineon/libraries/HAL_Drivers/drv_rtc.c | 5 +
.../psoc6-evaluationkit-062S2/.config | 43 ++++--
.../psoc6-evaluationkit-062S2/project.uvprojx | 136 ++++++++++++------
.../psoc6-evaluationkit-062S2/rtconfig.h | 13 +-
4 files changed, 139 insertions(+), 58 deletions(-)
diff --git a/bsp/Infineon/libraries/HAL_Drivers/drv_rtc.c b/bsp/Infineon/libraries/HAL_Drivers/drv_rtc.c
index 146f000ef1..de7205ae57 100644
--- a/bsp/Infineon/libraries/HAL_Drivers/drv_rtc.c
+++ b/bsp/Infineon/libraries/HAL_Drivers/drv_rtc.c
@@ -94,6 +94,11 @@ static rt_err_t ifx_rtc_get_timeval(struct timeval *tv)
static rt_err_t _rtc_init(void)
{
+#ifdef BSP_RTC_USING_LSE
+ Cy_RTC_SelectClockSource(CY_RTC_CLK_SELECT_WCO);
+#else
+ Cy_RTC_SelectClockSource(CY_RTC_CLK_SELECT_ILO);
+#endif /* BSP_RTC_USING_LSE */
if (cyhal_rtc_init(&rtc_obj) != RT_EOK)
{
LOG_E("rtc init failed.");
diff --git a/bsp/Infineon/psoc6-evaluationkit-062S2/.config b/bsp/Infineon/psoc6-evaluationkit-062S2/.config
index 2ab84deed1..2931ec360b 100644
--- a/bsp/Infineon/psoc6-evaluationkit-062S2/.config
+++ b/bsp/Infineon/psoc6-evaluationkit-062S2/.config
@@ -9,8 +9,10 @@
CONFIG_RT_NAME_MAX=8
# CONFIG_RT_USING_ARCH_DATA_TYPE is not set
# CONFIG_RT_USING_SMART is not set
+# CONFIG_RT_USING_NANO is not set
# CONFIG_RT_USING_AMP is not set
# CONFIG_RT_USING_SMP is not set
+CONFIG_RT_CPUS_NR=1
CONFIG_RT_ALIGN_SIZE=8
# CONFIG_RT_THREAD_PRIORITY_8 is not set
CONFIG_RT_THREAD_PRIORITY_32=y
@@ -20,6 +22,7 @@ CONFIG_RT_TICK_PER_SECOND=1000
CONFIG_RT_USING_OVERFLOW_CHECK=y
CONFIG_RT_USING_HOOK=y
CONFIG_RT_HOOK_USING_FUNC_PTR=y
+# CONFIG_RT_USING_HOOKLIST is not set
CONFIG_RT_USING_IDLE_HOOK=y
CONFIG_RT_IDLE_HOOK_LIST_SIZE=4
CONFIG_IDLE_THREAD_STACK_SIZE=256
@@ -38,7 +41,7 @@ CONFIG_RT_KSERVICE_USING_STDLIB=y
CONFIG_RT_USING_DEBUG=y
CONFIG_RT_DEBUGING_COLOR=y
CONFIG_RT_DEBUGING_CONTEXT=y
-# CONFIG_RT_DEBUGING_INIT is not set
+# CONFIG_RT_DEBUGING_AUTO_INIT is not set
#
# Inter-Thread communication
@@ -66,19 +69,16 @@ CONFIG_RT_USING_SMALL_MEM_AS_HEAP=y
# CONFIG_RT_USING_MEMTRACE is not set
# CONFIG_RT_USING_HEAP_ISR is not set
CONFIG_RT_USING_HEAP=y
-
-#
-# Kernel Device Object
-#
CONFIG_RT_USING_DEVICE=y
# CONFIG_RT_USING_DEVICE_OPS is not set
-# CONFIG_RT_USING_DM is not set
# CONFIG_RT_USING_INTERRUPT_INFO is not set
+# CONFIG_RT_USING_THREDSAFE_PRINTF is not set
CONFIG_RT_USING_CONSOLE=y
CONFIG_RT_CONSOLEBUF_SIZE=128
CONFIG_RT_CONSOLE_DEVICE_NAME="uart6"
-CONFIG_RT_VER_NUM=0x50002
+CONFIG_RT_VER_NUM=0x50100
# CONFIG_RT_USING_STDC_ATOMIC is not set
+CONFIG_RT_BACKTRACE_LEVEL_MAX_NR=32
# CONFIG_RT_USING_CACHE is not set
CONFIG_RT_USING_HW_ATOMIC=y
# CONFIG_ARCH_ARM_BOOTWITH_FLUSH_CACHE is not set
@@ -122,6 +122,7 @@ CONFIG_FINSH_USING_OPTION_COMPLETION=y
#
# Device Drivers
#
+# CONFIG_RT_USING_DM is not set
CONFIG_RT_USING_DEVICE_IPC=y
CONFIG_RT_UNAMED_PIPE_NUMBER=64
# CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set
@@ -145,7 +146,6 @@ CONFIG_RT_USING_PIN=y
# CONFIG_RT_USING_MTD_NOR is not set
# CONFIG_RT_USING_MTD_NAND is not set
# CONFIG_RT_USING_PM is not set
-# CONFIG_RT_USING_FDT is not set
# CONFIG_RT_USING_RTC is not set
# CONFIG_RT_USING_SDIO is not set
# CONFIG_RT_USING_SPI is not set
@@ -216,6 +216,12 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_RT_USING_LWIP is not set
# CONFIG_RT_USING_AT is not set
+#
+# Memory protection
+#
+# CONFIG_RT_USING_MEM_PROTECTION is not set
+# CONFIG_RT_USING_HW_STACK_GUARD is not set
+
#
# Utilities
#
@@ -268,6 +274,11 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# CONFIG_PKG_USING_WLAN_WICED is not set
# CONFIG_PKG_USING_RW007 is not set
+
+#
+# CYW43012 WiFi
+#
+# CONFIG_PKG_USING_WLAN_CYW43012 is not set
# CONFIG_PKG_USING_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set
# CONFIG_PKG_USING_NETUTILS is not set
@@ -329,6 +340,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ZFTP is not set
# CONFIG_PKG_USING_WOL is not set
# CONFIG_PKG_USING_ZEPHYR_POLLING is not set
+# CONFIG_PKG_USING_MATTER_ADAPTATION_LAYER is not set
#
# security packages
@@ -375,7 +387,6 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# LVGL: powerful and easy-to-use embedded GUI library
#
# CONFIG_PKG_USING_LVGL is not set
-# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
# CONFIG_PKG_USING_LV_MUSIC_DEMO is not set
# CONFIG_PKG_USING_GUI_GUIDER_DEMO is not set
@@ -452,6 +463,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_ARMV7M_DWT_TOOL is not set
# CONFIG_PKG_USING_VOFA_PLUS is not set
# CONFIG_PKG_USING_RT_TRACE is not set
+# CONFIG_PKG_USING_ZDEBUG is not set
#
# system packages
@@ -488,6 +500,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_UC_COMMON is not set
# CONFIG_PKG_USING_UC_MODBUS is not set
# CONFIG_PKG_USING_FREERTOS_WRAPPER is not set
+# CONFIG_PKG_USING_LITEOS_SDK is not set
+# CONFIG_PKG_USING_TZ_DATABASE is not set
# CONFIG_PKG_USING_CAIRO is not set
# CONFIG_PKG_USING_PIXMAN is not set
# CONFIG_PKG_USING_PARTITION is not set
@@ -511,6 +525,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_QBOOT is not set
# CONFIG_PKG_USING_PPOOL is not set
# CONFIG_PKG_USING_OPENAMP is not set
+# CONFIG_PKG_USING_RPMSG_LITE is not set
# CONFIG_PKG_USING_LPM is not set
# CONFIG_PKG_USING_TLSF is not set
# CONFIG_PKG_USING_EVENT_RECORDER is not set
@@ -524,6 +539,8 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_AGILE_UPGRADE is not set
# CONFIG_PKG_USING_FLASH_BLOB is not set
# CONFIG_PKG_USING_MLIBC is not set
+# CONFIG_PKG_USING_TASK_MSG_BUS is not set
+# CONFIG_PKG_USING_SFDB is not set
#
# peripheral libraries and drivers
@@ -588,6 +605,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_BALANCE is not set
# CONFIG_PKG_USING_SHT2X is not set
# CONFIG_PKG_USING_SHT3X is not set
+# CONFIG_PKG_USING_SHT4X is not set
# CONFIG_PKG_USING_AD7746 is not set
# CONFIG_PKG_USING_ADT74XX is not set
# CONFIG_PKG_USING_MAX17048 is not set
@@ -688,6 +706,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_FINGERPRINT is not set
# CONFIG_PKG_USING_BT_ECB02C is not set
# CONFIG_PKG_USING_UAT is not set
+# CONFIG_PKG_USING_ST7789 is not set
# CONFIG_PKG_USING_SPI_TOOLS is not set
#
@@ -711,6 +730,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
# CONFIG_PKG_USING_UKAL is not set
# CONFIG_PKG_USING_DIGITALCTRL is not set
# CONFIG_PKG_USING_KISSFFT is not set
+# CONFIG_PKG_USING_CMSIS_DSP is not set
#
# miscellaneous packages
@@ -932,6 +952,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_GFX_LIBRARY is not set
# CONFIG_PKG_USING_ARDUINO_U8G2 is not set
+# CONFIG_PKG_USING_ARDUINO_TFT_ESPI is not set
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_ST7735 is not set
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SSD1306 is not set
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_ILI9341 is not set
@@ -940,6 +961,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# Timing
#
+# CONFIG_PKG_USING_ARDUINO_RTCLIB is not set
# CONFIG_PKG_USING_ARDUINO_MSTIMER2 is not set
# CONFIG_PKG_USING_ARDUINO_TICKER is not set
# CONFIG_PKG_USING_ARDUINO_TASKSCHEDULER is not set
@@ -976,7 +998,6 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
#
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MFRC630 is not set
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SI5351 is not set
-# CONFIG_PKG_USING_ARDUINO_RTCLIB is not set
#
# Signal IO
@@ -1024,6 +1045,8 @@ CONFIG_BSP_USING_UART6=y
# CONFIG_BSP_USING_HW_I2C is not set
# CONFIG_BSP_USING_I2C is not set
# CONFIG_BSP_USING_RTC is not set
+# CONFIG_BSP_RTC_USING_LSE is not set
+# CONFIG_BSP_RTC_USING_LSI is not set
# CONFIG_BSP_USING_ON_CHIP_FLASH is not set
# CONFIG_BSP_USING_WDT is not set
# CONFIG_BSP_USING_DAC is not set
diff --git a/bsp/Infineon/psoc6-evaluationkit-062S2/project.uvprojx b/bsp/Infineon/psoc6-evaluationkit-062S2/project.uvprojx
index 86d726dafe..7c18ad66aa 100644
--- a/bsp/Infineon/psoc6-evaluationkit-062S2/project.uvprojx
+++ b/bsp/Infineon/psoc6-evaluationkit-062S2/project.uvprojx
@@ -336,7 +336,7 @@
CY_USING_HAL, __STDC_LIMIT_MACROS, RT_USING_ARMLIBC, CORE_NAME_CM0P_0, COMPONENT_CAT1A, RT_USING_LIBC, __CLK_TCK=RT_TICK_PER_SECOND, CY_USING_PREBUILT_CM0P_IMAGE, __RTTHREAD__, COMPONENT_CAT1, CORE_NAME_CM4_0, CY8C624ALQI_S2D42
- ..\libraries\IFX_PSOC6_HAL\mtb-pdl-cat1\devices\COMPONENT_CAT1A\include;..\libraries\IFX_PSOC6_HAL\mtb_shared\serial-flash;board\ports;..\libraries\IFX_PSOC6_HAL\mtb_shared\usbdev;libs\TARGET_RTT-062S2;board;..\..\..\components\libc\posix\io\eventfd;..\libraries\IFX_PSOC6_HAL\mtb-hal-cat1\include_pvt;..\..\..\components\libc\compilers\common\extension;..\libraries\IFX_PSOC6_HAL\mtb-hal-cat1\include;..\..\..\libcpu\arm\cortex-m4;..\..\..\include;..\libraries\IFX_PSOC6_HAL\psoc6cm0p;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\libraries\IFX_PSOC6_HAL\capsense;applications;..\libraries\IFX_PSOC6_HAL\core-lib\include;..\..\..\components\drivers\include;..\libraries\IFX_PSOC6_HAL\mtb_shared\csdidac;..\..\..\components\libc\compilers\common\include;..\libraries\IFX_PSOC6_HAL\mtb-pdl-cat1\drivers\include;..\libraries\HAL_Drivers\config;libs\TARGET_RTT-062S2\config;..\..\..\components\libc\posix\io\poll;..\..\..\components\libc\posix\ipc;libs\TARGET_RTT-062S2\bluetooth;..\libraries\IFX_PSOC6_HAL\mtb-hal-cat1\COMPONENT_CAT1A\include;..\libraries\HAL_Drivers;..\..\..\components\drivers\include;libs\TARGET_RTT-062S2\config\GeneratedSource;.;..\libraries\IFX_PSOC6_HAL\retarget-io;..\..\..\libcpu\arm\common;..\..\..\components\libc\compilers\common\extension\fcntl\octal;..\libraries\IFX_PSOC6_HAL\mtb-pdl-cat1\cmsis\include;..\..\..\components\libc\posix\io\epoll;..\..\..\components\finsh
+ ..\..\..\components\finsh;..\libraries\HAL_Drivers\config;..\libraries\IFX_PSOC6_HAL\psoc6cm0p;..\..\..\libcpu\arm\cortex-m4;..\libraries\HAL_Drivers;..\libraries\IFX_PSOC6_HAL\mtb-hal-cat1\COMPONENT_CAT1A\include;applications;..\..\..\include;libs\TARGET_RTT-062S2\bluetooth;..\libraries\IFX_PSOC6_HAL\mtb-hal-cat1\include_pvt;..\..\..\components\libc\posix\io\poll;..\libraries\IFX_PSOC6_HAL\core-lib\include;libs\TARGET_RTT-062S2\config;..\..\..\components\libc\posix\ipc;..\libraries\IFX_PSOC6_HAL\mtb_shared\usbdev;..\..\..\components\libc\posix\io\eventfd;..\libraries\IFX_PSOC6_HAL\mtb-hal-cat1\include;libs\TARGET_RTT-062S2;..\..\..\components\drivers\include;..\..\..\libcpu\arm\common;..\..\..\components\libc\posix\io\epoll;..\libraries\IFX_PSOC6_HAL\retarget-io;libs\TARGET_RTT-062S2\config\GeneratedSource;board\ports;board;.;..\..\..\components\drivers\include;..\libraries\IFX_PSOC6_HAL\mtb_shared\serial-flash;..\..\..\components\drivers\include;..\libraries\IFX_PSOC6_HAL\capsense;..\libraries\IFX_PSOC6_HAL\mtb-pdl-cat1\devices\COMPONENT_CAT1A\include;..\libraries\IFX_PSOC6_HAL\mtb_shared\csdidac;..\..\..\components\libc\compilers\common\extension\fcntl\octal;..\libraries\IFX_PSOC6_HAL\mtb-pdl-cat1\drivers\include;..\..\..\components\drivers\include;..\libraries\IFX_PSOC6_HAL\mtb-pdl-cat1\cmsis\include;..\..\..\components\libc\compilers\common\extension;..\..\..\components\libc\compilers\common\include
@@ -602,6 +602,18 @@
shell.c
1
..\..\..\components\finsh\shell.c
+
+
+
+
+ -Wstack-usage=4096
+
+
+
+
+
+
+
@@ -609,6 +621,18 @@
msh.c
1
..\..\..\components\finsh\msh.c
+
+
+
+
+ -Wstack-usage=4096
+
+
+
+
+
+
+
@@ -616,6 +640,18 @@
msh_parse.c
1
..\..\..\components\finsh\msh_parse.c
+
+
+
+
+ -Wstack-usage=4096
+
+
+
+
+
+
+
@@ -623,6 +659,18 @@
cmd.c
1
..\..\..\components\finsh\cmd.c
+
+
+
+
+ -Wstack-usage=4096
+
+
+
+
+
+
+
@@ -715,13 +763,6 @@
Libraries
-
-
- psoc6_03_cm0p_sleep.c
- 1
- ..\libraries\IFX_PSOC6_HAL\psoc6cm0p\COMPONENT_CM0P_SLEEP\psoc6_03_cm0p_sleep.c
-
-
cyhal_triggers_psoc6_02.c
@@ -771,6 +812,13 @@
..\libraries\IFX_PSOC6_HAL\mtb-hal-cat1\source\cyhal_clock.c
+
+
+ psoc6_03_cm0p_sleep.c
+ 1
+ ..\libraries\IFX_PSOC6_HAL\psoc6cm0p\COMPONENT_CM0P_SLEEP\psoc6_03_cm0p_sleep.c
+
+
cy_scb_uart.c
@@ -813,13 +861,6 @@
..\libraries\IFX_PSOC6_HAL\mtb-pdl-cat1\drivers\source\cy_ipc_sema.c
-
-
- psoc6_04_cm0p_sleep.c
- 1
- ..\libraries\IFX_PSOC6_HAL\psoc6cm0p\COMPONENT_CM0P_SLEEP\psoc6_04_cm0p_sleep.c
-
-
cyhal_utils.c
@@ -904,6 +945,13 @@
..\libraries\IFX_PSOC6_HAL\mtb-hal-cat1\COMPONENT_CAT1A\source\pin_packages\cyhal_psoc6_02_68_qfn.c
+
+
+ psoc6_04_cm0p_sleep.c
+ 1
+ ..\libraries\IFX_PSOC6_HAL\psoc6cm0p\COMPONENT_CM0P_SLEEP\psoc6_04_cm0p_sleep.c
+
+
cy_systick.c
@@ -965,16 +1013,9 @@
libs
- cycfg_system.c
+ cycfg_connectivity_bt.c
1
- libs\TARGET_RTT-062S2\config\GeneratedSource\cycfg_system.c
-
-
-
-
- cycfg_qspi_memslot.c
- 1
- libs\TARGET_RTT-062S2\config\GeneratedSource\cycfg_qspi_memslot.c
+ libs\TARGET_RTT-062S2\config\GeneratedSource\cycfg_connectivity_bt.c
@@ -986,16 +1027,9 @@
- system_psoc6_cm4.c
+ cycfg_clocks.c
1
- libs\TARGET_RTT-062S2\COMPONENT_CM4\system_psoc6_cm4.c
-
-
-
-
- cycfg_peripherals.c
- 1
- libs\TARGET_RTT-062S2\config\GeneratedSource\cycfg_peripherals.c
+ libs\TARGET_RTT-062S2\config\GeneratedSource\cycfg_clocks.c
@@ -1012,13 +1046,6 @@
libs\TARGET_RTT-062S2\config\GeneratedSource\cycfg_routing.c
-
-
- cycfg.c
- 1
- libs\TARGET_RTT-062S2\config\GeneratedSource\cycfg.c
-
-
cybsp.c
@@ -1028,16 +1055,37 @@
- cycfg_clocks.c
+ cycfg_peripherals.c
1
- libs\TARGET_RTT-062S2\config\GeneratedSource\cycfg_clocks.c
+ libs\TARGET_RTT-062S2\config\GeneratedSource\cycfg_peripherals.c
- cycfg_connectivity_bt.c
+ cycfg.c
1
- libs\TARGET_RTT-062S2\config\GeneratedSource\cycfg_connectivity_bt.c
+ libs\TARGET_RTT-062S2\config\GeneratedSource\cycfg.c
+
+
+
+
+ cycfg_qspi_memslot.c
+ 1
+ libs\TARGET_RTT-062S2\config\GeneratedSource\cycfg_qspi_memslot.c
+
+
+
+
+ system_psoc6_cm4.c
+ 1
+ libs\TARGET_RTT-062S2\COMPONENT_CM4\system_psoc6_cm4.c
+
+
+
+
+ cycfg_system.c
+ 1
+ libs\TARGET_RTT-062S2\config\GeneratedSource\cycfg_system.c
diff --git a/bsp/Infineon/psoc6-evaluationkit-062S2/rtconfig.h b/bsp/Infineon/psoc6-evaluationkit-062S2/rtconfig.h
index 8efef09b2b..edda51c6d9 100644
--- a/bsp/Infineon/psoc6-evaluationkit-062S2/rtconfig.h
+++ b/bsp/Infineon/psoc6-evaluationkit-062S2/rtconfig.h
@@ -7,6 +7,7 @@
/* RT-Thread Kernel */
#define RT_NAME_MAX 8
+#define RT_CPUS_NR 1
#define RT_ALIGN_SIZE 8
#define RT_THREAD_PRIORITY_32
#define RT_THREAD_PRIORITY_MAX 32
@@ -42,14 +43,12 @@
#define RT_USING_SMALL_MEM
#define RT_USING_SMALL_MEM_AS_HEAP
#define RT_USING_HEAP
-
-/* Kernel Device Object */
-
#define RT_USING_DEVICE
#define RT_USING_CONSOLE
#define RT_CONSOLEBUF_SIZE 128
#define RT_CONSOLE_DEVICE_NAME "uart6"
-#define RT_VER_NUM 0x50002
+#define RT_VER_NUM 0x50100
+#define RT_BACKTRACE_LEVEL_MAX_NR 32
#define RT_USING_HW_ATOMIC
#define RT_USING_CPU_FFS
#define ARCH_ARM
@@ -116,6 +115,9 @@
/* Network */
+/* Memory protection */
+
+
/* Utilities */
@@ -135,6 +137,9 @@
/* Wiced WiFi */
+/* CYW43012 WiFi */
+
+
/* IoT Cloud */