[feat] add shell demo

This commit is contained in:
jzlv 2021-06-20 12:30:18 +08:00
parent 4eaa5849e9
commit 4d70ca1363
8 changed files with 1923 additions and 2 deletions

View file

@ -1,7 +1,6 @@
################# Add global include #################
list(APPEND ADD_INCLUDE
"${CMAKE_CURRENT_SOURCE_DIR}"
)
#######################################################
@ -16,7 +15,6 @@ file(GLOB_RECURSE sources
"${CMAKE_CURRENT_SOURCE_DIR}/*.c")
#aux_source_directory(. sources)
list(APPEND ADD_SRCS ${sources})
#list(REMOVE_ITEM ADD_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/libc/src/strtox.c" "${CMAKE_CURRENT_SOURCE_DIR}/libc/src/atox.c")
#######################################################
########### Add required/dependent components #########

781
components/shell/shell.c Normal file
View file

@ -0,0 +1,781 @@
/**
* @file shell.c
* @brief
*
* Copyright (c) 2021 Bouffalolab team
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
#include "shell.h"
struct shell_syscall *_syscall_table_begin = NULL;
struct shell_syscall *_syscall_table_end = NULL;
struct shell_sysvar *_sysvar_table_begin = NULL;
struct shell_sysvar *_sysvar_table_end = NULL;
struct shell _shell;
static struct shell *shell;
int shell_help(int argc, char **argv)
{
SHELL_PRINTF("shell commands list:\r\n");
{
struct shell_syscall *index;
for (index = _syscall_table_begin; index < _syscall_table_end; index++) {
if (strncmp(index->name, "__cmd_", 6) != 0) {
continue;
}
#if defined(SHELL_USING_DESCRIPTION)
SHELL_PRINTF("%-16s - %s\r\n", &index->name[6], index->desc);
#else
SHELL_PRINTF("%s\r\n", &index->name[6]);
#endif
}
}
SHELL_PRINTF("\r\n");
return 0;
}
SHELL_CMD_EXPORT_ALIAS(shell_help, help, shell help.);
static char *shell_get_prompt(void)
{
static char shell_prompt[SHELL_CONSOLEBUF_SIZE + 1] = { 0 };
strcpy(shell_prompt, SHELL_NAME);
#if defined(SHELL_USING_FS)
/* get current working directory */
getcwd(&shell_prompt[strlen(shell_prompt)],
SHELL_CONSOLEBUF_SIZE - strlen(shell_prompt));
#endif
strcat(shell_prompt, "/>");
return shell_prompt;
}
static int str_common(const char *str1, const char *str2)
{
const char *str = str1;
while ((*str != 0) && (*str2 != 0) && (*str == *str2)) {
str++;
str2++;
}
return (str - str1);
}
static void shell_handle_history(struct shell *shell)
{
SHELL_PRINTF("\033[2K\r");
SHELL_PRINTF("%s%s", shell_get_prompt(), shell->line);
}
static void shell_push_history(struct shell *shell)
{
if (shell->line_position != 0) {
/* push history */
if (shell->history_count >= SHELL_HISTORY_LINES) {
/* if current cmd is same as last cmd, don't push */
if (memcmp(&shell->cmd_history[SHELL_HISTORY_LINES - 1], shell->line,
SHELL_CMD_SIZE)) {
/* move history */
int index;
for (index = 0; index < SHELL_HISTORY_LINES - 1; index++) {
memcpy(&shell->cmd_history[index][0],
&shell->cmd_history[index + 1][0], SHELL_CMD_SIZE);
}
memset(&shell->cmd_history[index][0], 0, SHELL_CMD_SIZE);
memcpy(&shell->cmd_history[index][0], shell->line,
shell->line_position);
/* it's the maximum history */
shell->history_count = SHELL_HISTORY_LINES;
}
} else {
/* if current cmd is same as last cmd, don't push */
if (shell->history_count == 0 ||
memcmp(&shell->cmd_history[shell->history_count - 1], shell->line,
SHELL_CMD_SIZE)) {
shell->current_history = shell->history_count;
memset(&shell->cmd_history[shell->history_count][0], 0, SHELL_CMD_SIZE);
memcpy(&shell->cmd_history[shell->history_count][0], shell->line,
shell->line_position);
/* increase count and set current history position */
shell->history_count++;
}
}
}
shell->current_history = shell->history_count;
}
#ifdef SHELL_USING_FS
void shell_auto_complete_path(char *path)
{
DIR *dir = RT_NULL;
struct dirent *dirent = RT_NULL;
char *full_path, *ptr, *index;
if (!path)
return;
full_path = (char *)rt_malloc(256);
if (full_path == RT_NULL)
return; /* out of memory */
if (*path != '/') {
getcwd(full_path, 256);
if (full_path[rt_strlen(full_path) - 1] != '/')
strcat(full_path, "/");
} else
*full_path = '\0';
index = RT_NULL;
ptr = path;
for (;;) {
if (*ptr == '/')
index = ptr + 1;
if (!*ptr)
break;
ptr++;
}
if (index == RT_NULL)
index = path;
if (index != RT_NULL) {
char *dest = index;
/* fill the parent path */
ptr = full_path;
while (*ptr)
ptr++;
for (index = path; index != dest;)
*ptr++ = *index++;
*ptr = '\0';
dir = opendir(full_path);
if (dir == RT_NULL) /* open directory failed! */
{
rt_free(full_path);
return;
}
/* restore the index position */
index = dest;
}
/* auto complete the file or directory name */
if (*index == '\0') /* display all of files and directories */
{
for (;;) {
dirent = readdir(dir);
if (dirent == RT_NULL)
break;
SHELL_PRINTF("%s\n", dirent->d_name);
}
} else {
rt_size_t length, min_length;
min_length = 0;
for (;;) {
dirent = readdir(dir);
if (dirent == RT_NULL)
break;
/* matched the prefix string */
if (strncmp(index, dirent->d_name, rt_strlen(index)) == 0) {
if (min_length == 0) {
min_length = rt_strlen(dirent->d_name);
/* save dirent name */
strcpy(full_path, dirent->d_name);
}
length = str_common(dirent->d_name, full_path);
if (length < min_length) {
min_length = length;
}
}
}
if (min_length) {
if (min_length < rt_strlen(full_path)) {
/* list the candidate */
rewinddir(dir);
for (;;) {
dirent = readdir(dir);
if (dirent == RT_NULL)
break;
if (strncmp(index, dirent->d_name, rt_strlen(index)) == 0)
SHELL_PRINTF("%s\n", dirent->d_name);
}
}
length = index - path;
memcpy(index, full_path, min_length);
path[length + min_length] = '\0';
}
}
closedir(dir);
rt_free(full_path);
}
#endif
static void shell_auto_complete(char *prefix)
{
int length, min_length;
const char *name_ptr, *cmd_name;
struct shell_syscall *index;
min_length = 0;
name_ptr = NULL;
SHELL_PRINTF("\r\n");
if (*prefix == '\0') {
shell_help(0, NULL);
return;
}
#ifdef SHELL_USING_FS
/* check whether a spare in the command */
{
char *ptr;
ptr = prefix + strlen(prefix);
while (ptr != prefix) {
if (*ptr == ' ') {
shell_auto_complete_path(ptr + 1);
break;
}
ptr--;
}
}
#endif
/* checks in internal command */
{
for (index = _syscall_table_begin; index < _syscall_table_end; index++) {
/* skip finsh shell function */
if (strncmp(index->name, "__cmd_", 6) != 0) {
continue;
}
cmd_name = (const char *)&index->name[6];
if (strncmp(prefix, cmd_name, strlen(prefix)) == 0) {
if (min_length == 0) {
/* set name_ptr */
name_ptr = cmd_name;
/* set initial length */
min_length = strlen(name_ptr);
}
length = str_common(name_ptr, cmd_name);
if (length < min_length) {
min_length = length;
}
SHELL_PRINTF("%s\r\n", cmd_name);
}
}
}
/* auto complete string */
if (name_ptr != NULL) {
strncpy(prefix, name_ptr, min_length);
}
SHELL_PRINTF("%s%s", shell_get_prompt(), prefix);
return;
}
static int shell_split(char *cmd, uint32_t length, char *argv[SHELL_ARG_NUM])
{
char *ptr;
uint32_t position;
uint32_t argc;
uint32_t i;
ptr = cmd;
position = 0;
argc = 0;
while (position < length) {
/* strip bank and tab */
while ((*ptr == ' ' || *ptr == '\t') && position < length) {
*ptr = '\0';
ptr++;
position++;
}
if (argc >= SHELL_ARG_NUM) {
SHELL_PRINTF("Too many args ! We only Use:\n");
for (i = 0; i < argc; i++) {
SHELL_PRINTF("%s ", argv[i]);
}
SHELL_PRINTF("\r\n");
break;
}
if (position >= length) {
break;
}
/* handle string */
if (*ptr == '"') {
ptr++;
position++;
argv[argc] = ptr;
argc++;
/* skip this string */
while (*ptr != '"' && position < length) {
if (*ptr == '\\') {
if (*(ptr + 1) == '"') {
ptr++;
position++;
}
}
ptr++;
position++;
}
if (position >= length) {
break;
}
/* skip '"' */
*ptr = '\0';
ptr++;
position++;
} else {
argv[argc] = ptr;
argc++;
while ((*ptr != ' ' && *ptr != '\t') && position < length) {
ptr++;
position++;
}
if (position >= length) {
break;
}
}
}
return argc;
}
static cmd_function_t shell_get_cmd(char *cmd, int size)
{
struct shell_syscall *index;
cmd_function_t cmd_func = NULL;
for (index = _syscall_table_begin; index < _syscall_table_end; index++) {
if (strncmp(index->name, "__cmd_", 6) != 0) {
continue;
}
if (strncmp(&index->name[6], cmd, size) == 0 &&
index->name[6 + size] == '\0') {
cmd_func = (cmd_function_t)index->func;
break;
}
}
return cmd_func;
}
static int shell_exec_cmd(char *cmd, uint32_t length, int *retp)
{
int argc;
uint32_t cmd0_size = 0;
cmd_function_t cmd_func;
char *argv[SHELL_ARG_NUM];
// ASSERT(cmd);
// ASSERT(retp);
/* find the size of first command */
while ((cmd[cmd0_size] != ' ' && cmd[cmd0_size] != '\t') &&
cmd0_size < length) {
cmd0_size++;
}
if (cmd0_size == 0) {
return -1;
}
cmd_func = shell_get_cmd(cmd, cmd0_size);
if (cmd_func == NULL) {
return -1;
}
/* split arguments */
memset(argv, 0x00, sizeof(argv));
argc = shell_split(cmd, length, argv);
if (argc == 0) {
return -1;
}
/* exec this command */
*retp = cmd_func(argc, argv);
return 0;
}
#if defined(SHELL_USING_LWIP) && defined(SHELL_USING_FS)
static int shell_exec_lwp(char *cmd, uint32_t length)
{
int argc;
int cmd0_size = 0;
char *argv[SHELL_ARG_NUM];
int fd = -1;
char *pg_name;
extern int exec(char *, int, char **);
/* find the size of first command */
while ((cmd[cmd0_size] != ' ' && cmd[cmd0_size] != '\t') &&
cmd0_size < length) {
cmd0_size++;
}
if (cmd0_size == 0) {
return -1;
}
/* split arguments */
rt_memset(argv, 0x00, sizeof(argv));
argc = msh_split(cmd, length, argv);
if (argc == 0) {
return -1;
}
pg_name = argv[0];
/* try to open program */
fd = open(pg_name, O_RDONLY, 0);
if (fd < 0) {
return -1;
}
/* found program */
close(fd);
exec(pg_name, argc, argv);
return 0;
}
#endif
int shell_exec(char *cmd, uint32_t length)
{
int cmd_ret;
/* strim the beginning of command */
while (*cmd == ' ' || *cmd == '\t') {
cmd++;
length--;
}
if (length == 0) {
return 0;
}
/* Exec sequence:
* 1. built-in command
* 2. module(if enabled)
*/
if (shell_exec_cmd(cmd, length, &cmd_ret) == 0) {
return cmd_ret;
}
#ifdef SHELL_USING_FS
extern int shell_exec_script(char *cmd, uint32_t length);
if (shell_exec_script(cmd, length) == 0) {
return 0;
}
#endif
#ifdef SHELL_USING_LWIP
if (shell_exec_lwp(cmd, length) == 0) {
return 0;
}
#endif
/* truncate the cmd at the first space. */
{
char *tcmd;
tcmd = cmd;
while (*tcmd != ' ' && *tcmd != '\0') {
tcmd++;
}
*tcmd = '\0';
}
SHELL_PRINTF("%s: command not found.\r\n", cmd);
return -1;
}
void shell_handler(uint8_t data)
{
/*
* handle control key
* up key : 0x1b 0x5b 0x41
* down key: 0x1b 0x5b 0x42
* right key:0x1b 0x5b 0x43
* left key: 0x1b 0x5b 0x44
*/
if (data == 0x1b) {
shell->stat = WAIT_SPEC_KEY;
return;
} else if (shell->stat == WAIT_SPEC_KEY) {
if (data == 0x5b) {
shell->stat = WAIT_FUNC_KEY;
return;
}
shell->stat = WAIT_NORMAL;
} else if (shell->stat == WAIT_FUNC_KEY) {
shell->stat = WAIT_NORMAL;
if (data == 0x41) /* up key */
{
/* prev history */
if (shell->current_history > 0) {
shell->current_history--;
} else {
shell->current_history = 0;
return;
}
/* copy the history command */
memcpy(shell->line, &shell->cmd_history[shell->current_history][0],
SHELL_CMD_SIZE);
shell->line_curpos = shell->line_position = strlen(shell->line);
shell_handle_history(shell);
return;
} else if (data == 0x42) /* down key */
{
/* next history */
if (shell->current_history < shell->history_count - 1) {
shell->current_history++;
} else {
/* set to the end of history */
if (shell->history_count != 0) {
shell->current_history = shell->history_count - 1;
} else {
return;
}
}
memcpy(shell->line, &shell->cmd_history[shell->current_history][0],
SHELL_CMD_SIZE);
shell->line_curpos = shell->line_position = strlen(shell->line);
shell_handle_history(shell);
return;
} else if (data == 0x44) /* left key */
{
if (shell->line_curpos) {
SHELL_PRINTF("\b");
shell->line_curpos--;
}
return;
} else if (data == 0x43) /* right key */
{
if (shell->line_curpos < shell->line_position) {
SHELL_PRINTF("%c", shell->line[shell->line_curpos]);
shell->line_curpos++;
}
return;
}
}
/* received null or error */
if (data == '\0' || data == 0xFF) {
return;
}
/* handle tab key */
else if (data == '\t') {
int i;
/* move the cursor to the beginning of line */
for (i = 0; i < shell->line_curpos; i++) {
SHELL_PRINTF("\b");
}
/* auto complete */
shell_auto_complete(&shell->line[0]);
/* re-calculate position */
shell->line_curpos = shell->line_position = strlen(shell->line);
return;
}
/* handle backspace key */
else if (data == 0x7f || data == 0x08) {
/* note that shell->line_curpos >= 0 */
if (shell->line_curpos == 0) {
return;
}
shell->line_position--;
shell->line_curpos--;
if (shell->line_position > shell->line_curpos) {
int i;
memmove(&shell->line[shell->line_curpos],
&shell->line[shell->line_curpos + 1],
shell->line_position - shell->line_curpos);
shell->line[shell->line_position] = 0;
SHELL_PRINTF("\b%s \b", &shell->line[shell->line_curpos]);
/* move the cursor to the origin position */
for (i = shell->line_curpos; i <= shell->line_position; i++) {
SHELL_PRINTF("\b");
}
} else {
SHELL_PRINTF("\b \b");
shell->line[shell->line_position] = 0;
}
return;
}
/* handle end of line, break */
if (data == '\r' || data == '\n') {
shell_push_history(shell);
SHELL_PRINTF("\r\n");
shell_exec(shell->line, shell->line_position);
SHELL_PRINTF(shell_get_prompt());
memset(shell->line, 0, sizeof(shell->line));
shell->line_curpos = shell->line_position = 0;
return;
}
/* it's a large line, discard it */
if (shell->line_position >= SHELL_CMD_SIZE) {
shell->line_position = 0;
}
/* normal character */
if (shell->line_curpos < shell->line_position) {
int i;
memmove(&shell->line[shell->line_curpos + 1],
&shell->line[shell->line_curpos],
shell->line_position - shell->line_curpos);
shell->line[shell->line_curpos] = data;
SHELL_PRINTF("%s", &shell->line[shell->line_curpos]);
/* move the cursor to new position */
for (i = shell->line_curpos; i < shell->line_position; i++) {
SHELL_PRINTF("\b");
}
} else {
shell->line[shell->line_position] = data;
SHELL_PRINTF("%c", data);
}
data = 0;
shell->line_position++;
shell->line_curpos++;
if (shell->line_position >= SHELL_CMD_SIZE) {
/* clear command line */
shell->line_position = 0;
shell->line_curpos = 0;
}
}
static void shell_function_init(const void *begin, const void *end)
{
_syscall_table_begin = (struct shell_syscall *)begin;
_syscall_table_end = (struct shell_syscall *)end;
}
static void shell_var_init(const void *begin, const void *end)
{
_sysvar_table_begin = (struct shell_sysvar *)begin;
_sysvar_table_end = (struct shell_sysvar *)end;
}
/*
* @ingroup shell
*
* This function will initialize shell
*/
void shell_init(void)
{
#if defined(__CC_ARM) || defined(__CLANG_ARM) /* ARM C Compiler */
extern const int FSymTab$$Base;
extern const int FSymTab$$Limit;
extern const int VSymTab$$Base;
extern const int VSymTab$$Limit;
shell_function_init(&FSymTab$$Base, &FSymTab$$Limit);
shell_var_init(&VSymTab$$Base, &VSymTab$$Limit);
#elif defined(__ICCARM__) || defined(__ICCRX__) /* for IAR Compiler */
shell_function_init(__section_begin("FSymTab"), __section_end("FSymTab"));
shell_var_init(__section_begin("VSymTab"), __section_end("VSymTab"));
#elif defined(__GNUC__)
/* GNU GCC Compiler and TI CCS */
extern const int __fsymtab_start;
extern const int __fsymtab_end;
extern const int __vsymtab_start;
extern const int __vsymtab_end;
shell_function_init(&__fsymtab_start, &__fsymtab_end);
shell_var_init(&__vsymtab_start, &__vsymtab_end);
#endif
shell = &_shell;
}

