添加数字钱包库测试程序
authorSnickerSun <snickersun@163.com>
Fri, 13 Sep 2024 09:50:08 +0000 (17:50 +0800)
committerSnickerSun <snickersun@163.com>
Fri, 13 Sep 2024 09:50:08 +0000 (17:50 +0800)
code/sdk/build/config/target_config/brandy/config.py
code/sdk/drivers/peripheral/CMakeLists.txt
code/sdk/drivers/peripheral/entest/CMakeLists.txt [new file with mode: 0644]
code/sdk/drivers/peripheral/entest/Lib/libleancrypto.a [new file with mode: 0644]
code/sdk/drivers/peripheral/entest/Lib/libleancrypto.h [new file with mode: 0644]
code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c

index 8d7da27..f8339ce 100755 (executable)
@@ -146,6 +146,7 @@ target = {
                     #'CYWEE_MAC_ACTIVE',
                     'SUPPORT_TCPIP',                                   
                     'SUPPORT_HID_SERVICE',
+                    #'LEANTEST',
                     'SUPPORT_BAIDU_MAP'
                     ],
         'ram_component': ["algorithm", "dfx_port_brandy", "dfx_update", 'dfx_nv', "osal", "arch_port", "-:testsuite",
@@ -183,6 +184,7 @@ target = {
                            "bleservice",
                            "blemoder",
                            "factorytest_service",
+                           #"leantest",
                            "hid_service"
                                                  ],
         'ram_component_set': ['bgh', 'media', 'gpu', 'graphic_uikit', 'bgh_audio', 'dfx_set', 'ohos_set', 'wearable_set', 'alipay_set'],
index 9a046ad..71a5095 100644 (file)
@@ -19,3 +19,4 @@ add_subdirectory_if_exist(rotary_encoder)
 add_subdirectory_if_exist(vibrator/service)
 add_subdirectory_if_exist(cywee)
 add_subdirectory_if_exist(a5133)
+add_subdirectory_if_exist(entest)
diff --git a/code/sdk/drivers/peripheral/entest/CMakeLists.txt b/code/sdk/drivers/peripheral/entest/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e7cd398
--- /dev/null
@@ -0,0 +1,41 @@
+#===============================================================================
+# @brief    cmake file
+# Copyright (c) @CompanyNameMagicTag 2022-2023. All rights reserved.
+#===============================================================================
+set(COMPONENT_NAME "leantest")
+
+set(SOURCES    
+)
+set(PUBLIC_HEADER
+)
+set(PRIVATE_HEADER
+)
+
+set(PRIVATE_DEFINES
+)
+
+set(PUBLIC_DEFINES
+)
+
+# use this when you want to add ccflags like -include xxx
+set(COMPONENT_PUBLIC_CCFLAGS
+)
+
+set(COMPONENT_CCFLAGS
+
+)
+
+set(WHOLE_LINK
+    true
+)
+
+set(MAIN_COMPONENT
+    false
+)
+
+if("LEANTEST" IN_LIST DEFINES)
+    find_library(LIB_PATH_LEAN_LIB Lib/libleancrypto.a ${CMAKE_CURRENT_SOURCE_DIR})
+    target_link_libraries(${TARGET_NAME} PRIVATE -Wl,--whole-archive ${LIB_PATH_LEAN_LIB} PRIVATE -Wl,--whole-archive)
+endif()
+
+build_component()
diff --git a/code/sdk/drivers/peripheral/entest/Lib/libleancrypto.a b/code/sdk/drivers/peripheral/entest/Lib/libleancrypto.a
new file mode 100644 (file)
index 0000000..9d51ec7
Binary files /dev/null and b/code/sdk/drivers/peripheral/entest/Lib/libleancrypto.a differ
diff --git a/code/sdk/drivers/peripheral/entest/Lib/libleancrypto.h b/code/sdk/drivers/peripheral/entest/Lib/libleancrypto.h
new file mode 100644 (file)
index 0000000..f81aa3e
--- /dev/null
@@ -0,0 +1,3 @@
+int kmac_tester(void);\r
+\r
+int sha3_256_tester(void);
\ No newline at end of file
index 7c5b699..e3de55a 100644 (file)
@@ -1220,6 +1220,38 @@ static uint32_t custom_resfiles_checksum(uint8_t *para, uint32_t paraLen, char *
     resfile_checksum_thread();
     return ERRCODE_SUCC;
 }
+
+static uint32_t leantest(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+{
+
+    UNUSED(strCommonCmd);
+    uint8_t argv[CUSTOM_UTILS_MAX_ARGC][CUSTOM_UTILS_MAX_ARGV_LEN] = { 0 };
+    uint32_t argc = 0;
+    uint8_t send_data[8] = {0};
+
+
+    int ret = ConvertCmdToParam(para, paraLen, argv, &argc);
+    if (ret != CUSTOM_UTILS_SUCCESS) {
+        wstp_print("CUSTOM_UTILSTEST ATCMD Convert Command Failed\n");
+        return ERRCODE_FAIL;
+    }
+
+    if (argc != 1) {
+        wstp_print("CUSTOM_UTILSTEST power_test ATCMD Set Parameter Failed argc %d\r\nPM_DSP_POWER_UP_AND_RUN=2  PM_DSP_POWER_OFF=3\r\n",argc);
+        return ERRCODE_FAIL;
+    }
+
+    uint8_t test1 = atol((char*)argv[0]);
+    if (test1 == 1)
+    {
+        kmac_tester();
+    }else if (test1==2)
+    {
+        sha3_256_tester();
+    }
+  
+    return ERRCODE_SUCC;
+}
 static const at_cmd_table_t g_custom_utils_cmd[] = {
     { (char *)"AT^CUSTOM_SN",      custom_utils_setsn, (char *)"123456789ABCDEF2345678" },
     { (char *)"AT^CUSTOM_SN_REQ",  custom_utils_getsn, (char *)" " },
@@ -1300,6 +1332,7 @@ static const at_cmd_table_t g_custom_utils_cmd[] = {
     { (char *)"AT^SETVOLUME",      custom_volume_test, (char *)" " },
     { (char *)"AT^CYWEESAVEKEY",      custom_cywee_save_mac_key, (char *)" " },
     { (char *)"AT^RESFILECHECK",      custom_resfiles_checksum, (char *)" " },
+        { (char *)"AT^LEANTEST",      leantest, (char *)" " },
 };