mirror of
https://github.com/Fishwaldo/bl_mcu_sdk.git
synced 2025-07-23 13:18:59 +00:00
[update] update lhal, soc and demos
* Add flash driver and init in boards. * Add timeout for all poll wait apis * Add 808 d0 startup to bringup * Update lhal device tables * Update demos
This commit is contained in:
parent
9f241971e3
commit
d6fab307bf
232 changed files with 26802 additions and 1471 deletions
|
@ -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(flash_read_write)
|
13
examples/peripherals/flash/flash_read_write/Makefile
Normal file
13
examples/peripherals/flash/flash_read_write/Makefile
Normal file
|
@ -0,0 +1,13 @@
|
|||
SDK_DEMO_PATH ?= .
|
||||
BL_SDK_BASE ?= $(SDK_DEMO_PATH)/../../../..
|
||||
|
||||
export BL_SDK_BASE
|
||||
|
||||
CHIP ?= bl616
|
||||
BOARD ?= bl616dk
|
||||
CROSS_COMPILE ?= riscv64-unknown-elf-
|
||||
|
||||
# add custom cmake definition
|
||||
#cmake_definition+=-Dxxx=sss
|
||||
|
||||
include $(BL_SDK_BASE)/project.build
|
53
examples/peripherals/flash/flash_read_write/main.c
Normal file
53
examples/peripherals/flash/flash_read_write/main.c
Normal file
|
@ -0,0 +1,53 @@
|
|||
#include "bflb_flash.h"
|
||||
#include "board.h"
|
||||
|
||||
#define FLASH_TEST_SIZE 1 * 1024 * 1024
|
||||
|
||||
int main(void)
|
||||
{
|
||||
board_init();
|
||||
|
||||
uint8_t write_buf[256];
|
||||
uint8_t read_buf[256];
|
||||
|
||||
for (uint16_t i = 0; i < 256; i++) {
|
||||
write_buf[i] = i;
|
||||
}
|
||||
|
||||
for (uint32_t i = 1; i < (FLASH_TEST_SIZE / 1024); i++) {
|
||||
printf("test addr:%08x\r\n", (0x00010000 + (i - 1) * 1024));
|
||||
/* erase 0x00010000 4k flash */
|
||||
bflb_flash_erase(0x00010000 + (i - 1) * 1024, i * 1024);
|
||||
|
||||
memset(read_buf, 0, 256);
|
||||
|
||||
/* read 0x00010000 flash data */
|
||||
bflb_flash_read(0x00010000 + (i - 1) * 1024, read_buf, sizeof(read_buf));
|
||||
for (uint16_t j = 0; j < 256; j++) {
|
||||
if (read_buf[j] != 0xff) {
|
||||
printf("flash test fail at %d, expect:%d but with %d\r\n", j, 0xff, read_buf[j]);
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
/* write 0x00010000 flash data */
|
||||
bflb_flash_write(0x00010000 + (i - 1) * 1024, write_buf, sizeof(write_buf));
|
||||
|
||||
memset(read_buf, 0, 256);
|
||||
|
||||
/* read 0x00010000 flash data */
|
||||
bflb_flash_read(0x00010000 + (i - 1) * 1024, read_buf, sizeof(read_buf));
|
||||
|
||||
for (uint16_t j = 0; j < 256; j++) {
|
||||
if (read_buf[j] != write_buf[j]) {
|
||||
printf("flash test fail at %d, expect:%d but with %d\r\n", j, write_buf[j], read_buf[j]);
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("flash test success\r\n");
|
||||
while (1) {
|
||||
}
|
||||
}
|
1
examples/peripherals/flash/flash_read_write/proj.conf
Normal file
1
examples/peripherals/flash/flash_read_write/proj.conf
Normal file
|
@ -0,0 +1 @@
|
|||
#set(CONFIG_XXX 1)
|
Loading…
Add table
Add a link
Reference in a new issue