-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
3,803 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
precompil/* | ||
build/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(sigfox_ep_addon_rfp) | ||
|
||
#Check if Project configure by himself or by a parent project (like sfx_lib_core_protocol) | ||
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR} ) | ||
if (NOT DEFINED SFX_LIB_CORE_PROTOCOL_DIR) | ||
message(FATAL_ERROR "${PROJECT_NAME} cannot be configured without -DSFX_LIB_CORE_PROTOCOL_DIR=<sfx_lib_core_protocol directory>") | ||
endif() | ||
set(ADDON_RFP OFF) | ||
add_subdirectory(${SFX_LIB_CORE_PROTOCOL_DIR} "${CMAKE_CURRENT_BINARY_DIR}/${SFX_LIB_CORE_PROTOCOL_DIR}") | ||
else() | ||
message("${PROJECT_NAME} is Fetched by a parent project") | ||
endif() | ||
|
||
set(ADDON_RFP_SOURCES | ||
src/sigfox_ep_addon_rfp_api.c | ||
src/tests_mode/sigfox_rfp_test_mode_a.c | ||
src/tests_mode/sigfox_rfp_test_mode_b.c | ||
src/tests_mode/sigfox_rfp_test_mode_c.c | ||
src/tests_mode/sigfox_rfp_test_mode_g.c | ||
src/tests_mode/sigfox_rfp_test_mode_j.c | ||
src/tests_mode/sigfox_rfp_test_mode_k.c | ||
src/tests_mode/sigfox_rfp_test_mode_l.c | ||
) | ||
|
||
set(ADDON_RFP_HEADERS | ||
inc/sigfox_ep_addon_rfp_api.h | ||
inc/sigfox_ep_addon_rfp_version.h | ||
inc/tests_mode/sigfox_rfp_test_mode_types.h | ||
) | ||
|
||
set(ADDON_RFP_PUBLIC_HEADERS | ||
inc/sigfox_ep_addon_rfp_api.h | ||
inc/sigfox_ep_addon_rfp_version.h | ||
) | ||
|
||
#When sigfox_ep_flag.h is don't used | ||
if(${USE_SIGFOX_EP_FLAGS_H} STREQUAL "ON") | ||
else() | ||
if(${CERTIFICATION} STREQUAL "OFF") | ||
message(FATAL_ERROR "CERTIFICATION Flag must be activated for this addon") | ||
endif() | ||
if((${RC3C} STREQUAL OFF) AND (${RC5} STREQUAL OFF)) | ||
list(REMOVE_ITEM ADDON_RFP_SOURCES "src/tests_mode/sigfox_rfp_test_mode_g.c") | ||
endif() | ||
if((${PUBLIC_KEY_CAPABLE} STREQUAL OFF) ) | ||
list(REMOVE_ITEM ADDON_RFP_SOURCES "src/tests_mode/sigfox_rfp_test_mode_k.c") | ||
endif() | ||
endif() | ||
|
||
#Add Cmake module path | ||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") | ||
|
||
#Precompile module | ||
include(precompile_addon_rfp) | ||
|
||
add_library(${PROJECT_NAME} STATIC ${PRECOMPIL_ADDON_RFP_SOURCES}) | ||
add_dependencies(${PROJECT_NAME} precompil_${PROJECT_NAME}) | ||
target_include_directories(${PROJECT_NAME} PUBLIC ${PRECOMPIL_DIR}/inc) | ||
target_compile_definitions(${PROJECT_NAME} PUBLIC ${DEF_FLAG_LIST}) | ||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${PRECOMPIL_ADDON_RFP_PUBLIC_HEADERS}") | ||
set_target_properties(${PROJECT_NAME} | ||
PROPERTIES | ||
ARCHIVE_OUTPUT_DIRECTORY ${LIB_LOCATION} | ||
LIBRARY_OUTPUT_DIRECTORY ${LIB_LOCATION} | ||
) | ||
install(TARGETS ${PROJECT_NAME} | ||
ARCHIVE DESTINATION ${LIB_LOCATION} | ||
PUBLIC_HEADER DESTINATION ${API_LOCATION} | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# Sigfox End-Point RF & Protocol addon (EP_ADDON_RFP) | ||
|
||
## Description | ||
|
||
This **Sigfox End-Point RF & Protocol addon** show an exemple of the [RF & Protocol test](https://support.sigfox.com/docs/rf-protocol-test-specification) implementation. This addon is an application of the [EP LIB](https://github.com/sigfox-tech-radio/sigfox-ep-lib) to offers a new API provided in the "sigfox_ep_addon_rfp_api.h" to execute different tests mode. | ||
|
||
## Stack architecture | ||
|
||
<p align="center"> | ||
<img src="docs/images/sigfox_ep_addon_rfp_architecture.png" width="600"/> | ||
</p> | ||
|
||
## Code optimization | ||
|
||
The **EP_ADDON_RFP** shared the same compilation flgas as the **EP-LIB**. For more details of these flags see **EP-LIB** repository. | ||
|
||
## Getting Started | ||
|
||
### Cloning the repository | ||
```bash | ||
$ git clone https://github.com/sigfox-tech-radio/sigfox-ep-addon-rfp.git | ||
``` | ||
|
||
### Usage | ||
|
||
Like the **EP-LIB** this **EP_ADDON_RFP** can be used in many ways: | ||
* The [original source code](#original-source-code) to used the raw sources files | ||
* The [precompiled source code](#precompiled-source-code) to remove all unused source code and have more readability. | ||
* The [library](#library) to used a compiled library. | ||
|
||
### Original source code | ||
|
||
#### Dependency | ||
|
||
The only dependence is the [EP-LIB](https://github.com/sigfox-tech-radio/sigfox-ep-lib) source code. | ||
|
||
#### Building Process | ||
|
||
Sources files are available in `inc` and `src` folders and must be copied directly in the embedded project. The configuration flags must be the same than the EP-LIB. | ||
|
||
### Precompiled source code | ||
|
||
#### Dependency | ||
|
||
Before building process install **unifdef**, **cmake** tools and clone or download the [EP_LIB](https://github.com/sigfox-tech-radio/sigfox-ep-lib) from github repository. | ||
The unifdef tool is used to remove dead code and cmake to build. | ||
All precompiles option are the same as EP-LIB (see [README.md](https://github.com/sigfox-tech-radio/sigfox-ep-lib/blob/master/README.md)). | ||
|
||
#### Building Process | ||
|
||
If you want to **precompile** the sources files for a given flags selection, you need to use the **cmake** commands: | ||
Create a build folder: | ||
|
||
```bash | ||
$ cd sigfox-ep-addon-rfp | ||
$ mkdir build | ||
$ cd build | ||
``` | ||
|
||
* Precompiling by reading the `inc/sigfox_ep_flags.h` file: | ||
|
||
```bash | ||
$ cmake -DUSE_SIGFOX_EP_FLAGS_H=ON \ | ||
-DSFX_LIB_CORE_PROTOCOL_DIR=<replace by EP LIB path> .. | ||
$ make precompil_sigfox_ep_addon_rfp | ||
``` | ||
|
||
* Precompiling by entering the flags selection on command line: | ||
|
||
```bash | ||
$ cmake -DUSE_SIGFOX_EP_FLAGS_H=OFF \ | ||
-DRC1=ON \ | ||
-DRC2=ON \ | ||
-DRC3C=ON \ | ||
-DRC3D=ON \ | ||
-DRC4=ON \ | ||
-DRC5=ON \ | ||
-DRC6=ON \ | ||
-DRC7=ON \ | ||
-DAPPLICATION_MESSAGES=ON \ | ||
-DCONTROL_KEEP_ALIVE_MESSAGE=ON \ | ||
-DBIDIRECTIONAL=ON \ | ||
-DASYNCHRONOUS=ON \ | ||
-DLOW_LEVEL_OPEN_CLOSE=ON \ | ||
-DREGULATORY=ON \ | ||
-DSINGLE_FRAME=ON \ | ||
-DPARAMETERS_CHECK=ON \ | ||
-DCERTIFICATION=ON \ | ||
-DPUBLIC_KEY_CAPABLE=ON \ | ||
-DVERBOSE=ON \ | ||
-DCRC_HW=OFF \ | ||
-DERROR_CODES=ON \ | ||
-DUL_BIT_RATE_BPS=OFF \ | ||
-DT_IFU_MS=OFF \ | ||
-DT_CONF_MS=OFF \ | ||
-DUL_PAYLOAD_SIZE=OFF \ | ||
-DMESSAGE_COUNTER_ROLLOVER=OFF \ | ||
-DERROR_STACK=12 \ | ||
-DSFX_LIB_CORE_PROTOCOL_DIR=<replace by EP LIB path> .. | ||
$ make precompil_sigfox_ep_addon_rfp | ||
``` | ||
|
||
The precompiled files will be generated in the `build/precompil` folder. | ||
|
||
### Library | ||
|
||
If you want to build a **static library**, you need to run this additionnal **cmake** command: | ||
|
||
```bash | ||
$ make sigfox_ep_addon_rfp | ||
``` | ||
|
||
The archive will be generated in the `build/lib` folder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
find_program(UNIFDEF unifdef REQUIRED) | ||
if(NOT UNIFDEF) | ||
message(FATAL_ERROR "unifdef not found!") | ||
endif() | ||
find_program(SPLINT splint REQUIRED) | ||
if(NOT SPLINT) | ||
message(FATAL_ERROR "splint not found!") | ||
endif() | ||
|
||
find_program(UNIFDEF unifdef REQUIRED) | ||
if(NOT UNIFDEF) | ||
message(FATAL_ERROR "unifdef not found!") | ||
endif() | ||
find_program(SPLINT splint REQUIRED) | ||
if(NOT SPLINT) | ||
message(FATAL_ERROR "splint not found!") | ||
endif() | ||
|
||
|
||
#List of precompileInc and precompileSrc files | ||
foreach(X IN LISTS ADDON_RFP_SOURCES) | ||
LIST(APPEND PRECOMPIL_ADDON_RFP_SOURCES "${PRECOMPIL_DIR}/${X}") | ||
endforeach() | ||
foreach(X IN LISTS ADDON_RFP_HEADERS) | ||
LIST(APPEND PRECOMPIL_ADDON_RFP_HEADERS "${PRECOMPIL_DIR}/${X}") | ||
endforeach() | ||
foreach(X IN LISTS ADDON_RFP_PUBLIC_HEADERS) | ||
LIST(APPEND PRECOMPIL_ADDON_RFP_PUBLIC_HEADERS "${PRECOMPIL_DIR}/${X}") | ||
endforeach() | ||
|
||
#Custom command Loop for all Sources | ||
foreach(X IN LISTS ADDON_RFP_SOURCES ADDON_RFP_HEADERS) | ||
add_custom_command( | ||
OUTPUT "${PRECOMPIL_DIR}/${X}" | ||
DEPENDS ${CMAKE_BINARY_DIR}/undefs_file | ||
DEPENDS ${CMAKE_BINARY_DIR}/defs_file | ||
DEPENDS ${X} | ||
COMMAND ${CMAKE_COMMAND} -E make_directory ${PRECOMPIL_DIR}/src/tests_mode ${PRECOMPIL_DIR}/inc/tests_mode | ||
COMMAND unifdef -B -k -x 2 -f ${CMAKE_BINARY_DIR}/undefs_file -f ${CMAKE_BINARY_DIR}/defs_file ${PROJECT_SOURCE_DIR}/${X} > "${PRECOMPIL_DIR}/${X}" | ||
VERBATIM | ||
) | ||
|
||
endforeach() | ||
set_property(GLOBAL PROPERTY ALLOW_DUPLICATE_CUSTOM_TARGETS 1) | ||
|
||
add_custom_target(precompil_${PROJECT_NAME} | ||
DEPENDS precompil | ||
DEPENDS ${PRECOMPIL_ADDON_RFP_SOURCES} | ||
DEPENDS ${PRECOMPIL_ADDON_RFP_HEADERS} | ||
VERBATIM | ||
) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.