[bsp]add bl808 uart2 driver && add bl60x/bl70x bsp to ci-action (#7097)

* update bl_mcu_sdk SConscript && add bl808 uart2 driver

* add bl60x/bl70x bsp to ci-action
This commit is contained in:
flyingcys 2023-03-25 19:05:33 +08:00 committed by GitHub
parent 1dc8e5060a
commit 575abd58ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 93 additions and 20 deletions

View File

@ -246,6 +246,8 @@ jobs:
- {RTT_BSP: "microchip/samc21", RTT_TOOL_CHAIN: "sourcery-arm"} - {RTT_BSP: "microchip/samc21", RTT_TOOL_CHAIN: "sourcery-arm"}
- {RTT_BSP: "microchip/same54", RTT_TOOL_CHAIN: "sourcery-arm"} - {RTT_BSP: "microchip/same54", RTT_TOOL_CHAIN: "sourcery-arm"}
- {RTT_BSP: "microchip/same70", RTT_TOOL_CHAIN: "sourcery-arm"} - {RTT_BSP: "microchip/same70", RTT_TOOL_CHAIN: "sourcery-arm"}
- {RTT_BSP: "bouffalo_lab/bl60x", RTT_TOOL_CHAIN: "sourcery-riscv64-unknown-elf"}
- {RTT_BSP: "bouffalo_lab/bl70x", RTT_TOOL_CHAIN: "sourcery-riscv64-unknown-elf"}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set up Python - name: Set up Python

View File

@ -4,6 +4,6 @@ cwd = GetCurrentDir()
src = Glob('*.c') + Glob('*.cpp') + Glob('*.S') src = Glob('*.c') + Glob('*.cpp') + Glob('*.S')
CPPPATH = [cwd] CPPPATH = [cwd]
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) group = DefineGroup('Board', src, depend = [''], CPPPATH = CPPPATH)
Return('group') Return('group')

View File

@ -4,6 +4,6 @@ cwd = GetCurrentDir()
src = Glob('*.c') + Glob('*.cpp') + Glob('*.S') src = Glob('*.c') + Glob('*.cpp') + Glob('*.S')
CPPPATH = [cwd] CPPPATH = [cwd]
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) group = DefineGroup('Board', src, depend = [''], CPPPATH = CPPPATH)
Return('group') Return('group')

View File

@ -4,6 +4,6 @@ cwd = GetCurrentDir()
src = Glob('*.c') + Glob('*.cpp') + Glob('*.S') src = Glob('*.c') + Glob('*.cpp') + Glob('*.S')
CPPPATH = [cwd] CPPPATH = [cwd]
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) group = DefineGroup('Board', src, depend = [''], CPPPATH = CPPPATH)
Return('group') Return('group')

View File

@ -4,6 +4,6 @@ cwd = GetCurrentDir()
src = Glob('*.c') + Glob('*.cpp') + Glob('*.S') src = Glob('*.c') + Glob('*.cpp') + Glob('*.S')
CPPPATH = [cwd] CPPPATH = [cwd]
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) group = DefineGroup('Board', src, depend = [''], CPPPATH = CPPPATH)
Return('group') Return('group')

View File

@ -4,6 +4,6 @@ cwd = GetCurrentDir()
src = Glob('*.c') + Glob('*.cpp') + Glob('*.S') src = Glob('*.c') + Glob('*.cpp') + Glob('*.S')
CPPPATH = [cwd] CPPPATH = [cwd]
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) group = DefineGroup('Board', src, depend = [''], CPPPATH = CPPPATH)
Return('group') Return('group')

View File

@ -175,16 +175,6 @@ void rt_hw_board_init(void)
} }
#endif #endif
/* GPIO driver initialization is open by default */
#ifdef BSP_USING_PIN
rt_hw_pin_init();
#endif
/* I2C driver initialization is open by default */
#ifdef BSP_USING_I2C
rt_hw_i2c_init();
#endif
/* Set the shell console output device */ /* Set the shell console output device */
#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE) #if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
rt_console_set_device(RT_CONSOLE_DEVICE_NAME); rt_console_set_device(RT_CONSOLE_DEVICE_NAME);

View File

