Skip to content

Commit df28d8f

Browse files
committed
west: Introduce hal bouffalo lab
Add initial version that uses bouffalo_sdk 1.4.5. Signed-off-by: Gerson Fernando Budke <[email protected]>
1 parent 90cd350 commit df28d8f

File tree

5 files changed

+148
-0
lines changed

5 files changed

+148
-0
lines changed

modules/Kconfig

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

66+
comment "hal_bouffalolab module not available."
67+
depends on !ZEPHYR_HAL_BOUFFALOLAB_MODULE
68+
6669
comment "hal_gigadevice module not available."
6770
depends on !ZEPHYR_HAL_GIGADEVICE_MODULE
6871

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Copyright (c) 2021-2025 Gerson Fernando Budke <[email protected]>
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
if(CONFIG_SOC_FAMILY_BOUFFALOLAB_BFLB)
6+
zephyr_library_named(hal_bouffalolab)
7+
8+
zephyr_library_compile_definitions(
9+
BFLB_USE_HAL_DRIVER
10+
BFLB_USE_CUSTOM_LD_SECTIONS
11+
)
12+
13+
set(bflb_soc bl602)
14+
set(bflb_drv_dir ${ZEPHYR_HAL_BOUFFALOLAB_MODULE_DIR}/drivers/${bflb_soc}_driver)
15+
set(bflb_common_dir ${ZEPHYR_HAL_BOUFFALOLAB_MODULE_DIR}/common)
16+
set(bflb_drv_src_dir ${bflb_drv_dir}/std_drv/src)
17+
18+
# Global includes
19+
zephyr_include_directories(
20+
include
21+
${ZEPHYR_HAL_BOUFFALOLAB_MODULE_DIR}/include
22+
23+
${bflb_drv_dir}/regs
24+
${bflb_drv_dir}/startup
25+
${bflb_drv_dir}/std_drv/inc
26+
27+
${bflb_common_dir}/misc
28+
)
29+
30+
zephyr_library_include_directories(
31+
${bflb_common_dir}/soft_crc
32+
)
33+
34+
zephyr_library_sources(
35+
${bflb_drv_src_dir}/${bflb_soc}_aon.c
36+
${bflb_drv_src_dir}/${bflb_soc}_ef_ctrl.c
37+
${bflb_drv_src_dir}/${bflb_soc}_glb.c
38+
${bflb_drv_src_dir}/${bflb_soc}_hbn.c
39+
${bflb_drv_src_dir}/${bflb_soc}_l1c.c
40+
${bflb_drv_src_dir}/${bflb_soc}_pds.c
41+
${bflb_drv_src_dir}/${bflb_soc}_romapi.c
42+
43+
${bflb_common_dir}/soft_crc/softcrc.c
44+
)
45+
46+
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_ACOMP ${bflb_drv_src_dir}/${bflb_soc}_acomp.c)
47+
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_ADC ${bflb_drv_src_dir}/${bflb_soc}_adc.c)
48+
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_DAC ${bflb_drv_src_dir}/${bflb_soc}_dac.c)
49+
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_DMA ${bflb_drv_src_dir}/${bflb_soc}_dma.c)
50+
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_I2C ${bflb_drv_src_dir}/${bflb_soc}_i2c.c)
51+
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_IR ${bflb_drv_src_dir}/${bflb_soc}_ir.c)
52+
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_PWM ${bflb_drv_src_dir}/${bflb_soc}_pwm.c)
53+
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_SPI ${bflb_drv_src_dir}/${bflb_soc}_spi.c)
54+
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_UART ${bflb_drv_src_dir}/${bflb_soc}_uart.c)
55+
endif() # SOC_FAMILY_BOUFFALOLAB_BFLB

