[sync] sync code from internal

This commit is contained in:
jzlv 2023-02-24 21:33:12 +08:00
parent e70e482d21
commit dd161b698b
302 changed files with 36006 additions and 27903 deletions

View file

@ -1,7 +1,6 @@
#include <stdlib.h>
#include "bflb_mtimer.h"
#include "board.h"
#include "vlibc_stdio.h"
#include "ff.h"
#include "log.h"
@ -25,12 +24,12 @@ void filesystem_init(void)
extern void fatfs_sdh_driver_register(void);
fatfs_sdh_driver_register();
ret = f_mount(&fs, "sd:/", 1);
ret = f_mount(&fs, "/sd/", 1);
if (ret == FR_NO_FILESYSTEM) {
LOG_W("No filesystem yet, try to be formatted...\r\n");
ret = f_mkfs("sd:/", &fs_para, workbuf, sizeof(workbuf));
ret = f_mkfs("/sd/", &fs_para, workbuf, sizeof(workbuf));
if (ret != FR_OK) {
LOG_F("fail to make filesystem\r\n");
@ -40,7 +39,7 @@ void filesystem_init(void)
if (ret == FR_OK) {
LOG_I("done with formatting.\r\n");
LOG_I("first start to unmount.\r\n");
ret = f_mount(NULL, "sd:/", 1);
ret = f_mount(NULL, "/sd/", 1);
LOG_I("then start to remount.\r\n");
}
} else if (ret != FR_OK) {
@ -62,18 +61,18 @@ int main(void)
filesystem_init();
extern int lua_start(int argc, char **argv);
extern int lua_main(int argc, char **argv);
/*!< 请将system.zip 解压到sd卡根目录下 */
/*!< 如果使用终端上位机软件(MobaXterm),需要启用 Implicit CR in every LF 保证打印格式正常 */
char *lua_argv[] = {
"lua", /*!< name */
"sd:/system/root.lua", /*!< base script */
"/sd/system/root.lua", /*!< base script */
NULL
};
_ASSERT_FUNC(EXIT_SUCCESS == lua_start(3, lua_argv));
_ASSERT_FUNC(EXIT_SUCCESS == lua_main(1, lua_argv));
LOG_W("lua exit");