@ -4,7 +4,8 @@ from building import *
cwd = GetCurrentDir() cwd = GetCurrentDir()
CPPPATH = [cwd + r'/include', CPPPATH = [cwd,
cwd + r'/include',
cwd + r'/include/arch', cwd + r'/include/arch',
cwd + r'/include/arch/risc-v/t-head', cwd + r'/include/arch/risc-v/t-head',
cwd + r'/include/arch/risc-v/t-head/Core/Include', cwd + r'/include/arch/risc-v/t-head/Core/Include',

View File

@ -1,5 +1,5 @@
#include "bflb_ef_ctrl.h" #include "bflb_ef_ctrl.h"
#include "hardware/ef_ctrl_reg.h" #include "include/hardware/ef_ctrl_reg.h"
#if defined(BL602) || defined(BL702) || defined(BL702L) #if defined(BL602) || defined(BL702) || defined(BL702L)
#define BFLB_EF_CTRL_BASE ((uint32_t)0x40007000) #define BFLB_EF_CTRL_BASE ((uint32_t)0x40007000)

View File

@ -25,7 +25,7 @@
#include "bflb_xip_sflash.h" #include "bflb_xip_sflash.h"
#include "bflb_sf_cfg.h" #include "bflb_sf_cfg.h"
#include "bflb_flash.h" #include "bflb_flash.h"
#include "hardware/sf_ctrl_reg.h" #include "include/hardware/sf_ctrl_reg.h"
#if defined(BL616) #if defined(BL616)
static uint32_t flash1_size = 4 * 1024 * 1024; static uint32_t flash1_size = 4 * 1024 * 1024;

View File

@ -35,7 +35,7 @@
*/ */
#include "bflb_sf_ctrl.h" #include "bflb_sf_ctrl.h"
#include "hardware/sf_ctrl_reg.h" #include "include/hardware/sf_ctrl_reg.h"
#if defined(BL602) || defined(BL702) || defined(BL702L) #if defined(BL602) || defined(BL702) || defined(BL702L)
#include <risc-v/e24/clic.h> #include <risc-v/e24/clic.h>
#else #else

View File

@ -83,6 +83,42 @@ menu "General Drivers Configuration"
endchoice endchoice
endif endif
if BSP_USING_BL808
menuconfig BSP_USING_UART2
bool "Enable UART2"
default n
if BSP_USING_UART2
choice
prompt "UART2 TX PIN"
default UART2_TX_USING_GPIO20
config UART2_TX_USING_GPIO4
bool "GPIO_4"
config UART2_TX_USING_GPIO16
bool "GPIO_16"
config UART2_TX_USING_GPIO18
bool "GPIO_18"
config UART2_TX_USING_GPIO20
bool "GPIO_20"
endchoice
choice
prompt "UART2 RX PIN"
default UART2_RX_USING_GPIO21
config UART2_RX_USING_GPIO3
bool "GPIO_3"
config UART2_RX_USING_GPIO5
bool "GPIO_5"
config UART2_RX_USING_GPIO17
bool "GPIO_17"
config UART2_RX_USING_GPIO19
bool "GPIO_19"
config UART2_RX_USING_GPIO21
bool "GPIO_21"
endchoice
endif
endif
endmenu endmenu
endmenu endmenu

View File

@ -63,7 +63,28 @@
#define UART1_GPIO_RX GPIO_PIN_27 #define UART1_GPIO_RX GPIO_PIN_27
#endif #endif
static struct bflb_device_s *gpio; // uart2
#ifdef UART2_TX_USING_GPIO4
#define UART2_GPIO_TX GPIO_PIN_4
#elif defined(UART2_TX_USING_GPIO16)
#define UART2_GPIO_TX GPIO_PIN_16
#elif defined(UART2_TX_USING_GPIO18)
#define UART2_GPIO_TX GPIO_PIN_18
#elif defined(UART2_TX_USING_GPIO20)
#define UART2_GPIO_TX GPIO_PIN_20
#endif
#ifdef UART2_RX_USING_GPIO3
#define UART2_GPIO_RX GPIO_PIN_3
#elif defined(UART2_RX_USING_GPIO5)
#define UART2_GPIO_RX GPIO_PIN_5
#elif defined(UART2_RX_USING_GPIO17)
#define UART2_GPIO_RX GPIO_PIN_17
#elif defined(UART2_RX_USING_GPIO19)
#define UART2_GPIO_RX GPIO_PIN_19
#elif defined(UART2_RX_USING_GPIO21)
#define UART2_GPIO_RX GPIO_PIN_21
#endif
struct device_uart struct device_uart
{ {
@ -250,6 +271,7 @@ static const struct rt_uart_ops _uart_ops =
int rt_hw_uart_init(void) int rt_hw_uart_init(void)
{ {
rt_err_t result = 0; rt_err_t result = 0;
struct bflb_device_s *gpio;
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT; struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
struct rt_serial_device *serial; struct rt_serial_device *serial;
@ -301,5 +323,27 @@ int rt_hw_uart_init(void)
uart); uart);
RT_ASSERT(result == RT_EOK); RT_ASSERT(result == RT_EOK);
#endif #endif
#ifdef BSP_USING_UART2
static struct device_uart bl_uart2;
serial = &bl_uart2.serial;
uart = &bl_uart2;
serial->ops = &_uart_ops;
serial->config = config;
serial->config.baud_rate = UART_DEFAULT_BAUDRATE;
uart->bflb_device = bflb_device_get_by_name("uart2");
bflb_gpio_uart_init(gpio, UART2_GPIO_TX, GPIO_UART_FUNC_UART2_TX);
bflb_gpio_uart_init(gpio, UART2_GPIO_RX, GPIO_UART_FUNC_UART2_RX);
/* register USART device */
result = rt_hw_serial_register(serial,
"uart2",
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
uart);
RT_ASSERT(result == RT_EOK);
#endif
return 0; return 0;
} }