Skip to content

Commit f1347e8

Browse files
committed
2025-12-12
1.在N32L40x的平台添加了串口1-串口5的Kconfig串口配置 2025-12-18 1.在N32G457的平台添加了串口1-串口7的Kconfig串口配置,修改了串口结构体增加了引脚映射配置
1 parent d196bf7 commit f1347e8

File tree

11 files changed

+710
-142
lines changed

11 files changed

+710
-142
lines changed

bsp n32 - 快捷方式.lnk

8 Bytes
Binary file not shown.

bsp/n32 - 快捷方式.lnk

1.19 KB
Binary file not shown.

bsp/n32/libraries/n32_drivers/drv_usart.c

Lines changed: 410 additions & 55 deletions
Large diffs are not rendered by default.

bsp/n32/n32g457qel-stb/.config

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,12 +1440,35 @@ CONFIG_SOC_N32G45X=y
14401440
CONFIG_BSP_USING_GPIO=y
14411441
CONFIG_BSP_USING_UART=y
14421442
CONFIG_BSP_USING_USART1=y
1443-
# CONFIG_BSP_USING_USART2 is not set
1444-
# CONFIG_BSP_USING_USART3 is not set
1445-
# CONFIG_BSP_USING_UART4 is not set
1446-
# CONFIG_BSP_USING_UART5 is not set
1447-
# CONFIG_BSP_USING_UART6 is not set
1448-
# CONFIG_BSP_USING_UART7 is not set
1443+
CONFIG_UART1_PA9_PA10=y
1444+
# CONFIG_UART1_PB6_PB7 is not set
1445+
CONFIG_BSP_USING_USART2=y
1446+
CONFIG_UART2_PA2_PA3=y
1447+
# CONFIG_UART2_PD5_PD6 is not set
1448+
# CONFIG_UART2_PC8_PC9 is not set
1449+
# CONFIG_UART2_PB4_PB5 is not set
1450+
CONFIG_BSP_USING_USART3=y
1451+
CONFIG_UART3_PB10_PB11=y
1452+
# CONFIG_UART3_PC10_PC11 is not set
1453+
# CONFIG_UART3_PD8_PD9 is not set
1454+
CONFIG_BSP_USING_UART4=y
1455+
CONFIG_UART4_PC10_PC11=y
1456+
# CONFIG_UART4_PB2_PE7 is not set
1457+
# CONFIG_UART4_PA13_PA14 is not set
1458+
# CONFIG_UART4_PD0_PD1 is not set
1459+
CONFIG_BSP_USING_UART5=y
1460+
CONFIG_UART5_PC12_PD2=y
1461+
# CONFIG_UART5_PB13_PB14 is not set
1462+
# CONFIG_UART5_PE8_PE9 is not set
1463+
# CONFIG_UART5_PB8_PB9 is not set
1464+
CONFIG_BSP_USING_UART6=y
1465+
CONFIG_UART6_PE2_PE3=y
1466+
# CONFIG_UART6_PC0_PC1 is not set
1467+
# CONFIG_UART6_PB0_PB1 is not set
1468+
CONFIG_BSP_USING_UART7=y
1469+
CONFIG_UART7_PC4_PC5=y
1470+
# CONFIG_UART7_PC2_PC3 is not set
1471+
# CONFIG_UART7_PG0_PG1 is not set
14491472
CONFIG_BSP_USING_SPI=y
14501473
CONFIG_BSP_USING_SPI1=y
14511474
# CONFIG_BSP_SPI1_REMAP_0 is not set

bsp/n32/n32g457qel-stb/board/Kconfig

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,118 @@ menu "On-chip Peripheral Drivers"
3030
config BSP_USING_USART1
3131
bool "Enable USART1"
3232
default y
33+
if BSP_USING_USART1
34+
choice
35+
prompt "Select UART Pin"
36+
default UART1_PA9_PA10
37+
config UART1_PA9_PA10
38+
bool "REMAP0 PA9 PA10"
39+
config UART1_PB6_PB7
40+
bool "REMAP1 PB6 PB7"
41+
endchoice
42+
endif
3343

3444
config BSP_USING_USART2
3545
bool "Enable USART2"
3646
default n
47+
if BSP_USING_USART2
48+
choice
49+
prompt "Select UART Pin"
50+
default UART2_PA2_PA3
51+
config UART2_PA2_PA3
52+
bool "REMAP0 PA2 PA3"
53+
config UART2_PD5_PD6
54+
bool "REMAP1 PD5 PD6"
55+
config UART2_PC8_PC9
56+
bool "REMAP2 PC8 PC9"
57+
config UART2_PB4_PB5
58+
bool "REMAP3 PB4 PB5"
59+
endchoice
60+
endif
3761

