enable lp core of bl808 and change example name to triplecore

This commit is contained in:
Cjacker 2023-03-01 14:52:04 +08:00 committed by sakumisu
parent ff125a583c
commit ab70ccc953
22 changed files with 102 additions and 10 deletions

View File

@ -33,9 +33,9 @@ MEMORY
SECTIONS SECTIONS
{ {
.fw_header0 : .fw_header :
{ {
KEEP(*(.fw_header0)) KEEP(*(.fw_header))
} > fw_header_memory0 } > fw_header_memory0
.text : .text :

View File

@ -203,8 +203,9 @@ static void console_init()
bflb_gpio_init(gpio, GPIO_PIN_16, 21 | GPIO_ALTERNATE | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_1); bflb_gpio_init(gpio, GPIO_PIN_16, 21 | GPIO_ALTERNATE | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_1);
bflb_gpio_init(gpio, GPIO_PIN_17, 21 | GPIO_ALTERNATE | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_1); bflb_gpio_init(gpio, GPIO_PIN_17, 21 | GPIO_ALTERNATE | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_1);
#elif defined(CPU_LP) #elif defined(CPU_LP)
bflb_gpio_uart_init(gpio, GPIO_PIN_16, GPIO_UART_FUNC_UART1_TX); /* map GPIO_PIN_18 and GPIO_PIN_19 as UART for LP core */
bflb_gpio_uart_init(gpio, GPIO_PIN_17, GPIO_UART_FUNC_UART1_RX); bflb_gpio_uart_init(gpio, GPIO_PIN_18, GPIO_UART_FUNC_UART1_TX);
bflb_gpio_uart_init(gpio, GPIO_PIN_19, GPIO_UART_FUNC_UART1_RX);
#endif #endif
struct bflb_uart_config_s cfg; struct bflb_uart_config_s cfg;
cfg.baudrate = 2000000; cfg.baudrate = 2000000;
@ -277,6 +278,12 @@ void board_init(void)
/* D0 image offset on flash is CONFIG_D0_FLASH_ADDR+0x1000(header) */ /* D0 image offset on flash is CONFIG_D0_FLASH_ADDR+0x1000(header) */
bflb_sf_ctrl_set_flash_image_offset(CONFIG_D0_FLASH_ADDR + 0x1000, 1, SF_CTRL_FLASH_BANK0); bflb_sf_ctrl_set_flash_image_offset(CONFIG_D0_FLASH_ADDR + 0x1000, 1, SF_CTRL_FLASH_BANK0);
Tzc_Sec_Set_CPU_Group(GLB_CORE_ID_LP, 2);
/* LP boot from 0x58020000 */
GLB_Set_CPU_Reset_Address(GLB_CORE_ID_LP, 0x58020000);
/* LP image offset on flash is CONFIG_LP_FLASH_ADDR+0x1000(header) */
bflb_sf_ctrl_set_flash_image_offset(CONFIG_LP_FLASH_ADDR + 0x1000, 2, SF_CTRL_FLASH_BANK1);
bflb_irq_restore(flag); bflb_irq_restore(flag);
GLB_Release_CPU(GLB_CORE_ID_D0); GLB_Release_CPU(GLB_CORE_ID_D0);

View File

@ -128,7 +128,7 @@ string(TOUPPER ${CPU_ID} CPU_ID_NAME)
sdk_add_compile_definitions(-DCPU_${CPU_ID_NAME}) sdk_add_compile_definitions(-DCPU_${CPU_ID_NAME})
endif() endif()
if(NOT ("${CPU_ID}" STREQUAL "d0")) if((NOT ("${CPU_ID}" STREQUAL "d0")) AND (NOT ("${CPU_ID}" STREQUAL "lp")))
sdk_add_static_library(src/pka/libpka.a) sdk_add_static_library(src/pka/libpka.a)
endif() endif()
# add_subdirectory(src/pka) # add_subdirectory(src/pka)

View File

@ -1,5 +1,6 @@
build_dirs += helloworld_m0 build_dirs += helloworld_m0
build_dirs += helloworld_d0 build_dirs += helloworld_d0
build_dirs += helloworld_lp
all: $(build_dirs) all: $(build_dirs)

View File

@ -1,4 +1,4 @@
# bl808_dualcore # bl808_triplecore
## Support CHIP ## Support CHIP

View File

@ -0,0 +1,14 @@
SDK_DEMO_PATH ?= .
BL_SDK_BASE ?= $(SDK_DEMO_PATH)/../../..
export BL_SDK_BASE
CHIP ?= bl808
BOARD ?= bl808dk
CPU_ID ?= lp
CROSS_COMPILE ?= riscv64-unknown-elf-
# add custom cmake definition
#cmake_definition+=-Dxxx=sss
include $(BL_SDK_BASE)/project.build

View File

@ -0,0 +1,28 @@
# bl808_triplecore
## Support CHIP
| CHIP | Remark |
|:----------------:|:------:|
|BL808 | Only for LP CPU |
## Compile
- BL808
```
make CHIP=bl808 BOARD=bl808dk CPU_ID=lp
```
## Flash
```
make flash CHIP=chip_name COMX=xxx # xxx is your com name
```
## UART of LP
It's defined in 'console_init' of bl808dk/board.c.
- GPIO 18 : TX
- GPIO 19 : RX

View File

@ -0,0 +1,12 @@
[cfg]
# 0: no erase, 1:programmed section erase, 2: chip erase
erase = 1
# skip mode set first para is skip addr, second para is skip len, multi-segment region with ; separated
skip_mode = 0x0, 0x0
# 0: not use isp mode, #1: isp mode
boot2_isp_mode = 0
[FW]
filedir = ./build/build_out/helloworld*_$(CHIPNAME).bin
# since LP is boot by M0this address should consistent with m0's board_init in board.c
address = 0x20000

View File

@ -0,0 +1,19 @@
#include "bflb_mtimer.h"
#include "board.h"
#define DBG_TAG "MAIN"
#include "log.h"
int main(void)
{
board_init();
while (1) {
LOG_F("hello world lp\r\n");
LOG_E("hello world lp\r\n");
LOG_W("hello world lp\r\n");
LOG_I("hello world lp\r\n");
LOG_D("hello world lp\r\n");
LOG_T("hello world lp\r\n");
bflb_mtimer_delay_ms(1000);
}
}

View File

@ -0,0 +1,2 @@
set(CONFIG_BFLOG 0)
set(CONFIG_PSRAM 1)

View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.15)
include(proj.conf)
find_package(bouffalo_sdk REQUIRED HINTS $ENV{BL_SDK_BASE})
sdk_set_main_file(main.c)
project(helloworld)

View File

@ -1,4 +1,4 @@
# bl808_dualcore # bl808_triplecore
## Support CHIP ## Support CHIP