west: Introduce hal bouffalo lab

Add initial version that uses bouffalo_sdk 1.4.5.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
This commit is contained in:
Gerson Fernando Budke 2021-07-17 22:49:40 -03:00 committed by Benjamin Cabé
commit 0020af2a8b
5 changed files with 148 additions and 0 deletions

View file

@ -63,6 +63,9 @@ comment "Unavailable modules, please install those via the project manifest."
# config ZEPHYR_<MODULE_NAME_UPPER>_MODULE
# bool
comment "hal_bouffalolab module not available."
depends on !ZEPHYR_HAL_BOUFFALOLAB_MODULE
comment "hal_gigadevice module not available."
depends on !ZEPHYR_HAL_GIGADEVICE_MODULE

View file

@ -0,0 +1,55 @@
# Copyright (c) 2021-2025 Gerson Fernando Budke <nandojve@gmail.com>
#
# SPDX-License-Identifier: Apache-2.0
if(CONFIG_SOC_FAMILY_BOUFFALOLAB_BFLB)
zephyr_library_named(hal_bouffalolab)
zephyr_library_compile_definitions(
BFLB_USE_HAL_DRIVER
BFLB_USE_CUSTOM_LD_SECTIONS
)
set(bflb_soc bl602)
set(bflb_drv_dir ${ZEPHYR_HAL_BOUFFALOLAB_MODULE_DIR}/drivers/${bflb_soc}_driver)
set(bflb_common_dir ${ZEPHYR_HAL_BOUFFALOLAB_MODULE_DIR}/common)
set(bflb_drv_src_dir ${bflb_drv_dir}/std_drv/src)
# Global includes
zephyr_include_directories(
include
${ZEPHYR_HAL_BOUFFALOLAB_MODULE_DIR}/include
${bflb_drv_dir}/regs
${bflb_drv_dir}/startup
${bflb_drv_dir}/std_drv/inc
${bflb_common_dir}/misc
)
zephyr_library_include_directories(
${bflb_common_dir}/soft_crc
)
zephyr_library_sources(
${bflb_drv_src_dir}/${bflb_soc}_aon.c
${bflb_drv_src_dir}/${bflb_soc}_ef_ctrl.c
${bflb_drv_src_dir}/${bflb_soc}_glb.c
${bflb_drv_src_dir}/${bflb_soc}_hbn.c
${bflb_drv_src_dir}/${bflb_soc}_l1c.c
${bflb_drv_src_dir}/${bflb_soc}_pds.c
${bflb_drv_src_dir}/${bflb_soc}_romapi.c
${bflb_common_dir}/soft_crc/softcrc.c
)
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_ACOMP ${bflb_drv_src_dir}/${bflb_soc}_acomp.c)
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_ADC ${bflb_drv_src_dir}/${bflb_soc}_adc.c)
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_DAC ${bflb_drv_src_dir}/${bflb_soc}_dac.c)
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_DMA ${bflb_drv_src_dir}/${bflb_soc}_dma.c)
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_I2C ${bflb_drv_src_dir}/${bflb_soc}_i2c.c)
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_IR ${bflb_drv_src_dir}/${bflb_soc}_ir.c)
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_PWM ${bflb_drv_src_dir}/${bflb_soc}_pwm.c)
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_SPI ${bflb_drv_src_dir}/${bflb_soc}_spi.c)
zephyr_library_sources_ifdef(CONFIG_USE_BFLB_UART ${bflb_drv_src_dir}/${bflb_soc}_uart.c)
endif() # SOC_FAMILY_BOUFFALOLAB_BFLB

View file

@ -0,0 +1,59 @@
# Copyright (c) 2021-2025 Gerson Fernando Budke <nandojve@gmail.com>
#
# SPDX-License-Identifier: Apache-2.0
config ZEPHYR_HAL_BOUFFALOLAB_MODULE
bool
config HAS_BFLB_HAL
bool
if HAS_BFLB_HAL
config USE_BFLB_ACOMP
bool
help
Enable BFLB Analog Comparator (ACOMP) HAL module driver
config USE_BFLB_ADC
bool
help
Enable BFLB Analog-to-Digital Converter (ADC) HAL module driver
config USE_BFLB_DAC
bool
help
Enable BFLB Digital-to-Analog Converter (DAC) HAL module driver
config USE_BFLB_DMA
bool
help
Enable BFLB Direct Memory Access controller (DMA) HAL module driver
config USE_BFLB_I2C
bool
help
Enable BFLB Inter-Integrated Circuit Interface (I2C) HAL module driver
config USE_BFLB_IR
bool
help
Enable BFLB Infrared Remote controller (IR) HAL module driver
config USE_BFLB_PWM
bool
help
Enable BFLB Pulse Width Modulation (PMU) HAL module driver
config USE_BFLB_SPI
bool
help
Enable BFLB Serial Peripheral Interface(SPI) HAL module driver
config USE_BFLB_UART
bool
help
Enable BFLB Universal Asynchronous Receiver/Transmitter (UART)
HAL module driver
endif # HAS_BFLB_HAL

View file

@ -0,0 +1,26 @@
/*
* Copyright (c) 2021-2025 Gerson Fernando Budke <nandojve@gmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __BL_LD_SECTIONS_H
#define __BL_LD_SECTIONS_H
#define ATTR_STRINGIFY(x) #x
#define ATTR_TOSTRING(x) ATTR_STRINGIFY(x)
#define ATTR_SECTION(x) __attribute__((section(x)))
#define ATTR_UNI_SYMBOL __FILE__ ATTR_TOSTRING(__LINE__)
#define ATTR_CLOCK_SECTION ATTR_SECTION(".itcm.sclock_rlt_code." ATTR_UNI_SYMBOL)
#define ATTR_CLOCK_CONST_SECTION ATTR_SECTION(".itcm.sclock_rlt_const." ATTR_UNI_SYMBOL)
#define ATTR_TCM_SECTION ATTR_SECTION(".itcm.code." ATTR_UNI_SYMBOL)
#define ATTR_TCM_CONST_SECTION ATTR_SECTION(".itcm.const." ATTR_UNI_SYMBOL)
#define ATTR_DTCM_SECTION ATTR_SECTION(".dtcm.data")
#define ATTR_HSRAM_SECTION ATTR_SECTION(".hsram_code")
#define ATTR_DMA_RAM_SECTION ATTR_SECTION(".system_ram")
#define ATTR_HBN_RAM_SECTION ATTR_SECTION(".hbn_ram_code")
#define ATTR_HBN_RAM_CONST_SECTION ATTR_SECTION(".hbn_ram_data")
#define ATTR_FALLTHROUGH() __attribute__((fallthrough))
#define ATTR_USED __attribute__((__used__))
#define ATTR_EALIGN(x) __aligned(size)
#endif /* __BL_LD_SECTIONS_H */

View file

@ -161,6 +161,11 @@ manifest:
path: modules/hal/atmel
groups:
- hal
- name: hal_bouffalolab
path: modules/hal/bouffalolab
revision: c6c44b879503d990dfba643c212b606cee414faa
groups:
- hal
- name: hal_espressif
revision: dbc28ad4c1bdcdb25e79ca225cb5528a75d8dc91
path: modules/hal/espressif