From f410560a5e5b45bb4221f4daa3fffbc6481d8fc4 Mon Sep 17 00:00:00 2001 From: Miroslav Dzurik Date: Tue, 31 Dec 2024 10:11:14 +0100 Subject: [PATCH] CI changes --- .github/workflows/build.yaml | 28 +++++++++++++++++++++++----- components/script/src/l_component.c | 29 +++++++++++++++++++---------- components/script/src/l_component.h | 2 +- components/script/src/script.c | 5 +++-- main/main.c | 2 +- test_app/main/script.lua | 2 +- test_app/main/test_script.c | 3 ++- test_app/requirements.txt | 2 +- 8 files changed, 51 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 269daba..5463e42 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -29,12 +29,30 @@ jobs: esp_idf_version: ${{ needs.env.outputs.esp_idf_version }} target: ${{ matrix.platform }} - - name: Rename file - shell: bash - run: cp build/esp32-evse.bin ${{ matrix.platform }}-evse.bin + - name: Merge factory + uses: espressif/esp-idf-ci-action@v1 + with: + esp_idf_version: ${{ needs.env.outputs.esp_idf_version }} + target: ${{ matrix.platform }} + command: esptool.py --chip ${{ matrix.platform }} merge_bin -o build/${{ matrix.platform }}-evse.factory.bin --flash_mode dio --flash_freq 40m --flash_size 4MB \ + 0x1000 build/bootloader/bootloader.bin \ + 0x10000 build/esp32-evse.bin \ + 0x8000 build/partition_table/partition-table.bin \ + 0xd000 build/ota_data_initial.bin - - name: Upload artifact + - name: Rename file bin + shell: bash + run: cp build/esp32-evse.bin build/${{ matrix.platform }}-evse.bin + + - name: Upload artifact bin uses: actions/upload-artifact@v4 with: name: firmware-${{ matrix.platform }} - path: ${{ matrix.platform }}-evse.bin + path: build/${{ matrix.platform }}-evse.bin + + - name: Upload artifact factory + uses: actions/upload-artifact@v4 + with: + name: factory-${{ matrix.platform }} + path: build/${{ matrix.platform }}-evse.factory.bin + \ No newline at end of file diff --git a/components/script/src/l_component.c b/components/script/src/l_component.c index 7a00820..2331afb 100644 --- a/components/script/src/l_component.c +++ b/components/script/src/l_component.c @@ -176,7 +176,7 @@ static component_list_t* get_component_list(lua_State* L) return component_list; } -static int l_add_component(lua_State* L) +static int l_register(lua_State* L) { luaL_argcheck(L, lua_istable(L, 1), 1, "must be table"); @@ -225,7 +225,7 @@ static int l_add_component(lua_State* L) return 0; } -static int l_component_gc(lua_State* L) +static int l_gc(lua_State* L) { component_list_t* component_list = get_component_list(L); @@ -242,21 +242,30 @@ static int l_component_gc(lua_State* L) return 0; } -void l_component_register(lua_State* L) +static const luaL_Reg lib[] = { + { "register", l_register }, + { NULL, NULL }, +}; + +static const luaL_Reg metadata[] = { + { "__index", NULL }, + { "__gc", l_gc }, + { NULL, NULL }, +}; + +int luaopen_component(lua_State* L) { - lua_pushcfunction(L, l_add_component); - lua_setglobal(L, "addcomponent"); + luaL_newlib(L, lib); component_list_t* components = (component_list_t*)lua_newuserdata(L, sizeof(component_list_t)); SLIST_INIT(components); + components_ref = luaL_ref(L, LUA_REGISTRYINDEX); luaL_newmetatable(L, "component"); - lua_pushcfunction(L, l_component_gc); - lua_setfield(L, -2, "__gc"); + luaL_setfuncs(L, metadata, 0); + lua_setmetatable(L, -1); - lua_setmetatable(L, -2); - - components_ref = luaL_ref(L, LUA_REGISTRYINDEX); + return 1; } void l_component_resume(lua_State* L) diff --git a/components/script/src/l_component.h b/components/script/src/l_component.h index 66adc7d..ba0c79b 100644 --- a/components/script/src/l_component.h +++ b/components/script/src/l_component.h @@ -6,7 +6,7 @@ #include "lua.h" #include "script.h" -void l_component_register(lua_State* L); +int luaopen_component(lua_State* L); void l_component_resume(lua_State* L); diff --git a/components/script/src/script.c b/components/script/src/script.c index b4207b5..f90b991 100644 --- a/components/script/src/script.c +++ b/components/script/src/script.c @@ -59,9 +59,10 @@ static void script_task_func(void* param) luaL_openlibs(L); - l_component_register(L); + luaL_requiref(L, "component", luaopen_component, 1); + lua_pop(L, 1); - luaL_requiref(L, "evse", luaopen_evse, 1); + luaL_requiref(L, "evse", luaopen_evse, 0); lua_pop(L, 1); luaL_requiref(L, "mqtt", luaopen_mqtt, 0); diff --git a/main/main.c b/main/main.c index 1a41ab8..0a7b2d6 100755 --- a/main/main.c +++ b/main/main.c @@ -199,7 +199,7 @@ static void update_leds(void) void app_main(void) { logger_init(); - // esp_log_set_vprintf(logger_vprintf); + esp_log_set_vprintf(logger_vprintf); const esp_partition_t* running = esp_ota_get_running_partition(); ESP_LOGI(TAG, "Running partition: %s", running->label); diff --git a/test_app/main/script.lua b/test_app/main/script.lua index a4de994..47ad981 100644 --- a/test_app/main/script.lua +++ b/test_app/main/script.lua @@ -3,7 +3,7 @@ paramstring1 = "init" paramnumber1 = "init" paramboolean1 = "init" -addcomponent({ +component.register({ id = "component1", name = "Test component 1", description = "The test component 1", diff --git a/test_app/main/test_script.c b/test_app/main/test_script.c index acf8d5a..d24b899 100644 --- a/test_app/main/test_script.c +++ b/test_app/main/test_script.c @@ -43,7 +43,8 @@ TEST_SETUP(script) luaL_openlibs(L); - l_component_register(L); + luaL_requiref(L, "component", luaopen_component, 1); + lua_pop(L, 1); luaL_requiref(L, "evse", luaopen_evse, 1); lua_pop(L, 1); diff --git a/test_app/requirements.txt b/test_app/requirements.txt index 94adb10..23856a3 100644 --- a/test_app/requirements.txt +++ b/test_app/requirements.txt @@ -2,7 +2,7 @@ bitarray==2.9.2 bitstring==4.1.4 cffi==1.16.0 colorama==0.4.6 -cryptography==43.0.1 +cryptography==41.0.7 ecdsa==0.18.0 esp-idf-panic-decoder==1.0.1 esptool==4.7.0