mirror of
https://github.com/bouffalolab/bouffalo_sdk.git
synced 2025-05-09 03:11:58 +08:00
[update][examples] update demo
This commit is contained in:
parent
941f146392
commit
06b3131662
@ -25,7 +25,6 @@
|
||||
* Function: Environment variables operating interface. This is the Next Generation version.
|
||||
* Created on: 2019-02-02
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <easyflash.h>
|
||||
|
@ -30,8 +30,10 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef CONFIG_FREERTOS
|
||||
#include <FreeRTOS.h>
|
||||
#include <semphr.h>
|
||||
#endif
|
||||
#include <bflb_mtd.h>
|
||||
#include <ef_cfg.h>
|
||||
|
||||
@ -44,8 +46,9 @@ static const ef_env default_env_set[] = {
|
||||
{"boot_times", "3", 1}
|
||||
};
|
||||
|
||||
#ifdef CONFIG_FREERTOS
|
||||
static SemaphoreHandle_t env_cache_lock = NULL;
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Flash port for hardware initialize.
|
||||
*
|
||||
@ -84,13 +87,13 @@ EfErrCode ef_port_init(ef_env const **default_env, size_t *default_env_size) {
|
||||
*default_env_size = sizeof(default_env_set) / sizeof(default_env_set[0]);
|
||||
|
||||
printf("*default_env_size = 0x%08x\r\n", *default_env_size);
|
||||
|
||||
#ifdef CONFIG_FREERTOS
|
||||
#if configUSE_RECURSIVE_MUTEXES
|
||||
env_cache_lock = xSemaphoreCreateRecursiveMutex();
|
||||
#else
|
||||
env_cache_lock = xSemaphoreCreateMutex();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
return EF_NO_ERR;
|
||||
}
|
||||
|
||||
@ -168,7 +171,7 @@ EfErrCode ef_port_write(uint32_t addr, const uint32_t *buf, size_t size) {
|
||||
* lock the ENV ram cache
|
||||
*/
|
||||
void ef_port_env_lock(void) {
|
||||
|
||||
#ifdef CONFIG_FREERTOS
|
||||
#if configUSE_RECURSIVE_MUTEXES
|
||||
xSemaphoreTakeRecursive(env_cache_lock,
|
||||
portMAX_DELAY);
|
||||
@ -177,20 +180,21 @@ void ef_port_env_lock(void) {
|
||||
xSemaphoreTake( env_cache_lock,
|
||||
portMAX_DELAY );
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* unlock the ENV ram cache
|
||||
*/
|
||||
void ef_port_env_unlock(void) {
|
||||
|
||||
#ifdef CONFIG_FREERTOS
|
||||
#if configUSE_RECURSIVE_MUTEXES
|
||||
xSemaphoreGiveRecursive(env_cache_lock);
|
||||
#else
|
||||
/* You can add your code under here. */
|
||||
xSemaphoreGive( env_cache_lock );
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,7 +82,7 @@ int printf(const char *fmt, ...)
|
||||
#endif
|
||||
|
||||
#define __is_print(ch) ((unsigned int)((ch) - ' ') < 127u - ' ')
|
||||
void bflb_dump_hex(const void *ptr, uint32_t buflen)
|
||||
void bflb_hexdump(const void *ptr, uint32_t buflen)
|
||||
{
|
||||
unsigned char *buf = (unsigned char *)ptr;
|
||||
int i, j;
|
||||
@ -108,40 +108,27 @@ void bflb_dump_hex(const void *ptr, uint32_t buflen)
|
||||
}
|
||||
}
|
||||
|
||||
// void bflb_dump_hex(uint8_t *data, uint32_t len)
|
||||
// {
|
||||
// uint32_t i = 0;
|
||||
|
||||
// for (i = 0; i < len; i++) {
|
||||
// if (i % 16 == 0) {
|
||||
// printf("\r\n");
|
||||
// }
|
||||
|
||||
// printf("%02x ", data[i]);
|
||||
// }
|
||||
|
||||
// printf("\r\n");
|
||||
// }
|
||||
|
||||
void bflb_reg_dump(uint32_t addr)
|
||||
void bflb_dump(uint8_t *data, uint32_t len)
|
||||
{
|
||||
printf("%08lx[31:0]=%08lx\r\n", addr, *(volatile uint32_t *)(addr));
|
||||
}
|
||||
uint32_t i = 0;
|
||||
|
||||
int bflb_data_compare(const uint8_t *expected, uint8_t *input, uint32_t len)
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < len; i++) {
|
||||
if (input[i] != expected[i]) {
|
||||
printf("Compare fail at %d,input %02x, but expect %02x\r\n", i, input[i], expected[i]);
|
||||
return -1;
|
||||
if (i % 16 == 0) {
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
printf("%02x ", data[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
void bflb_regdump(uint32_t addr)
|
||||
{
|
||||
printf("%08lx[31:0]=%08lx\r\n", addr, *(volatile uint32_t *)(addr));
|
||||
}
|
||||
|
||||
void bflb_uart_set_console(struct bflb_device_s *dev)
|
||||
{
|
||||
console = dev;
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,11 @@ CHIP ?= bl616
|
||||
BOARD ?= bl616dk
|
||||
CPU_ID ?=
|
||||
|
||||
makefile_files += $(shell find ./peripherals -name 'Makefile' -not -path "*/build/*")
|
||||
makefile_dirs = $(sort $(dir $(makefile_files)))
|
||||
peripherals_makefile_files = $(shell find ./peripherals -name 'Makefile' -not -path "*/build/*")
|
||||
wifi_makefile_files = $(shell find ./wifi/sta -name 'Makefile' -not -path "*/build/*")
|
||||
btble_makefile_files = $(shell find ./btble -name 'Makefile' -not -path "*/build/*")
|
||||
|
||||
makefile_dirs = $(sort $(dir $(peripherals_makefile_files)))
|
||||
|
||||
makefile_dirs += ./bflb_block_pool
|
||||
makefile_dirs += ./bflog/barebone_sync
|
||||
@ -43,22 +46,20 @@ endif
|
||||
ifeq ($(CHIP),bl616)
|
||||
filter_out_dirs += ./peripherals/csi/%
|
||||
filter_out_dirs += ./peripherals/pwm_v1/%
|
||||
|
||||
makefile_dirs += ./fatfs
|
||||
makefile_dirs += ./littlefs
|
||||
makefile_dirs += ./lvgl
|
||||
makefile_dirs += ./lua
|
||||
makefile_dirs += ./btble/ble_mesh_cli
|
||||
makefile_dirs += ./btble/peripheral
|
||||
makefile_dirs += ./wifi/sta/wifi_http
|
||||
makefile_dirs += ./wifi/sta/wifi_https_demo
|
||||
makefile_dirs += ./wifi/sta/wifi_mqtt_pub
|
||||
makefile_dirs += ./wifi/sta/wifi_mqtt_sub
|
||||
makefile_dirs += ./wifi/sta/wifi_tcp
|
||||
makefile_dirs += ./wifi/sta/wifi_udp
|
||||
|
||||
makefile_dirs += $(sort $(dir $(wifi_makefile_files)))
|
||||
makefile_dirs += $(sort $(dir $(btble_makefile_files)))
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(CHIP),bl808)
|
||||
filter_out_dirs += ./peripherals/pwm_v1/%
|
||||
|
||||
makefile_dirs += ./fatfs
|
||||
makefile_dirs += ./littlefs
|
||||
makefile_dirs += ./lvgl
|
||||
@ -76,4 +77,4 @@ buildall:
|
||||
cleanall:
|
||||
@for n in $(build_dirs); do make -C $$n clean; done
|
||||
|
||||
.PHONY: buildall cleanall
|
||||
.PHONY: buildall cleanall
|
||||
|
@ -108,7 +108,7 @@ MAIN_RETURN_TYPE core_mark(int argc, char *argv[])
|
||||
portable_init(&(results[0].port), &argc, argv);
|
||||
/* First some checks to make sure benchmark will run ok */
|
||||
if (sizeof(struct list_head_s) > 128) {
|
||||
ee_printf("list_head structure too big for comparable data!\n");
|
||||
ee_printf("list_head structure too big for comparable data!\r\n");
|
||||
return MAIN_RETURN_VAL;
|
||||
}
|
||||
results[0].seed1 = get_seed(1);
|
||||
@ -243,23 +243,23 @@ for (i = 0; i < MULTITHREAD; i++) {
|
||||
switch (seedcrc) { /* test known output for common seeds */
|
||||
case 0x8a02: /* seed1=0, seed2=0, seed3=0x66, size 2000 per algorithm */
|
||||
known_id = 0;
|
||||
ee_printf("6k performance run parameters for coremark.\n");
|
||||
ee_printf("6k performance run parameters for coremark.\r\n");
|
||||
break;
|
||||
case 0x7b05: /* seed1=0x3415, seed2=0x3415, seed3=0x66, size 2000 per algorithm */
|
||||
known_id = 1;
|
||||
ee_printf("6k validation run parameters for coremark.\n");
|
||||
ee_printf("6k validation run parameters for coremark.\r\n");
|
||||
break;
|
||||
case 0x4eaf: /* seed1=0x8, seed2=0x8, seed3=0x8, size 400 per algorithm */
|
||||
known_id = 2;
|
||||
ee_printf("Profile generation run parameters for coremark.\n");
|
||||
ee_printf("Profile generation run parameters for coremark.\r\n");
|
||||
break;
|
||||
case 0xe9f5: /* seed1=0, seed2=0, seed3=0x66, size 666 per algorithm */
|
||||
known_id = 3;
|
||||
ee_printf("2K performance run parameters for coremark.\n");
|
||||
ee_printf("2K performance run parameters for coremark.\r\n");
|
||||
break;
|
||||
case 0x18f2: /* seed1=0x3415, seed2=0x3415, seed3=0x66, size 666 per algorithm */
|
||||
known_id = 4;
|
||||
ee_printf("2K validation run parameters for coremark.\n");
|
||||
ee_printf("2K validation run parameters for coremark.\r\n");
|
||||
break;
|
||||
default:
|
||||
total_errors = -1;
|
||||
@ -270,17 +270,17 @@ for (i = 0; i < MULTITHREAD; i++) {
|
||||
results[i].err = 0;
|
||||
if ((results[i].execs & ID_LIST) &&
|
||||
(results[i].crclist != list_known_crc[known_id])) {
|
||||
ee_printf("[%u]ERROR! list crc 0x%04x - should be 0x%04x\n", i, results[i].crclist, list_known_crc[known_id]);
|
||||
ee_printf("[%u]ERROR! list crc 0x%04x - should be 0x%04x\r\n", i, results[i].crclist, list_known_crc[known_id]);
|
||||
results[i].err++;
|
||||
}
|
||||
if ((results[i].execs & ID_MATRIX) &&
|
||||
(results[i].crcmatrix != matrix_known_crc[known_id])) {
|
||||
ee_printf("[%u]ERROR! matrix crc 0x%04x - should be 0x%04x\n", i, results[i].crcmatrix, matrix_known_crc[known_id]);
|
||||
ee_printf("[%u]ERROR! matrix crc 0x%04x - should be 0x%04x\r\n", i, results[i].crcmatrix, matrix_known_crc[known_id]);
|
||||
results[i].err++;
|
||||
}
|
||||
if ((results[i].execs & ID_STATE) &&
|
||||
(results[i].crcstate != state_known_crc[known_id])) {
|
||||
ee_printf("[%u]ERROR! state crc 0x%04x - should be 0x%04x\n", i, results[i].crcstate, state_known_crc[known_id]);
|
||||
ee_printf("[%u]ERROR! state crc 0x%04x - should be 0x%04x\r\n", i, results[i].crcstate, state_known_crc[known_id]);
|
||||
results[i].err++;
|
||||
}
|
||||
total_errors += results[i].err;
|
||||
@ -288,44 +288,44 @@ for (i = 0; i < MULTITHREAD; i++) {
|
||||
}
|
||||
total_errors += check_data_types();
|
||||
/* and report results */
|
||||
ee_printf("CoreMark Size : %lu\n", (long unsigned)results[0].size);
|
||||
ee_printf("Total ticks : %lu\n", (long unsigned)total_time);
|
||||
ee_printf("CoreMark Size : %lu\r\n", (long unsigned)results[0].size);
|
||||
ee_printf("Total ticks : %lu\r\n", (long unsigned)total_time);
|
||||
#if HAS_FLOAT
|
||||
ee_printf("Total time (secs): %f\n", time_in_secs(total_time));
|
||||
ee_printf("Total time (secs): %f\r\n", time_in_secs(total_time));
|
||||
if (time_in_secs(total_time) > 0)
|
||||
ee_printf("Iterations/Sec : %f\n", default_num_contexts * results[0].iterations / time_in_secs(total_time));
|
||||
ee_printf("Iterations/Sec : %f\r\n", default_num_contexts * results[0].iterations / time_in_secs(total_time));
|
||||
#else
|
||||
ee_printf("Total time (secs): %d\n", time_in_secs(total_time));
|
||||
ee_printf("Total time (secs): %d\r\n", time_in_secs(total_time));
|
||||
if (time_in_secs(total_time) > 0)
|
||||
ee_printf("Iterations/Sec : %d\n", default_num_contexts * results[0].iterations / time_in_secs(total_time));
|
||||
ee_printf("Iterations/Sec : %d\r\n", default_num_contexts * results[0].iterations / time_in_secs(total_time));
|
||||
#endif
|
||||
if (time_in_secs(total_time) < 10) {
|
||||
ee_printf("ERROR! Must execute for at least 10 secs for a valid result!\n");
|
||||
ee_printf("ERROR! Must execute for at least 10 secs for a valid result!\r\n");
|
||||
total_errors++;
|
||||
}
|
||||
|
||||
ee_printf("Iterations : %lu\n", (long unsigned)default_num_contexts * results[0].iterations);
|
||||
ee_printf("Compiler version : %s\n", COMPILER_VERSION);
|
||||
ee_printf("Compiler flags : %s\n", COMPILER_FLAGS);
|
||||
ee_printf("Iterations : %lu\r\n", (long unsigned)default_num_contexts * results[0].iterations);
|
||||
ee_printf("Compiler version : %s\r\n", COMPILER_VERSION);
|
||||
ee_printf("Compiler flags : %s\r\n", COMPILER_FLAGS);
|
||||
#if (MULTITHREAD > 1)
|
||||
ee_printf("Parallel %s : %d\n", PARALLEL_METHOD, default_num_contexts);
|
||||
ee_printf("Parallel %s : %d\r\n", PARALLEL_METHOD, default_num_contexts);
|
||||
#endif
|
||||
ee_printf("Memory location : %s\n", MEM_LOCATION);
|
||||
ee_printf("Memory location : %s\r\n", MEM_LOCATION);
|
||||
/* output for verification */
|
||||
ee_printf("seedcrc : 0x%04x\n", seedcrc);
|
||||
ee_printf("seedcrc : 0x%04x\r\n", seedcrc);
|
||||
if (results[0].execs & ID_LIST)
|
||||
for (i = 0; i < default_num_contexts; i++)
|
||||
ee_printf("[%d]crclist : 0x%04x\n", i, results[i].crclist);
|
||||
ee_printf("[%d]crclist : 0x%04x\r\n", i, results[i].crclist);
|
||||
if (results[0].execs & ID_MATRIX)
|
||||
for (i = 0; i < default_num_contexts; i++)
|
||||
ee_printf("[%d]crcmatrix : 0x%04x\n", i, results[i].crcmatrix);
|
||||
ee_printf("[%d]crcmatrix : 0x%04x\r\n", i, results[i].crcmatrix);
|
||||
if (results[0].execs & ID_STATE)
|
||||
for (i = 0; i < default_num_contexts; i++)
|
||||
ee_printf("[%d]crcstate : 0x%04x\n", i, results[i].crcstate);
|
||||
ee_printf("[%d]crcstate : 0x%04x\r\n", i, results[i].crcstate);
|
||||
for (i = 0; i < default_num_contexts; i++)
|
||||
ee_printf("[%d]crcfinal : 0x%04x\n", i, results[i].crc);
|
||||
ee_printf("[%d]crcfinal : 0x%04x\r\n", i, results[i].crc);
|
||||
if (total_errors == 0) {
|
||||
ee_printf("Correct operation validated. See readme.txt for run and reporting rules.\n");
|
||||
ee_printf("Correct operation validated. See readme.txt for run and reporting rules.\r\n");
|
||||
#if HAS_FLOAT
|
||||
if (known_id == 3) {
|
||||
ee_printf("CoreMark 1.0 : %f / %s %s", default_num_contexts * results[0].iterations / time_in_secs(total_time), COMPILER_VERSION, COMPILER_FLAGS);
|
||||
@ -338,7 +338,7 @@ for (i = 0; i < MULTITHREAD; i++) {
|
||||
#if (MULTITHREAD > 1)
|
||||
ee_printf(" / %d:%s", default_num_contexts, PARALLEL_METHOD);
|
||||
#endif
|
||||
ee_printf("\n");
|
||||
ee_printf("\r\n");
|
||||
}
|
||||
#else
|
||||
if (known_id == 3) {
|
||||
@ -352,14 +352,14 @@ for (i = 0; i < MULTITHREAD; i++) {
|
||||
#if (MULTITHREAD > 1)
|
||||
ee_printf(" / %d:%s", default_num_contexts, PARALLEL_METHOD);
|
||||
#endif
|
||||
ee_printf("\n");
|
||||
ee_printf("\r\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (total_errors > 0)
|
||||
ee_printf("Errors detected\n");
|
||||
ee_printf("Errors detected\r\n");
|
||||
if (total_errors < 0)
|
||||
ee_printf("Cannot validate operation for these seed values, please compare with results on a known platform.\n");
|
||||
ee_printf("Cannot validate operation for these seed values, please compare with results on a known platform.\r\n");
|
||||
|
||||
#if (MEM_METHOD == MEM_MALLOC)
|
||||
for (i = 0; i < MULTITHREAD; i++)
|
||||
|
9
examples/easyflash/CMakeLists.txt
Normal file
9
examples/easyflash/CMakeLists.txt
Normal 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(easyflash)
|
13
examples/easyflash/Makefile
Normal file
13
examples/easyflash/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
|
44
examples/easyflash/README.md
Normal file
44
examples/easyflash/README.md
Normal file
@ -0,0 +1,44 @@
|
||||
# easyflash
|
||||
|
||||
|
||||
## Support CHIP
|
||||
|
||||
| CHIP | Remark |
|
||||
|:----------------:|:------:|
|
||||
|BL602/BL604 | |
|
||||
|BL702/BL704/BL706 | |
|
||||
|BL616/BL618 | |
|
||||
|BL808 | |
|
||||
|
||||
## Compile
|
||||
|
||||
- BL602/BL604
|
||||
|
||||
```
|
||||
make CHIP=bl602 BOARD=bl602dk
|
||||
```
|
||||
|
||||
- BL702/BL704/BL706
|
||||
|
||||
```
|
||||
make CHIP=bl702 BOARD=bl702dk
|
||||
```
|
||||
|
||||
- BL616/BL618
|
||||
|
||||
```
|
||||
make CHIP=bl616 BOARD=bl616dk
|
||||
```
|
||||
|
||||
- BL808
|
||||
|
||||
```
|
||||
make CHIP=bl808 BOARD=bl808dk CPU_ID=m0
|
||||
make CHIP=bl808 BOARD=bl808dk CPU_ID=d0
|
||||
```
|
||||
|
||||
## Flash
|
||||
|
||||
```
|
||||
make flash CHIP=chip_name COMX=xxx # xxx is your com name
|
||||
```
|
20
examples/easyflash/flash_prog_cfg.ini
Normal file
20
examples/easyflash/flash_prog_cfg.ini
Normal file
@ -0,0 +1,20 @@
|
||||
[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
|
||||
|
||||
[boot2]
|
||||
filedir = ./build/build_out/boot2_*.bin
|
||||
address = 0x000000
|
||||
|
||||
[partition]
|
||||
filedir = ./build/build_out/partition*.bin
|
||||
address = 0xE000
|
||||
|
||||
[FW]
|
||||
filedir = ./build/build_out/easyflash_$(CHIPNAME).bin
|
||||
address = @partition
|
||||
|
51
examples/easyflash/main.c
Normal file
51
examples/easyflash/main.c
Normal file
@ -0,0 +1,51 @@
|
||||
#include "bflb_mtimer.h"
|
||||
#include "board.h"
|
||||
#include "bflb_mtd.h"
|
||||
#include "easyflash.h"
|
||||
|
||||
uint8_t test_data[] = { "1234567890" };
|
||||
uint8_t read_buffer[100];
|
||||
|
||||
int main(void)
|
||||
{
|
||||
board_init();
|
||||
|
||||
/* Partition and boot2 must be use, and we can only operate partition **psm** with easyflash
|
||||
*
|
||||
* partition_cfg with psm:
|
||||
*
|
||||
[[pt_entry]]
|
||||
type = 3
|
||||
name = "PSM"
|
||||
device = 0
|
||||
address0 = 0x3E9000
|
||||
size0 = 0x8000
|
||||
address1 = 0
|
||||
size1 = 0
|
||||
# compressed image must set len,normal image can left it to 0
|
||||
len = 0
|
||||
# If header is 1, it will add the header.
|
||||
header = 0
|
||||
# If header is 1 and security is 1, It will be encrypted.
|
||||
security= 0
|
||||
|
||||
*/
|
||||
bflb_mtd_init();
|
||||
easyflash_init();
|
||||
|
||||
memset(read_buffer, 0, sizeof(read_buffer));
|
||||
ef_port_erase(0x0, 4096);
|
||||
|
||||
ef_port_write(0x0, test_data, sizeof(test_data));
|
||||
ef_port_read(0x0, read_buffer, sizeof(test_data));
|
||||
|
||||
if (memcmp(read_buffer, test_data, sizeof(test_data))) {
|
||||
printf("easyflash fail\r\n");
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
printf("write data: %s\r\n", read_buffer);
|
||||
printf("easyflash ok\r\n");
|
||||
while (1) {
|
||||
}
|
||||
}
|
3
examples/easyflash/proj.conf
Normal file
3
examples/easyflash/proj.conf
Normal file
@ -0,0 +1,3 @@
|
||||
set(CONFIG_EASYFLASH4 1)
|
||||
set(CONFIG_BFLB_MTD 1)
|
||||
set(CONFIG_PARTITION 1)
|
@ -114,7 +114,7 @@ void fatfs_write_read_test()
|
||||
if (ret == FR_OK) {
|
||||
time_node = (uint32_t)bflb_mtimer_get_time_ms();
|
||||
/*write into file*/
|
||||
ret = f_write(&fnew, RW_Buffer, 1024, &fnum);
|
||||
// ret = f_write(&fnew, RW_Buffer, 1024, &fnum);
|
||||
for (i = 0; i < 1024; i++) {
|
||||
ret = f_write(&fnew, RW_Buffer, sizeof(RW_Buffer), &fnum);
|
||||
if (ret) {
|
||||
@ -147,7 +147,7 @@ void fatfs_write_read_test()
|
||||
if (ret == FR_OK) {
|
||||
time_node = (uint32_t)bflb_mtimer_get_time_ms();
|
||||
|
||||
ret = f_read(&fnew, RW_Buffer, 1024, &fnum);
|
||||
// ret = f_read(&fnew, RW_Buffer, 1024, &fnum);
|
||||
for (i = 0; i < 1024; i++) {
|
||||
ret = f_read(&fnew, RW_Buffer, sizeof(RW_Buffer), &fnum);
|
||||
if (ret) {
|
||||
@ -178,7 +178,7 @@ void fatfs_write_read_test()
|
||||
LOG_I("******************** be about to check test... **********************\r\n");
|
||||
ret = f_open(&fnew, "/sd/test_file.txt", FA_OPEN_EXISTING | FA_READ);
|
||||
if (ret == FR_OK) {
|
||||
ret = f_read(&fnew, RW_Buffer, 1024, &fnum);
|
||||
// ret = f_read(&fnew, RW_Buffer, 1024, &fnum);
|
||||
for (i = 0; i < 1024; i++) {
|
||||
ret = f_read(&fnew, RW_Buffer, sizeof(RW_Buffer), &fnum);
|
||||
if (ret) {
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#define AUADC_SAMPLING_NUM (48 * 1024)
|
||||
|
||||
static ATTR_NOCACHE_NOINIT_RAM_SECTION uint16_t record_buff[AUADC_SAMPLING_NUM];
|
||||
static __attribute((aligned(32))) uint16_t record_buff[AUADC_SAMPLING_NUM];
|
||||
|
||||
/* audio adc config */
|
||||
struct bflb_auadc_init_config_s auadc_init_cfg = {
|
||||
@ -32,6 +32,7 @@ struct bflb_device_s *auadc_dma_hd;
|
||||
|
||||
void audio_dma_callback(void *arg)
|
||||
{
|
||||
bflb_l1c_dcache_invalidate_range(record_buff, sizeof(record_buff));
|
||||
printf("auadc record end\r\n");
|
||||
}
|
||||
|
||||
|
@ -5,13 +5,13 @@
|
||||
|
||||
#define DMA_BUFFER_LENGTH 4100
|
||||
|
||||
static ATTR_NOCACHE_NOINIT_RAM_SECTION uint8_t src1_buffer[DMA_BUFFER_LENGTH];
|
||||
static ATTR_NOCACHE_NOINIT_RAM_SECTION uint8_t src2_buffer[DMA_BUFFER_LENGTH];
|
||||
static ATTR_NOCACHE_NOINIT_RAM_SECTION uint8_t src3_buffer[DMA_BUFFER_LENGTH];
|
||||
static __attribute((aligned(32))) uint8_t src1_buffer[DMA_BUFFER_LENGTH];
|
||||
static __attribute((aligned(32))) uint8_t src2_buffer[DMA_BUFFER_LENGTH];
|
||||
static __attribute((aligned(32))) uint8_t src3_buffer[DMA_BUFFER_LENGTH];
|
||||
|
||||
static ATTR_NOINIT_PSRAM_SECTION uint8_t dst1_buffer[DMA_BUFFER_LENGTH];
|
||||
static ATTR_NOINIT_PSRAM_SECTION uint8_t dst2_buffer[DMA_BUFFER_LENGTH];
|
||||
static ATTR_NOINIT_PSRAM_SECTION uint8_t dst3_buffer[DMA_BUFFER_LENGTH];
|
||||
static __attribute((aligned(32))) uint8_t dst1_buffer[DMA_BUFFER_LENGTH];
|
||||
static __attribute((aligned(32))) uint8_t dst2_buffer[DMA_BUFFER_LENGTH];
|
||||
static __attribute((aligned(32))) uint8_t dst3_buffer[DMA_BUFFER_LENGTH];
|
||||
|
||||
static volatile uint8_t dma_tc_flag0 = 0;
|
||||
|
||||
@ -96,9 +96,6 @@ int main(void)
|
||||
printf("copy finished with time=%dus\r\n", (int)(bflb_mtimer_get_time_us() - start_time));
|
||||
|
||||
/* Check data */
|
||||
bflb_l1c_dcache_invalidate_range(src1_buffer, sizeof(src1_buffer));
|
||||
bflb_l1c_dcache_invalidate_range(src2_buffer, sizeof(src2_buffer));
|
||||
bflb_l1c_dcache_invalidate_range(src3_buffer, sizeof(src3_buffer));
|
||||
bflb_l1c_dcache_invalidate_range(dst1_buffer, sizeof(dst1_buffer));
|
||||
bflb_l1c_dcache_invalidate_range(dst2_buffer, sizeof(dst2_buffer));
|
||||
bflb_l1c_dcache_invalidate_range(dst3_buffer, sizeof(dst3_buffer));
|
||||
|
@ -1 +1 @@
|
||||
set(CONFIG_PSRAM 1)
|
||||
# set(CONFIG_PSRAM 1)
|
||||
|
@ -4,13 +4,14 @@
|
||||
|
||||
#define DMA_BUFFER_LENGTH 4100
|
||||
|
||||
static ATTR_NOCACHE_NOINIT_RAM_SECTION uint8_t src1_buffer[DMA_BUFFER_LENGTH];
|
||||
static ATTR_NOCACHE_NOINIT_RAM_SECTION uint8_t src2_buffer[DMA_BUFFER_LENGTH];
|
||||
static ATTR_NOCACHE_NOINIT_RAM_SECTION uint8_t src3_buffer[DMA_BUFFER_LENGTH];
|
||||
static __attribute((aligned(32))) uint8_t src1_buffer[DMA_BUFFER_LENGTH];
|
||||
static __attribute((aligned(32))) uint8_t src2_buffer[DMA_BUFFER_LENGTH];
|
||||
static __attribute((aligned(32))) uint8_t src3_buffer[DMA_BUFFER_LENGTH];
|
||||
|
||||
static __attribute((aligned(32))) uint8_t dst1_buffer[DMA_BUFFER_LENGTH];
|
||||
static __attribute((aligned(32))) uint8_t dst2_buffer[DMA_BUFFER_LENGTH];
|
||||
static __attribute((aligned(32))) uint8_t dst3_buffer[DMA_BUFFER_LENGTH];
|
||||
|
||||
static ATTR_NOCACHE_NOINIT_RAM_SECTION uint8_t dst1_buffer[DMA_BUFFER_LENGTH];
|
||||
static ATTR_NOCACHE_NOINIT_RAM_SECTION uint8_t dst2_buffer[DMA_BUFFER_LENGTH];
|
||||
static ATTR_NOCACHE_NOINIT_RAM_SECTION uint8_t dst3_buffer[DMA_BUFFER_LENGTH];
|
||||
static volatile uint8_t dma_tc_flag0 = 0;
|
||||
|
||||
struct bflb_device_s *dma0_ch0;
|
||||
@ -37,6 +38,13 @@ void sram_init()
|
||||
memset(dst1_buffer, 0, DMA_BUFFER_LENGTH);
|
||||
memset(dst2_buffer, 0, DMA_BUFFER_LENGTH);
|
||||
memset(dst3_buffer, 0, DMA_BUFFER_LENGTH);
|
||||
|
||||
bflb_l1c_dcache_clean_range(src1_buffer, sizeof(src1_buffer));
|
||||
bflb_l1c_dcache_clean_range(src2_buffer, sizeof(src2_buffer));
|
||||
bflb_l1c_dcache_clean_range(src3_buffer, sizeof(src3_buffer));
|
||||
bflb_l1c_dcache_clean_range(dst1_buffer, sizeof(dst1_buffer));
|
||||
bflb_l1c_dcache_clean_range(dst2_buffer, sizeof(dst2_buffer));
|
||||
bflb_l1c_dcache_clean_range(dst3_buffer, sizeof(dst3_buffer));
|
||||
}
|
||||
|
||||
int main(void)
|
||||
@ -88,6 +96,10 @@ int main(void)
|
||||
}
|
||||
|
||||
/* Check data */
|
||||
bflb_l1c_dcache_invalidate_range(dst1_buffer, sizeof(dst1_buffer));
|
||||
bflb_l1c_dcache_invalidate_range(dst2_buffer, sizeof(dst2_buffer));
|
||||
bflb_l1c_dcache_invalidate_range(dst3_buffer, sizeof(dst3_buffer));
|
||||
|
||||
for (i = 0; i < DMA_BUFFER_LENGTH; i++) {
|
||||
if (src1_buffer[i] != dst1_buffer[i]) {
|
||||
printf("Error! index: %ld, src1: 0x%02x, dst1: 0x%02x\r\n", i, src1_buffer[i], dst1_buffer[i]);
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define XIP_READBUF_SIZE 4096
|
||||
#define BFLB_FW_IMG_OFFSET 0x1000
|
||||
extern void bflb_dump_hex(const void *ptr, uint32_t buflen);
|
||||
extern void bflb_hexdump(const void *ptr, uint32_t buflen);
|
||||
|
||||
ATTR_NOCACHE_RAM_SECTION struct bflb_sha256_ctx_s sha256_ctx ;
|
||||
struct bflb_device_s *sha256_handle = NULL;
|
||||
@ -36,7 +36,7 @@ static int32_t bflb_image_cal_hash(uint32_t startaddr, uint32_t total_len)
|
||||
|
||||
bflb_spi_flash_read_xip(addr, read_buf, readlen);
|
||||
|
||||
//bflb_dump_hex((uint8_t *)read_buf,readlen);
|
||||
//bflb_hexdump((uint8_t *)read_buf,readlen);
|
||||
|
||||
/* update hash */
|
||||
bflb_sha256_update(sha256_handle, &sha256_ctx, (uint8_t *)read_buf, readlen);
|
||||
@ -85,9 +85,9 @@ int main(void)
|
||||
if(img_hash_cal[i]!=img_hash_hdr[i]){
|
||||
printf("hash cal error:\r\n");
|
||||
printf("calculated:\r\n");
|
||||
bflb_dump_hex(img_hash_cal,32);
|
||||
bflb_hexdump(img_hash_cal,32);
|
||||
printf("header:\r\n");
|
||||
bflb_dump_hex(img_hash_hdr,32);
|
||||
bflb_hexdump(img_hash_hdr,32);
|
||||
while(1);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#define BLOCK_NUM 2
|
||||
#define ROW_NUM (8 * BLOCK_NUM)
|
||||
#define CAM_FRAME_COUNT_USE 50
|
||||
#define CAM_FRAME_COUNT_USE 5
|
||||
|
||||
static struct bflb_device_s *i2c0;
|
||||
static struct bflb_device_s *cam0;
|
||||
@ -19,6 +19,9 @@ volatile uint32_t pic_count = 0;
|
||||
volatile uint32_t pic_addr[CAM_FRAME_COUNT_USE] = { 0 };
|
||||
volatile uint32_t pic_len[CAM_FRAME_COUNT_USE] = { 0 };
|
||||
|
||||
static __attribute__((aligned(32))) ATTR_NOINIT_PSRAM_SECTION uint8_t dvp_buffer[480 * 2 * ROW_NUM];
|
||||
static __attribute__((aligned(32))) ATTR_NOINIT_PSRAM_SECTION uint8_t mjpeg_buffer[50 * 1024 * CAM_FRAME_COUNT_USE];
|
||||
|
||||
void mjpeg_isr(int irq, void *arg)
|
||||
{
|
||||
uint8_t *pic;
|
||||
@ -84,7 +87,7 @@ int main(void)
|
||||
cam_config.with_mjpeg = true;
|
||||
cam_config.input_source = CAM_INPUT_SOURCE_DVP;
|
||||
cam_config.output_format = CAM_OUTPUT_FORMAT_AUTO;
|
||||
cam_config.output_bufaddr = BFLB_PSRAM_BASE;
|
||||
cam_config.output_bufaddr = (uint32_t)dvp_buffer;
|
||||
cam_config.output_bufsize = cam_config.resolution_x * 2 * ROW_NUM;
|
||||
|
||||
bflb_cam_init(cam0, &cam_config);
|
||||
@ -99,10 +102,10 @@ int main(void)
|
||||
config.rows = ROW_NUM;
|
||||
config.resolution_x = cam_config.resolution_x;
|
||||
config.resolution_y = cam_config.resolution_y;
|
||||
config.input_bufaddr0 = (uint32_t)BFLB_PSRAM_BASE;
|
||||
config.input_bufaddr0 = (uint32_t)dvp_buffer;
|
||||
config.input_bufaddr1 = 0;
|
||||
config.output_bufaddr = (uint32_t)BFLB_PSRAM_BASE + cam_config.resolution_x * 2 * ROW_NUM;
|
||||
config.output_bufsize = SIZE_BUFFER - cam_config.resolution_x * 2 * ROW_NUM;
|
||||
config.output_bufaddr = (uint32_t)mjpeg_buffer;
|
||||
config.output_bufsize = sizeof(mjpeg_buffer);
|
||||
config.input_yy_table = NULL; /* use default table */
|
||||
config.input_uv_table = NULL; /* use default table */
|
||||
|
||||
@ -123,6 +126,10 @@ int main(void)
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < CAM_FRAME_COUNT_USE; i++) {
|
||||
if ((pic_addr[i] + pic_len[i]) > ((uint32_t)mjpeg_buffer + sizeof(mjpeg_buffer))) {
|
||||
printf("drop invalid pic\r\n");
|
||||
continue;
|
||||
}
|
||||
printf("jpg addr:%08x ,jpg size:%d\r\n", pic_addr[i], pic_len[i]);
|
||||
//bflb_mjpeg_dump_hex((uint8_t *)pic_addr[i], pic_len[i]);
|
||||
}
|
||||
|
@ -4,39 +4,15 @@
|
||||
#include "jpeg_head.h"
|
||||
#include "test_64x64.h"
|
||||
|
||||
static struct bflb_device_s *mjpeg;
|
||||
|
||||
#define X 64
|
||||
#define Y 64
|
||||
|
||||
#define ROW_NUM (Y * MJPEG_MAX_FRAME_COUNT)
|
||||
|
||||
volatile uint32_t pic_count = 0;
|
||||
volatile uint32_t pic_addr[MJPEG_MAX_FRAME_COUNT] = { 0 };
|
||||
volatile uint32_t pic_len[MJPEG_MAX_FRAME_COUNT] = { 0 };
|
||||
|
||||
void mjpeg_isr(int irq, void *arg)
|
||||
{
|
||||
uint8_t *pic;
|
||||
uint32_t jpeg_len;
|
||||
|
||||
uint32_t intstatus = bflb_mjpeg_get_intstatus(mjpeg);
|
||||
if (intstatus & MJPEG_INTSTS_ONE_FRAME) {
|
||||
bflb_mjpeg_int_clear(mjpeg, MJPEG_INTCLR_ONE_FRAME);
|
||||
jpeg_len = bflb_mjpeg_get_frame_info(mjpeg, &pic);
|
||||
pic_addr[pic_count] = (uint32_t)pic;
|
||||
pic_len[pic_count] = jpeg_len;
|
||||
pic_count++;
|
||||
bflb_mjpeg_pop_one_frame(mjpeg);
|
||||
}
|
||||
}
|
||||
#define X 64
|
||||
#define Y 64
|
||||
|
||||
uint8_t jpg_head_buf[800] = { 0 };
|
||||
uint32_t jpg_head_len;
|
||||
|
||||
uint8_t MJPEG_QUALITY = 50;
|
||||
|
||||
#define SIZE_BUFFER (4 * 1024 * 1024)
|
||||
static __attribute__((aligned(32))) ATTR_NOINIT_PSRAM_SECTION uint8_t mjpeg_buffer[50 * 1024];
|
||||
|
||||
void bflb_mjpeg_dump_hex(uint8_t *data, uint32_t len)
|
||||
{
|
||||
@ -53,48 +29,72 @@ void bflb_mjpeg_dump_hex(uint8_t *data, uint32_t len)
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
static struct bflb_device_s *mjpeg;
|
||||
|
||||
volatile uint32_t pic_count = 0;
|
||||
volatile uint8_t *pic_addr;
|
||||
volatile uint32_t pic_len;
|
||||
|
||||
void mjpeg_isr(int irq, void *arg)
|
||||
{
|
||||
board_init();
|
||||
uint32_t intstatus = bflb_mjpeg_get_intstatus(mjpeg);
|
||||
if (intstatus & MJPEG_INTSTS_ONE_FRAME) {
|
||||
bflb_mjpeg_int_clear(mjpeg, MJPEG_INTCLR_ONE_FRAME);
|
||||
pic_len = bflb_mjpeg_get_frame_info(mjpeg, &pic_addr);
|
||||
pic_count = 1;
|
||||
bflb_mjpeg_pop_one_frame(mjpeg);
|
||||
}
|
||||
}
|
||||
|
||||
void mjpeg_init(uint32_t x, uint32_t y, uint8_t *yuv, uint8_t *jpeg, uint32_t size, uint8_t quality)
|
||||
{
|
||||
struct bflb_mjpeg_config_s config;
|
||||
|
||||
mjpeg = bflb_device_get_by_name("mjpeg");
|
||||
|
||||
struct bflb_mjpeg_config_s config;
|
||||
|
||||
config.format = MJPEG_FORMAT_YUV422_YUYV;
|
||||
config.quality = MJPEG_QUALITY;
|
||||
config.rows = ROW_NUM;
|
||||
config.resolution_x = X;
|
||||
config.resolution_y = Y;
|
||||
config.input_bufaddr0 = (uint32_t)test_64x64;
|
||||
config.quality = quality;
|
||||
config.rows = y;
|
||||
config.resolution_x = x;
|
||||
config.resolution_y = y;
|
||||
config.input_bufaddr0 = (uint32_t)yuv;
|
||||
config.input_bufaddr1 = 0;
|
||||
config.output_bufaddr = (uint32_t)BFLB_PSRAM_BASE + X * 2 * ROW_NUM;
|
||||
config.output_bufsize = SIZE_BUFFER - X * 2 * ROW_NUM;
|
||||
config.output_bufaddr = (uint32_t)jpeg;
|
||||
config.output_bufsize = size;
|
||||
config.input_yy_table = NULL; /* use default table */
|
||||
config.input_uv_table = NULL; /* use default table */
|
||||
|
||||
bflb_mjpeg_init(mjpeg, &config);
|
||||
|
||||
jpg_head_len = JpegHeadCreate(YUV_MODE_422, MJPEG_QUALITY, X, Y, jpg_head_buf);
|
||||
jpg_head_len = JpegHeadCreate(YUV_MODE_422, quality, x, y, jpg_head_buf);
|
||||
bflb_mjpeg_fill_jpeg_header_tail(mjpeg, jpg_head_buf, jpg_head_len);
|
||||
|
||||
bflb_mjpeg_tcint_mask(mjpeg, false);
|
||||
bflb_irq_attach(mjpeg->irq_num, mjpeg_isr, NULL);
|
||||
bflb_irq_enable(mjpeg->irq_num);
|
||||
}
|
||||
|
||||
bflb_mjpeg_sw_run(mjpeg, MJPEG_MAX_FRAME_COUNT);
|
||||
void mjpeg_compress(uint8_t *yuv, uint8_t *jpeg, uint32_t size)
|
||||
{
|
||||
bflb_mjpeg_update_input_output_buff(mjpeg, yuv, NULL, jpeg, size);
|
||||
bflb_mjpeg_sw_run(mjpeg, 1);
|
||||
}
|
||||
|
||||
while (pic_count < MJPEG_MAX_FRAME_COUNT) {
|
||||
printf("pic count:%d\r\n", pic_count);
|
||||
int main(void)
|
||||
{
|
||||
board_init();
|
||||
|
||||
mjpeg_init(X, Y, NULL, NULL, 0, MJPEG_QUALITY);
|
||||
|
||||
/* compress one pic */
|
||||
mjpeg_compress(test_64x64, mjpeg_buffer, 50 * 1024);
|
||||
|
||||
while (pic_count != 1) {
|
||||
bflb_mtimer_delay_ms(200);
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < MJPEG_MAX_FRAME_COUNT; i++) {
|
||||
printf("jpg addr:%08x ,jpg size:%d\r\n", pic_addr[i], pic_len[i]);
|
||||
bflb_mjpeg_dump_hex((uint8_t *)pic_addr[i], pic_len[i]);
|
||||
}
|
||||
printf("jpg addr:%08x ,jpg size:%d\r\n", pic_addr, pic_len);
|
||||
bflb_mjpeg_dump_hex(pic_addr, pic_len);
|
||||
|
||||
while (1) {
|
||||
bflb_mtimer_delay_ms(2000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ include(proj.conf)
|
||||
|
||||
find_package(bouffalo_sdk REQUIRED HINTS $ENV{BL_SDK_BASE})
|
||||
|
||||
sdk_set_linker_script(bl616_flash.ld)
|
||||
sdk_set_main_file(main.c)
|
||||
|
||||
project(sec_eng_aes_sw_key_costtime)
|
||||
|
@ -0,0 +1,327 @@
|
||||
/****************************************************************************************
|
||||
* @file flash.ld
|
||||
*
|
||||
* @brief This file is the link script file (gnuarm or armgcc).
|
||||
*
|
||||
* Copyright (C) BouffaloLab 2021
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/* configure the CPU type */
|
||||
OUTPUT_ARCH( "riscv" )
|
||||
|
||||
/* configure the entry point */
|
||||
ENTRY(__start)
|
||||
|
||||
StackSize = 0x1000; /* 4KB */
|
||||
HeapMinSize = 0x1000; /* 4KB */
|
||||
psram_min_size = 0x1000;
|
||||
|
||||
__EM_SIZE = DEFINED(btble_controller_init) ? 32K : 0K;
|
||||
__RFTLV_SIZE_OFFSET = 1K;
|
||||
__RFTLV_SIZE_HOLE = 2K;
|
||||
__RFTLV_HEAD1_H = (0x46524C42); /* BLRF */
|
||||
__RFTLV_HEAD1_L = (0x41524150); /* PAPA */
|
||||
|
||||
MEMORY
|
||||
{
|
||||
fw_header_memory (rx) : ORIGIN = 0xA0000000 - 0x1000, LENGTH = 4K
|
||||
xip_memory (rx) : ORIGIN = 0xA0000000, LENGTH = 4M
|
||||
ram_psram (wxa) : ORIGIN = 0xA8000000, LENGTH = 4M
|
||||
itcm_memory (rx) : ORIGIN = 0x62FC0000, LENGTH = 12K
|
||||
dtcm_memory (rx) : ORIGIN = 0x62FC3000, LENGTH = 4K
|
||||
nocache_ram_memory (!rx) : ORIGIN = 0x22FC4000, LENGTH = 64K
|
||||
ram_memory (!rx) : ORIGIN = 0x62FD4000, LENGTH = 320K-12K-4K-64K
|
||||
ram_wifi (wxa) : ORIGIN = 0x23010000, LENGTH = 160K - __EM_SIZE
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
BOOT2_PT_ADDR = 0x63027c00;
|
||||
|
||||
.fw_header :
|
||||
{
|
||||
KEEP(*(.fw_header))
|
||||
} > fw_header_memory
|
||||
|
||||
.init :
|
||||
{
|
||||
KEEP (*(SORT_NONE(.init)))
|
||||
KEEP (*(SORT_NONE(.vector)))
|
||||
|
||||
} > xip_memory
|
||||
|
||||
.rftlv.tool :
|
||||
{
|
||||
. = ORIGIN(xip_memory) + __RFTLV_SIZE_OFFSET;
|
||||
PROVIDE( _ld_symbol_rftlv_address = . );
|
||||
LONG(__RFTLV_HEAD1_H);
|
||||
LONG(__RFTLV_HEAD1_L);
|
||||
. = ORIGIN(xip_memory) + __RFTLV_SIZE_OFFSET + __RFTLV_SIZE_HOLE;
|
||||
} > xip_memory
|
||||
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__text_code_start__ = .;
|
||||
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
|
||||
/* section information for shell */
|
||||
. = ALIGN(4);
|
||||
__fsymtab_start = .;
|
||||
KEEP(*(FSymTab))
|
||||
__fsymtab_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__vsymtab_start = .;
|
||||
KEEP(*(VSymTab))
|
||||
__vsymtab_end = .;
|
||||
|
||||
/* section information for usb usbh_class_info */
|
||||
. = ALIGN(4);
|
||||
__usbh_class_info_start__ = .;
|
||||
KEEP(*(.usbh_class_info))
|
||||
. = ALIGN(4);
|
||||
__usbh_class_info_end__ = .;
|
||||
|
||||
/*put .rodata**/
|
||||
*(EXCLUDE_FILE( *bl616_glb*.o* \
|
||||
*bl616_pds*.o* \
|
||||
*bl616_common*.o* \
|
||||
*bl616_sf_cfg*.o* \
|
||||
*bl616_sf_ctrl*.o* \
|
||||
*bl616_sflash*.o* \
|
||||
*bl616_xip_sflash*.o* \
|
||||
*bl616_ef_ctrl*.o* \
|
||||
*bl616_romapi_patch*.o* ).rodata*)
|
||||
|
||||
*(.srodata)
|
||||
*(.srodata.*)
|
||||
|
||||
. = ALIGN(4);
|
||||
__text_code_end__ = .;
|
||||
} > xip_memory
|
||||
|
||||
. = ALIGN(4);
|
||||
__itcm_load_addr = .;
|
||||
|
||||
.itcm_region : AT (__itcm_load_addr)
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__tcm_code_start__ = .;
|
||||
|
||||
*(.tcm_code.*)
|
||||
*(.tcm_const.*)
|
||||
*(.sclock_rlt_code.*)
|
||||
*(.sclock_rlt_const.*)
|
||||
|
||||
*bl616_glb*.o*(.rodata*)
|
||||
*bl616_pds*.o*(.rodata*)
|
||||
*bl616_common*.o*(.rodata*)
|
||||
*bl616_sf_cfg*.o*(.rodata*)
|
||||
*bl616_sf_ctrl*.o*(.rodata*)
|
||||
*bl616_sflash*.o*(.rodata*)
|
||||
*bl616_xip_sflash*.o*(.rodata*)
|
||||
*bl616_ef_ctrl*.o*(.rodata*)
|
||||
*bl616_romapi_patch*.o*(.rodata*)
|
||||
|
||||
. = ALIGN(4);
|
||||
__tcm_code_end__ = .;
|
||||
} > itcm_memory
|
||||
|
||||
__dtcm_load_addr = __itcm_load_addr + SIZEOF(.itcm_region);
|
||||
|
||||
.dtcm_region : AT (__dtcm_load_addr)
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__tcm_data_start__ = .;
|
||||
|
||||
*(.tcm_data)
|
||||
/* *finger_print.o(.data*) */
|
||||
|
||||
. = ALIGN(4);
|
||||
__tcm_data_end__ = .;
|
||||
} > dtcm_memory
|
||||
|
||||
/*************************************************************************/
|
||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||
* used for linker to calculate size of stack sections, and assign
|
||||
* values to stack symbols later */
|
||||
.stack_dummy (NOLOAD):
|
||||
{
|
||||
. = ALIGN(0x4);
|
||||
. = . + StackSize;
|
||||
. = ALIGN(0x4);
|
||||
} > dtcm_memory
|
||||
|
||||
/* Set stack top to end of RAM, and stack limit move down by
|
||||
* size of stack_dummy section */
|
||||
__StackTop = ORIGIN(dtcm_memory) + LENGTH(dtcm_memory);
|
||||
PROVIDE( __freertos_irq_stack_top = __StackTop);
|
||||
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
||||
|
||||
/* Check if data + heap + stack exceeds RAM limit */
|
||||
ASSERT(__StackLimit >= __tcm_data_end__, "region RAM overflowed with stack")
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
__nocache_ram_load_addr = __dtcm_load_addr + SIZEOF(.dtcm_region);
|
||||
|
||||
.nocache_ram_region : AT (__nocache_ram_load_addr)
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__nocache_ram_data_start__ = .;
|
||||
|
||||
*(.nocache_ram)
|
||||
|
||||
. = ALIGN(4);
|
||||
__nocache_ram_data_end__ = .;
|
||||
} > nocache_ram_memory
|
||||
|
||||
__ram_load_addr = __nocache_ram_load_addr + SIZEOF(.nocache_ram_region);
|
||||
|
||||
/* Data section */
|
||||
RAM_DATA : AT (__ram_load_addr)
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__ram_data_start__ = .;
|
||||
|
||||
PROVIDE( __global_pointer$ = . + 0x800 );
|
||||
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
*(.sdata2)
|
||||
*(.sdata2.*)
|
||||
|
||||
. = ALIGN(4);
|
||||
__bflog_tags_start__ = .;
|
||||
*(.bflog_tags_array)
|
||||
. = ALIGN(4);
|
||||
__bflog_tags_end__ = .;
|
||||
__ram_data_end__ = .;
|
||||
} > ram_memory
|
||||
|
||||
|
||||
__psram_load_addr = (__ram_load_addr + SIZEOF (RAM_DATA));
|
||||
|
||||
.psram_data_region : AT (__psram_load_addr)
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__psram_data_start__ = .;
|
||||
|
||||
KEEP(*(.psram_data*))
|
||||
|
||||
. = ALIGN(4);
|
||||
__psram_data_end__ = .;
|
||||
} > ram_psram
|
||||
|
||||
__etext_final = (__psram_load_addr + SIZEOF (.psram_data_region));
|
||||
ASSERT(__etext_final <= ORIGIN(xip_memory) + LENGTH(xip_memory), "code memory overflow")
|
||||
|
||||
.bss (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__bss_start__ = .;
|
||||
|
||||
*(.bss*)
|
||||
*(.sbss*)
|
||||
*(COMMON)
|
||||
|
||||
. = ALIGN(4);
|
||||
__bss_end__ = .;
|
||||
} > ram_memory
|
||||
|
||||
.noinit_data (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__noinit_data_start__ = .;
|
||||
|
||||
*(.noinit_data*)
|
||||
|
||||
. = ALIGN(4);
|
||||
__noinit_data_end__ = .;
|
||||
} > ram_memory
|
||||
|
||||
.nocache_noinit_ram_region (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__nocache_noinit_ram_data_start__ = .;
|
||||
|
||||
*(.nocache_noinit_ram)
|
||||
*(.noncacheable)
|
||||
|
||||
. = ALIGN(4);
|
||||
__nocache_noinit_ram_data_end__ = .;
|
||||
} > nocache_ram_memory
|
||||
|
||||
.heap (NOLOAD):
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__HeapBase = .;
|
||||
|
||||
KEEP(*(.heap*))
|
||||
|
||||
. = ALIGN(4);
|
||||
__HeapLimit = .;
|
||||
} > ram_memory
|
||||
|
||||
__HeapLimit = ORIGIN(ram_memory) + LENGTH(ram_memory);
|
||||
ASSERT(__HeapLimit - __HeapBase >= HeapMinSize, "heap region overflow")
|
||||
|
||||
.psram_noinit_data (NOLOAD):
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__psram_noinit_data_start__ = .;
|
||||
|
||||
KEEP(*(.psram_noinit*))
|
||||
KEEP(*(.img_buf*))
|
||||
|
||||
. = ALIGN(4);
|
||||
__psram_noinit_data_end__ = .;
|
||||
} > ram_psram
|
||||
|
||||
.psram_heap (NOLOAD):
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__psram_heap_base = .;
|
||||
KEEP(*(.psram_heap*))
|
||||
. = ALIGN(4);
|
||||
__psram_heap_end = .;
|
||||
} > ram_psram
|
||||
|
||||
__psram_limit = ORIGIN(ram_psram) + LENGTH(ram_psram);
|
||||
ASSERT(__psram_limit - __psram_heap_base >= psram_min_size, "psram heap region overflow")
|
||||
|
||||
.wifibss (NOLOAD) :
|
||||
{
|
||||
PROVIDE( __wifi_bss_start = ADDR(.wifibss) );
|
||||
PROVIDE( __wifi_bss_end = ADDR(.wifibss) + SIZEOF(.wifibss) );
|
||||
_sshram = . ;
|
||||
*(SHAREDRAMIPC)
|
||||
*(SHAREDRAM)
|
||||
_eshram = . ;
|
||||
*ipc_shared.o(COMMON)
|
||||
*sdu_shared.o(COMMON)
|
||||
*hal_desc.o(COMMON)
|
||||
*txl_buffer_shared.o(COMMON)
|
||||
*txl_frame_shared.o(COMMON)
|
||||
*scan_shared.o(COMMON)
|
||||
*scanu_shared.o(COMMON)
|
||||
*mfp_bip.o(COMMON)
|
||||
*me_mic.o(COMMON)
|
||||
*(.wifi_ram*)
|
||||
. = ALIGN(16);
|
||||
} > ram_wifi
|
||||
|
||||
PROVIDE( _heap_wifi_start = . );
|
||||
PROVIDE( _heap_wifi_size = ORIGIN(ram_wifi) + LENGTH(ram_wifi) - _heap_wifi_start );
|
||||
PROVIDE(__LD_CONFIG_EM_SEL = __EM_SIZE);
|
||||
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ void uart_isr(int irq, void *arg)
|
||||
|
||||
if (intstatus & UART_INTSTS_RTO) {
|
||||
//printf("rto\r\n");
|
||||
bflb_rx_cycle_dma_process(&g_uart_rx_dma, 0);
|
||||
bflb_uart_int_clear(uartx, UART_INTCLR_RTO);
|
||||
bflb_rx_cycle_dma_process(&g_uart_rx_dma, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,18 +16,18 @@ void uart_isr(int irq, void *arg)
|
||||
}
|
||||
}
|
||||
if (intstatus & UART_INTSTS_RTO) {
|
||||
bflb_uart_int_clear(uartx, UART_INTCLR_RTO);
|
||||
while (bflb_uart_rxavailable(uartx)) {
|
||||
printf("0x%02x\r\n", bflb_uart_getchar(uartx));
|
||||
}
|
||||
bflb_uart_int_clear(uartx, UART_INTCLR_RTO);
|
||||
}
|
||||
if (intstatus & UART_INTSTS_TX_END) {
|
||||
printf("tx end\r\n");
|
||||
bflb_uart_int_clear(uartx, UART_INTCLR_TX_END);
|
||||
printf("tx end\r\n");
|
||||
}
|
||||
if (intstatus & UART_INTSTS_RX_END) {
|
||||
printf("rx end\r\n");
|
||||
bflb_uart_int_clear(uartx, UART_INTCLR_RX_END);
|
||||
printf("rx end\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,11 @@ void uart_isr(int irq, void *arg)
|
||||
}
|
||||
}
|
||||
if (intstatus & UART_INTSTS_RTO) {
|
||||
bflb_uart_int_clear(uartx, UART_INTCLR_RTO);
|
||||
printf("rto\r\n");
|
||||
while (bflb_uart_rxavailable(uartx)) {
|
||||
printf("0x%02x\r\n", bflb_uart_getchar(uartx));
|
||||
}
|
||||
bflb_uart_int_clear(uartx, UART_INTCLR_RTO);
|
||||
}
|
||||
if (intstatus & UART_INTSTS_TX_FIFO) {
|
||||
printf("tx fifo\r\n");
|
||||
|
@ -16,11 +16,11 @@ void uart_isr(int irq, void *arg)
|
||||
bflb_uart_feature_control(uartx, UART_CMD_SET_RTS_VALUE, 1);
|
||||
}
|
||||
if (intstatus & UART_INTSTS_RTO) {
|
||||
bflb_uart_int_clear(uartx, UART_INTCLR_RTO);
|
||||
printf("rto\r\n");
|
||||
while (bflb_uart_rxavailable(uartx)) {
|
||||
printf("0x%02x\r\n", bflb_uart_getchar(uartx));
|
||||
}
|
||||
bflb_uart_int_clear(uartx, UART_INTCLR_RTO);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user