132
components/shell/shell.h Normal file
View file

@ -0,0 +1,132 @@
/**
* @file shell.h
* @brief
*
* Copyright (c) 2021 Bouffalolab team
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
#ifndef __SHELL_H__
#define __SHELL_H__
#include "stdint.h"
#include "string.h"
#include "shell_config.h"
#include "bflb_platform.h"
#define SHELL_PRINTF bflb_platform_printf
typedef int (*syscall_func)(void);
typedef int (*cmd_function_t)(int argc, char **argv);
enum input_stat {
WAIT_NORMAL,
WAIT_SPEC_KEY,
WAIT_FUNC_KEY,
};
struct shell {
enum input_stat stat;
uint16_t current_history;
uint16_t history_count;
char cmd_history[SHELL_HISTORY_LINES][SHELL_CMD_SIZE];
char line[SHELL_CMD_SIZE];
uint16_t line_position;
uint16_t line_curpos;
#ifdef SHELL_USING_AUTH
char password[SHELL_PASSWORD_MAX];
#endif
#if defined(SHELL_USING_FS)
#endif
};
/* system call table */
struct shell_syscall {
const char *name; /* the name of system call */
#if defined(SHELL_USING_DESCRIPTION)
const char *desc; /* description of system call */
#endif
syscall_func func; /* the function address of system call */
};
/* system variable table */
struct shell_sysvar {
const char *name; /* the name of variable */
#if defined(SHELL_USING_DESCRIPTION)
const char *desc; /* description of system variable */
#endif
uint8_t type; /* the type of variable */
void *var; /* the address of variable */
};
#ifdef SHELL_USING_DESCRIPTION
#define SHELL_FUNCTION_EXPORT_CMD(name, cmd, desc) \
const char __fsym_##cmd##_name[] __attribute__((section(".rodata.name"))) = #cmd; \
const char __fsym_##cmd##_desc[] __attribute__((section(".rodata.name"))) = #desc; \
__attribute__((used)) const struct shell_syscall __fsym_##cmd __attribute__((section("FSymTab"))) = { \
__fsym_##cmd##_name, \
__fsym_##cmd##_desc, \
(syscall_func)&name \
};
#define SHELL_VAR_EXPORT(name, type, desc) \
const char __vsym_##name##_name[] __attribute__((section(".rodata.name"))) = #name; \
const char __vsym_##name##_desc[] __attribute__((section(".rodata.name"))) = #desc; \
__attribute__((used)) const struct shell_sysvar __vsym_##name __attribute__((section("VSymTab"))) = { \
__vsym_##name##_name, \
__vsym_##name##_desc, \
type, \
(void *)&name \
};
#else
#define SHELL_FUNCTION_EXPORT_CMD(name, cmd, desc) \
const char __fsym_##cmd##_name[] = #cmd; \
__attribute__((used)) const struct shell_syscall __fsym_##cmd __attribute__((section("FSymTab"))) = { \
__fsym_##cmd##_name, \
(syscall_func)&name \
};
#define SHELL_VAR_EXPORT(name, type, desc) \
const char __vsym_##name##_name[] = #name; \
__attribute__((used)) const struct shell_sysvar __vsym_##name __attribute__((section("VSymTab"))) = { \
__vsym_##name##_name, \
type, \
(void *)&name \
};
#endif /* end of SHELL_USING_DESCRIPTION */
/**
* @ingroup shell
*
* This macro exports a command to module shell.
*
* @param command the name of command.
* @param desc the description of command, which will show in help.
*/
#define SHELL_CMD_EXPORT(command, desc) \
SHELL_FUNCTION_EXPORT_CMD(command, __cmd_##command, desc)
#define SHELL_CMD_EXPORT_ALIAS(command, alias, desc) \
SHELL_FUNCTION_EXPORT_CMD(command, __cmd_##alias, desc)
void shell_handler(uint8_t data);
void shell_init(void);
#endif

View file

@ -0,0 +1,13 @@
#ifndef __SHELL_CONFIG_H__
#define __SHELL_CONFIG_H__
#define SHELL_NAME "bouffalolab "
#define SHELL_CONSOLEBUF_SIZE 128
#define SHELL_HISTORY_LINES 5
#define SHELL_CMD_SIZE 50
#define SHELL_ARG_NUM 8
//#define SHELL_USING_FS
#endif

View file

@ -0,0 +1,4 @@
set(TARGET_REQUIRED_LIBS shell)
set(mains main.c)
generate_bin()

View file

@ -0,0 +1,921 @@
<?xml version="1.0" encoding="UTF-8"?>
<Project Name="shell" Version="1" Language="C">
<Description>CPU: RV32IMAFC
Chip: bl70x
Board: bl70x_iot
</Description>
<Dependencies Name="Debug"/>
<VirtualDirectory Name="app">
<File Name="../main.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="chip">
<VirtualDirectory Name="riscv">
<File Name="../../../drivers/bl702_driver/startup/interrupt.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/startup/system_bl702.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="startup">
<File Name="../../../drivers/bl702_driver/startup/GCC/entry.S">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/startup/GCC/start_load.c">
<FileOption/>
</File>
</VirtualDirectory>
</VirtualDirectory>
<VirtualDirectory Name="hal">
<File Name="../../../drivers/bl702_driver/hal_drv/src/hal_adc.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/hal_drv/src/hal_dac.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/hal_drv/src/hal_dma.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/hal_drv/src/hal_gpio.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/hal_drv/src/hal_i2c.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/hal_drv/src/hal_i2s.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/hal_drv/src/hal_mtimer.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/hal_drv/src/hal_pwm.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/hal_drv/src/hal_spi.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/hal_drv/src/hal_timer.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/hal_drv/src/hal_uart.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/hal_drv/src/hal_usb.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/hal_drv/src/hal_clock.c"/>
</VirtualDirectory>
<VirtualDirectory Name="std">
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_acomp.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_adc.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_aon.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_cam.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_clock.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_dac.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_dma.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_ef_ctrl.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_emac.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_glb.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_hbn.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_i2c.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_i2c_gpio_sim.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_i2s.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_ir.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_common.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_kys.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_l1c.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_mjpeg.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_pds.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_psram.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_pwm.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_qdec.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_romapi.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_romdriver.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_sec_dbg.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_sec_eng.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_sf_cfg.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_sf_cfg_ext.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_sf_ctrl.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_sflash.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_sflash_ext.c" ExcludeProjConfig="">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_spi.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_timer.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_uart.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_usb.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_xip_sflash.c">
<FileOption/>
</File>
<File Name="../../../drivers/bl702_driver/std_drv/src/bl702_xip_sflash_ext.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="board">
<File Name="../../../bsp/board/bl706_iot/board.c">
<FileOption/>
</File>
<File Name="../../../bsp/bsp_common/platform/bflb_platform.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="common">
<File Name="../../../common/device/drv_device.c">
<FileOption/>
</File>
<File Name="../../../common/memheap/drv_mmheap.c">
<FileOption/>
</File>
<File Name="../../../common/ring_buffer/ring_buffer.c">
<FileOption/>
</File>
<File Name="../../../common/soft_crc/softcrc.c">
<FileOption/>
</File>
<VirtualDirectory Name="libc">
<File Name="../../../common/libc/src/atof.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/atoi.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/atol.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/atoll.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/atox.c" ExcludeProjConfig="BuildSet;CK_Link_Debug;OpenOCD_Debug">
<FileOption/>
</File>
<File Name="../../../common/libc/src/bsearch.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/common.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/ctype_isalnum.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/ctype_isalpha.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/ctype_isascii.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/ctype_isblank.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/ctype_iscntrl.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/ctype_isdigit.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/ctype_isgraph.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/ctype_islower.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/ctype_isprint.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/ctype_ispunct.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/ctype_isspace.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/ctype_isupper.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/ctype_isxdigit.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/ctype_tolower.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/ctype_toupper.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/ctypes.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/fnmatch.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/jrand48.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/lrand48.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/memccpy.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/memchr.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/memcmp.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/memcpy.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/memmem.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/memrchr.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/memset.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/memswap.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/mrand48.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/nrand48.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/qsort.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/seed48.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/snprintf.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/sprintf.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/srand48.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/sscanf.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/stdlib.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strcasecmp.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strcat.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strchr.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strcmp.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strcpy.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strcspn.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strlcat.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strlcpy.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strlen.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strncasecmp.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strncat.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strncmp.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strncpy.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strnlen.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strntoimax.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strntoumax.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strpbrk.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strrchr.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strsep.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strspn.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strstr.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strtoimax.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strtok.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strtok_r.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strtol.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strtoll.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strtoul.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strtoull.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strtoumax.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strtox.c" ExcludeProjConfig="BuildSet;CK_Link_Debug;OpenOCD_Debug">
<FileOption/>
</File>
<File Name="../../../common/libc/src/strxspn.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/vsnprintf.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/vsprintf.c">
<FileOption/>
</File>
<File Name="../../../common/libc/src/vsscanf.c">
<FileOption/>
</File>
</VirtualDirectory>
<File Name="../../../common/misc/misc.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="script">
<File Name="../../../tools/openocd/openocd_bl702_evb.cfg">
<FileOption/>
</File>
<File Name="../../../tools/openocd/bl70x_gdb.init">
<FileOption/>
</File>
</VirtualDirectory>
<MonitorProgress>
<DebugLaunch>76</DebugLaunch>
</MonitorProgress>
<VirtualDirectory Name="components">
<VirtualDirectory Name="fatfs">
<File Name="../../../components/fatfs/diskio.c">
<FileOption/>
</File>
<File Name="../../../components/fatfs/ff.c">
<FileOption/>
</File>
<File Name="../../../components/fatfs/ffsystem.c">
<FileOption/>
</File>
<File Name="../../../components/fatfs/ffunicode.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="shell">
<File Name="../../../components/shell/drv_shell.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="usb_stack">
<VirtualDirectory Name="class">
<VirtualDirectory Name="cdc">
<File Name="../../../components/usb_stack/class/cdc/usbd_cdc.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="hid">
<File Name="../../../components/usb_stack/class/hid/usbd_hid.c">
<FileOption/>
</File>
</VirtualDirectory>
<VirtualDirectory Name="msc">
<File Name="../../../components/usb_stack/class/msc/usbd_msc.c">
<FileOption/>
</File>
</VirtualDirectory>
</VirtualDirectory>
<VirtualDirectory Name="core">
<File Name="../../../components/usb_stack/core/usbd_core.c">
<FileOption/>
</File>
</VirtualDirectory>
</VirtualDirectory>
</VirtualDirectory>
<DebugSessions>
<watchExpressions/>
<memoryExpressions>;;;</memoryExpressions>
<statistics>;;MHZ;</statistics>
<peripheralTabs/>
<WatchDisplayFormat>1</WatchDisplayFormat>
<LocalDisplayFormat>1</LocalDisplayFormat>
<debugLayout/>
<memoryTabColSizeExpressions>100:8;100:8;100:8;100:8;</memoryTabColSizeExpressions>
</DebugSessions>
<Dependencies Name="BuildSet"/>
<BuildConfigs>
<BuildConfig Name="OpenOCD_Debug">
<Target>
<ROMBank Selected="1">
<ROM1>
<InUse>no</InUse>
<Start>0x23000000</Start>
<Size>0x100000</Size>
</ROM1>
<ROM2>
<InUse>no</InUse>
<Start>0x22014000</Start>
<Size>0x4000</Size>
</ROM2>
<ROM3>
<InUse>no</InUse>
<Start>0x42018000</Start>
<Size>0x8000</Size>
</ROM3>
<ROM4>
<InUse>no</InUse>
<Start/>
<Size/>
</ROM4>
<ROM5>
<InUse>no</InUse>
<Start/>
<Size/>
</ROM5>
</ROMBank>
<RAMBank>
<RAM1>
<InUse>yes</InUse>
<Start>0x42020000</Start>
<Size>0xc000</Size>
<Init>yes</Init>
</RAM1>
<RAM2>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM2>
<RAM3>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM3>
<RAM4>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM4>
<RAM5>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM5>
</RAMBank>
<CPU>rv32imafc</CPU>
<UseMiniLib>no</UseMiniLib>
<Endian>little</Endian>
<UseHardFloat>no</UseHardFloat>
<UseEnhancedLRW>no</UseEnhancedLRW>
<UseContinueBuild>no</UseContinueBuild>
<UseSemiHost>no</UseSemiHost>
</Target>
<Output>
<OutputName>$(ProjectName)</OutputName>
<Type>Executable</Type>
<CreateHexFile>no</CreateHexFile>
<CreateBinFile>yes</CreateBinFile>
<Preprocessor>no</Preprocessor>
<Disassmeble>yes</Disassmeble>
<CallGraph>no</CallGraph>
<Map>yes</Map>
</Output>
<User>
<BeforeCompile>
<RunUserProg>no</RunUserProg>
<UserProgName/>
</BeforeCompile>
<BeforeMake>
<RunUserProg>no</RunUserProg>
<UserProgName/>
</BeforeMake>
<AfterMake>
<RunUserProg>no</RunUserProg>
<UserProgName>$(ProjectPath)../../../tools/bflb_flash_tool/bflb_mcu_tool.exe --chipname=bl702 --interface=openocd --firmware="$(ProjectPath)/Obj/$(ProjectName).bin" </UserProgName>
</AfterMake>
</User>
<Compiler>
<Define>ARCH_RISCV;</Define>
<Undefine/>
<Optim>Optimize more (-O2)</Optim>
<DebugLevel>Default (-g)</DebugLevel>
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../components/fatfs;$(ProjectPath)../../../components/freertos/Source/include;$(ProjectPath)../../../components/shell;$(ProjectPath)../../../components/usb_stack/class/audio;$(ProjectPath)../../../components/usb_stack/class/cdc;$(ProjectPath)../../../components/usb_stack/class/hid;$(ProjectPath)../../../components/usb_stack/class/msc;$(ProjectPath)../../../components/usb_stack/class/video;$(ProjectPath)../../../components/usb_stack/class/webusb;$(ProjectPath)../../../components/usb_stack/class/winusb;$(ProjectPath)../../../components/usb_stack/common;$(ProjectPath)../../../components/usb_stack/core;$(ProjectPath)../../../bsp/board/bl706_iot;$(ProjectPath)../../../bsp/bsp_common/platform;$(ProjectPath)../../../common/libc/inc;$(ProjectPath)../../../common/libc/inc/arm_gcc;$(ProjectPath)../../../common/libc/inc/bits;$(ProjectPath)../../../common/libc/inc/sys;$(ProjectPath)../../../common/libc/src;$(ProjectPath)../../../common/device;$(ProjectPath)../../../common/list;$(ProjectPath)../../../common/memheap;$(ProjectPath)../../../common/misc;$(ProjectPath)../../../common/ring_buffer;$(ProjectPath)../../../common/soft_crc;$(ProjectPath)../../../components/shell;$(ProjectPath)../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../drivers/bl702_driver/regs;$(ProjectPath)../../../drivers/bl702_driver/startup;$(ProjectPath)../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../drivers/bl602_driver/startup;$(ProjectPath)../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../drivers/bl602_driver/regs;$(ProjectPath)../../../drivers/bl602_driver/std_drv/inc</IncludePath>
<OtherFlags>-fshort-enums -fno-common -fms-extensions -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wall -Wshift-negative-value -Wchar-subscripts -Wformat -Wuninitialized -Winit-self -fno-jump-tables -Wignored-qualifiers -Wswitch-default -Wunused -Wundef -msmall-data-limit=4</OtherFlags>
<Verbose>no</Verbose>
<Ansi>no</Ansi>
<Syntax>no</Syntax>
<Pedantic>no</Pedantic>
<PedanticErr>no</PedanticErr>
<InhibitWarn>no</InhibitWarn>
<AllWarn>yes</AllWarn>
<WarnErr>no</WarnErr>
<OneElfS>yes</OneElfS>
<Fstrict>no</Fstrict>
</Compiler>
<Asm>
<Define/>
<Undefine/>
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../components/fatfs;$(ProjectPath)../../../components/freertos/Source/include;$(ProjectPath)../../../components/shell;$(ProjectPath)../../../components/usb_stack/class/audio;$(ProjectPath)../../../components/usb_stack/class/cdc;$(ProjectPath)../../../components/usb_stack/class/hid;$(ProjectPath)../../../components/usb_stack/class/msc;$(ProjectPath)../../../components/usb_stack/class/video;$(ProjectPath)../../../components/usb_stack/class/webusb;$(ProjectPath)../../../components/usb_stack/class/winusb;$(ProjectPath)../../../components/usb_stack/common;$(ProjectPath)../../../components/usb_stack/core;$(ProjectPath)../../../bsp/board/bl706_iot;$(ProjectPath)../../../bsp/bsp_common/platform;$(ProjectPath)../../../common/device;$(ProjectPath)../../../common/list;$(ProjectPath)../../../common/memheap;$(ProjectPath)../../../common/misc;$(ProjectPath)../../../common/ring_buffer;$(ProjectPath)../../../common/soft_crc;$(ProjectPath)../../../components/shell;$(ProjectPath)../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../drivers/bl702_driver/regs;$(ProjectPath)../../../drivers/bl702_driver/startup;$(ProjectPath)../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../drivers/bl602_driver/startup;$(ProjectPath)../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../drivers/bl602_driver/regs;$(ProjectPath)../../../drivers/bl602_driver/std_drv/inc</IncludePath>
<OtherFlags/>
<DebugLevel>gdwarf2</DebugLevel>
</Asm>
<Linker>
<Garbage>yes</Garbage>
<Garbage2>yes</Garbage2>
<LDFile>$(ProjectPath)../../../drivers/bl702_driver/bl702_flash.ld</LDFile>
<LibName/>
<LibPath/>
<OtherFlags/>
<AutoLDFile>no</AutoLDFile>
<LinkType/>
</Linker>
<Debug>
<LoadApplicationAtStartup>yes</LoadApplicationAtStartup>
<Connector>OpenOCD</Connector>
<StopAt>yes</StopAt>
<StopAtText>main</StopAtText>
<InitFile/>
<AfterLoadFile>$(ProjectPath)../../../tools/openocd/bl70x_gdb.init</AfterLoadFile>
<AutoRun>yes</AutoRun>
<ResetType>Hard Reset</ResetType>
<SoftResetVal>23000000</SoftResetVal>
<ResetAfterLoad>no</ResetAfterLoad>
<Dumpcore>no</Dumpcore>
<DumpcoreText>$(ProjectPath)/$(ProjectName).cdkcore</DumpcoreText>
<ConfigICE>
<IP>localhost</IP>
<PORT>1025</PORT>
<CPUNumber>0</CPUNumber>
<Clock>2000</Clock>
<Delay>10</Delay>
<WaitReset>50</WaitReset>
<DDC>yes</DDC>
<TRST>no</TRST>
<DebugPrint>no</DebugPrint>
<Connect>Normal</Connect>
<ResetType>Hard Reset</ResetType>
<SoftResetVal>21000000</SoftResetVal>
<RTOSType>Bare Metal</RTOSType>
<DownloadToFlash>yes</DownloadToFlash>
<ResetAfterConnect>yes</ResetAfterConnect>
<GDBName/>
<GDBServerType>Local</GDBServerType>
<OtherFlags>-arch riscv</OtherFlags>
</ConfigICE>
<ConfigSIM>
<SIMTarget/>
<OtherFlags/>
<NoGraphic>yes</NoGraphic>
<Log>no</Log>
<SimTrace>no</SimTrace>
</ConfigSIM>
<ConfigOpenOCD>
<OpenOCDExecutablePath>openocd-hifive</OpenOCDExecutablePath>
<OpenOCDTelnetPortEnable>no</OpenOCDTelnetPortEnable>
<OpenOCDTelnetPort>4444</OpenOCDTelnetPort>
<OpenOCDTclPortEnable>no</OpenOCDTclPortEnable>
<OpenOCDTclPort>6666</OpenOCDTclPort>
<OpenOCDConfigOptions>-f ../../../tools/openocd/if_rv_dbg_plus.cfg -f ../../../tools/openocd/tgt_702.cfg</OpenOCDConfigOptions>
</ConfigOpenOCD>
</Debug>
<Flash>
<InitFile/>
<Erase>Erase Sectors</Erase>
<Algorithms Path="">bl70x_flasher.elf</Algorithms>
<Program>yes</Program>
<Verify>yes</Verify>
<ResetAndRun>no</ResetAndRun>
<ResetType>Hard Reset</ResetType>
<SoftResetVal/>
<External>no</External>
<Command/>
<Arguments/>
</Flash>
</BuildConfig>
<BuildConfig Name="CK_Link_Debug">
<Target>
<ROMBank Selected="1">
<ROM1>
<InUse>no</InUse>
<Start>0x23000000</Start>
<Size>0x100000</Size>
</ROM1>
<ROM2>
<InUse>no</InUse>
<Start>0x22014000</Start>
<Size>0x4000</Size>
</ROM2>
<ROM3>
<InUse>no</InUse>
<Start>0x42018000</Start>
<Size>0x8000</Size>
</ROM3>
<ROM4>
<InUse>no</InUse>
<Start/>
<Size/>
</ROM4>
<ROM5>
<InUse>no</InUse>
<Start/>
<Size/>
</ROM5>
</ROMBank>
<RAMBank>
<RAM1>
<InUse>yes</InUse>
<Start>0x42020000</Start>
<Size>0xc000</Size>
<Init>yes</Init>
</RAM1>
<RAM2>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM2>
<RAM3>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM3>
<RAM4>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM4>
<RAM5>
<InUse>no</InUse>
<Start/>
<Size/>
<Init>yes</Init>
</RAM5>
</RAMBank>
<CPU>rv32imac</CPU>
<UseMiniLib>no</UseMiniLib>
<Endian>little</Endian>
<UseHardFloat>no</UseHardFloat>
<UseEnhancedLRW>no</UseEnhancedLRW>
<UseContinueBuild>no</UseContinueBuild>
<UseSemiHost>no</UseSemiHost>
</Target>
<Output>
<OutputName>$(ProjectName)</OutputName>
<Type>Executable</Type>
<CreateHexFile>no</CreateHexFile>
<CreateBinFile>yes</CreateBinFile>
<Preprocessor>no</Preprocessor>
<Disassmeble>yes</Disassmeble>
<CallGraph>no</CallGraph>
<Map>yes</Map>
</Output>
<User>
<BeforeCompile>
<RunUserProg>no</RunUserProg>
<UserProgName/>
</BeforeCompile>
<BeforeMake>
<RunUserProg>no</RunUserProg>
<UserProgName/>
</BeforeMake>
<AfterMake>
<RunUserProg>no</RunUserProg>
<UserProgName>$(ProjectPath)../../../tools/bflb_flash_tool/bflb_mcu_tool.exe --chipname=bl702 --firmware="$(ProjectPath)/Obj/$(ProjectName).bin" </UserProgName>
</AfterMake>
</User>
<Compiler>
<Define>ARCH_RISCV;</Define>
<Undefine/>
<Optim>Optimize more (-O2)</Optim>
<DebugLevel>Default (-g)</DebugLevel>
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../components/fatfs;$(ProjectPath)../../../components/freertos/Source/include;$(ProjectPath)../../../components/shell;$(ProjectPath)../../../components/usb_stack/class/audio;$(ProjectPath)../../../components/usb_stack/class/cdc;$(ProjectPath)../../../components/usb_stack/class/hid;$(ProjectPath)../../../components/usb_stack/class/msc;$(ProjectPath)../../../components/usb_stack/class/video;$(ProjectPath)../../../components/usb_stack/class/webusb;$(ProjectPath)../../../components/usb_stack/class/winusb;$(ProjectPath)../../../components/usb_stack/common;$(ProjectPath)../../../components/usb_stack/core;$(ProjectPath)../../../bsp/board/bl706_iot;$(ProjectPath)../../../bsp/bsp_common/platform;$(ProjectPath)../../../common/libc/inc;$(ProjectPath)../../../common/libc/inc/arm_gcc;$(ProjectPath)../../../common/libc/inc/bits;$(ProjectPath)../../../common/libc/inc/sys;$(ProjectPath)../../../common/libc/src;$(ProjectPath)../../../common/device;$(ProjectPath)../../../common/list;$(ProjectPath)../../../common/memheap;$(ProjectPath)../../../common/misc;$(ProjectPath)../../../common/ring_buffer;$(ProjectPath)../../../common/soft_crc;$(ProjectPath)../../../components/shell;$(ProjectPath)../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../drivers/bl702_driver/regs;$(ProjectPath)../../../drivers/bl702_driver/startup;$(ProjectPath)../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../drivers/bl602_driver/startup;$(ProjectPath)../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../drivers/bl602_driver/regs;$(ProjectPath)../../../drivers/bl602_driver/std_drv/inc</IncludePath>
<OtherFlags>-fshort-enums -fno-common -fms-extensions -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wall -Wshift-negative-value -Wchar-subscripts -Wformat -Wuninitialized -Winit-self -fno-jump-tables -Wignored-qualifiers -Wswitch-default -Wunused -Wundef -msmall-data-limit=4</OtherFlags>
<Verbose>no</Verbose>
<Ansi>no</Ansi>
<Syntax>no</Syntax>
<Pedantic>no</Pedantic>
<PedanticErr>no</PedanticErr>
<InhibitWarn>no</InhibitWarn>
<AllWarn>yes</AllWarn>
<WarnErr>no</WarnErr>
<OneElfS>yes</OneElfS>
<Fstrict>no</Fstrict>
</Compiler>
<Asm>
<Define/>
<Undefine/>
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../components/fatfs;$(ProjectPath)../../../components/freertos/Source/include;$(ProjectPath)../../../components/shell;$(ProjectPath)../../../components/usb_stack/class/audio;$(ProjectPath)../../../components/usb_stack/class/cdc;$(ProjectPath)../../../components/usb_stack/class/hid;$(ProjectPath)../../../components/usb_stack/class/msc;$(ProjectPath)../../../components/usb_stack/class/video;$(ProjectPath)../../../components/usb_stack/class/webusb;$(ProjectPath)../../../components/usb_stack/class/winusb;$(ProjectPath)../../../components/usb_stack/common;$(ProjectPath)../../../components/usb_stack/core;$(ProjectPath)../../../bsp/board/bl706_iot;$(ProjectPath)../../../bsp/bsp_common/platform;$(ProjectPath)../../../common/device;$(ProjectPath)../../../common/list;$(ProjectPath)../../../common/memheap;$(ProjectPath)../../../common/misc;$(ProjectPath)../../../common/ring_buffer;$(ProjectPath)../../../common/soft_crc;$(ProjectPath)../../../components/shell;$(ProjectPath)../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../drivers/bl702_driver/regs;$(ProjectPath)../../../drivers/bl702_driver/startup;$(ProjectPath)../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../drivers/bl602_driver/startup;$(ProjectPath)../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../drivers/bl602_driver/regs;$(ProjectPath)../../../drivers/bl602_driver/std_drv/inc</IncludePath>
<OtherFlags/>
<DebugLevel>gdwarf2</DebugLevel>
</Asm>
<Linker>
<Garbage>yes</Garbage>
<Garbage2>yes</Garbage2>
<LDFile>$(ProjectPath)../../../drivers/bl702_driver/bl702_flash.ld</LDFile>
<LibName/>
<LibPath/>
<OtherFlags/>
<AutoLDFile>no</AutoLDFile>
<LinkType/>
</Linker>
<Debug>
<LoadApplicationAtStartup>no</LoadApplicationAtStartup>
<Connector>ICE</Connector>
<StopAt>yes</StopAt>
<StopAtText>main</StopAtText>
<InitFile>$(ProjectPath)/../../../tools/openocd/bl70x_gdb.init</InitFile>
<AfterLoadFile/>
<AutoRun>yes</AutoRun>
<ResetType>Hard Reset</ResetType>
<SoftResetVal>21000000</SoftResetVal>
<ResetAfterLoad>no</ResetAfterLoad>
<Dumpcore>no</Dumpcore>
<DumpcoreText>$(ProjectPath)/$(ProjectName).cdkcore</DumpcoreText>
<ConfigICE>
<IP>localhost</IP>
<PORT>1025</PORT>
<CPUNumber>0</CPUNumber>
<Clock>2000</Clock>
<Delay>10</Delay>
<WaitReset>50</WaitReset>
<DDC>yes</DDC>
<TRST>yes</TRST>
<DebugPrint>no</DebugPrint>
<Connect>with Pre-reset</Connect>
<ResetType>Hard Reset</ResetType>
<SoftResetVal>21000000</SoftResetVal>
<RTOSType>Bare Metal</RTOSType>
<DownloadToFlash>no</DownloadToFlash>
<ResetAfterConnect>yes</ResetAfterConnect>
<GDBName/>
<GDBServerType>Local</GDBServerType>
<OtherFlags>-arch riscv</OtherFlags>
</ConfigICE>
<ConfigSIM>
<SIMTarget/>
<OtherFlags/>
<NoGraphic>yes</NoGraphic>
<Log>no</Log>
<SimTrace>no</SimTrace>
</ConfigSIM>
<ConfigOpenOCD>
<OpenOCDExecutablePath>openocd-hifive</OpenOCDExecutablePath>
<OpenOCDTelnetPortEnable>no</OpenOCDTelnetPortEnable>
<OpenOCDTelnetPort>4444</OpenOCDTelnetPort>
<OpenOCDTclPortEnable>no</OpenOCDTclPortEnable>
<OpenOCDTclPort>6666</OpenOCDTclPort>
<OpenOCDConfigOptions>-f ../../../tools/openocd/if_rv_dbg_plus.cfg -f ../../../tools/openocd/tgt_702.cfg</OpenOCDConfigOptions>
</ConfigOpenOCD>
</Debug>
<Flash>
<InitFile>$(ProjectPath)/flash.init</InitFile>
<Erase>Erase Sectors</Erase>
<Algorithms Path=""/>
<Program>no</Program>
<Verify>no</Verify>
<ResetAndRun>no</ResetAndRun>
<ResetType>Soft Reset</ResetType>
<SoftResetVal/>
<External>yes</External>
<Command/>
<Arguments/>
</Flash>
</BuildConfig>
</BuildConfigs>
<DebugSessions>
<watchExpressions/>
<memoryExpressions>;;;</memoryExpressions>
<statistics>;;MHZ;</statistics>
<peripheralTabs>
<Tab disFormat="Hex">glb</Tab>
<Tab disFormat="Hex">uart</Tab>
</peripheralTabs>
<WatchDisplayFormat>1</WatchDisplayFormat>
<LocalDisplayFormat>1</LocalDisplayFormat>
<debugLayout/>
<memoryTabColSizeExpressions>100:8;100:8;100:8;100:8;</memoryTabColSizeExpressions>
</DebugSessions>
<DebugSessions>
<watchExpressions/>
<memoryExpressions>;;;</memoryExpressions>
<statistics>;;MHZ;</statistics>
<peripheralTabs>
<Tab disFormat="Hex">glb</Tab>
<Tab disFormat="Hex">uart</Tab>
</peripheralTabs>
<WatchDisplayFormat>1</WatchDisplayFormat>
<LocalDisplayFormat>1</LocalDisplayFormat>
<debugLayout/>
<memoryTabColSizeExpressions>100:8;100:8;100:8;100:8;</memoryTabColSizeExpressions>
</DebugSessions>
</Project>

67
examples/shell/main.c Normal file
View file

@ -0,0 +1,67 @@
/**
* @file main.c
* @brief
*
* Copyright (c) 2021 Bouffalolab team
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
#include "hal_uart.h"
#include "shell.h"
void shell_irq_callback(struct device *dev, void *args, uint32_t size, uint32_t state)
{
uint8_t data;
if (state == UART_EVENT_RX_FIFO) {
data = *(uint8_t *)args;
shell_handler(data);
}
}
int main(void)
{
bflb_platform_init(0);
shell_init();
struct device *uart = device_find("debug_log");
if (uart) {
device_set_callback(uart, shell_irq_callback);
device_control(uart, DEVICE_CTRL_SET_INT, (void *)(UART_RX_FIFO_IT));
}
while (1) {
__asm volatile("nop");
}
}
void hellowd()
{
MSG("hello World\r\n");
}
int echo(int argc, char *argv[])
{
MSG("%dparameter(s)\r\n", argc);
for (uint8_t i = 1; i < argc; i++) {
MSG("%s\r\n", argv[i]);
}
return 0;
}
SHELL_CMD_EXPORT(hellowd, hellowd test)
SHELL_CMD_EXPORT(echo, echo test)

5
examples/shell/readme.md Normal file
View file

@ -0,0 +1,5 @@
```bash
$ make APP=shell BOARD=bl706_iot
```