Browse Source

change: LUA_TINTEGER 提到lua.h , 顺便修正fdb库的几个编译警告

Wendal Chen 3 years ago
parent
commit
8ff1cdc9db

+ 3 - 0
components/fal/inc/fal_def.h

@@ -31,8 +31,11 @@
 #include "luat_base.h"
 #include "luat_malloc.h"
 
+#ifndef LUAT_LOG_TAG
 #define LUAT_LOG_TAG "fal"
 #include "luat_log.h"
+#endif
+
 #define FAL_PRINTF LLOGD
 
 #define FAL_SW_VERSION                 "0.5.0"

+ 5 - 1
components/fal/src/fal_flash.c

@@ -42,7 +42,9 @@ static uint8_t init_ok = 0;
 int fal_flash_init(void)
 {
     size_t i;
+    #if FAL_DEBUG
     const struct fal_flash_dev *dev;
+    #endif
 
     if (init_ok)
     {
@@ -51,7 +53,6 @@ int fal_flash_init(void)
 
     for (i = 0; i < device_table_len; i++)
     {
-        dev = device_table[i];
         assert(device_table[i]->ops.read);
         assert(device_table[i]->ops.write);
         assert(device_table[i]->ops.erase);
@@ -60,9 +61,12 @@ int fal_flash_init(void)
         {
             device_table[i]->ops.init();
         }
+        #if FAL_DEBUG
+        dev = device_table[i];
         log_d("Flash device | %*.*s | addr: 0x%08lx | len: 0x%08x | blk_size: 0x%08x |initialized finish.",
                 FAL_DEV_NAME_MAX, FAL_DEV_NAME_MAX, dev->name, dev->addr, dev->len,
                 dev->blk_size);
+        #endif
     }
 
     init_ok = 1;

+ 2 - 0
components/fal/src/luat_fal_onchip_flash.c

@@ -1,8 +1,10 @@
 #include "luat_base.h"
 #include "luat_sfd.h"
 
+#ifndef LUAT_LOG_TAG
 #define LUAT_LOG_TAG "fal"
 #include "luat_log.h"
+#endif
 
 #include "fal.h"
 

+ 2 - 0
components/flashdb/inc/fdb_cfg.h

@@ -13,8 +13,10 @@
 #define _FDB_CFG_H_
 
 #include "luat_base.h"
+#ifndef LUAT_LOG_TAG
 #define LUAT_LOG_TAG "flashdb"
 #include "luat_log.h"
+#endif
 
 /* using KVDB feature */
 #define FDB_USING_KVDB

+ 2 - 3
components/flashdb/src/luat_lib_fdb.c

@@ -13,7 +13,6 @@
 
 static struct fdb_kvdb kvdb;
 
-#define LUA_TINTEGER 21
 /**
 初始化kv数据库
 @api fdb.kvdb_init(name, partition)
@@ -163,7 +162,7 @@ if fdb.kvdb_init("env", "onchip_fdb") then
 end
  */
 static int l_fdb_kv_get(lua_State *L) {
-    size_t len;
+    // size_t len;
     luaL_Buffer buff;
     struct fdb_blob blob = {0};
     const char* key = luaL_checkstring(L, 1);
@@ -173,7 +172,7 @@ static int l_fdb_kv_get(lua_State *L) {
     size_t read_len = fdb_kv_get_blob(&kvdb, key, &blob);
     
     lua_Integer *intVal;
-    lua_Number *numVal;
+    // lua_Number *numVal;
 
     if (read_len) {
         // LLOGD("KV value T=%02X", buff.b[0]);

+ 2 - 0
lua/include/lua.h

@@ -72,6 +72,8 @@ typedef struct lua_State lua_State;
 #define LUA_TTHREAD		8
 
 #define LUA_NUMTAGS		9
+// add by wendal @ LuatOS
+#define LUA_TINTEGER 21
 
 
 

+ 0 - 2
lua/include/rotable2.h

@@ -23,8 +23,6 @@ typedef struct rotable_Reg2 {
   rotable_Reg_Value_t value;
 } rotable_Reg_t;
 
-#define LUA_TINTEGER 11
-
 #define ROREG_FUNC(fvalue) {.type=LUA_TFUNCTION, .value={.func=fvalue}}
 #define ROREG_NUM(fvalue)  {.type=LUA_TNUMBER,   .value={.numvalue=fvalue}}
 #define ROREG_INT(fvalue)  {.type=LUA_TINTEGER,  .value={.intvalue=fvalue}}