diff --git a/CMakeLists.txt b/CMakeLists.txt index 129d9c3c..4fee3b5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,9 +55,6 @@ if(ENABLE_UNIT_TESTING) # Run generate_lib_iec60730 include(generate_lib_iec60730) -<<<<<<< HEAD -generate_lib_iec60730(gecko_sdk) -======= generate_lib_iec60730(${SDK_CMAKE_RELATIVE_DIR}) get_target_property(MAIN_CFLAGS_LIB_IEC60730 slc_lib_iec60730 COMPILE_OPTIONS) string(REPLACE "$<$:SHELL:-imacros sl_gcc_preinclude.h>;" "" MAIN_CFLAGS_LIB_IEC60730 "${MAIN_CFLAGS_LIB_IEC60730}") @@ -65,8 +62,4 @@ string(REPLACE "$<$:SHELL:-imacros sl_gcc_preinclude.h>;" string(REPLACE "$<$:SHELL:-imacros sl_gcc_preinclude.h>;" "" MAIN_CFLAGS_LIB_IEC60730 "${MAIN_CFLAGS_LIB_IEC60730}") target_compile_options(unity PUBLIC ${MAIN_CFLAGS_LIB_IEC60730}) ->>>>>>> bc931c0277996d2249b12498620c427bb84a0dae - -endif() - - +endif() \ No newline at end of file diff --git a/cmake/generate_iostream_usart.cmake b/cmake/generate_iostream_usart.cmake new file mode 100644 index 00000000..2798f64d --- /dev/null +++ b/cmake/generate_iostream_usart.cmake @@ -0,0 +1,18 @@ +function(generate_iostream_usart relative_dir) + + set(FULL_DIR ${CMAKE_SOURCE_DIR}/${relative_dir}) + + execute_process(COMMAND make prepare + WORKING_DIRECTORY ${FULL_DIR}) + + execute_process(COMMAND slc generate -p + ${FULL_DIR} -np -d ${FULL_DIR}/src -cpsdk -name=iostream_usart -o cmake --with ${BOARD_NAME} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) + + if (EXISTS ${FULL_DIR}/CMakeLists.txt) + message("-- Path have CMake File: ${FULL_DIR}/CMakeLists.txt") + add_subdirectory(${FULL_DIR}) + else() + message("-- Path don't have CMake File: ${FULL_DIR}") + endif() +endfunction(generate_iostream_usart) \ No newline at end of file diff --git a/docs/html/EFR32_ICE60730_Libraries/globals.html b/docs/html/EFR32_ICE60730_Libraries/globals.html index 69fccc27..8a82a15b 100644 --- a/docs/html/EFR32_ICE60730_Libraries/globals.html +++ b/docs/html/EFR32_ICE60730_Libraries/globals.html @@ -379,7 +379,6 @@

