diff --git a/bsp/nxp/mcx/mcxa/frdm-mcxa346/.config b/bsp/nxp/mcx/mcxa/frdm-mcxa346/.config index 30fa7004d7e..92b1ada6260 100644 --- a/bsp/nxp/mcx/mcxa/frdm-mcxa346/.config +++ b/bsp/nxp/mcx/mcxa/frdm-mcxa346/.config @@ -268,6 +268,7 @@ CONFIG_RT_USING_RTC=y # CONFIG_RT_USING_SOFT_RTC is not set # CONFIG_RT_USING_SDIO is not set CONFIG_RT_USING_SPI=y +CONFIG_RT_USING_SPI_ISR=y # CONFIG_RT_USING_SOFT_SPI is not set # CONFIG_RT_USING_QSPI is not set # CONFIG_RT_USING_SPI_MSD is not set @@ -362,8 +363,6 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0 # CONFIG_RT_USING_RT_LINK is not set # end of Utilities -# CONFIG_RT_USING_VBUS is not set - # # Using USB legacy version # @@ -645,6 +644,9 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0 # CONFIG_PKG_USING_RVBACKTRACE is not set # CONFIG_PKG_USING_HPATCHLITE is not set # CONFIG_PKG_USING_THREAD_METRIC is not set +# CONFIG_PKG_USING_UORB is not set +# CONFIG_PKG_USING_RT_TUNNEL is not set +# CONFIG_PKG_USING_VIRTUAL_TERMINAL is not set # end of tools packages # @@ -739,6 +741,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0 # CONFIG_PKG_USING_R_RHEALSTONE is not set # CONFIG_PKG_USING_HEARTBEAT is not set # CONFIG_PKG_USING_MICRO_ROS_RTTHREAD_PACKAGE is not set +# CONFIG_PKG_USING_CHERRYECAT is not set # end of system packages # @@ -901,6 +904,12 @@ CONFIG_PKG_NXP_MCX_SERIES_DRIVER_VER="latest" # CONFIG_PKG_USING_GD32_ARM_CMSIS_DRIVER is not set # CONFIG_PKG_USING_GD32_ARM_SERIES_DRIVER is not set # end of GD32 Drivers + +# +# HPMicro SDK +# +# CONFIG_PKG_USING_HPM_SDK is not set +# end of HPMicro SDK # end of HAL & SDK Drivers # @@ -949,6 +958,7 @@ CONFIG_PKG_NXP_MCX_SERIES_DRIVER_VER="latest" # CONFIG_PKG_USING_MLX90393 is not set # CONFIG_PKG_USING_MLX90392 is not set # CONFIG_PKG_USING_MLX90394 is not set +# CONFIG_PKG_USING_MLX90396 is not set # CONFIG_PKG_USING_MLX90397 is not set # CONFIG_PKG_USING_MS5611 is not set # CONFIG_PKG_USING_MAX31865 is not set @@ -1430,7 +1440,11 @@ CONFIG_BSP_USING_UART2=y # CONFIG_BSP_USING_ADC is not set # CONFIG_BSP_USING_RTC is not set # CONFIG_BSP_USING_WDT is not set -# CONFIG_BSP_USING_HWTIMER is not set +CONFIG_BSP_USING_HWTIMER=y +CONFIG_BSP_USING_CTIMER0=y +CONFIG_BSP_USING_CTIMER1=y +# CONFIG_BSP_USING_CTIMER3 is not set +# CONFIG_BSP_USING_CTIMER4 is not set # CONFIG_BSP_USING_PWM is not set # end of On-chip Peripheral Drivers diff --git a/bsp/nxp/mcx/mcxa/frdm-mcxa346/applications/main.c b/bsp/nxp/mcx/mcxa/frdm-mcxa346/applications/main.c index 27f2ffc6697..49756adfc59 100644 --- a/bsp/nxp/mcx/mcxa/frdm-mcxa346/applications/main.c +++ b/bsp/nxp/mcx/mcxa/frdm-mcxa346/applications/main.c @@ -20,7 +20,7 @@ #define BUTTON_PIN ((1*32)+7) /* P1_7 button pin */ static rt_bool_t led_state = RT_FALSE; /* Current LED state */ - +int create_tester_hwtimer_thread(void); /* Button interrupt callback function */ void button_irq_callback(void *args) @@ -52,13 +52,13 @@ int main(void) /* Attach interrupt to button pin */ rt_pin_attach_irq(BUTTON_PIN, PIN_IRQ_MODE_FALLING, button_irq_callback, RT_NULL); rt_pin_irq_enable(BUTTON_PIN, PIN_IRQ_ENABLE); - + create_tester_hwtimer_thread(); while (1) { - /* Toggle LED state */ - led_state = !led_state; +// /* Toggle LED state */ +// led_state = !led_state; - rt_pin_write(LED_PIN, led_state ? PIN_HIGH : PIN_LOW); +// rt_pin_write(LED_PIN, led_state ? PIN_HIGH : PIN_LOW); rt_thread_mdelay(500); } diff --git a/bsp/nxp/mcx/mcxa/frdm-mcxa346/project.uvoptx b/bsp/nxp/mcx/mcxa/frdm-mcxa346/project.uvoptx index 56d3a78b4df..a2698c02d3f 100644 --- a/bsp/nxp/mcx/mcxa/frdm-mcxa346/project.uvoptx +++ b/bsp/nxp/mcx/mcxa/frdm-mcxa346/project.uvoptx @@ -120,7 +120,7 @@ 0 CMSIS_AGDI_V8M - -X"Any" -UAny -O206 -S9 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(6BA02477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0MCXA34X_1024.FLM -FS00 -FL0FE000 -FP0($$Device:MCXA346VLQ$devices\MCXA346\arm\MCXA34X_1024.FLM) + -X"Any" -UAny -O206 -S9 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(6BA02477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0MCXA_1024 -FS00 -FL0FE000 -FP0($$Device:MCXA346VLQ$devices\MCXA346\arm\MCXA_1024.FLM) 0 @@ -211,26 +211,26 @@ 0 0 - - - - Compiler - 0 - 0 - 0 - 0 - 2 + 1 3 1 0 0 0 - ..\..\..\..\..\components\libc\compilers\armlibc\syscall_mem.c - syscall_mem.c + .\test_hwtimer.c + test_hwtimer.c 0 0 + + + + CPU + 1 + 0 + 0 + 0 2 4 @@ -238,8 +238,8 @@ 0 0 0 - ..\..\..\..\..\components\libc\compilers\armlibc\syscalls.c - syscalls.c + ..\..\..\..\..\libcpu\arm\common\atomic_arm.c + atomic_arm.c 0 0 @@ -250,8 +250,8 @@ 0 0 0 - ..\..\..\..\..\components\libc\compilers\common\cctype.c - cctype.c + ..\..\..\..\..\libcpu\arm\common\div0.c + div0.c 0 0 @@ -262,20 +262,20 @@ 0 0 0 - ..\..\..\..\..\components\libc\compilers\common\cstdlib.c - cstdlib.c + ..\..\..\..\..\libcpu\arm\common\showmem.c + showmem.c 0 0 2 7 - 1 + 2 0 0 0 - ..\..\..\..\..\components\libc\compilers\common\cstring.c - cstring.c + ..\..\..\..\..\libcpu\arm\cortex-m33\context_rvds.S + context_rvds.S 0 0 @@ -286,20 +286,20 @@ 0 0 0 - ..\..\..\..\..\components\libc\compilers\common\ctime.c - ctime.c + ..\..\..\..\..\libcpu\arm\cortex-m33\cpuport.c + cpuport.c 0 0 2 9 - 1 + 2 0 0 0 - ..\..\..\..\..\components\libc\compilers\common\cunistd.c - cunistd.c + ..\..\..\..\..\libcpu\arm\cortex-m33\syscall_rvds.S + syscall_rvds.S 0 0 @@ -310,8 +310,8 @@ 0 0 0 - ..\..\..\..\..\components\libc\compilers\common\cwchar.c - cwchar.c + ..\..\..\..\..\libcpu\arm\cortex-m33\trustzone.c + trustzone.c 0 0 @@ -319,7 +319,7 @@ DeviceDrivers - 0 + 1 0 0 0 @@ -567,7 +567,7 @@ Drivers - 0 + 1 0 0 0 @@ -614,6 +614,18 @@ 0 0 0 + ..\Libraries\drivers\drv_hwtimer.c + drv_hwtimer.c + 0 + 0 + + + 4 + 35 + 1 + 0 + 0 + 0 ..\Libraries\drivers\drv_pin.c drv_pin.c 0 @@ -621,7 +633,7 @@ 4 - 35 + 36 1 0 0 @@ -635,13 +647,13 @@ Finsh - 0 + 1 0 0 0 5 - 36 + 37 1 0 0 @@ -653,7 +665,7 @@ 5 - 37 + 38 1 0 0 @@ -665,7 +677,7 @@ 5 - 38 + 39 1 0 0 @@ -677,7 +689,7 @@ 5 - 39 + 40 1 0 0 @@ -691,13 +703,13 @@ Kernel - 0 + 1 0 0 0 6 - 40 + 41 1 0 0 @@ -709,7 +721,7 @@ 6 - 41 + 42 1 0 0 @@ -721,7 +733,7 @@ 6 - 42 + 43 1 0 0 @@ -733,7 +745,7 @@ 6 - 43 + 44 1 0 0 @@ -745,7 +757,7 @@ 6 - 44 + 45 1 0 0 @@ -757,7 +769,7 @@ 6 - 45 + 46 1 0 0 @@ -769,7 +781,7 @@ 6 - 46 + 47 1 0 0 @@ -781,7 +793,7 @@ 6 - 47 + 48 1 0 0 @@ -793,7 +805,7 @@ 6 - 48 + 49 1 0 0 @@ -805,7 +817,7 @@ 6 - 49 + 50 1 0 0 @@ -817,7 +829,7 @@ 6 - 50 + 51 1 0 0 @@ -829,7 +841,7 @@ 6 - 51 + 52 1 0 0 @@ -841,7 +853,7 @@ 6 - 52 + 53 1 0 0 @@ -853,7 +865,7 @@ 6 - 53 + 54 1 0 0 @@ -865,7 +877,7 @@ 6 - 54 + 55 1 0 0 @@ -878,23 +890,11 @@ - klibc - 0 + Libc + 1 0 0 0 - - 7 - 55 - 1 - 0 - 0 - 0 - ..\..\..\..\..\src\klibc\kerrno.c - kerrno.c - 0 - 0 - 7 56 @@ -902,8 +902,8 @@ 0 0 0 - ..\..\..\..\..\src\klibc\kstdio.c - kstdio.c + ..\..\..\..\..\components\libc\compilers\armlibc\syscall_mem.c + syscall_mem.c 0 0 @@ -914,8 +914,8 @@ 0 0 0 - ..\..\..\..\..\src\klibc\kstring.c - kstring.c + ..\..\..\..\..\components\libc\compilers\armlibc\syscalls.c + syscalls.c 0 0 @@ -926,8 +926,8 @@ 0 0 0 - ..\..\..\..\..\src\klibc\rt_vsscanf.c - rt_vsscanf.c + ..\..\..\..\..\components\libc\compilers\common\cctype.c + cctype.c 0 0 @@ -938,100 +938,116 @@ 0 0 0 - ..\..\..\..\..\src\klibc\rt_vsnprintf_tiny.c - rt_vsnprintf_tiny.c + ..\..\..\..\..\components\libc\compilers\common\cstdlib.c + cstdlib.c 0 0 - - - - libcpu - 0 - 0 - 0 - 0 - 8 + 7 60 1 0 0 0 - ..\..\..\..\..\libcpu\arm\common\atomic_arm.c - atomic_arm.c + ..\..\..\..\..\components\libc\compilers\common\cstring.c + cstring.c 0 0 - 8 + 7 61 1 0 0 0 - ..\..\..\..\..\libcpu\arm\common\div0.c - div0.c + ..\..\..\..\..\components\libc\compilers\common\ctime.c + ctime.c 0 0 - 8 + 7 62 1 0 0 0 - ..\..\..\..\..\libcpu\arm\common\showmem.c - showmem.c + ..\..\..\..\..\components\libc\compilers\common\cunistd.c + cunistd.c 0 0 - 8 + 7 63 - 2 + 1 0 0 0 - ..\..\..\..\..\libcpu\arm\cortex-m33\context_rvds.S - context_rvds.S + ..\..\..\..\..\components\libc\compilers\common\cwchar.c + cwchar.c 0 0 - 8 + 7 64 1 0 0 0 - ..\..\..\..\..\libcpu\arm\cortex-m33\cpuport.c - cpuport.c + ..\..\..\..\..\src\klibc\kerrno.c + kerrno.c 0 0 - 8 + 7 65 - 2 + 1 0 0 0 - ..\..\..\..\..\libcpu\arm\cortex-m33\syscall_rvds.S - syscall_rvds.S + ..\..\..\..\..\src\klibc\kstdio.c + kstdio.c 0 0 - 8 + 7 66 1 0 0 0 - ..\..\..\..\..\libcpu\arm\cortex-m33\trustzone.c - trustzone.c + ..\..\..\..\..\src\klibc\kstring.c + kstring.c + 0 + 0 + + + 7 + 67 + 1 + 0 + 0 + 0 + ..\..\..\..\..\src\klibc\rt_vsnprintf_tiny.c + rt_vsnprintf_tiny.c + 0 + 0 + + + 7 + 68 + 1 + 0 + 0 + 0 + ..\..\..\..\..\src\klibc\rt_vsscanf.c + rt_vsscanf.c 0 0 @@ -1044,8 +1060,8 @@ 0 0 - 9 - 67 + 8 + 69 1 0 0 @@ -1056,8 +1072,8 @@ 0 - 9 - 68 + 8 + 70 1 0 0 @@ -1068,8 +1084,8 @@ 0 - 9 - 69 + 8 + 71 1 0 0 @@ -1080,8 +1096,8 @@ 0 - 9 - 70 + 8 + 72 1 0 0 @@ -1092,8 +1108,8 @@ 0 - 9 - 71 + 8 + 73 1 0 0 @@ -1104,8 +1120,8 @@ 0 - 9 - 72 + 8 + 74 1 0 0 @@ -1116,8 +1132,8 @@ 0 - 9 - 73 + 8 + 75 1 0 0 @@ -1128,8 +1144,8 @@ 0 - 9 - 74 + 8 + 76 1 0 0 @@ -1140,8 +1156,8 @@ 0 - 9 - 75 + 8 + 77 1 0 0 @@ -1152,8 +1168,8 @@ 0 - 9 - 76 + 8 + 78 1 0 0 @@ -1164,8 +1180,8 @@ 0 - 9 - 77 + 8 + 79 1 0 0 @@ -1176,8 +1192,8 @@ 0 - 9 - 78 + 8 + 80 1 0 0 @@ -1188,8 +1204,8 @@ 0 - 9 - 79 + 8 + 81 1 0 0 @@ -1200,8 +1216,8 @@ 0 - 9 - 80 + 8 + 82 1 0 0 @@ -1212,8 +1228,8 @@ 0 - 9 - 81 + 8 + 83 1 0 0 @@ -1224,8 +1240,8 @@ 0 - 9 - 82 + 8 + 84 1 0 0 @@ -1236,8 +1252,8 @@ 0 - 9 - 83 + 8 + 85 1 0 0 @@ -1248,8 +1264,8 @@ 0 - 9 - 84 + 8 + 86 1 0 0 @@ -1260,8 +1276,8 @@ 0 - 9 - 85 + 8 + 87 1 0 0 @@ -1272,8 +1288,8 @@ 0 - 9 - 86 + 8 + 88 1 0 0 @@ -1284,8 +1300,8 @@ 0 - 9 - 87 + 8 + 89 1 0 0 @@ -1296,8 +1312,8 @@ 0 - 9 - 88 + 8 + 90 1 0 0 @@ -1308,8 +1324,8 @@ 0 - 9 - 89 + 8 + 91 1 0 0 @@ -1320,8 +1336,8 @@ 0 - 9 - 90 + 8 + 92 1 0 0 @@ -1332,8 +1348,8 @@ 0 - 9 - 91 + 8 + 93 1 0 0 @@ -1344,8 +1360,8 @@ 0 - 9 - 92 + 8 + 94 1 0 0 @@ -1356,8 +1372,8 @@ 0 - 9 - 93 + 8 + 95 1 0 0 @@ -1368,8 +1384,8 @@ 0 - 9 - 94 + 8 + 96 1 0 0 @@ -1380,8 +1396,8 @@ 0 - 9 - 95 + 8 + 97 1 0 0 @@ -1392,8 +1408,8 @@ 0 - 9 - 96 + 8 + 98 1 0 0 @@ -1404,8 +1420,8 @@ 0 - 9 - 97 + 8 + 99 1 0 0 @@ -1416,8 +1432,8 @@ 0 - 9 - 98 + 8 + 100 1 0 0 @@ -1428,8 +1444,8 @@ 0 - 9 - 99 + 8 + 101 1 0 0 @@ -1440,8 +1456,8 @@ 0 - 9 - 100 + 8 + 102 1 0 0 @@ -1452,8 +1468,8 @@ 0 - 9 - 101 + 8 + 103 1 0 0 @@ -1464,8 +1480,8 @@ 0 - 9 - 102 + 8 + 104 1 0 0 diff --git a/bsp/nxp/mcx/mcxa/frdm-mcxa346/project.uvprojx b/bsp/nxp/mcx/mcxa/frdm-mcxa346/project.uvprojx index a4553409c63..9ee92b3cf9f 100644 --- a/bsp/nxp/mcx/mcxa/frdm-mcxa346/project.uvprojx +++ b/bsp/nxp/mcx/mcxa/frdm-mcxa346/project.uvprojx @@ -10,13 +10,13 @@ rtthread-frdm-mcxa346 0x4 ARM-ADS - 6230000::V6.23::ARMCLANG + 6180000::V6.18::ARMCLANG 1 MCXA346VLQ NXP - NXP.MCXA346_DFP.25.06.00 + NXP.MCXA346_DFP.25.09.00 https://mcuxpresso.nxp.com/cmsis_pack/repo/ IRAM(0x20000000,0x03c000) IRAM2(0x04000000,0x2000) IROM(0x03000000,0x2000) IROM2(0x00000000,0x0fe000) XRAM(0x04002000,0x2000) CPUTYPE("Cortex-M33") FPU3(SFPU) DSP CLOCK(12000000) ELITTLE @@ -338,9 +338,9 @@ 0 --target=arm-arm-none-eabi - __RTTHREAD__, CPU_MCXA346VLQ, RT_USING_ARMLIBC, DEBUG, __STDC_LIMIT_MACROS, RT_USING_LIBC, __CLK_TCK=RT_TICK_PER_SECOND + __STDC_LIMIT_MACROS, CPU_MCXA346VLQ, __CLK_TCK=RT_TICK_PER_SECOND, __RTTHREAD__, RT_USING_LIBC, RT_USING_ARMLIBC, DEBUG - ..\..\..\..\..\components\drivers\include;applications;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\libc\posix\io\poll;..\..\..\..\..\components\libc\compilers\common\extension;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\drivers\smp_call;..\Libraries\drivers\config;..\..\..\..\..\components\drivers\spi;..\..\..\..\..\components\drivers\include;.;..\..\..\..\..\libcpu\arm\common;packages\nxp-mcx-cmsis-latest\Core\Include;packages\nxp-mcx-series-latest\MCXA346\drivers;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\libc\posix\io\eventfd;..\..\..\..\..\components\drivers\include;packages\nxp-mcx-series-latest\MCXA346\periph2;..\..\..\..\..\libcpu\arm\cortex-m33;..\..\..\..\..\components\libc\posix\ipc;..\..\..\..\..\components\finsh;packages\nxp-mcx-series-latest\MCXA346;..\..\..\..\..\components\libc\compilers\common\extension\fcntl\octal;..\Libraries\drivers;..\..\..\..\..\components\drivers\include;..\..\..\..\..\include;..\..\..\..\..\components\libc\posix\io\epoll;board\MCUX_Config\board;..\..\..\..\..\components\drivers\include;packages\nxp-mcx-series-latest\MCXA346\components\codec;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\libc\compilers\common\include;board;..\..\..\..\..\components\drivers\phy + ..\..\..\..\..\include;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\finsh;.;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\drivers\include;packages\nxp-mcx-series-latest\MCXA346\components\codec;packages\nxp-mcx-series-latest\MCXA346\drivers;board\MCUX_Config\board;..\..\..\..\..\libcpu\arm\common;..\..\..\..\..\components\drivers\include;..\Libraries\drivers;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\drivers\spi;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\libc\compilers\common\extension;..\..\..\..\..\components\libc\compilers\common\extension\fcntl\octal;..\..\..\..\..\components\libc\posix\ipc;..\..\..\..\..\libcpu\arm\cortex-m33;..\..\..\..\..\components\libc\compilers\common\include;applications;packages\nxp-mcx-series-latest\MCXA346\periph2;packages\nxp-mcx-cmsis-latest\Core\Include;..\..\..\..\..\components\drivers\smp_call;..\..\..\..\..\components\drivers\phy;..\..\..\..\..\components\libc\posix\io\eventfd;..\Libraries\drivers\config;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\libc\posix\io\poll;packages\nxp-mcx-series-latest\MCXA346;..\..\..\..\..\components\net\utest;..\..\..\..\..\components\drivers\include;..\..\..\..\..\components\libc\posix\io\epoll;..\..\..\..\..\components\drivers\include;board @@ -394,50 +394,50 @@ 1 applications\main.c + + test_hwtimer.c + 1 + .\test_hwtimer.c + - Compiler + CPU - syscall_mem.c - 1 - ..\..\..\..\..\components\libc\compilers\armlibc\syscall_mem.c - - - syscalls.c + atomic_arm.c 1 - ..\..\..\..\..\components\libc\compilers\armlibc\syscalls.c + ..\..\..\..\..\libcpu\arm\common\atomic_arm.c - cctype.c + div0.c 1 - ..\..\..\..\..\components\libc\compilers\common\cctype.c + ..\..\..\..\..\libcpu\arm\common\div0.c - cstdlib.c + showmem.c 1 - ..\..\..\..\..\components\libc\compilers\common\cstdlib.c + ..\..\..\..\..\libcpu\arm\common\showmem.c - cstring.c - 1 - ..\..\..\..\..\components\libc\compilers\common\cstring.c + context_rvds.S + 2 + ..\..\..\..\..\libcpu\arm\cortex-m33\context_rvds.S - ctime.c + cpuport.c 1 - ..\..\..\..\..\components\libc\compilers\common\ctime.c + ..\..\..\..\..\libcpu\arm\cortex-m33\cpuport.c - cunistd.c - 1 - ..\..\..\..\..\components\libc\compilers\common\cunistd.c + syscall_rvds.S + 2 + ..\..\..\..\..\libcpu\arm\cortex-m33\syscall_rvds.S - cwchar.c + trustzone.c 1 - ..\..\..\..\..\components\libc\compilers\common\cwchar.c + ..\..\..\..\..\libcpu\arm\cortex-m33\trustzone.c @@ -1584,6 +1584,11 @@ 1 board\board.c + + drv_hwtimer.c + 1 + ..\Libraries\drivers\drv_hwtimer.c + drv_pin.c 1 @@ -2467,72 +2472,72 @@ - klibc + Libc - kerrno.c + syscall_mem.c 1 - ..\..\..\..\..\src\klibc\kerrno.c + ..\..\..\..\..\components\libc\compilers\armlibc\syscall_mem.c - kstdio.c + syscalls.c 1 - ..\..\..\..\..\src\klibc\kstdio.c + ..\..\..\..\..\components\libc\compilers\armlibc\syscalls.c - kstring.c + cctype.c 1 - ..\..\..\..\..\src\klibc\kstring.c + ..\..\..\..\..\components\libc\compilers\common\cctype.c - rt_vsscanf.c + cstdlib.c 1 - ..\..\..\..\..\src\klibc\rt_vsscanf.c + ..\..\..\..\..\components\libc\compilers\common\cstdlib.c - rt_vsnprintf_tiny.c + cstring.c 1 - ..\..\..\..\..\src\klibc\rt_vsnprintf_tiny.c + ..\..\..\..\..\components\libc\compilers\common\cstring.c - - - - libcpu - - atomic_arm.c + ctime.c 1 - ..\..\..\..\..\libcpu\arm\common\atomic_arm.c + ..\..\..\..\..\components\libc\compilers\common\ctime.c - div0.c + cunistd.c 1 - ..\..\..\..\..\libcpu\arm\common\div0.c + ..\..\..\..\..\components\libc\compilers\common\cunistd.c - showmem.c + cwchar.c 1 - ..\..\..\..\..\libcpu\arm\common\showmem.c + ..\..\..\..\..\components\libc\compilers\common\cwchar.c - context_rvds.S - 2 - ..\..\..\..\..\libcpu\arm\cortex-m33\context_rvds.S + kerrno.c + 1 + ..\..\..\..\..\src\klibc\kerrno.c - cpuport.c + kstdio.c 1 - ..\..\..\..\..\libcpu\arm\cortex-m33\cpuport.c + ..\..\..\..\..\src\klibc\kstdio.c - syscall_rvds.S - 2 - ..\..\..\..\..\libcpu\arm\cortex-m33\syscall_rvds.S + kstring.c + 1 + ..\..\..\..\..\src\klibc\kstring.c - trustzone.c + rt_vsnprintf_tiny.c 1 - ..\..\..\..\..\libcpu\arm\cortex-m33\trustzone.c + ..\..\..\..\..\src\klibc\rt_vsnprintf_tiny.c + + + rt_vsscanf.c + 1 + ..\..\..\..\..\src\klibc\rt_vsscanf.c diff --git a/bsp/nxp/mcx/mcxa/frdm-mcxa346/rtconfig.h b/bsp/nxp/mcx/mcxa/frdm-mcxa346/rtconfig.h index 71bdd77c255..d674de68721 100644 --- a/bsp/nxp/mcx/mcxa/frdm-mcxa346/rtconfig.h +++ b/bsp/nxp/mcx/mcxa/frdm-mcxa346/rtconfig.h @@ -155,6 +155,7 @@ #define RT_USING_ADC #define RT_USING_RTC #define RT_USING_SPI +#define RT_USING_SPI_ISR #define RT_USING_PIN #define RT_USING_HWTIMER /* end of Device Drivers */ @@ -330,6 +331,10 @@ /* GD32 Drivers */ /* end of GD32 Drivers */ + +/* HPMicro SDK */ + +/* end of HPMicro SDK */ /* end of HAL & SDK Drivers */ /* sensors drivers */ @@ -419,6 +424,9 @@ #define BSP_USING_PIN #define BSP_USING_UART #define BSP_USING_UART2 +#define BSP_USING_HWTIMER +#define BSP_USING_CTIMER0 +#define BSP_USING_CTIMER1 /* end of On-chip Peripheral Drivers */ /* Board extended module Drivers */ diff --git a/bsp/nxp/mcx/mcxa/frdm-mcxa346/test_hwtimer.c b/bsp/nxp/mcx/mcxa/frdm-mcxa346/test_hwtimer.c new file mode 100644 index 00000000000..ce3d3cd9a89 --- /dev/null +++ b/bsp/nxp/mcx/mcxa/frdm-mcxa346/test_hwtimer.c @@ -0,0 +1,210 @@ +#include +#include +#include "drv_pin.h" +#include "pin_mux.h" +#include "clock_config.h" +#include "board.h" +#include "fsl_inputmux.h" +#include "fsl_gpio.h" +#include +#include "fsl_reset.h" +#include "fsl_ctimer.h" + +#define HWTIMER_DEV_NAME "timer0" /* device name */ +#define HWTIMER_DEV2_NAME "timer1" /* device name */ + +#define THREAD_PRIORITY 25 +#define THREAD_STACK_SIZE 512 +#define THREAD_TIMESLICE 5 +static rt_thread_t tid1 = RT_NULL; +static rt_thread_t tid2 = RT_NULL; +rt_uint8_t timeout_flag = 0; +rt_uint8_t timeout2_flag = 0; +static rt_bool_t led_state = RT_FALSE; /* Current LED state */ +#define LED_PIN ((3*32)+18) /* Original LED pin */ + +static rt_err_t timeout_cb(rt_device_t dev, rt_size_t size) +{ +// rt_kprintf("this is hwtimer timeout callback fucntion!\n"); +// rt_kprintf("tick is :%d !\n", rt_tick_get()); + + timeout_flag = 1; + + return 0; +} + +int test_hwtimer() +{ + rt_err_t ret = RT_EOK; + rt_hwtimerval_t timeout_s; + rt_device_t hw_dev = RT_NULL; + rt_hwtimer_mode_t mode; + rt_uint32_t freq = 10000000; + + hw_dev = rt_device_find(HWTIMER_DEV_NAME); + rt_kprintf("find device success,device=%x\r\n",hw_dev); + if (hw_dev == RT_NULL) + { + rt_kprintf("hwtimer sample run failed! can't find %s device!\n", HWTIMER_DEV_NAME); + return -RT_ERROR; + } + + ret = rt_device_open(hw_dev, RT_DEVICE_OFLAG_RDWR); + rt_kprintf("open device success\r\n"); + if (ret != RT_EOK) + { + rt_kprintf("open %s device failed!\n", HWTIMER_DEV_NAME); + return ret; + } + + rt_device_set_rx_indicate(hw_dev, timeout_cb); + + rt_device_control(hw_dev, HWTIMER_CTRL_FREQ_SET, &freq); + + mode = HWTIMER_MODE_PERIOD; + ret = rt_device_control(hw_dev, HWTIMER_CTRL_MODE_SET, &mode); + if (ret != RT_EOK) + { + rt_kprintf("set mode failed! ret is :%d\n", ret); + return ret; + } + + /* Example Set the timeout period of the timer */ + timeout_s.sec = 3; /* secend */ + timeout_s.usec = 0; /* microsecend */ + if (rt_device_write(hw_dev, 0, &timeout_s, sizeof(timeout_s)) != sizeof(timeout_s)) + { + rt_kprintf("set timeout value failed\n"); + return -RT_ERROR; + } + rt_kprintf("init success\r\n"); + while (1) + { + //rt_thread_mdelay(3000); + if(timeout_flag) + { + timeout_flag = 0; + rt_hwtimer_t *timer = (rt_hwtimer_t *)hw_dev; + rt_device_read(hw_dev, 0, &timeout_s, sizeof(timeout_s)); + rt_uint32_t timer_start = timer->ops->count_get(timer); + rt_kprintf("Read: Sec = %d, Usec = %d \r\n", timeout_s.sec, timeout_s.usec); + rt_uint32_t timer_end = timer->ops->count_get(timer); + rt_kprintf("printf elapse: %d us,start:%d end:%d\n", (timer_end - timer_start)/10,timer_start,timer_end); + } + } + return ret; +} +MSH_CMD_EXPORT(test_hwtimer, hwtimer sample); + + + +static rt_err_t timeout_cb2(rt_device_t dev, rt_size_t size) +{ +// rt_kprintf("this is hwtimer timeout callback fucntion!\n"); +// rt_kprintf("tick is :%d !\n", rt_tick_get()); + timeout2_flag = 1; + return 0; +} + +int test_hwtimer2() +{ + rt_err_t ret = RT_EOK; + rt_hwtimerval_t timeout_s; + rt_device_t hw_dev = RT_NULL; + rt_hwtimer_mode_t mode; + rt_uint32_t freq = 100000; + + hw_dev = rt_device_find(HWTIMER_DEV2_NAME); + rt_kprintf("find device2 success,device=%x\r\n",hw_dev); + if (hw_dev == RT_NULL) + { + rt_kprintf("hwtimer sample run failed! can't find %s device!\n", HWTIMER_DEV_NAME); + return -RT_ERROR; + } + + ret = rt_device_open(hw_dev, RT_DEVICE_OFLAG_RDWR); + rt_kprintf("open device2 success\r\n"); + if (ret != RT_EOK) + { + rt_kprintf("open %s device failed!\n", HWTIMER_DEV_NAME); + return ret; + } + + rt_device_set_rx_indicate(hw_dev, timeout_cb2); + + rt_device_control(hw_dev, HWTIMER_CTRL_FREQ_SET, &freq); + + mode = HWTIMER_MODE_PERIOD; + ret = rt_device_control(hw_dev, HWTIMER_CTRL_MODE_SET, &mode); + if (ret != RT_EOK) + { + rt_kprintf("set mode failed! ret is :%d\n", ret); + return ret; + } + + /* Example Set the timeout period of the timer */ + timeout_s.sec = 0; /* secend */ + timeout_s.usec = 100000; /* microsecend */ + if (rt_device_write(hw_dev, 0, &timeout_s, sizeof(timeout_s)) != sizeof(timeout_s)) + { + rt_kprintf("set timeout value failed\n"); + return -RT_ERROR; + } + rt_kprintf("init device2 success\r\n"); + while (1) + { + //rt_thread_mdelay(3000); + if(timeout2_flag) + { + timeout2_flag = 0; + /* Toggle LED state */ + led_state = !led_state; + + rt_pin_write(LED_PIN, led_state ? PIN_HIGH : PIN_LOW); + } + } + return ret; +} + +static void thread1_entry(void *parameter) +{ + test_hwtimer(); +} + +static void thread2_entry(void *parameter) +{ + test_hwtimer2(); +} + + +int create_tester_hwtimer_thread(void) +{ + //* CTimer functional clock needs to be greater than or equal to SYSTEM_CLK */ + CLOCK_SetClockDiv(kCLOCK_DivCTIMER0, 1u); + CLOCK_AttachClk(kFRO_HF_to_CTIMER0); + + + tid1 = rt_thread_create("thread1", + thread1_entry, RT_NULL, + THREAD_STACK_SIZE, + THREAD_PRIORITY, THREAD_TIMESLICE); + + + if (tid1 != RT_NULL) + rt_thread_startup(tid1); + + rt_thread_mdelay(1000); + CLOCK_SetClockDiv(kCLOCK_DivCTIMER1, 1u); + CLOCK_AttachClk(kFRO_HF_to_CTIMER1); + + tid2 = rt_thread_create("thread2", + thread2_entry, RT_NULL, + THREAD_STACK_SIZE, + THREAD_PRIORITY, THREAD_TIMESLICE); + + + if (tid2 != RT_NULL) + rt_thread_startup(tid2); + + return 0; +} \ No newline at end of file