Skip to content

Commit 43ce67b

Browse files
committed
modules: Add gigadevice hal module
This add access to modules/hal/gigadevice with three firmware libraries by updating west.yaml file: - GD32E10X ARM (Cortex-M4F) - GD32F403 ARM (Cortex-M4F) - GD32VF103 RISC-V (Nucleisys Bumblebee core) It introduce module/hal_gigadevice, which contains all Cmake and Kconfig rules to build GigaDevice SoCs into zephyr main tree. Signed-off-by: Gerson Fernando Budke <[email protected]>
1 parent f243679 commit 43ce67b

File tree

4 files changed

+251
-0
lines changed

4 files changed

+251
-0
lines changed

modules/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ comment "Unavailable modules, please install those via the project manifest."
4646
# config ZEPHYR_<MODULE_NAME_UPPER>_MODULE
4747
# bool
4848

49+
comment "hal_gigadevice module not available."
50+
depends on !ZEPHYR_HAL_GIGADEVICE_MODULE
51+
4952
comment "hal_nordic module not available."
5053
depends on !ZEPHYR_HAL_NORDIC_MODULE
5154

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright (c) 2021 ATL-Electronics
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if(CONFIG_HAS_GD32_HAL)
5+
6+
zephyr_library_named(hal_gigadevice)
7+
8+
if(NOT gd32_soc_uc)
9+
message(WARNING "'gd32_soc' not defined. The gd32_soc variables\
10+
are necessary to identify firmware directory. Make sure that\
11+
CONFIG_SOC_SERIES_GD32* is well defined at modules/hal_gigadevice")
12+
endif()
13+
14+
zephyr_library_compile_definitions(${gd32_soc_uc})
15+
16+
set(gd32_soc_dir ${ZEPHYR_HAL_GIGADEVICE_MODULE_DIR}/${gd32_soc_uc})
17+
set(gd32_cmsis_dir ${gd32_soc_dir}/CMSIS/GD/${gd32_soc_uc})
18+
set(gd32_std_dir ${gd32_soc_dir}/standard_peripheral)
19+
set(gd32_std_src_dir ${gd32_std_dir}/Source)
20+
21+
# Global includes to be used outside hal_gigadevice
22+
zephyr_include_directories(${gd32_cmsis_dir}/Include)
23+
zephyr_include_directories(${gd32_std_dir}/Include)
24+
25+
zephyr_library_sources(${gd32_cmsis_dir}/Source/system_${gd32_soc_lc}.c)
26+
27+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_ADC ${gd32_std_src_dir}/${gd32_soc_lc}_adc.c)
28+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_BKP ${gd32_std_src_dir}/${gd32_soc_lc}_bkp.c)
29+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_CAN ${gd32_std_src_dir}/${gd32_soc_lc}_can.c)
30+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_CRC ${gd32_std_src_dir}/${gd32_soc_lc}_crc.c)
31+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_CTC ${gd32_std_src_dir}/${gd32_soc_lc}_ctc.c)
32+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_DAC ${gd32_std_src_dir}/${gd32_soc_lc}_dac.c)
33+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_DBG ${gd32_std_src_dir}/${gd32_soc_lc}_dbg.c)
34+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_DMA ${gd32_std_src_dir}/${gd32_soc_lc}_dma.c)
35+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_EXMC ${gd32_std_src_dir}/${gd32_soc_lc}_exmc.c)
36+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_EXTI ${gd32_std_src_dir}/${gd32_soc_lc}_exti.c)
37+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_FMC ${gd32_std_src_dir}/${gd32_soc_lc}_fmc.c)
38+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_FWDGT ${gd32_std_src_dir}/${gd32_soc_lc}_fwdgt.c)
39+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_GPIO ${gd32_std_src_dir}/${gd32_soc_lc}_gpio.c)
40+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_I2C ${gd32_std_src_dir}/${gd32_soc_lc}_i2c.c)
41+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_MISC ${gd32_std_src_dir}/${gd32_soc_lc}_misc.c)
42+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_PMU ${gd32_std_src_dir}/${gd32_soc_lc}_pmu.c)
43+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_RCU ${gd32_std_src_dir}/${gd32_soc_lc}_rcu.c)
44+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_RTC ${gd32_std_src_dir}/${gd32_soc_lc}_rtc.c)
45+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_SDIO ${gd32_std_src_dir}/${gd32_soc_lc}_sdio.c)
46+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_SPI ${gd32_std_src_dir}/${gd32_soc_lc}_spi.c)
47+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_TIMER ${gd32_std_src_dir}/${gd32_soc_lc}_timer.c)
48+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_USART ${gd32_std_src_dir}/${gd32_soc_lc}_usart.c)
49+
zephyr_library_sources_ifdef(CONFIG_USE_GD32_WWDGT ${gd32_std_src_dir}/${gd32_soc_lc}_wwdgt.c)
50+
51+
endif()

