From: SnickerSun Date: Fri, 13 Sep 2024 09:50:08 +0000 (+0800) Subject: 添加数字钱包库测试程序 X-Git-Tag: release_V1.2.70_20241020_135402~485^2^2~3^2~3 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=4cb03bac5e93698f0174e2b8f0f29d30fc9c45d4;p=mirrors%2FFD230.git 添加数字钱包库测试程序 --- diff --git a/code/sdk/build/config/target_config/brandy/config.py b/code/sdk/build/config/target_config/brandy/config.py index 8d7da2701..f8339ce7b 100755 --- a/code/sdk/build/config/target_config/brandy/config.py +++ b/code/sdk/build/config/target_config/brandy/config.py @@ -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'], diff --git a/code/sdk/drivers/peripheral/CMakeLists.txt b/code/sdk/drivers/peripheral/CMakeLists.txt index 9a046ad46..71a509508 100644 --- a/code/sdk/drivers/peripheral/CMakeLists.txt +++ b/code/sdk/drivers/peripheral/CMakeLists.txt @@ -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 index 000000000..e7cd39850 --- /dev/null +++ b/code/sdk/drivers/peripheral/entest/CMakeLists.txt @@ -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 index 000000000..9d51ec73e 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 index 000000000..f81aa3e0f --- /dev/null +++ b/code/sdk/drivers/peripheral/entest/Lib/libleancrypto.h @@ -0,0 +1,3 @@ +int kmac_tester(void); + +int sha3_256_tester(void); \ No newline at end of file diff --git a/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c b/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c index 7c5b6990d..e3de55a1c 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c @@ -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 *)" " }, };