mirror of
https://github.com/eclipse-threadx/levelx.git
synced 2026-09-14 04:06:00 +08:00
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"image": "ghcr.io/tiejunms/azure_rtos_docker",
|
||||
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"ms-vscode.cpptools",
|
||||
"ms-vscode.cmake-tools"
|
||||
],
|
||||
|
||||
"remoteUser": "vscode",
|
||||
|
||||
"runArgs": [ "--cap-add=NET_ADMIN"]
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
# This is a basic workflow that is manually triggered
|
||||
|
||||
name: regression_test
|
||||
|
||||
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||
# events but only for the master branch
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "linux_job"
|
||||
run_tests:
|
||||
permissions:
|
||||
contents: read
|
||||
issues: read
|
||||
checks: write
|
||||
pull-requests: write
|
||||
pages: write
|
||||
id-token: write
|
||||
uses: azure-rtos/threadx/.github/workflows/regression_template.yml@master
|
||||
+17
-1
@@ -26,7 +26,7 @@
|
||||
/* APPLICATION INTERFACE DEFINITION RELEASE */
|
||||
/* */
|
||||
/* lx_api.h PORTABLE C */
|
||||
/* 6.3.0 */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -86,6 +86,9 @@
|
||||
/* bitmap and obsolete count */
|
||||
/* cache for NOR flash, */
|
||||
/* resulting in version 6.3.0 */
|
||||
/* xx-xx-xxxx Xiuwen Cai Modified comment(s), */
|
||||
/* added configuration checks, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@@ -279,6 +282,19 @@ typedef unsigned long long ULONG64;
|
||||
#define LX_NOR_PHYSICAL_SECTOR_FREE 0xFFFFFFFF
|
||||
|
||||
|
||||
/* Check extended cache configurations. */
|
||||
#ifdef LX_NOR_DISABLE_EXTENDED_CACHE
|
||||
|
||||
#ifdef LX_NOR_ENABLE_MAPPING_BITMAP
|
||||
#error "To enable mapping bitmap, you need to undefine LX_NOR_DISABLE_EXTENDED_CACHE."
|
||||
#endif
|
||||
|
||||
#ifdef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
|
||||
#error "To enable obsolete count cache, you need to undefine LX_NOR_DISABLE_EXTENDED_CACHE."
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Define NAND flash constants. */
|
||||
|
||||
#define LX_NAND_GOOD_BLOCK 0xFF
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _lx_nand_flash_data_page_copy PORTABLE C */
|
||||
/* 6.2.1 */
|
||||
/* 6.x */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Xiuwen Cai, Microsoft Corporation */
|
||||
@@ -78,7 +78,11 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */
|
||||
/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */
|
||||
/* xx-xx-xxxx Xiuwen Cai Modified comment(s), */
|
||||
/* fixed sequential checking */
|
||||
/* logic, */
|
||||
/* resulting in version 6.x */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _lx_nand_flash_data_page_copy(LX_NAND_FLASH* nand_flash, ULONG logical_sector, ULONG source_block, USHORT src_block_status,
|
||||
@@ -168,7 +172,7 @@ ULONG number_of_pages;
|
||||
}
|
||||
|
||||
/* Check if the pages in destination block is still sequential. */
|
||||
if ((destination_page) != (logical_sector + i % nand_flash -> lx_nand_flash_pages_per_block))
|
||||
if (destination_page != ((logical_sector + i) % nand_flash -> lx_nand_flash_pages_per_block))
|
||||
{
|
||||
/* Mark the block status as non sequential. */
|
||||
dest_block_status |= LX_NAND_BLOCK_STATUS_NON_SEQUENTIAL;
|
||||
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
$(dirname `realpath $0`)/../test/cmake/run.sh build all
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
|
||||
# Remove large folder
|
||||
rm -rf /opt/hostedtoolcache
|
||||
|
||||
# Install necessary softwares for Ubuntu.
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
gcc-multilib \
|
||||
git \
|
||||
g++ \
|
||||
python3-pip \
|
||||
ninja-build \
|
||||
unifdef \
|
||||
p7zip-full \
|
||||
tofrodos \
|
||||
gawk \
|
||||
software-properties-common
|
||||
|
||||
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -
|
||||
CODENAME=$(lsb_release -c | cut -f2 -d':' | sed 's/\t//')
|
||||
apt-add-repository "deb https://apt.kitware.com/ubuntu/ $CODENAME main"
|
||||
|
||||
python3 -m pip install --upgrade pip
|
||||
pip3 install gcovr==4.1
|
||||
pip install --upgrade cmake
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
$(dirname `realpath $0`)/../test/cmake/run.sh test all
|
||||
@@ -0,0 +1,4 @@
|
||||
threadx
|
||||
filex
|
||||
coverage_report
|
||||
.run.sh
|
||||
@@ -0,0 +1,128 @@
|
||||
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
cmake_policy(SET CMP0057 NEW)
|
||||
|
||||
project(levelx_test LANGUAGES C)
|
||||
|
||||
# Set build configurations
|
||||
set(BUILD_CONFIGURATIONS default_build_coverage
|
||||
free_sector_verify_build
|
||||
full_build
|
||||
standalone_build
|
||||
standalone_free_sector_verify_build
|
||||
standalone_full_build
|
||||
new_driver_interface_build
|
||||
nor_obsolete_cache_build
|
||||
nor_mapping_cache_build
|
||||
nor_obsolete_mapping_cache_build)
|
||||
set(CMAKE_CONFIGURATION_TYPES
|
||||
${BUILD_CONFIGURATIONS}
|
||||
CACHE STRING "list of supported configuration types" FORCE)
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
||||
${CMAKE_CONFIGURATION_TYPES})
|
||||
list(GET CMAKE_CONFIGURATION_TYPES 0 BUILD_TYPE)
|
||||
if((NOT CMAKE_BUILD_TYPE) OR (NOT ("${CMAKE_BUILD_TYPE}" IN_LIST
|
||||
CMAKE_CONFIGURATION_TYPES)))
|
||||
set(CMAKE_BUILD_TYPE
|
||||
"${BUILD_TYPE}"
|
||||
CACHE STRING "Build Type of the project" FORCE)
|
||||
endif()
|
||||
|
||||
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
||||
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.")
|
||||
set(FX_FAULT_TOLERANT_DEFINITIONS
|
||||
-DFX_ENABLE_FAULT_TOLERANT -DFX_UPDATE_FILE_SIZE_ON_ALLOCATE
|
||||
-DFX_FAULT_TOLERANT_TRANSACTION_FAIL_FUNCTION)
|
||||
set(default_build_coverage "")
|
||||
set(free_sector_verify_build -DLX_FREE_SECTOR_DATA_VERIFY)
|
||||
set(full_build -DLX_FREE_SECTOR_DATA_VERIFY
|
||||
-DLX_DIRECT_READ
|
||||
-DLX_NAND_FLASH_DIRECT_MAPPING_CACHE
|
||||
-DLX_NOR_DISABLE_EXTENDED_CACHE
|
||||
-DLX_THREAD_SAFE_ENABLE)
|
||||
# For Standalone builds LX_STANADLONE_ENABLE is defined in line 61
|
||||
set(standalone_build -DLX_STANDALONE_ENABLE)
|
||||
set(standalone_free_sector_verify_build -DLX_STANDALONE_ENABLE ${free_sector_verify_build})
|
||||
set(standalone_full_build -DLX_STANDALONE_ENABLE ${full_build})
|
||||
set(new_driver_interface_build -DLX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE
|
||||
-DLX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE)
|
||||
set(nor_obsolete_cache_build -DLX_NOR_ENABLE_OBSOLETE_COUNT_CACHE)
|
||||
set(nor_mapping_cache_build -DLX_NOR_ENABLE_MAPPING_BITMAP)
|
||||
set(nor_obsolete_mapping_cache_build -DLX_NOR_ENABLE_MAPPING_BITMAP
|
||||
-DLX_NOR_ENABLE_OBSOLETE_COUNT_CACHE)
|
||||
|
||||
add_compile_options(
|
||||
-m32
|
||||
-std=c99
|
||||
-ggdb
|
||||
-g3
|
||||
-gdwarf-2
|
||||
-fdiagnostics-color
|
||||
-Werror
|
||||
${${CMAKE_BUILD_TYPE}})
|
||||
add_link_options(-m32)
|
||||
|
||||
enable_testing()
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES "standalone.*")
|
||||
set(LX_STANDALONE_ENABLE
|
||||
ON
|
||||
CACHE BOOL "LevelX standalone enabled(No Azure RTOS ThreadX)" FORCE)
|
||||
set(FX_STANDALONE_ENABLE
|
||||
ON
|
||||
CACHE BOOL "FileX standalone enabled(No Azure RTOS ThreadX)" FORCE)
|
||||
endif()
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../.. levelx)
|
||||
add_subdirectory(regression)
|
||||
add_subdirectory(samples)
|
||||
|
||||
# Coverage
|
||||
if(CMAKE_BUILD_TYPE MATCHES ".*_coverage")
|
||||
target_compile_options(levelx PRIVATE -fprofile-arcs -ftest-coverage)
|
||||
target_link_options(levelx PRIVATE -fprofile-arcs -ftest-coverage)
|
||||
endif()
|
||||
|
||||
|
||||
# Build ThreadX library once
|
||||
execute_process(COMMAND ${CMAKE_CURRENT_LIST_DIR}/run.sh build_libs)
|
||||
add_custom_target(build_libs ALL COMMAND ${CMAKE_CURRENT_LIST_DIR}/run.sh
|
||||
build_libs)
|
||||
add_dependencies(levelx build_libs)
|
||||
target_include_directories(levelx PUBLIC ${CMAKE_BINARY_DIR}/../libs/inc)
|
||||
if(NOT LX_STANDALONE_ENABLE)
|
||||
add_library(threadx SHARED IMPORTED GLOBAL)
|
||||
add_library("azrtos::threadx" ALIAS threadx)
|
||||
set_target_properties(
|
||||
threadx PROPERTIES IMPORTED_LOCATION
|
||||
${CMAKE_BINARY_DIR}/../libs/threadx/libthreadx.so)
|
||||
add_library(filex SHARED IMPORTED GLOBAL)
|
||||
add_library("azrtos::filex" ALIAS filex)
|
||||
set_target_properties(filex PROPERTIES IMPORTED_LOCATION
|
||||
${CMAKE_BINARY_DIR}/../libs/filex/libfilex.so)
|
||||
else()
|
||||
get_filename_component(
|
||||
externals ${CMAKE_CURRENT_SOURCE_DIR} ABSOLUTE)
|
||||
add_subdirectory(${externals}/filex filex)
|
||||
add_library("azrtos::filex" ALIAS filex)
|
||||
endif()
|
||||
|
||||
target_compile_options(
|
||||
levelx
|
||||
PRIVATE -Werror
|
||||
-Wall
|
||||
-Wextra
|
||||
-pedantic
|
||||
-fmessage-length=0
|
||||
-fsigned-char
|
||||
-ffunction-sections
|
||||
-fdata-sections
|
||||
-Wunused
|
||||
-Wuninitialized
|
||||
-Wmissing-declarations
|
||||
-Wconversion
|
||||
-Wpointer-arith
|
||||
-Wshadow
|
||||
-Wlogical-op
|
||||
-Waggregate-return
|
||||
-Wfloat-equal)
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cd $(dirname $0)
|
||||
mkdir -p coverage_report/$1
|
||||
gcovr --object-directory=build/$1/levelx/CMakeFiles/levelx.dir/common/src -r ../../common/src --xml-pretty --output coverage_report/$1.xml
|
||||
gcovr --object-directory=build/$1/levelx/CMakeFiles/levelx.dir/common/src -r ../../common/src --html --html-details --output coverage_report/$1/index.html
|
||||
@@ -0,0 +1,38 @@
|
||||
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
|
||||
|
||||
project(libs LANGUAGES C)
|
||||
|
||||
if($ENV{ENABLE_64})
|
||||
message(STATUS "Building for 64bit")
|
||||
else()
|
||||
add_compile_options(-m32)
|
||||
add_link_options(-m32)
|
||||
message(STATUS "Building for 32bit")
|
||||
endif()
|
||||
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.")
|
||||
|
||||
get_filename_component(
|
||||
externals ${CMAKE_CURRENT_SOURCE_DIR}/.. ABSOLUTE)
|
||||
|
||||
if(NOT LX_STANDALONE_ENABLE)
|
||||
add_subdirectory(${externals}/threadx threadx)
|
||||
endif()
|
||||
add_subdirectory(${externals}/filex filex)
|
||||
target_compile_options(threadx PRIVATE -DTX_ENABLE_EVENT_TRACE)
|
||||
if(NOT DEFINED ENV{ENABLE_IDLE})
|
||||
target_compile_options(threadx PRIVATE -DTX_LINUX_NO_IDLE_ENABLE)
|
||||
endif()
|
||||
|
||||
|
||||
if((NOT LX_STANDALONE_ENABLE) OR (NOT FX_STANDALONE_ENABLE))
|
||||
foreach(lib threadx filex)
|
||||
get_target_property(dirs ${lib} INCLUDE_DIRECTORIES)
|
||||
execute_process(COMMAND mkdir -p ${CMAKE_BINARY_DIR}/inc)
|
||||
foreach(dir ${dirs})
|
||||
file(GLOB header_files ${dir}/*.h)
|
||||
foreach(header_file ${header_files})
|
||||
execute_process(COMMAND ln -sf ${header_file} ${CMAKE_BINARY_DIR}/inc)
|
||||
endforeach()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endif()
|
||||
@@ -0,0 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
|
||||
cmake_policy(SET CMP0057 NEW)
|
||||
|
||||
project(regression_test LANGUAGES C)
|
||||
|
||||
set(SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../regression)
|
||||
|
||||
set(regression_test_cases
|
||||
${SOURCE_DIR}/levelx_nand_flash_test.c
|
||||
${SOURCE_DIR}/levelx_nor_flash_test.c
|
||||
${SOURCE_DIR}/levelx_nor_flash_test_cache.c)
|
||||
|
||||
foreach(test_case ${regression_test_cases} ${regression_test_cases_exfat})
|
||||
get_filename_component(test_name ${test_case} NAME_WE)
|
||||
add_executable(${test_name} ${test_case})
|
||||
target_link_libraries(${test_name} PRIVATE azrtos::filex)
|
||||
target_link_libraries(${test_name} PRIVATE azrtos::levelx)
|
||||
target_compile_definitions(${test_name} PRIVATE BATCH_TEST)
|
||||
add_test(${CMAKE_BUILD_TYPE}::${test_name} ${test_name})
|
||||
endforeach()
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
# if threadx repo does not exist, clone it
|
||||
[ -d threadx ] || git clone https://github.com/azure-rtos/threadx.git --depth 1
|
||||
[ -d filex ] || git clone https://github.com/azure-rtos/filex.git --depth 1
|
||||
[ -f .run.sh ] || ln -sf threadx/scripts/cmake_bootstrap.sh .run.sh
|
||||
./.run.sh $*
|
||||
@@ -0,0 +1,17 @@
|
||||
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
|
||||
cmake_policy(SET CMP0057 NEW)
|
||||
|
||||
project(samples LANGUAGES C)
|
||||
|
||||
set(SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../samples)
|
||||
|
||||
set(sample_files
|
||||
${SOURCE_DIR}/demo_filex_nand_flash.c
|
||||
${SOURCE_DIR}/demo_filex_nor_flash.c)
|
||||
|
||||
foreach(sample_file ${sample_files})
|
||||
get_filename_component(sample_file_name ${sample_file} NAME_WE)
|
||||
add_executable(${sample_file_name} ${sample_file})
|
||||
target_link_libraries(${sample_file_name} PRIVATE azrtos::filex)
|
||||
target_link_libraries(${sample_file_name} PRIVATE azrtos::levelx)
|
||||
endforeach()
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user