1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg/libfixmath: add compile options to Kconfig

The option list has been taken from
https://code.google.com/archive/p/libfixmath/wikis/CompilationOptions.wiki.
The defaults are the current ones.
This commit is contained in:
Leandro Lanzieri 2021-11-12 11:29:50 +01:00
parent 7036388769
commit 584052ec6e
No known key found for this signature in database
GPG Key ID: F4E9A721761C7593
2 changed files with 64 additions and 0 deletions

View File

@ -19,4 +19,64 @@ config MODULE_LIBFIXMATH_UNITTESTS
depends on !HAS_ARCH_8BIT
depends on !HAS_MSP430
menu "Accuracy"
config FIXMATH_NO_ROUNDING
bool "Disable rounding"
help
Say y to disable rounding. Results may round randomly up or down, i.e.
their accuracy is +-1. Runs slightly faster.
config FIXMATH_NO_OVERFLOW
bool "Disable overflow detection"
help
Say y to disable overflow detection and saturating arithmetic support.
Overflowing computations will give garbage results. Runs slightly
faster.
endmenu
menu "Platform"
config FIXMATH_NO_64BIT
bool "Disable use of uint64_t"
help
Say y to disable use of uint64_t in the code. Meant for compilers that
do not have 64-bit support. Runs the same speed or slightly slower.
config FIXMATH_OPTIMIZE_8BIT
bool "Optimize for 8-bit architectures"
default y if HAS_ARCH_8BIT
help
Say y to use variants of the functions that are suitable for small 8- and
16-bit processors. Much faster on those processors, much slower on 32-bit
processors.
config FIXMATH_NO_CACHE
bool "Do not use cache"
default y
help
Say y to avoid using cache for exp etc. function results. Uses less RAM,
runs slightly slower.
endmenu
menu "Algorithms"
config FIXMATH_SIN_LUT
bool "Use sin look-up table generated by fixsingen"
help
Say y to use a look-up table generated by the fixsingen tool from svn,
it is faster on some devices but the lookup table takes up ~200KiB
(205376 bytes) in memory and can be slower depending on usage.
config FIXMATH_FAST_SIN
bool "Fast sin approximation"
help
Say y to enable a faster but less accurate approximation of the sin
function, for code where accuracy isn't as important such as games logic
or graphics rendering then this is often a worthwhile tradeoff.
endmenu
endif # PACKAGE_LIBFIXMATH

View File

@ -7,6 +7,10 @@ ifneq (,$(filter arch_8bit,$(FEATURES_USED)))
CFLAGS += -DFIXMATH_OPTIMIZE_8BIT
endif
# translate Kconfig options to CFLAGS for the package
libfixmath_options = $(filter CONFIG_FIXMATH_%,$(.VARIABLES))
CFLAGS += $(libfixmath_options:CONFIG_FIXMATH_%=-DFIXMATH_%)
INCLUDES += -I$(PKG_SOURCE_DIR)/libfixmath
ifneq (,$(filter libfixmath-unittests,$(USEMODULE)))