- i -

  • iec60730_WatchdogValid : sl_iec60730_watchdog.h
  • -<<<<<<< HEAD:docs/html/EFR32_ICE60730_Libraries/globals.html
  • SL_IEC60730_IMC_CRC_BUFFER_SAMPLE_TEST : sl_iec60730.h
  • @@ -391,19 +390,6 @@

    - i -

    • SL_IEC60730_IMC_DATA_READ_BYTE_REVERSED : sl_iec60730.h -======= -
    • IMC_CRCBUFFER_SAMPLETEST -: iec60730.h -
    • -
    • IMC_DATA_READ -: iec60730.h -
    • -
    • IMC_DATA_READ_BIT_REVERSED -: iec60730.h -
    • -
    • IMC_DATA_READ_BYTE_REVERSED -: iec60730.h ->>>>>>> develop:Doc/html/EFR32_ICE60730_Libraries/globals.html
    • INV_CLASSB_PVAR : sl_iec60730.h diff --git a/docs/html/EFR32_ICE60730_Libraries/globals_defs.html b/docs/html/EFR32_ICE60730_Libraries/globals_defs.html index 241afb17..eaaa2383 100644 --- a/docs/html/EFR32_ICE60730_Libraries/globals_defs.html +++ b/docs/html/EFR32_ICE60730_Libraries/globals_defs.html @@ -175,13 +175,8 @@

      - i -

      • IEC60730_VMC_COMPLETE : sl_iec60730.h
      • -<<<<<<< HEAD:docs/html/EFR32_ICE60730_Libraries/globals_defs.html
      • SL_IEC60730_IMC_CRC_BUFFER_SAMPLE_TEST : sl_iec60730.h -======= -
      • IMC_CRCBUFFER_SAMPLETEST -: iec60730.h ->>>>>>> develop:Doc/html/EFR32_ICE60730_Libraries/globals_defs.html
      • INV_CLASSB_PVAR : sl_iec60730.h diff --git a/docs/html/EFR32_ICE60730_Libraries/globals_eval.html b/docs/html/EFR32_ICE60730_Libraries/globals_eval.html index 1b27eb60..2782328c 100644 --- a/docs/html/EFR32_ICE60730_Libraries/globals_eval.html +++ b/docs/html/EFR32_ICE60730_Libraries/globals_eval.html @@ -169,7 +169,6 @@

        - i -

        • iec60730_WatchdogValid : sl_iec60730_watchdog.h
        • -<<<<<<< HEAD:docs/html/EFR32_ICE60730_Libraries/globals_eval.html
        • SL_IEC60730_IMC_DATA_READ : sl_iec60730.h
        • @@ -178,16 +177,6 @@

          - i -

          • SL_IEC60730_IMC_DATA_READ_BYTE_REVERSED : sl_iec60730.h -======= -
          • IMC_DATA_READ -: iec60730.h -
          • -
          • IMC_DATA_READ_BIT_REVERSED -: iec60730.h -
          • -
          • IMC_DATA_READ_BYTE_REVERSED -: iec60730.h ->>>>>>> develop:Doc/html/EFR32_ICE60730_Libraries/globals_eval.html
          diff --git a/docs/html/EFR32_ICE60730_Libraries/search/all_9.js b/docs/html/EFR32_ICE60730_Libraries/search/all_9.js index 09f33e4f..66233dd8 100644 --- a/docs/html/EFR32_ICE60730_Libraries/search/all_9.js +++ b/docs/html/EFR32_ICE60730_Libraries/search/all_9.js @@ -113,17 +113,10 @@ var searchData= ['iec60730_5fwatchdogtesting_149',['iec60730_WatchdogTesting',['../group__IEC60730__WDOG__Test.html#ggaece8bdb434f4c8bafba3590467815044a5d9a9cd963dc0a0bbccd807d674bffe9',1,'sl_iec60730_watchdog.h']]], ['iec60730_5fwatchdogvalid_150',['iec60730_WatchdogValid',['../group__IEC60730__WDOG__Test.html#ggaece8bdb434f4c8bafba3590467815044a7f643e2fc022bee4149c82ec9c42f3ef',1,'sl_iec60730_watchdog.h']]], ['iec60730testbase_151',['iec60730TestBase',['../classiec60730__test__base_1_1iec60730TestBase.html',1,'iec60730_test_base']]], -<<<<<<< HEAD:docs/html/EFR32_ICE60730_Libraries/search/all_9.js ['imc_5fcrcbuffer_5fsampletest_152',['SL_IEC60730_IMC_CRC_BUFFER_SAMPLE_TEST',['../group__IEC60730__INVARIABLE__MEMORY__Test.html#ga558de50fe1c89a1afb8292d2ee4346da',1,'sl_iec60730.h']]], ['imc_5fdata_5fread_153',['SL_IEC60730_IMC_DATA_READ',['../group__IEC60730__INVARIABLE__MEMORY__Test.html#gga06fc87d81c62e9abb8790b6e5713c55ba81e9d30c093158a799c13cf1d42df28a',1,'sl_iec60730.h']]], ['imc_5fdata_5fread_5fbit_5freversed_154',['SL_IEC60730_IMC_DATA_READ_BIT_REVERSED',['../group__IEC60730__INVARIABLE__MEMORY__Test.html#gga06fc87d81c62e9abb8790b6e5713c55ba14b98b0e584e8059ab9e3990ffe8e149',1,'sl_iec60730.h']]], ['imc_5fdata_5fread_5fbyte_5freversed_155',['SL_IEC60730_IMC_DATA_READ_BYTE_REVERSED',['../group__IEC60730__INVARIABLE__MEMORY__Test.html#gga06fc87d81c62e9abb8790b6e5713c55ba641228c714e8ef6fb667f3ee76761f22',1,'sl_iec60730.h']]], -======= - ['imc_5fcrcbuffer_5fsampletest_152',['IMC_CRCBUFFER_SAMPLETEST',['../group__IEC60730__INVARIABLE__MEMORY__Test.html#ga558de50fe1c89a1afb8292d2ee4346da',1,'iec60730.h']]], - ['imc_5fdata_5fread_153',['IMC_DATA_READ',['../group__IEC60730__INVARIABLE__MEMORY__Test.html#gga06fc87d81c62e9abb8790b6e5713c55ba81e9d30c093158a799c13cf1d42df28a',1,'iec60730.h']]], - ['imc_5fdata_5fread_5fbit_5freversed_154',['IMC_DATA_READ_BIT_REVERSED',['../group__IEC60730__INVARIABLE__MEMORY__Test.html#gga06fc87d81c62e9abb8790b6e5713c55ba14b98b0e584e8059ab9e3990ffe8e149',1,'iec60730.h']]], - ['imc_5fdata_5fread_5fbyte_5freversed_155',['IMC_DATA_READ_BYTE_REVERSED',['../group__IEC60730__INVARIABLE__MEMORY__Test.html#gga06fc87d81c62e9abb8790b6e5713c55ba641228c714e8ef6fb667f3ee76761f22',1,'iec60730.h']]], ->>>>>>> develop:Doc/html/EFR32_ICE60730_Libraries/search/all_9.js ['imcparams_5ft_156',['imcParams_t',['../structimcParams__t.html',1,'']]], ['init_157',['init',['../structupdateCrcParams__t.html#abcc7407def14860e8e7937ca993327cb',1,'updateCrcParams_t']]], ['inv_5fclassb_5fpvar_158',['INV_CLASSB_PVAR',['../group__IEC60730__POST.html#ga5e516d9dd091357c8ecb7ba3c10c7f9b',1,'sl_iec60730.h']]], diff --git a/docs/html/EFR32_ICE60730_Libraries/search/enumvalues_0.js b/docs/html/EFR32_ICE60730_Libraries/search/enumvalues_0.js index b7ca7363..b4b6ed3e 100644 --- a/docs/html/EFR32_ICE60730_Libraries/search/enumvalues_0.js +++ b/docs/html/EFR32_ICE60730_Libraries/search/enumvalues_0.js @@ -1,6 +1,5 @@ var searchData= [ -<<<<<<< HEAD:docs/html/EFR32_ICE60730_Libraries/search/enumvalues_0.js ['iec60730_5fanalogfail_525',['iec60730_AnalogFail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023a20099345d848be169d47f829ae6a0336',1,'sl_iec60730.h']]], ['iec60730_5fclockfail_526',['iec60730_ClockFail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023ad003937e7ee5395df23045f964f3749c',1,'sl_iec60730.h']]], ['iec60730_5fcpuregistersfail_527',['iec60730_CpuRegistersFail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023af5015ade87ec06e17e02167377e10e3e',1,'sl_iec60730.h']]], @@ -39,44 +38,4 @@ var searchData= ['imc_5fdata_5fread_560',['SL_IEC60730_IMC_DATA_READ',['../group__IEC60730__INVARIABLE__MEMORY__Test.html#gga06fc87d81c62e9abb8790b6e5713c55ba81e9d30c093158a799c13cf1d42df28a',1,'sl_iec60730.h']]], ['imc_5fdata_5fread_5fbit_5freversed_561',['SL_IEC60730_IMC_DATA_READ_BIT_REVERSED',['../group__IEC60730__INVARIABLE__MEMORY__Test.html#gga06fc87d81c62e9abb8790b6e5713c55ba14b98b0e584e8059ab9e3990ffe8e149',1,'sl_iec60730.h']]], ['imc_5fdata_5fread_5fbyte_5freversed_562',['SL_IEC60730_IMC_DATA_READ_BYTE_REVERSED',['../group__IEC60730__INVARIABLE__MEMORY__Test.html#gga06fc87d81c62e9abb8790b6e5713c55ba641228c714e8ef6fb667f3ee76761f22',1,'sl_iec60730.h']]] -======= - ['iec60730_5fanalogfail_525',['iec60730_AnalogFail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023a20099345d848be169d47f829ae6a0336',1,'iec60730.h']]], - ['iec60730_5fclockfail_526',['iec60730_ClockFail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023ad003937e7ee5395df23045f964f3749c',1,'iec60730.h']]], - ['iec60730_5fcpuregistersfail_527',['iec60730_CpuRegistersFail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023af5015ade87ec06e17e02167377e10e3e',1,'iec60730.h']]], - ['iec60730_5fcs0fail_528',['iec60730_Cs0Fail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023ae13ecaf8f999311eeab49158b67bf6ed',1,'iec60730.h']]], - ['iec60730_5feuart0fail_529',['iec60730_Euart0Fail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023afb8e8e8231785b81e00711b3fe84fab6',1,'iec60730.h']]], - ['iec60730_5fgpiofail_530',['iec60730_GpioFail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023afef1b5d3f282d2caea3db8d9fb8cee3d',1,'iec60730.h']]], - ['iec60730_5fi2c0fail_531',['iec60730_I2C0Fail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023a04b440e5e7bd688fab1a429ef6e46972',1,'iec60730.h']]], - ['iec60730_5fi2c1fail_532',['iec60730_I2C1Fail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023ac82d6bf3316e7aa84fabec0e68f33c3d',1,'iec60730.h']]], - ['iec60730_5fimcfail_533',['iec60730_IMCFail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023a00fa8cb85279e95b80245257295d1eb4',1,'iec60730.h']]], - ['iec60730_5finterruptfail_534',['iec60730_InterruptFail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023ad57c493440d16f911ef6c0fdfe03db3d',1,'iec60730.h']]], - ['iec60730_5flesense0fail_535',['iec60730_LeSense0Fail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023ac87264cca086949be9c9aa9daea6b0a9',1,'iec60730.h']]], - ['iec60730_5fleuart0fail_536',['iec60730_LeUart0Fail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023ada4e6b4f9c673b0d3c806faf59fe6fa8',1,'iec60730.h']]], - ['iec60730_5fnofailure_537',['iec60730_NoFailure',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023a7afc614dedb7ebd805585fab8a83dda8',1,'iec60730.h']]], - ['iec60730_5foemfail_5f1_538',['iec60730_OEMFail_1',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023a7c05b7386df07953405727367f758f5c',1,'iec60730.h']]], - ['iec60730_5foemfail_5f2_539',['iec60730_OEMFail_2',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023a1722b60782680dfc96a7483bf840e1cf',1,'iec60730.h']]], - ['iec60730_5foemfail_5f3_540',['iec60730_OEMFail_3',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023a4a75cdefcb04ee50969580efe5bcef75',1,'iec60730.h']]], - ['iec60730_5foemfail_5f4_541',['iec60730_OEMFail_4',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023a6809805b6bbebc7280405b5d0a59f4c1',1,'iec60730.h']]], - ['iec60730_5fpdm0fail_542',['iec60730_Pdm0Fail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023a88f37f65231d879973c84ef81a10f843',1,'iec60730.h']]], - ['iec60730_5fprogrammecounterfail_543',['iec60730_ProgrammeCounterFail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023a8f2d4992410253abe701c4d543937f6b',1,'iec60730.h']]], - ['iec60730_5fradiofail_544',['iec60730_RadioFail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023a8519cb420d2b3566c90c464d1dd98704',1,'iec60730.h']]], - ['iec60730_5ftestfailed_545',['iec60730_TestFailed',['../group__IEC60730__POST.html#gga15a78a582ee2ef5999615f3a64d26741a26db973cd4fdebd964685ce701486450',1,'iec60730.h']]], - ['iec60730_5ftestinprogress_546',['iec60730_TestInProgress',['../group__IEC60730__POST.html#gga15a78a582ee2ef5999615f3a64d26741a60b3c9c488facdb917c35ffca92960f9',1,'iec60730.h']]], - ['iec60730_5ftestpassed_547',['iec60730_TestPassed',['../group__IEC60730__POST.html#gga15a78a582ee2ef5999615f3a64d26741a6796830621fbae14b5c78b4a36af1b84',1,'iec60730.h']]], - ['iec60730_5ftestverify_548',['iec60730_TestVerify',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023a2dfe01a597b96f83096e9667eb51617c',1,'iec60730.h']]], - ['iec60730_5ftimertestdisable_549',['iec60730_TimerTestDisable',['../group__IEC60730__SYSTEM__CLOCK__Test.html#gga5d9503d6c07fff2f4cf1ace3cb59c989a0ca88c5af3c7f609332ca92e279a3db1',1,'iec60730.h']]], - ['iec60730_5ftimertestenable_550',['iec60730_TimerTestEnable',['../group__IEC60730__SYSTEM__CLOCK__Test.html#gga5d9503d6c07fff2f4cf1ace3cb59c989a047379c994d751fca75b338a81569d74',1,'iec60730.h']]], - ['iec60730_5fusart0fail_551',['iec60730_Usart0Fail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023a7a06d9691ab6362b3b9e1c520c66acdf',1,'iec60730.h']]], - ['iec60730_5fusart1fail_552',['iec60730_Usart1Fail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023ab7190b1b31e1dd7e364e8a4b5910a9db',1,'iec60730.h']]], - ['iec60730_5fusart2fail_553',['iec60730_Usart2Fail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023a11b62da15bc0da8e734f3a8b932d5c53',1,'iec60730.h']]], - ['iec60730_5fusart3fail_554',['iec60730_Usart3Fail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023a96d303448c3808f6980700ffd24b93a9',1,'iec60730.h']]], - ['iec60730_5fvmcfail_555',['iec60730_VMCFail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023ac4a9584420d98b8a3ea0846ac5b40f82',1,'iec60730.h']]], - ['iec60730_5fwatchdoginvalid_556',['iec60730_WatchdogInvalid',['../group__IEC60730__WDOG__Test.html#ggaece8bdb434f4c8bafba3590467815044a3dbff590e48b57859ec08cfff6c6812b',1,'iec60730_watchdog.h']]], - ['iec60730_5fwatchdogpostfail_557',['iec60730_WatchdogPostFail',['../group__IEC60730__POST.html#ggab423b676af8982b70e767164f1574023a25dd32462cffeb3067f286e07f87c27d',1,'iec60730.h']]], - ['iec60730_5fwatchdogtesting_558',['iec60730_WatchdogTesting',['../group__IEC60730__WDOG__Test.html#ggaece8bdb434f4c8bafba3590467815044a5d9a9cd963dc0a0bbccd807d674bffe9',1,'iec60730_watchdog.h']]], - ['iec60730_5fwatchdogvalid_559',['iec60730_WatchdogValid',['../group__IEC60730__WDOG__Test.html#ggaece8bdb434f4c8bafba3590467815044a7f643e2fc022bee4149c82ec9c42f3ef',1,'iec60730_watchdog.h']]], - ['imc_5fdata_5fread_560',['IMC_DATA_READ',['../group__IEC60730__INVARIABLE__MEMORY__Test.html#gga06fc87d81c62e9abb8790b6e5713c55ba81e9d30c093158a799c13cf1d42df28a',1,'iec60730.h']]], - ['imc_5fdata_5fread_5fbit_5freversed_561',['IMC_DATA_READ_BIT_REVERSED',['../group__IEC60730__INVARIABLE__MEMORY__Test.html#gga06fc87d81c62e9abb8790b6e5713c55ba14b98b0e584e8059ab9e3990ffe8e149',1,'iec60730.h']]], - ['imc_5fdata_5fread_5fbyte_5freversed_562',['IMC_DATA_READ_BYTE_REVERSED',['../group__IEC60730__INVARIABLE__MEMORY__Test.html#gga06fc87d81c62e9abb8790b6e5713c55ba641228c714e8ef6fb667f3ee76761f22',1,'iec60730.h']]] ->>>>>>> develop:Doc/html/EFR32_ICE60730_Libraries/search/enumvalues_0.js ]; diff --git a/gecko_sdk/lib_iec60730.slcp b/gecko_sdk/lib_iec60730.slcp index 4d7b3276..3277ecca 100644 --- a/gecko_sdk/lib_iec60730.slcp +++ b/gecko_sdk/lib_iec60730.slcp @@ -1,9 +1,9 @@ project_name: lib_iec60730 package: iec60730 quality: test -label: Souce code lib IEC60730 for unit test +label: Source code lib IEC60730 for unit test description: > - Souce code lib IEC60730 for unit test. + Source code lib IEC60730 for unit test. category: Example|iec60730 sdk: {id: gecko_sdk, version: 4.4.2} @@ -29,11 +29,7 @@ component: from: iec60730 configuration: - name: SL_BOARD_ENABLE_VCOM -<<<<<<< HEAD - value: 1 -======= value: 0 ->>>>>>> bc931c0277996d2249b12498620c427bb84a0dae - name: SL_IOSTREAM_USART_VCOM_CONVERT_BY_DEFAULT_LF_TO_CRLF value: 1 - name: SL_IOSTREAM_USART_VCOM_RX_BUFFER_SIZE @@ -41,9 +37,6 @@ configuration: - name: SL_DEVICE_INIT_HFRCO_BAND value: cmuHFRCOFreq_19M0Hz condition: -<<<<<<< HEAD - - device_series_1 -======= - device_series_1 - name: SL_IEC60730_IRQ_STATUS_ENABLE value: 1 @@ -51,7 +44,6 @@ configuration: value: 1 - name: SL_IEC60730_CRC_DEBUG_ENABLE value: 0 ->>>>>>> bc931c0277996d2249b12498620c427bb84a0dae toolchain_settings: - option: linkerfile value: autogen/linkerfile_iec60730.ld @@ -64,4 +56,4 @@ toolchain_settings: - option: iar_linker_option value: "--keep __checksum --place_holder __checksum,2,.checksum,64" condition: - - toolchain_iar + - toolchain_iar \ No newline at end of file diff --git a/test/test_script/iec60730_get_report_unit_test.py b/test/test_script/iec60730_get_report_unit_test.py index d1efa652..852f41f0 100644 --- a/test/test_script/iec60730_get_report_unit_test.py +++ b/test/test_script/iec60730_get_report_unit_test.py @@ -66,7 +66,7 @@ def get_report_unit_test(result,file_test_case,log_report): list_test_case = get_test_case(file_test_case,logger,unity_begin_row,unity_end_row) if len(list_test_case) != len(result): - raise ValueError("The list of test cases " + str(len(list_test_case)) + " in the file" + raise ValueError("The list of test cases " + str(len(list_test_case)) + " in the file" + file_test + " is not equal " + str(len(result)) + " test cases" " results received from device") @@ -84,4 +84,3 @@ def get_report_unit_test(result,file_test_case,log_report): logger.info("FAIL") else: logger.info("PASS") - diff --git a/test/test_script/unit_test_iec60730_module_demo.py b/test/test_script/unit_test_iec60730_module_demo.py new file mode 100644 index 00000000..25ba36d5 --- /dev/null +++ b/test/test_script/unit_test_iec60730_module_demo.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python +# License +# Copyright 2021 Silicon Laboratories Inc. www.silabs.com +# ******************************************************************************* +# +# The licensor of this software is Silicon Laboratories Inc. Your use of this +# software is governed by the terms of Silicon Labs Master Software License +# Agreement (MSLA) available at +# www.silabs.com/about-us/legal/master-software-license-agreement. This +# software is distributed to you in Source Code format and is governed by the +# sections of the MSLA applicable to Source Code. +# ******************************************************************************* + +from binascii import hexlify +import random +import os +import sys +from time import sleep + +from iec60730_get_report_unit_test import * +from iec60730_test_base import * +import jlink, jlink_constants +import unittest +import enums + +def int_to_bytes(number: int) -> bytes: + return number.to_bytes(length=(8 + (number + (number < 0)).bit_length()) // 8, byteorder='big', signed=True) + + +## IEC60730 get unit test result +# +# @details This class runs IEC60730 get unit test results +# +# Hardware setup: +# Connect DUT to PC. No additional hardware setup required. + +class iec60730_unit_test_result(unittest.TestCase, iec60730TestBase): + + def get_unit_test_result(self): + def get_result(self): + self.adapter.halt() + self.adapter.clear_all_breakpoints() + + self.adapter.set_breakpoint(address = asm_labels['IEC60730_UNIT_TEST_END'], + typeflags=enums.JLinkBreakpoint.ANY) + + self.adapter.reset() + pc = self.adapter.run_to_breakpoint(3) + logging.info("Halted at label: " + self.get_label(pc)) + self.assertEqual(pc, asm_labels['IEC60730_UNIT_TEST_END'],\ + "DUT failed to stop at IEC60730_UNIT_TEST_END" \ + " , pc = " + hex(pc)) + #logging.info("Halted at label: " + self.get_label(pc)) + current_test_numth = variables['current_test_numth'] + self.assertNotEqual(0, current_test_numth,\ + "Can not read current_test_numth address") + reg = self.adapter.memory_read8(current_test_numth, 1, zone=None) + + current_test_numth = variables['current_test_numth'] + self.assertNotEqual(0, current_test_numth,\ + "Can not read current_test_numth address") + current_test_numth = self.adapter.memory_read8(current_test_numth, 1, zone=None) + + test_case_result = variables['test_case_result'] + self.assertNotEqual(0, test_case_result,\ + "Can not read test_case_result address") + result = self.adapter.memory_read(test_case_result,current_test_numth[0]) + return result + def connect_device(self): + self.pre_exec_test() + logging.info("----------------- Start get unit test result") + result = get_result(self) + logging.info("Get unit test result: Done. See unit_test_report.log") + logging.info("----------------- End get unit test result") + self.post_exec_test() + file_test_case = "../unit_test/src/test_iec60730_module_demo.c" + log_report = '../../log/unit_test_iec60730_module_demo.log' + get_report_unit_test(result,file_test_case,log_report) + return connect_device(self) + + + +if __name__ == "__main__": + + chip_name = os.getenv('CHIP') + + app_type = os.getenv('APP_TYPE') + + lst_file_path = os.getenv('LST_PATH') + + adapter_serial_no = os.getenv('ADAPTER_SN') + + lib_path = os.getenv('JLINK_PATH') + + while len(sys.argv) > 1: + line = sys.argv.pop() + if len(sys.argv) == 1: + compiler = line + + print("Compiler: "+compiler) + + iec60730_unit_test_result = iec60730_unit_test_result() + iec60730_unit_test_result.env_setup(adapter_serial_no, + chip_name, + lst_file_path, + lib_path, + app_type, + compiler) + iec60730_unit_test_result.get_unit_test_result() + +## @} +# @} diff --git a/test/unit_test/inc/test_common.h b/test/unit_test/inc/test_common.h new file mode 100644 index 00000000..b12c103a --- /dev/null +++ b/test/unit_test/inc/test_common.h @@ -0,0 +1,34 @@ +/***************************************************************************//** + * @file + * @brief common unit test api + ******************************************************************************* + * # License + * Copyright 2020 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + ******************************************************************************/ + +#ifndef _TEST_COMMON_H +#define _TEST_COMMON_H + +#include +#include +#include "unity.h" + +/*=======Result test case=====*/ +#define MAX_NUMBER_OF_TEST_CASE 20 + +extern uint8_t test_case_result[MAX_NUMBER_OF_TEST_CASE]; +extern uint8_t current_test_numth; + +/*=======Test Runner Used To Run Each Test=====*/ +extern void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE line_num); + +#endif // _TEST_COMMON_H diff --git a/test/unit_test/src/app.c b/test/unit_test/src/app.c index 001c4881..4282b490 100644 --- a/test/unit_test/src/app.c +++ b/test/unit_test/src/app.c @@ -42,4 +42,4 @@ void app_init(void) void app_process_action(void) { -} +} \ No newline at end of file diff --git a/test/unit_test/src/test_common.c b/test/unit_test/src/test_common.c new file mode 100644 index 00000000..98f95d74 --- /dev/null +++ b/test/unit_test/src/test_common.c @@ -0,0 +1,80 @@ +/***************************************************************************//** + * @file + * @brief common unit test api + ******************************************************************************* + * # License + * Copyright 2020 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * The licensor of this software is Silicon Laboratories Inc. Your use of this + * software is governed by the terms of Silicon Labs Master Software License + * Agreement (MSLA) available at + * www.silabs.com/about-us/legal/master-software-license-agreement. This + * software is distributed to you in Source Code format and is governed by the + * sections of the MSLA applicable to Source Code. + * + ******************************************************************************/ + +#include "test_common.h" + +/*=======Result test case=====*/ + +uint8_t test_case_result[MAX_NUMBER_OF_TEST_CASE]; +uint8_t current_test_numth; + +/*=======Mock Management=====*/ +static void CMock_Init(void) +{ +} +static void CMock_Verify(void) +{ +} +static void CMock_Destroy(void) +{ +} +/*=======Test Reset Options=====*/ +void resetTest(void); +void resetTest(void) +{ + tearDown(); + CMock_Verify(); + CMock_Destroy(); + CMock_Init(); + setUp(); +} +void verifyTest(void); +void verifyTest(void) +{ + CMock_Verify(); +} +/*=======Test Runner Used To Run Each Test=====*/ +void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE line_num) +{ + Unity.CurrentTestName = name; + Unity.CurrentTestLineNumber = line_num; +#ifdef UNITY_USE_COMMAND_LINE_ARGS + if (!UnityTestMatches()) + return; +#endif + Unity.NumberOfTests++; + UNITY_CLR_DETAILS(); + UNITY_EXEC_TIME_START(); + CMock_Init(); + if (TEST_PROTECT()) + { + setUp(); + func(); + } + if (TEST_PROTECT()) + { + tearDown(); + CMock_Verify(); + } + CMock_Destroy(); + UNITY_EXEC_TIME_STOP(); + + test_case_result[current_test_numth++] = Unity.CurrentTestFailed; + + UnityConcludeTest(); +} +