diff --git a/bsp/board/bl808dk/bl808_flash_lp.ld b/bsp/board/bl808dk/bl808_flash_lp.ld index 4bd704fe..0eb3a77d 100644 --- a/bsp/board/bl808dk/bl808_flash_lp.ld +++ b/bsp/board/bl808dk/bl808_flash_lp.ld @@ -33,9 +33,9 @@ MEMORY SECTIONS { - .fw_header0 : + .fw_header : { - KEEP(*(.fw_header0)) + KEEP(*(.fw_header)) } > fw_header_memory0 .text : diff --git a/bsp/board/bl808dk/board.c b/bsp/board/bl808dk/board.c index 214fe2ef..88e4a88b 100644 --- a/bsp/board/bl808dk/board.c +++ b/bsp/board/bl808dk/board.c @@ -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_17, 21 | GPIO_ALTERNATE | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_1); #elif defined(CPU_LP) - bflb_gpio_uart_init(gpio, GPIO_PIN_16, GPIO_UART_FUNC_UART1_TX); - bflb_gpio_uart_init(gpio, GPIO_PIN_17, GPIO_UART_FUNC_UART1_RX); + /* map GPIO_PIN_18 and GPIO_PIN_19 as UART for LP core */ + 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 struct bflb_uart_config_s cfg; cfg.baudrate = 2000000; @@ -277,6 +278,12 @@ void board_init(void) /* 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); + 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); GLB_Release_CPU(GLB_CORE_ID_D0); diff --git a/drivers/lhal/CMakeLists.txt b/drivers/lhal/CMakeLists.txt index 931ae31f..8b0e3c0b 100644 --- a/drivers/lhal/CMakeLists.txt +++ b/drivers/lhal/CMakeLists.txt @@ -128,7 +128,7 @@ string(TOUPPER ${CPU_ID} CPU_ID_NAME) sdk_add_compile_definitions(-DCPU_${CPU_ID_NAME}) 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) endif() # add_subdirectory(src/pka) diff --git a/examples/bl808_dualcore/Makefile b/examples/bl808_triplecore/Makefile similarity index 67% rename from examples/bl808_dualcore/Makefile rename to examples/bl808_triplecore/Makefile index 8d7dc301..38bf0adc 100644 --- a/examples/bl808_dualcore/Makefile +++ b/examples/bl808_triplecore/Makefile @@ -1,9 +1,10 @@ build_dirs += helloworld_m0 build_dirs += helloworld_d0 +build_dirs += helloworld_lp all: $(build_dirs) $(build_dirs): make -C $@ -.PHONY: $(build_dirs) \ No newline at end of file +.PHONY: $(build_dirs) diff --git a/examples/bl808_dualcore/helloworld_d0/CMakeLists.txt b/examples/bl808_triplecore/helloworld_d0/CMakeLists.txt similarity index 100% rename from examples/bl808_dualcore/helloworld_d0/CMakeLists.txt rename to examples/bl808_triplecore/helloworld_d0/CMakeLists.txt diff --git a/examples/bl808_dualcore/helloworld_d0/Makefile b/examples/bl808_triplecore/helloworld_d0/Makefile similarity index 100% rename from examples/bl808_dualcore/helloworld_d0/Makefile rename to examples/bl808_triplecore/helloworld_d0/Makefile diff --git a/examples/bl808_dualcore/helloworld_d0/README.md b/examples/bl808_triplecore/helloworld_d0/README.md similarity index 92% rename from examples/bl808_dualcore/helloworld_d0/README.md rename to examples/bl808_triplecore/helloworld_d0/README.md index 92b485c6..faa40eee 100644 --- a/examples/bl808_dualcore/helloworld_d0/README.md +++ b/examples/bl808_triplecore/helloworld_d0/README.md @@ -1,4 +1,4 @@ -# bl808_dualcore +# bl808_triplecore ## Support CHIP @@ -19,4 +19,4 @@ make CHIP=bl808 BOARD=bl808dk CPU_ID=d0 ``` make flash CHIP=chip_name COMX=xxx # xxx is your com name -``` \ No newline at end of file +``` diff --git a/examples/bl808_dualcore/helloworld_d0/flash_prog_cfg.ini b/examples/bl808_triplecore/helloworld_d0/flash_prog_cfg.ini similarity index 100% rename from examples/bl808_dualcore/helloworld_d0/flash_prog_cfg.ini rename to examples/bl808_triplecore/helloworld_d0/flash_prog_cfg.ini diff --git a/examples/bl808_dualcore/helloworld_d0/main.c b/examples/bl808_triplecore/helloworld_d0/main.c similarity index 100% rename from examples/bl808_dualcore/helloworld_d0/main.c rename to examples/bl808_triplecore/helloworld_d0/main.c diff --git a/examples/bl808_dualcore/helloworld_d0/proj.conf b/examples/bl808_triplecore/helloworld_d0/proj.conf similarity index 100% rename from examples/bl808_dualcore/helloworld_d0/proj.conf rename to examples/bl808_triplecore/helloworld_d0/proj.conf diff --git a/examples/bl808_dualcore/helloworld_m0/CMakeLists.txt b/examples/bl808_triplecore/helloworld_lp/CMakeLists.txt similarity index 100% rename from examples/bl808_dualcore/helloworld_m0/CMakeLists.txt rename to examples/bl808_triplecore/helloworld_lp/CMakeLists.txt diff --git a/examples/bl808_triplecore/helloworld_lp/Makefile b/examples/bl808_triplecore/helloworld_lp/Makefile new file mode 100644 index 00000000..0762414e --- /dev/null +++ b/examples/bl808_triplecore/helloworld_lp/Makefile @@ -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 diff --git a/examples/bl808_triplecore/helloworld_lp/README.md b/examples/bl808_triplecore/helloworld_lp/README.md new file mode 100644 index 00000000..6d7b6d87 --- /dev/null +++ b/examples/bl808_triplecore/helloworld_lp/README.md @@ -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 diff --git a/examples/bl808_triplecore/helloworld_lp/flash_prog_cfg.ini b/examples/bl808_triplecore/helloworld_lp/flash_prog_cfg.ini new file mode 100644 index 00000000..cc3b1f09 --- /dev/null +++ b/examples/bl808_triplecore/helloworld_lp/flash_prog_cfg.ini @@ -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 M0,this address should consistent with m0's board_init in board.c +address = 0x20000 diff --git a/examples/bl808_triplecore/helloworld_lp/main.c b/examples/bl808_triplecore/helloworld_lp/main.c new file mode 100644 index 00000000..4350c756 --- /dev/null +++ b/examples/bl808_triplecore/helloworld_lp/main.c @@ -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); + } +} diff --git a/examples/bl808_triplecore/helloworld_lp/proj.conf b/examples/bl808_triplecore/helloworld_lp/proj.conf new file mode 100644 index 00000000..13fafbfc --- /dev/null +++ b/examples/bl808_triplecore/helloworld_lp/proj.conf @@ -0,0 +1,2 @@ +set(CONFIG_BFLOG 0) +set(CONFIG_PSRAM 1) diff --git a/examples/bl808_triplecore/helloworld_m0/CMakeLists.txt b/examples/bl808_triplecore/helloworld_m0/CMakeLists.txt new file mode 100644 index 00000000..273cfe95 --- /dev/null +++ b/examples/bl808_triplecore/helloworld_m0/CMakeLists.txt @@ -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) diff --git a/examples/bl808_dualcore/helloworld_m0/Makefile b/examples/bl808_triplecore/helloworld_m0/Makefile similarity index 100% rename from examples/bl808_dualcore/helloworld_m0/Makefile rename to examples/bl808_triplecore/helloworld_m0/Makefile diff --git a/examples/bl808_dualcore/helloworld_m0/README.md b/examples/bl808_triplecore/helloworld_m0/README.md similarity index 92% rename from examples/bl808_dualcore/helloworld_m0/README.md rename to examples/bl808_triplecore/helloworld_m0/README.md index f29ca294..28813df9 100644 --- a/examples/bl808_dualcore/helloworld_m0/README.md +++ b/examples/bl808_triplecore/helloworld_m0/README.md @@ -1,4 +1,4 @@ -# bl808_dualcore +# bl808_triplecore ## Support CHIP @@ -19,4 +19,4 @@ make CHIP=bl808 BOARD=bl808dk CPU_ID=m0 ``` make flash CHIP=chip_name COMX=xxx # xxx is your com name -``` \ No newline at end of file +``` diff --git a/examples/bl808_dualcore/helloworld_m0/flash_prog_cfg.ini b/examples/bl808_triplecore/helloworld_m0/flash_prog_cfg.ini similarity index 100% rename from examples/bl808_dualcore/helloworld_m0/flash_prog_cfg.ini rename to examples/bl808_triplecore/helloworld_m0/flash_prog_cfg.ini diff --git a/examples/bl808_dualcore/helloworld_m0/main.c b/examples/bl808_triplecore/helloworld_m0/main.c similarity index 100% rename from examples/bl808_dualcore/helloworld_m0/main.c rename to examples/bl808_triplecore/helloworld_m0/main.c diff --git a/examples/bl808_dualcore/helloworld_m0/proj.conf b/examples/bl808_triplecore/helloworld_m0/proj.conf similarity index 100% rename from examples/bl808_dualcore/helloworld_m0/proj.conf rename to examples/bl808_triplecore/helloworld_m0/proj.conf