Skip to content

Commit

Permalink
Add update documents
Browse files Browse the repository at this point in the history
  • Loading branch information
silabs-hieuhoang committed Nov 5, 2024
1 parent ad809c7 commit ded9f89
Show file tree
Hide file tree
Showing 890 changed files with 67,377 additions and 8,125 deletions.
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
*.json
GNU ARM */
Build
Test/test_script/__pycache__
Doc/html/EFR32_ICE60730_Libraries/latex
build
test/test_script/__pycache__
*.temp-stream*
gecko_sdk/src/*
!gecko_sdk/src/CMakeLists.txt
cmake_build
simplicity_sdk/src/*
!simplicity_sdk/src/CMakeLists.txt
cmake_build
log/
site
16 changes: 12 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
exclude: ^(Doc/|Build/|artifact|Lib/asm|Lib/CMSIS|Lib/Device/efm32pg22|Lib/Device/efr32bg22|Lib/Device/efr32fg22|Lib/Device/efr32fg23|Lib/Device/efr32mg12p|Lib/Device/efr32mg21|Lib/Device/efr32mg22|Lib/Device/efr32mg24|Lib/Device/efr32zg23|Make|Test/test_script|Test/test_compile|Test/test_script|Test/artifact|Test/comm/emlib|Lib/inc/coding_standard.h|Releases)

exclude: ^(docs|pictures|simplicity_sdk|test/test_script|log|sample|cmake|components|lib/inc/coding_standard.h|lib/inc/silabs_license_agreement.h|lib/inc/sl_iec60730_library_documentation.h|README.md)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
Expand All @@ -13,7 +14,14 @@ repos:
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
- id: clang-format
args: [-i,--style=file:./tools/.clang-format]
- id: uncrustify
args: [-c,./tools/uncrustify.cfg,-lC,--no-backup,--replace]
- id: clang-tidy
args:
- --config-file=./tools/.clang-tidy
- --use-color
- --extra-arg=-Iusr/include
- --header-filter:'^((?!test).)*$'
- -p=./build
- id: cppcheck
args: [--language=c,--std=c99,--check-config,-DIEC_BOARD_HEADER="sl_iec60730_board.h",-DEFR32MG24_DEVICE,-D__CM33_REV,--suppress=missingInclude,--suppress=unmatchedSuppression]
args: [--language=c,--std=c99,--check-config,-DSL_IEC60730_BOARD_HEADER="sl_iec60730_board.h",--suppress=missingInclude,--suppress=unmatchedSuppression]
188 changes: 170 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION "3.25")
# Project definition
project(
IE60730_LIBRARY
VERSION 1.2.0
VERSION 2.0.0
LANGUAGES C ASM CXX
)

Expand All @@ -15,7 +15,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(LIBRARY_NAME iec60730)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
set(LIB_IEC60730_MAP "lib_iec60730.map")
set(SDK_CMAKE_RELATIVE_DIR "gecko_sdk")
set(SDK_CMAKE_RELATIVE_DIR "simplicity_sdk")
set(SDK_LIB_CMAKE_RELATIVE_DIR "${SDK_CMAKE_RELATIVE_DIR}/src/lib_iec60730_cmake")

# choose toolchain
Expand All @@ -24,19 +24,31 @@ if(DEFINED ENV{TOOL_CHAINS})
else()
set(TOOL_CHAINS "GCC")
endif()
message("-- Toolchains build: ${TOOL_CHAINS}")
message("-- [I] Toolchains build: ${TOOL_CHAINS}")

# enable unit test
option(ENABLE_UNIT_TESTING "Enable a Unit Testing Build" OFF)
# enable integration test
option(ENABLE_INTEGRATION_TESTING "Enable a Integration Testing Build" OFF)
# enable test peripherals non-secure test
option(TEST_SECURE_PERIPHERALS_ENABLE "Check non-secure peripherals" OFF)
# enable integration test watchdog 1
option(INTEGRATION_TEST_WDOG1_ENABLE "Enable integration test watchdog 1" OFF)
# disable using MarchXC algorithm
option(INTEGRATION_TEST_USE_MARCHX_DISABLE "Disable using MarchXC algorithm" OFF)
# pre-build iar tool
option(PRE_BUILD_IAR_TOOL "pre-build iar tool" OFF)
# Coding convention
option(CHECK_CODING_CONVETION_ENABLE "check coding convention" OFF)

# choose board name
option(BOARD_NAME "choose board name" brd4187c)
message("-- Board name: ${BOARD_NAME}")
message("-- [I] Board name: ${BOARD_NAME}")

#Add external libraries with Fetch Content
include(FetchContent)

if(ENABLE_UNIT_TESTING)
if(ENABLE_UNIT_TESTING AND (NOT PRE_BUILD_IAR_TOOL))
FetchContent_Declare(
unity
GIT_REPOSITORY https://github.com/ThrowTheSwitch/Unity
Expand All @@ -45,21 +57,161 @@ if(ENABLE_UNIT_TESTING)
FetchContent_MakeAvailable(unity)
endif()

add_subdirectory(lib)
add_subdirectory(test)
# Run Make file
include(makefile)
# Support calculate CRC
option(ENABLE_CAL_CRC_32 "Enable calculate crc 32" OFF)
option(ENABLE_CRC_USE_SW "Enable using software calculate CRC" OFF)
option(ENABLE_SW_CRC_TABLE "Enable software calculate CRC using table CRC" OFF)
set(OPTION_SUPPORT_TEST_IMC_MODULE "ENABLE_CAL_CRC_32 ENABLE_CRC_USE_SW ENABLE_SW_CRC_TABLE")

# Set address start calculate crc
if(DEFINED ENV{FLASH_REGIONS_TEST})
set(FLASH_REGIONS_TEST "$ENV{FLASH_REGIONS_TEST}")
else()
set(FLASH_REGIONS_TEST "0x00000000")
endif()

message("-- [I] Options to support running tests of invariable memory modules: ${OPTION_SUPPORT_TEST_IMC_MODULE}")

if(ENABLE_CAL_CRC_32)
message("-- [I] Support crc calculation for invariable memory modules: CRC-32")
else()
message("-- [I] Support crc calculation for invariable memory modules: CRC-16")
endif()

if(ENABLE_CRC_USE_SW)
message("-- [I] Enable using software to calculate CRC")
if(ENABLE_SW_CRC_TABLE)
message("-- [I] Enable software using CRC pre-defined table to calculate CRC")
else() # ENABLE_SW_CRC_TABLE
message("-- [I] Disable software using CRC pre-defined table to calculate CRC")
endif() # ENABLE_SW_CRC_TABLE
else() # ENABLE_CRC_USE_SW
message("-- [I] Enable using hardware GPCRC to calculate CRC")
endif() # ENABLE_CRC_USE_SW

if(ENABLE_UNIT_TESTING)
message("-- [I] Start address calculate crc value of flash: ${FLASH_REGIONS_TEST}")

# Run generate_lib_iec60730
include(generate_lib_iec60730)

generate_lib_iec60730(${SDK_CMAKE_RELATIVE_DIR})
get_target_property(MAIN_CFLAGS_LIB_IEC60730 slc_lib_iec60730 COMPILE_OPTIONS)
string(REPLACE "$<$<COMPILE_LANGUAGE:C>:SHELL:-imacros sl_gcc_preinclude.h>;" "" MAIN_CFLAGS_LIB_IEC60730 "${MAIN_CFLAGS_LIB_IEC60730}")
string(REPLACE "$<$<COMPILE_LANGUAGE:CXX>:SHELL:-imacros sl_gcc_preinclude.h>;" "" MAIN_CFLAGS_LIB_IEC60730 "${MAIN_CFLAGS_LIB_IEC60730}")
string(REPLACE "$<$<COMPILE_LANGUAGE:ASM>:SHELL:-imacros sl_gcc_preinclude.h>;" "" MAIN_CFLAGS_LIB_IEC60730 "${MAIN_CFLAGS_LIB_IEC60730}")
target_compile_options(unity PUBLIC
${MAIN_CFLAGS_LIB_IEC60730})
endif()
if(${TOOL_CHAINS} STREQUAL "GCC")
if(ENABLE_UNIT_TESTING)
generate_lib_iec60730(${SDK_CMAKE_RELATIVE_DIR})
get_target_property(MAIN_CFLAGS_LIB_IEC60730 slc_lib_iec60730 COMPILE_OPTIONS)
string(REPLACE "$<$<COMPILE_LANGUAGE:C>:SHELL:-imacros sl_gcc_preinclude.h>;" "" MAIN_CFLAGS_LIB_IEC60730 "${MAIN_CFLAGS_LIB_IEC60730}")
string(REPLACE "$<$<COMPILE_LANGUAGE:CXX>:SHELL:-imacros sl_gcc_preinclude.h>;" "" MAIN_CFLAGS_LIB_IEC60730 "${MAIN_CFLAGS_LIB_IEC60730}")
string(REPLACE "$<$<COMPILE_LANGUAGE:ASM>:SHELL:-imacros sl_gcc_preinclude.h>;" "" MAIN_CFLAGS_LIB_IEC60730 "${MAIN_CFLAGS_LIB_IEC60730}")
target_compile_options(unity PUBLIC
${MAIN_CFLAGS_LIB_IEC60730})

endif()

if(ENABLE_INTEGRATION_TESTING)

if(TEST_SECURE_PERIPHERALS_ENABLE)
message("-- [I] Enable integration testing check secure peripherals")
else()
message("-- [I] Enable integration testing check non-secure peripherals")
endif()

if(INTEGRATION_TEST_WDOG1_ENABLE)
message("-- [I] Watchdog 1 testing: enable")
else()
message("-- [I] Watchdog 1 testing: disable")
endif()

if(INTEGRATION_TEST_USE_MARCHX_DISABLE)
message("-- [I] Using MarchXC algorithm: disable")
else()
message("-- [I] Using MarchXC algorithm: enable ")
endif()

generate_lib_iec60730(${SDK_CMAKE_RELATIVE_DIR})
get_target_property(COMPILE_DEFINITIONS_IEC60730 slc_lib_iec60730 COMPILE_DEFINITIONS)
endif()

elseif (${TOOL_CHAINS} STREQUAL "IAR")

if(PRE_BUILD_IAR_TOOL)
generate_lib_iec60730(${SDK_CMAKE_RELATIVE_DIR})
get_target_property(MAIN_CFLAGS_LIB_IEC60730 slc_lib_iec60730 COMPILE_OPTIONS)
string(FIND "${MAIN_CFLAGS_LIB_IEC60730}" "cortex-m33" CORE_TYPE)
if(${CORE_TYPE} GREATER 0)
#message("-- [I] CORE_TYPE: cortex-m33")
set(PRE_IAR_CORE_TYPE "CORE_TYPE=m33")
else()
#message("-- [I] CORE_TYPE: cortex-m4")
set(PRE_IAR_CORE_TYPE "")
endif()

if(ENABLE_CAL_CRC_32)
set(PRE_IAR_CAL_CRC_32 "CAL_CRC_32=enable")
else()
set(PRE_IAR_CAL_CRC_32 "")
endif()

if(TEST_SECURE_PERIPHERALS_ENABLE)
set(PRE_IAR_SECURE_PERIPHERALS_ENABLE "SECURE_PERIPHERALS_ENABLE=enable")
else()
set(PRE_SECURE_PERIPHERALS_ENABLE "")
endif()

execute_process(COMMAND python3 ${CMAKE_SOURCE_DIR}/${SDK_CMAKE_RELATIVE_DIR}/pre_build_iar.py ${PRE_IAR_CORE_TYPE} ${PRE_IAR_CAL_CRC_32} ${PRE_IAR_SECURE_PERIPHERALS_ENABLE})
endif()

if(ENABLE_UNIT_TESTING)

add_subdirectory(${SDK_CMAKE_RELATIVE_DIR})
get_target_property(MAIN_CFLAGS_LIB_IEC60730 slc_lib_iec60730 COMPILE_OPTIONS)
string(REPLACE "$<$<COMPILE_LANGUAGE:C>:SHELL:-imacros sl_gcc_preinclude.h>;" "" MAIN_CFLAGS_LIB_IEC60730 "${MAIN_CFLAGS_LIB_IEC60730}")
string(REPLACE "$<$<COMPILE_LANGUAGE:CXX>:SHELL:-imacros sl_gcc_preinclude.h>;" "" MAIN_CFLAGS_LIB_IEC60730 "${MAIN_CFLAGS_LIB_IEC60730}")
string(REPLACE "$<$<COMPILE_LANGUAGE:ASM>:SHELL:-imacros sl_gcc_preinclude.h>;" "" MAIN_CFLAGS_LIB_IEC60730 "${MAIN_CFLAGS_LIB_IEC60730}")
target_compile_options(unity PUBLIC
${MAIN_CFLAGS_LIB_IEC60730})
set_property(TARGET unity PROPERTY C_STANDARD_REQUIRED OFF)

endif()

if(ENABLE_INTEGRATION_TESTING)

add_subdirectory(${SDK_CMAKE_RELATIVE_DIR})
if(TEST_SECURE_PERIPHERALS_ENABLE)
message("-- [I] Enable integration testing check secure peripherals")
else()
message("-- [I] Enable integration testing check non-secure peripherals")
endif()

if(INTEGRATION_TEST_WDOG1_ENABLE)
message("-- [I] Watchdog 1 testing: enable")
else()
message("-- [I] Watchdog 1 testing: disable")
endif()

if(INTEGRATION_TEST_USE_MARCHX_DISABLE)
message("-- [I] Using MarchXC algorithm: disable")
else()
message("-- [I] Using MarchXC algorithm: enable ")
endif()

get_target_property(COMPILE_DEFINITIONS_IEC60730 slc_lib_iec60730 COMPILE_DEFINITIONS)
endif()
endif()

# Start run test
add_subdirectory(lib)

if(ENABLE_INTEGRATION_TESTING OR ENABLE_UNIT_TESTING)
add_subdirectory(test)
endif()

# Start check coding convention
# Run coding_convention
include(coding_convention)

if(CHECK_CODING_CONVETION_ENABLE)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Disable response files
set(CMAKE_C_USE_RESPONSE_FILE_FOR_INCLUDES ON)
message("-- [I] Check coding convention: enable")
generate_coding_convention(${SDK_CMAKE_RELATIVE_DIR})
endif()
Loading

0 comments on commit ded9f89

Please sign in to comment.