modules/hal_gigadevice/Kconfig

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
# Copyright (c) 2021 ATL-Electronics
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config ZEPHYR_HAL_GIGADEVICE_MODULE
5+
bool
6+
7+
config SOC_FAMILY_GD32
8+
bool
9+
select HAS_GD32_HAL
10+
select BUILD_OUTPUT_HEX
11+
12+
config SOC_FAMILY
13+
string
14+
default "gigadevice"
15+
depends on SOC_FAMILY_GD32
16+
17+
config HAS_GD32_HAL
18+
bool
19+
20+
if HAS_GD32_HAL
21+
22+
config USE_GD32_ADC
23+
bool
24+
help
25+
Enable GD32 Analog-to-Digital Converter (ADC) HAL module driver
26+
27+
config USE_GD32_BKP
28+
bool
29+
help
30+
Enable GD32 Backup Registers (BKP) HAL module driver
31+
32+
config USE_GD32_CAN
33+
bool
34+
help
35+
Enable GD32 Controller Area Network (CAN) HAL module driver
36+
37+
config USE_GD32_CMP
38+
bool
39+
help
40+
Enable GD32 Comparator (CMP) HAL module driver
41+
42+
config USE_GD32_CRC
43+
bool
44+
help
45+
Enable GD32 Cyclic redundancy check calculation unit (CRC) HAL
46+
module driver
47+
48+
config USE_GD32_CTC
49+
bool
50+
help
51+
Enable GD32 Clock Trim Controller (CTC) HAL module driver
52+
53+
config USE_GD32_DAC
54+
bool
55+
help
56+
Enable GD32 Digital-to-Analog Converter (DAC) HAL module driver
57+
58+
config USE_GD32_DBG
59+
bool
60+
help
61+
Enable GD32 Debug (DBG) HAL module driver
62+
63+
config USE_GD32_DMA
64+
bool
65+
help
66+
Enable GD32 Direct Memory Access controller (DMA) HAL module driver
67+
68+
config USE_GD32_ECLIC
69+
bool
70+
help
71+
Enable GD32 Enhancement Core-Local Interrupt Controller (ECLIC) HAL
72+
module driver
73+
74+
config USE_GD32_ENET
75+
bool
76+
help
77+
Enable GD32 Ethernet (ENET) HAL module driver
78+
79+
config USE_GD32_EXMC
80+
bool
81+
help
82+
Enable GD32 External Memory Controller (EXMC) HAL module driver
83+
84+
config USE_GD32_EXTI
85+
bool
86+
help
87+
Enable GD32 Interrupt/Event controller (EXTI) HAL module driver
88+
89+
config USE_GD32_FMC
90+
bool
91+
help
92+
Enable GD32 Flash Memory Controller (FMC) HAL module driver
93+
94+
config USE_GD32_FWDGT
95+
bool
96+
help
97+
Enable GD32 Free Watchdog Timer (FWDGT) HAL module driver
98+
99+
config USE_GD32_GPIO
100+
bool
101+
default y
102+
help
103+
Enable GD32 General-purpose and Alternate-Function I/Os
104+
(GPIO and AFIO) HAL module driver
105+
106+
config USE_GD32_I2C
107+
bool
108+
help
109+
Enable GD32 Inter-Integrated Circuit Interface (I2C) HAL module driver
110+
111+
config USE_GD32_MISC
112+
bool
113+
help
114+
Enable GD32 System Utilities (MISC) HAL module driver
115+
116+
config USE_GD32_PMU
117+
bool
118+
help
119+
Enable GD32 Power Management Unit (PMU) HAL module driver
120+
121+
config USE_GD32_RCU
122+
bool
123+
default y
124+
help
125+
Enable GD32 Reset and Clock Unit (RCU) HAL module driver
126+
127+
config USE_GD32_RTC
128+
bool
129+
help
130+
Enable GD32 Real-Time Clock (RTC) HAL module driver
131+
132+
config USE_GD32_SDIO
133+
bool
134+
help
135+
Enable GD32 Secure Digital Input/Output interface (SDIO) HAL module
136+
driver
137+
138+
config USE_GD32_SPI
139+
bool
140+
help
141+
Enable GD32 Serial Peripheral Interface(SPI) HAL module driver
142+
143+
config USE_GD32_SQPI
144+
bool
145+
help
146+
Enable GD32 Serial/Quad Parallel Interface (SQPI) HAL module driver
147+
148+
config USE_GD32_SHRTIMER
149+
bool
150+
help
151+
Enable GD32 Super High-Resolution Timer (SHRTIMER) HAL module driver
152+
153+
config USE_GD32_TIMER
154+
bool
155+
help
156+
Enable GD32 Timer (TIMER) HAL module driver
157+
158+
config USE_GD32_TMU
159+
bool
160+
help
161+
Enable GD32 Trigonometric Math Unit (TMU) HAL module driver
162+
163+
config USE_GD32_USART
164+
bool
165+
help
166+
Enable GD32 Universal Synchronous/Asynchronous Receiver/Transmitter
167+
(USART) HAL module driver
168+
169+
config USE_GD32_USBD
170+
bool
171+
help
172+
Enable GD32 Universal Serial Bus full-speed Device interface (USBD)
173+
HAL module driver
174+
175+
config USE_GD32_USBFS
176+
bool
177+
help
178+
Enable GD32 Universal Serial Bus on-the-go Full-Speed (USBFS) HAL
179+
module driver
180+
181+
config USE_GD32_USBHS
182+
bool
183+
help
184+
Enable GD32 Universal Serial Bus High-Speed interface (USBHS) HAL
185+
module driver
186+
187+
config USE_GD32_WWDGT
188+
bool
189+
help
190+
Enable GD32 Window Watchdog Timer (WWDGT) HAL module driver
191+
192+
endif # HAS_GD32_HAL

west.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ manifest:
6767
west-commands: west/west-commands.yml
6868
groups:
6969
- hal
70+
- name: hal_gigadevice
71+
revision: ce323de9655972a545cbdddda813c1576d85d5d1
72+
path: modules/hal/gigadevice
73+
groups:
74+
- hal
7075
- name: hal_infineon
7176
revision: f1fa8241f8786198ba41155413243de36ed878a5
7277
path: modules/hal/infineon

0 commit comments

Comments
 (0)