Skip to content

How to add Sigfox library to your project

Ludovic-Lesur edited this page Mar 22, 2024 · 6 revisions

Submodule

The best way to embed the Sigfox End-Point library into your project is to use a Git submodule. The library will be seen as a sub-repository with independant history. It will be much easier to upgrade the library or to switch between versions when necessary, by using the common git pull and git checkout commands within the sigfox-ep-lib folder.

In order to keep the repository clean, it is recommended to select the compilation flags in your project settings, without modifying the sigfox_ep_flags.h file (which is only included if the USE_SIGFOX_EP_FLAGS_H flag is defined). This way, you can change the compilation flags when you want, in order to add features or save code memory. The source code will be set up automatically according to your flags selection, without any action or diff in the submodule folder. You will also need to exclude the src/manuf folder from build (where the manufacturer templates are defined) and implement the functions in another location of your project, so that the repository is kept clean.

To add the Sigfox library submodule, go to your project location and run the following commands:

mkdir lib
cd lib/
git submodule add https://github.com/sigfox-tech-radio/sigfox-ep-lib.git

This will clone the Sigfox End-Point library repository. At project level, you can commit the submodule creation with the following commands:

git commit --message "Add Sigfox End Point library submodule."
git push

With the submodule, you can easily:

  • Update the library to the latest version:
cd lib/sigfox-ep-lib/
git pull
git checkout master
  • Use a specific release:
cd lib/sigfox-ep-lib/
git pull
git checkout <tag>

Raw source code

You can download or clone any release of the Sigfox End-Point library and copy all files into your project. Then you can either define the USE_SIGFOX_EP_FLAGS_H flag and select your compilation flags in the sigfox_ep_flags.h file, or define them in your project settings.

git clone https://github.com/sigfox-tech-radio/sigfox-ep-lib.git

Precompiled source code

You can download or clone any release of the Sigfox End-Point library and copy all files into your project. If you do not plan to change your compilation flags in the future, you can perform a precompilation step before copying the file in your project. The precompilation will remove all preprocessor directives according to your flags selection, in order to produce a more readable code. Then you can copy the new files into your project.

git clone https://github.com/sigfox-tech-radio/sigfox-ep-lib.git

To perform the precompilation, you have to install cmake and unifdef tools, and run the following commands:

cd sigfox-ep-lib/
mkdir build
cd build/
  • Precompiling by reading the sigfox_ep_flags.h file:
cmake -DUSE_SIGFOX_EP_FLAGS_H=ON ..
make precompil
  • Precompiling by entering the flags selection on command line:
cmake -DUSE_SIGFOX_EP_FLAGS_H=OFF \
      -DRC1_ZONE=ON \
      -DRC2_ZONE=ON \
      -DRC3C_ZONE=ON \
      -DRC3D_ZONE=ON \
      -DRC4_ZONE=ON \
      -DRC5_ZONE=ON \
      -DRC6_ZONE=ON \
      -DRC7_ZONE=ON \
      -DAPPLICATION_MESSAGES=ON \
      -DCONTROL_KEEP_ALIVE_MESSAGE=ON \
      -DBIDIRECTIONAL=ON \
      -DASYNCHRONOUS=ON \
      -DLOW_LEVEL_OPEN_CLOSE=ON \
      -DREGULATORY=ON \
      -DLATENCY_COMPENSATION=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 ..
make precompil

The new files will be generated in the build/precompil folder.

Static library

You can also download or clone any release of the Sigfox End-Point library and build a static library.

git clone https://github.com/sigfox-tech-radio/sigfox-ep-lib.git

To build a static library, you have to install cmake tool and run the following commands:

cd sigfox-ep-lib/
mkdir build
cd build/
  • Building by reading the sigfox_ep_flags.h file:
cmake -DUSE_SIGFOX_EP_FLAGS_H=ON ..
make sigfox_ep_lib
  • Building by entering the flags selection on command line:
cmake -DUSE_SIGFOX_EP_FLAGS_H=OFF \
      -DRC1_ZONE=ON \
      -DRC2_ZONE=ON \
      -DRC3C_ZONE=ON \
      -DRC3D_ZONE=ON \
      -DRC4_ZONE=ON \
      -DRC5_ZONE=ON \
      -DRC6_ZONE=ON \
      -DRC7_ZONE=ON \
      -DAPPLICATION_MESSAGES=ON \
      -DCONTROL_KEEP_ALIVE_MESSAGE=ON \
      -DBIDIRECTIONAL=ON \
      -DASYNCHRONOUS=ON \
      -DLOW_LEVEL_OPEN_CLOSE=ON \
      -DREGULATORY=ON \
      -DLATENCY_COMPENSATION=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 ..
make sigfox_ep_lib

The archive will be generated in the build/lib folder.