This is a small header-only library with some tools that are usefull for embedded firmware projects.
The tools include:
- compiler_support.h which provides a set of macros controlling compiler-specific attributes
- endianess.h which provides tools for manipulating the endianess
- expect.h which provides a set of tools to organize error handling and make it more explicit
include(FetchContent)
# Remove FIND_PACKAGE_ARGS when using CMake < 3.24
FetchContent_Declare(embeutils https://github.com/embetech-official/embeutils/archive/refs/tags/v1.zip FIND_PACKAGE_ARGS)
# If you need to set configuration options, this is the last spot to do so
FetchContent_MakeAvailable(embeutils)
target_link_libraries(my_target PRIVATE embetech::utils)
#include <embetech/expect.h>
void do_work(void* data) {
EXPECT(data != NULL) OR_ABORT("data must be non-null");
}
The component provides functions to convert data representation between little- and big-endian. When using C11 compliant compiler, there are Generic selection conversion macros.
-
EMBEUTILS_EXPECT_VERBOSE: Force enables verbose messages in EXPECT macros.
-
EMBEUTILS_EXTRA_CHECKS : Force enables additional runtime checks (executed via EXPECT_EXTRA macro)
Important
The default behaviour is to enable both EXPECT_EXTRA and verbose messages in DEBUG build configuration. If you wish to force disable the options, unset appropriate cache variables and set non-cache variables to OFF