3862
config BSP_USING_USART3
3963
bool "Enable USART3"
4064
default n
65+
if BSP_USING_USART3
66+
choice
67+
prompt "Select UART Pin"
68+
default UART3_PB10_PB11
69+
config UART3_PB10_PB11
70+
bool "REMAP0 PB10_PB11"
71+
config UART3_PC10_PC11
72+
bool "REMAP1 PC10_PC11"
73+
config UART3_PD8_PD9
74+
bool "REMAP3 PD8_PD9"
75+
endchoice
76+
endif
4177

4278
config BSP_USING_UART4
4379
bool "Enable UART4"
4480
default n
81+
if BSP_USING_UART4
82+
choice
83+
prompt "Select UART Pin"
84+
default UART4_PC10_PC11
85+
config UART4_PC10_PC11
86+
bool "REMAP0 PC10_PC11"
87+
config UART4_PB2_PE7
88+
bool "REMAP1 PB2_PE7"
89+
config UART4_PA13_PA14
90+
bool "REMAP2 PA13_PA14"
91+
config UART4_PD0_PD1
92+
bool "REMAP3 PD0_PD1"
93+
endchoice
94+
endif
4595

4696
config BSP_USING_UART5
4797
bool "Enable UART5"
4898
default n
99+
if BSP_USING_UART5
100+
choice
101+
prompt "Select UART Pin"
102+
default UART5_PC12_PD2
103+
config UART5_PC12_PD2
104+
bool "REMAP0 PC12_PD2"
105+
config UART5_PB13_PB14
106+
bool "REMAP1 PB13_PB14"
107+
config UART5_PE8_PE9
108+
bool "REMAP2 PE8_PE9"
109+
config UART5_PB8_PB9
110+
bool "REMAP3 PB8_PB9"
111+
endchoice
112+
endif
49113

50114
config BSP_USING_UART6
51115
bool "Enable UART6"
52116
default n
117+
if BSP_USING_UART6
118+
choice
119+
prompt "Select UART Pin"
120+
default UART6_PE2_PE3
121+
config UART6_PE2_PE3
122+
bool "REMAP0 PE2_PE3"
123+
config UART6_PC0_PC1
124+
bool "REMAP2 PC0_PC1"
125+
config UART6_PB0_PB1
126+
bool "REMAP3 PB0_PB1"
127+
endchoice
128+
endif
53129

54130
config BSP_USING_UART7
55131
bool "Enable UART7"
56132
default n
133+
if BSP_USING_UART7
134+
choice
135+
prompt "Select UART Pin"
136+
default UART7_PC4_PC5
137+
config UART7_PC4_PC5
138+
bool "REMAP0 PC4_PC5"
139+
config UART7_PC2_PC3
140+
bool "REMAP1 PC2_PC3"
141+
config UART7_PG0_PG1
142+
bool "REMAP3 PG0_PG1"
143+
endchoice
144+
endif
57145
endif
58146
#--------BSP_USING_SPI-------------------
59147
menuconfig BSP_USING_SPI