modules/hal_bouffalolab/Kconfig

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copyright (c) 2021-2025 Gerson Fernando Budke <[email protected]>
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
config ZEPHYR_HAL_BOUFFALOLAB_MODULE
6+
bool
7+
8+
config HAS_BFLB_HAL
9+
bool
10+
11+
if HAS_BFLB_HAL
12+
13+
config USE_BFLB_ACOMP
14+
bool
15+
help
16+
Enable BFLB Analog Comparator (ACOMP) HAL module driver
17+
18+
config USE_BFLB_ADC
19+
bool
20+
help
21+
Enable BFLB Analog-to-Digital Converter (ADC) HAL module driver
22+
23+
config USE_BFLB_DAC
24+
bool
25+
help
26+
Enable BFLB Digital-to-Analog Converter (DAC) HAL module driver
27+
28+
config USE_BFLB_DMA
29+
bool
30+
help
31+
Enable BFLB Direct Memory Access controller (DMA) HAL module driver
32+
33+
config USE_BFLB_I2C
34+
bool
35+
help
36+
Enable BFLB Inter-Integrated Circuit Interface (I2C) HAL module driver
37+
38+
config USE_BFLB_IR
39+
bool
40+
help
41+
Enable BFLB Infrared Remote controller (IR) HAL module driver
42+
43+
config USE_BFLB_PWM
44+
bool
45+
help
46+
Enable BFLB Pulse Width Modulation (PMU) HAL module driver
47+
48+
config USE_BFLB_SPI
49+
bool
50+
help
51+
Enable BFLB Serial Peripheral Interface(SPI) HAL module driver
52+
53+
config USE_BFLB_UART
54+
bool
55+
help
56+
Enable BFLB Universal Asynchronous Receiver/Transmitter (UART)
57+
HAL module driver
58+
59+
endif # HAS_BFLB_HAL
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2021-2025 Gerson Fernando Budke <[email protected]>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
#ifndef __BL_LD_SECTIONS_H
7+
#define __BL_LD_SECTIONS_H
8+
9+
#define ATTR_STRINGIFY(x) #x
10+
#define ATTR_TOSTRING(x) ATTR_STRINGIFY(x)
11+
#define ATTR_SECTION(x) __attribute__((section(x)))
12+
#define ATTR_UNI_SYMBOL __FILE__ ATTR_TOSTRING(__LINE__)
13+
#define ATTR_CLOCK_SECTION ATTR_SECTION(".itcm.sclock_rlt_code." ATTR_UNI_SYMBOL)
14+
#define ATTR_CLOCK_CONST_SECTION ATTR_SECTION(".itcm.sclock_rlt_const." ATTR_UNI_SYMBOL)
15+
#define ATTR_TCM_SECTION ATTR_SECTION(".itcm.code." ATTR_UNI_SYMBOL)
16+
#define ATTR_TCM_CONST_SECTION ATTR_SECTION(".itcm.const." ATTR_UNI_SYMBOL)
17+
#define ATTR_DTCM_SECTION ATTR_SECTION(".dtcm.data")
18+
#define ATTR_HSRAM_SECTION ATTR_SECTION(".hsram_code")
19+
#define ATTR_DMA_RAM_SECTION ATTR_SECTION(".system_ram")
20+
#define ATTR_HBN_RAM_SECTION ATTR_SECTION(".hbn_ram_code")
21+
#define ATTR_HBN_RAM_CONST_SECTION ATTR_SECTION(".hbn_ram_data")
22+
#define ATTR_FALLTHROUGH() __attribute__((fallthrough))
23+
#define ATTR_USED __attribute__((__used__))
24+
#define ATTR_EALIGN(x) __aligned(size)
25+
26+
#endif /* __BL_LD_SECTIONS_H */

west.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ manifest:
161161
path: modules/hal/atmel
162162
groups:
163163
- hal
164+
- name: hal_bouffalolab
165+
path: modules/hal/bouffalolab
166+
revision: c6c44b879503d990dfba643c212b606cee414faa
167+
groups:
168+
- hal
164169
- name: hal_espressif
165170
revision: dbc28ad4c1bdcdb25e79ca225cb5528a75d8dc91
166171
path: modules/hal/espressif

0 commit comments

Comments
 (0)