Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/document_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
pwd
ls -al
pip install -r ./docs/requirements.txt

- id: deployment
uses: sphinx-notes/pages@v3
with:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/linux_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install build tools
run: |
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib

- name: Configure linux_threadx_debug
working-directory: ${{github.workspace}}
run: cmake --preset=linux_threadx_debug
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/linux_unit_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ jobs:
- uses: actions/checkout@v3
- uses: threeal/gcovr-action@v1.1.0

- name: Install build tools
run: |
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib
Comment thread
QuangHaiNguyen marked this conversation as resolved.

- name: Configure linux_test_debug
working-directory: ${{github.workspace}}
run: cmake --preset=linux_test_debug
Expand Down
14 changes: 5 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
cmake_minimum_required(VERSION 3.25)

project(EzEmbeddedFramework
VERSION 1.0.0
VERSION 1.0.2
LANGUAGES C CXX
DESCRIPTION "Easy Embedded Software Framework"
)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(BUILD_NUMBER 0)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) # use -std=c++20 (not gnu++20)

# Configure a header file with version + build number
configure_file(
cmake/ez_version.h.in
inc/ez_version.h
)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

Comment thread
QuangHaiNguyen marked this conversation as resolved.
#Only build test, targets, and extern when being build as a project
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
Expand Down
19 changes: 15 additions & 4 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
"rhs": "Linux"
},
"cacheVariables": {
"TARGET_PATH": "samples/linux"
"TARGET_PATH": "samples/linux",
"CMAKE_C_FLAGS": "-m32",
"CMAKE_CXX_FLAGS": "-m32",
"CMAKE_EXE_LINKER_FLAGS": "-m32"
}
},
{
Expand All @@ -35,7 +38,10 @@
"cacheVariables": {
"TARGET_PATH": "samples/linux_threadx",
"THREADX_ARCH": "linux",
"THREADX_TOOLCHAIN": "gnu"
"THREADX_TOOLCHAIN": "gnu",
"CMAKE_C_FLAGS": "-m32",
"CMAKE_CXX_FLAGS": "-m32",
"CMAKE_EXE_LINKER_FLAGS": "-m32"
}
},
{
Expand All @@ -50,7 +56,10 @@
"rhs": "Linux"
},
"cacheVariables": {
"TARGET_PATH": "samples/linux_freertos"
"TARGET_PATH": "samples/linux_freertos",
"CMAKE_C_FLAGS": "-m32",
"CMAKE_CXX_FLAGS": "-m32",
"CMAKE_EXE_LINKER_FLAGS": "-m32"
}
},
{
Expand Down Expand Up @@ -81,7 +90,9 @@
"binaryDir": "${sourceDir}/build_linux_test_debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_FLAGS":"-fprofile-arcs -ftest-coverage -fPIC"
"CMAKE_C_FLAGS": "-m32 -fprofile-arcs -ftest-coverage -fPIC",
"CMAKE_CXX_FLAGS": "-m32",
"CMAKE_EXE_LINKER_FLAGS": "-m32"
}
},
{
Expand Down
10 changes: 0 additions & 10 deletions cmake/ez_version.h.in

This file was deleted.

4 changes: 2 additions & 2 deletions inc/ez_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#define EZ_SDK_VERSION_MAJOR 1
#define EZ_SDK_VERSION_MINOR 0
#define EZ_SDK_VERSION_PATCH 0
#define EZ_SDK_VERSION_PATCH 2
#define EZ_SDK_BUILD_NUMBER 0
#define EZ_SDK_VERSION "1.0.0-0"
#define EZ_SDK_VERSION "1.0.2-0"

#endif
5 changes: 4 additions & 1 deletion inc/middlewares/osal/ez_osal.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,23 @@ extern "C" {
#define EZ_OSAL_DEFINE_SEMAPHORE_HANDLE(NAME, MAX_COUNT, RESOURCE) \
ezOsal_SemaphoreHandle_t NAME = { \
.max_count = MAX_COUNT, \
.static_resource = RESOURCE \
.static_resource = RESOURCE, \
.handle = NULL \
}

#define EZ_OSAL_DEFINE_TIMER_HANDLE(NAME, PERIOD, FUNC, ARG, RESOURCE) \
ezOsal_TimerHandle_t NAME = { \
.timer_name = #NAME, \
.period_ticks = PERIOD, \
.timer_callback = FUNC, \
.handle = NULL, \
.argument = ARG, \
.static_resource = RESOURCE \
}

#define EZ_OSAL_DEFINE_EVENT_HANDLE(NAME, RESOURCE) \
ezOsal_EventHandle_t NAME = { \
.handle = NULL, \
.static_resource = RESOURCE \
}

Expand Down
2 changes: 1 addition & 1 deletion inc/service/cli/ez_cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ typedef CLI_NOTIFY_CODE (*EXEC_CMD_CALLBACK)(char * tx_rx_buff, const void **arg
* @param: None
* @return one character (char)
*/
typedef const char (*GET_CHAR_CALLBACK)(void);
typedef char (*GET_CHAR_CALLBACK)(void);

/** @brief Callback to send response
* @param[in] tx_buff: data to be transmitted
Expand Down
2 changes: 1 addition & 1 deletion inc/service/data_model/ez_data_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const void* ezDataModel_GetDataPoint(
* @pre data_model must be initialized using ezDataModel_Initialize()
* @post None
*/
const uint32_t ezDataModel_GetFirstDirty(ezDataModel_t *data_model);
uint32_t ezDataModel_GetFirstDirty(ezDataModel_t *data_model);


/**
Expand Down
4 changes: 1 addition & 3 deletions inc/service/rpc/ez_rpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ ezSTATUS ezRPC_CreateRpcRequest(struct ezRpc *rpc_inst,
*****************************************************************************/
ezSTATUS ezRPC_CreateRpcResponse(struct ezRpc *rpc_inst,
uint16_t cmd_id,
uint32_t uuid,
uint16_t uuid,
uint8_t *payload,
uint32_t payload_size);

Expand Down Expand Up @@ -388,8 +388,6 @@ uint32_t ezRPC_NumOfPendingRecords(struct ezRpc *rpc_inst);
*****************************************************************************/
static inline bool ezRpc_IsRpcInstanceReady(struct ezRpc *rpc_inst)
{
bool is_ready = false;

if (rpc_inst != NULL)
{
return ((rpc_inst->commands != NULL)
Expand Down
2 changes: 1 addition & 1 deletion inc/utilities/hexdump/ez_hexdump.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ extern "C" {
* @endcode
*
*****************************************************************************/
void ezHexdump(void *address, uint16_t size);
void ezHexdump(void *address, uint32_t size);

#endif /* CONFIG_HELPER_HEXDUMP */

Expand Down
48 changes: 24 additions & 24 deletions inc/utilities/logging/ez_logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,25 @@ extern "C" {
#endif

#if (EZ_LOGGING_COLOR == 1U)
#define black "\033[0;30m"
#define red "\033[0;31m"
#define green "\033[0;32m"
#define yellow "\033[0;33m"
#define blue "\033[0;34m"
#define purple "\033[0;35m"
#define cyan "\033[0;36m"
#define white "\033[0;37m"
#define reset_color "\033[0m"
#define EZ_BLACK "\033[0;30m"
#define EZ_RED "\033[0;31m"
#define EZ_GREEN "\033[0;32m"
#define EZ_YELLOW "\033[0;33m"
#define EZ_BLUE "\033[0;34m"
#define EZ_PURPLE "\033[0;35m"
#define EZ_CYAN "\033[0;36m"
#define EZ_WHITE "\033[0;37m"
#define EZ_RESET_COLOR "\033[0m"
#else
#define black
#define red
#define green
#define yellow
#define blue
#define purple
#define cyan
#define white
#define reset_color
#define EZ_BLACK
#define EZ_RED
#define EZ_GREEN
#define EZ_YELLOW
#define EZ_BLUE
#define EZ_PURPLE
#define EZ_CYAN
#define EZ_WHITE
#define EZ_RESET_COLOR
#endif

Comment thread
QuangHaiNguyen marked this conversation as resolved.
#if (PRINT_MODULE_NAME == 1U)
Expand Down Expand Up @@ -111,7 +111,7 @@ extern "C" {
#if (EZ_LOGGING == 1U)
#if DEBUG_LVL >= LVL_CRITICAL
#define EZCRITICAL(fmt, ...) do {\
dbg_print("\n" purple "[CRITICAL] " reset_color);\
dbg_print("\n" EZ_PURPLE "[CRITICAL] " EZ_RESET_COLOR);\
print_module(MOD_NAME);\
print_file();\
print_line();\
Expand All @@ -124,7 +124,7 @@ extern "C" {

#if DEBUG_LVL >= LVL_ERROR
#define EZERROR(fmt, ...) do {\
dbg_print("\n" red "[ ERROR] " reset_color);\
dbg_print("\n" EZ_RED "[ ERROR] " EZ_RESET_COLOR);\
print_module(MOD_NAME);\
print_file();\
print_line();\
Expand All @@ -139,7 +139,7 @@ extern "C" {
#define EZWARNING(fmt, ...) do {\
if (DEBUG_LVL >= LVL_WARNING)\
{\
dbg_print("\n" yellow "[ WARNING] " reset_color);\
dbg_print("\n" EZ_YELLOW "[ WARNING] " EZ_RESET_COLOR);\
print_module(MOD_NAME);\
print_file();\
print_line();\
Expand All @@ -153,7 +153,7 @@ extern "C" {

#if DEBUG_LVL >= LVL_INFO
#define EZINFO(fmt, ...) do {\
dbg_print("\n" cyan "[ INFO] " reset_color);\
dbg_print("\n" EZ_CYAN "[ INFO] " EZ_RESET_COLOR);\
print_module(MOD_NAME);\
print_file();\
print_line();\
Expand All @@ -166,7 +166,7 @@ extern "C" {

#if DEBUG_LVL >= LVL_DEBUG
#define EZDEBUG(fmt, ...) do {\
dbg_print("\n" green "[ DEBUG] " reset_color);\
dbg_print("\n" EZ_GREEN "[ DEBUG] " EZ_RESET_COLOR);\
print_module(MOD_NAME);\
print_file();\
print_line();\
Expand All @@ -180,7 +180,7 @@ extern "C" {
#if DEBUG_LVL >= LVL_TRACE
#define EZTRACE(fmt, ...) do {\
dbg_print("\n");\
dbg_print(blue "[ TRACE] " reset_color);\
dbg_print(EZ_BLUE "[ TRACE] " EZ_RESET_COLOR);\
print_module(MOD_NAME);\
print_file();\
print_line();\
Expand Down
3 changes: 2 additions & 1 deletion samples/linux/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@
* External functions
*******************************************************************************/

void main(void)
int main(void)
{
printf("Linux target - Hello world!\n");
printf("Version: %s\n", EZ_SDK_VERSION);
return 0;
}

/******************************************************************************
Expand Down
22 changes: 22 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,28 @@ message(STATUS "**********************************************************")
message(STATUS "* Generating easy_embedded library build files")
message(STATUS "**********************************************************")

# GCC/Clang quality and security flags for framework targets only
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
add_compile_options(
-Wall
-Wextra
-Wpedantic
-Werror
-Wconversion
-Wshadow
-Wformat=2
-Wnull-dereference
-Wduplicated-cond
-Wduplicated-branches
-Wlogical-op
-Wcast-align
)

add_compile_definitions(
$<$<CONFIG:Release,RelWithDebInfo,MinSizeRel>:_FORTIFY_SOURCE=2>
)
endif()

option(BUILD_WITH_CMAKE "code base is built using CMake. Do not turn this OFF" ON)

# Include --------------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions src/hal/gpio/ez_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ static struct Node hw_driver_list = EZ_LINKEDLIST_INIT_NODE(hw_driver_list);
*****************************************************************************/
EZ_DRV_STATUS ezGpio_SystemRegisterHwDriver(struct ezGpioDriver *hw_gpio_driver)
{
EZ_DRV_STATUS status = STATUS_ERR_GENERIC;

EZTRACE("ezGpio_SystemRegisterHwDriver()");
if(hw_gpio_driver == NULL)
{
Expand Down
2 changes: 2 additions & 0 deletions src/hal/uart/ez_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@ static void ezUart_PrintStatus(EZ_DRV_STATUS status)
case STATUS_TIMEOUT: EZDEBUG("STATUS_TIMEOUT"); break;
default: break;
}
#else
(void)status; /* avoid unused parameter warning */
#endif
}

Expand Down
8 changes: 8 additions & 0 deletions src/middlewares/osal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ target_sources(ez_osal_lib
$<$<BOOL:${ENABLE_THREADX}>:ez_osal_threadx.c>
)

if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
set_source_files_properties(
ez_osal_threadx.c
PROPERTIES
COMPILE_OPTIONS "-Wno-error=cast-function-type"
)
endif()


# Definitions ----------------------------------------------------------------
target_compile_definitions(ez_osal_lib
Expand Down
5 changes: 3 additions & 2 deletions src/middlewares/osal/ez_osal_freertos.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,11 @@ static int ezOsal_FreeRTOSEventWait(ezOsal_EventHandle_t *handle, uint32_t event
if((bits & event_mask) > 0)
{
EZDEBUG("event is set");
return bits;
return (int)bits;
}

EZWARNING("Event = %d timeout", event_mask);
return bits;
return (int)bits;
}

static ezSTATUS ezOsal_FreeRTOSEventSet(ezOsal_EventHandle_t *handle, uint32_t event_mask)
Expand Down Expand Up @@ -471,6 +471,7 @@ static ezSTATUS ezOsal_FreeRTOSEventClear(ezOsal_EventHandle_t *handle, uint32_t
EZDEBUG("Clear event mask = %d", event_mask);
bits = xEventGroupClearBits((EventGroupHandle_t)handle->handle, event_mask);
EZDEBUG("Clear event success");
(void)bits;
return ezSUCCESS;
}

Expand Down
Loading
Loading