bsp/n32/n32g457qel-stb/project.uvprojx

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,9 @@
334334
<v6Rtti>0</v6Rtti>
335335
<VariousControls>
336336
<MiscControls />
337-
<Define>__RTTHREAD__, N32G45X, RT_USING_ARMLIBC, RT_USING_LIBC, USE_STDPERIPH_DRIVER, __CLK_TCK=RT_TICK_PER_SECOND, __STDC_LIMIT_MACROS</Define>
337+
<Define>__CLK_TCK=RT_TICK_PER_SECOND, RT_USING_LIBC, RT_USING_ARMLIBC, USE_STDPERIPH_DRIVER, __RTTHREAD__, N32G45X, __STDC_LIMIT_MACROS</Define>
338338
<Undefine />
339-
<IncludePath>..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\spi;board;..\..\..\components\drivers\include;..\..\..\components\libc\posix\ipc;..\..\..\components\drivers\smp_call;..\..\..\components\drivers\include;.;..\libraries\n32_drivers;..\..\..\components\libc\posix\io\epoll;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\libc\compilers\common\extension\fcntl\octal;..\..\..\components\drivers\include;applications;..\libraries\N32G45x_Firmware_Library\CMSIS\core;..\..\..\components\finsh;..\..\..\components\net\utest;..\..\..\components\libc\posix\io\poll;..\..\..\libcpu\arm\cortex-m4;..\..\..\components\drivers\include;..\..\..\components\drivers\phy;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\libc\posix\io\eventfd;..\libraries\N32G45x_Firmware_Library\CMSIS\device;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\libc\compilers\common\extension;..\..\..\libcpu\arm\common;..\..\..\components\drivers\include;..\..\..\components\libc\compilers\common\include;..\libraries\n32_drivers\config;..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\inc;..\..\..\include</IncludePath>
339+
<IncludePath>..\..\..\components\drivers\include;..\..\..\components\net\utest;..\..\..\components\libc\compilers\common\extension\fcntl\octal;..\..\..\components\drivers\include;..\..\..\libcpu\arm\common;..\..\..\components\libc\posix\io\eventfd;..\..\..\components\drivers\include;..\libraries\N32G45x_Firmware_Library\CMSIS\core;..\..\..\components\drivers\include;..\..\..\components\libc\posix\io\poll;..\libraries\n32_drivers;..\..\..\include;..\..\..\components\drivers\include;..\..\..\components\finsh;..\..\..\components\drivers\smp_call;..\libraries\N32G45x_Firmware_Library\CMSIS\device;..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\inc;..\..\..\libcpu\arm\cortex-m4;..\..\..\components\drivers\include;..\..\..\components\drivers\include;applications;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;board;..\..\..\components\libc\compilers\common\include;..\libraries\n32_drivers\config;..\..\..\components\libc\compilers\common\extension;..\..\..\components\drivers\spi;..\..\..\components\libc\posix\ipc;.;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\libc\posix\io\epoll;..\..\..\components\drivers\phy</IncludePath>
340340
</VariousControls>
341341
</Cads>
342342
<Aads>
@@ -963,23 +963,23 @@
963963
</Files>
964964
<Files>
965965
<File>
966-
<FileName>msh_parse.c</FileName>
966+
<FileName>msh.c</FileName>
967967
<FileType>1</FileType>
968-
<FilePath>..\..\..\components\finsh\msh_parse.c</FilePath>
968+
<FilePath>..\..\..\components\finsh\msh.c</FilePath>
969969
</File>
970970
</Files>
971971
<Files>
972972
<File>
973-
<FileName>msh.c</FileName>
973+
<FileName>cmd.c</FileName>
974974
<FileType>1</FileType>
975-
<FilePath>..\..\..\components\finsh\msh.c</FilePath>
975+
<FilePath>..\..\..\components\finsh\cmd.c</FilePath>
976976
</File>
977977
</Files>
978978
<Files>
979979
<File>
980-
<FileName>cmd.c</FileName>
980+
<FileName>msh_parse.c</FileName>
981981
<FileType>1</FileType>
982-
<FilePath>..\..\..\components\finsh\cmd.c</FilePath>
982+
<FilePath>..\..\..\components\finsh\msh_parse.c</FilePath>
983983
</File>
984984
</Files>
985985
</Group>
@@ -1388,93 +1388,93 @@
13881388
<GroupName>Libraries</GroupName>
13891389
<Files>
13901390
<File>
1391-
<FileName>n32g45x_can.c</FileName>
1391+
<FileName>n32g45x_usart.c</FileName>
13921392
<FileType>1</FileType>
1393-
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_can.c</FilePath>
1393+
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_usart.c</FilePath>
13941394
</File>
13951395
</Files>
13961396
<Files>
13971397
<File>
1398-
<FileName>n32g45x_iwdg.c</FileName>
1398+
<FileName>n32g45x_pwr.c</FileName>
13991399
<FileType>1</FileType>
1400-
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_iwdg.c</FilePath>
1400+
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_pwr.c</FilePath>
14011401
</File>
14021402
</Files>
14031403
<Files>
14041404
<File>
1405-
<FileName>n32g45x_wwdg.c</FileName>
1405+
<FileName>n32g45x_rtc.c</FileName>
14061406
<FileType>1</FileType>
1407-
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_wwdg.c</FilePath>
1407+
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_rtc.c</FilePath>
14081408
</File>
14091409
</Files>
14101410
<Files>
14111411
<File>
1412-
<FileName>n32g45x_exti.c</FileName>
1412+
<FileName>system_n32g45x.c</FileName>
14131413
<FileType>1</FileType>
1414-
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_exti.c</FilePath>
1414+
<FilePath>..\libraries\N32G45x_Firmware_Library\CMSIS\device\system_n32g45x.c</FilePath>
14151415
</File>
14161416
</Files>
14171417
<Files>
14181418
<File>
1419-
<FileName>n32g45x_gpio.c</FileName>
1419+
<FileName>n32g45x_rcc.c</FileName>
14201420
<FileType>1</FileType>
1421-
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_gpio.c</FilePath>
1421+
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_rcc.c</FilePath>
14221422
</File>
14231423
</Files>
14241424
<Files>
14251425
<File>
1426-
<FileName>system_n32g45x.c</FileName>
1426+
<FileName>n32g45x_exti.c</FileName>
14271427
<FileType>1</FileType>
1428-
<FilePath>..\libraries\N32G45x_Firmware_Library\CMSIS\device\system_n32g45x.c</FilePath>
1428+
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_exti.c</FilePath>
14291429
</File>
14301430
</Files>
14311431
<Files>
14321432
<File>
1433-
<FileName>n32g45x_rtc.c</FileName>
1433+
<FileName>n32g45x_spi.c</FileName>
14341434
<FileType>1</FileType>
1435-
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_rtc.c</FilePath>
1435+
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_spi.c</FilePath>
14361436
</File>
14371437
</Files>
14381438
<Files>
14391439
<File>
1440-
<FileName>n32g45x_spi.c</FileName>
1440+
<FileName>n32g45x_dma.c</FileName>
14411441
<FileType>1</FileType>
1442-
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_spi.c</FilePath>
1442+
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_dma.c</FilePath>
14431443
</File>
14441444
</Files>
14451445
<Files>
14461446
<File>
1447-
<FileName>n32g45x_pwr.c</FileName>
1447+
<FileName>n32g45x_dac.c</FileName>
14481448
<FileType>1</FileType>
1449-
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_pwr.c</FilePath>
1449+
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_dac.c</FilePath>
14501450
</File>
14511451
</Files>
14521452
<Files>
14531453
<File>
1454-
<FileName>n32g45x_adc.c</FileName>
1454+
<FileName>n32g45x_iwdg.c</FileName>
14551455
<FileType>1</FileType>
1456-
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_adc.c</FilePath>
1456+
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_iwdg.c</FilePath>
14571457
</File>
14581458
</Files>
14591459
<Files>
14601460
<File>
1461-
<FileName>n32g45x_tim.c</FileName>
1461+
<FileName>misc.c</FileName>
14621462
<FileType>1</FileType>
1463-
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_tim.c</FilePath>
1463+
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\misc.c</FilePath>
14641464
</File>
14651465
</Files>
14661466
<Files>
14671467
<File>
1468-
<FileName>n32g45x_dma.c</FileName>
1468+
<FileName>n32g45x_adc.c</FileName>
14691469
<FileType>1</FileType>
1470-
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_dma.c</FilePath>
1470+
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_adc.c</FilePath>
14711471
</File>
14721472
</Files>
14731473
<Files>
14741474
<File>
1475-
<FileName>n32g45x_rcc.c</FileName>
1475+
<FileName>n32g45x_wwdg.c</FileName>
14761476
<FileType>1</FileType>
1477-
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_rcc.c</FilePath>
1477+
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_wwdg.c</FilePath>
14781478
</File>
14791479
</Files>
14801480
<Files>
@@ -1486,23 +1486,23 @@
14861486
</Files>
14871487
<Files>
14881488
<File>
1489-
<FileName>n32g45x_usart.c</FileName>
1489+
<FileName>n32g45x_can.c</FileName>
14901490
<FileType>1</FileType>
1491-
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_usart.c</FilePath>
1491+
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_can.c</FilePath>
14921492
</File>
14931493
</Files>
14941494
<Files>
14951495
<File>
1496-
<FileName>n32g45x_dac.c</FileName>
1496+
<FileName>n32g45x_gpio.c</FileName>
14971497
<FileType>1</FileType>
1498-
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_dac.c</FilePath>
1498+
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_gpio.c</FilePath>
14991499
</File>
15001500
</Files>
15011501
<Files>
15021502
<File>
1503-
<FileName>misc.c</FileName>
1503+
<FileName>n32g45x_tim.c</FileName>
15041504
<FileType>1</FileType>
1505-
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\misc.c</FilePath>
1505+
<FilePath>..\libraries\N32G45x_Firmware_Library\n32g45x_std_periph_driver\src\n32g45x_tim.c</FilePath>
15061506
</File>
15071507
</Files>
15081508
</Group>

bsp/n32/n32g457qel-stb/rtconfig.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,19 @@
430430
#define BSP_USING_GPIO
431431
#define BSP_USING_UART
432432
#define BSP_USING_USART1
433+
#define UART1_PA9_PA10
434+
#define BSP_USING_USART2
435+
#define UART2_PA2_PA3
436+
#define BSP_USING_USART3
437+
#define UART3_PB10_PB11
438+
#define BSP_USING_UART4
439+
#define UART4_PC10_PC11
440+
#define BSP_USING_UART5
441+
#define UART5_PC12_PD2
442+
#define BSP_USING_UART6
443+
#define UART6_PE2_PE3
444+
#define BSP_USING_UART7
445+
#define UART7_PC4_PC5
433446
#define BSP_USING_SPI
434447
#define BSP_USING_SPI1
435448
#define BSP_SPI1_REMAP_1

0 commit comments

Comments
 (0)