Commit Graph

52 Commits

Author SHA1 Message Date
xuxin19 c60b980968 cmake(bugfix):fix robot openlibm cmake build missing source error
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-30 22:14:40 +08:00
Yongrong Wang 4baec5a248 libs/xxx/CMakeLists.txt: add cmake compile support
Add the lib_bzero.c files to the build use it's API
Add the floating point math C files to the build to use it's API

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-10-16 12:33:54 +08:00
liwenxiang1 3fd75efed9 Revert "libs/libc:Openlibm adds exp10 and exp10f function implementations"
This implementation is from glibc, and the license is LGPL

This reverts commit 862244586976b9388f87dc639225d714dd70e4af.

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-16 08:03:31 +08:00
liwenxiang1 8d09eaaee0 libs/libc:Openlibm adds exp10 and exp10f function implementations
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-13 02:31:44 +08:00
liwenxiang1 1c65fbf15a libc/newlib:Declaration of adding depth
Resolve the issue of inability to compile when opening newlib

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-13 02:30:51 +08:00
xuxingliang b9adff0e90 libm/newlib: remove -Wno-maybe-uninitialized
Since there's no warning presents now.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-11 19:52:52 +08:00
Alin Jerpelea d5754ec7da libs/libm: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-10-01 12:25:52 +08:00
Petro Karashchenko f0cbcb95ff nuttx/libm: switch from integer to double constants in pow
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-09-30 08:32:46 +08:00
Petro Karashchenko 776035ee9e nuttx/libm: fix powl wrong if first parameter is negative
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-09-30 08:32:46 +08:00
yanghuatao 7cd38dca6a nuttx/libm: Fix powf wrong if first parameter is negative
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-09-28 10:42:36 +08:00
yanghuatao 375178b42a nuttx/libm: Move define __BSD_VISIBLE to openlibm_math.h
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-09-27 23:21:01 +08:00
Masayuki Ishikawa df298c186f Revert "build depend:Revert Make.dep intermediate ddc file"
This reverts commit ddc3119c4e.
2024-09-15 19:29:47 +08:00
xuxin19 997be40003 cmake:bugfix fix sim CMake build break
fix lim CMake config prefix error

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:29:21 +08:00
xuxin19 5b3275c07b cmake:add libmcs cmake build
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:29:21 +08:00
xuxin19 21c68b44da cmake:support openlibm cmake build
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:29:21 +08:00
xuxin19 ddc3119c4e build depend:Revert Make.dep intermediate ddc file
Revert "Parallelize depend file generation"
This reverts commit d5b6ec450f.

parallel depend ddc does not significantly speed up compilation,
intermediately generated .ddc files can cause problems if compilation is interrupted unexpectedly

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:01:58 +08:00
Petro Karashchenko c6a7816bed libs/libm/libm: increase number of 'log' iterations before epsilon relaxation
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-09-06 17:40:57 +08:00
Petro Karashchenko 02b1e895e2 libs/libm/libm: apply epsilon relax factor only if epsilon is small
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-09-06 17:40:57 +08:00
Petro Karashchenko 9cfb10069c Revert "libs/libm: fix epsilon relaxation in log and logf"
This reverts commit a2ed0ddd72.
2024-09-06 17:40:57 +08:00
Petro Karashchenko a2ed0ddd72 libs/libm: fix epsilon relaxation in log and logf
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-09-05 10:14:04 +08:00
Petro Karashchenko 1528b8dcca nuttx: resolve various 'FAR' and 'CODE' issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-26 10:21:03 +08:00
Yingwei Zheng 871cd306c5 libm/copysign: respect signed zero/NaN in copysign 2024-08-01 01:08:19 +08:00
p-szafonimateusz c932fe3045 libm/newlib: disable optimization for sincos
Disable sincos optimization for all functions in this file,
otherwise gcc would generate infinite calls.
Refer to gcc bug 46926.
-fno-builtin-sin or -fno-builtin-cos can disable sincos optimization,
but these two options do not work inside optimize pragma in-file.
Thus we just enforce -O0 when compiling this file.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-06-28 01:26:18 +08:00
p-szafonimateusz 23b2f96c9d libm/libm: disable optimization for sincos
Disable sincos optimization for all functions in this file,
otherwise gcc would generate infinite calls.
Refer to gcc bug 46926.
-fno-builtin-sin or -fno-builtin-cos can disable sincos optimization,
but these two options do not work inside optimize pragma in-file.
Thus we just enforce -O0 when compiling this file.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-06-28 01:26:18 +08:00
simbit18 09bfaa7292 fix nxstyle
fix Relative file path does not match actual file.
2024-05-11 01:19:06 +08:00
simbit18 7677f10d3f fix nxstyle
fix Relative file path does not match actual file.
2024-04-16 19:09:12 +08:00
p-szafonimateusz e967be059a newlib: fix compilation for sincosl
aggresive optimisation can replace occurrences of sinl() and cosl() with
sincosl(), but sincosl() is missing in newlib which causes error. So let's
use custom implementation here.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-02-26 23:56:47 +08:00
p-szafonimateusz 5288e063ec newlib: fix support for x86
Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-02-26 23:56:47 +08:00
SPRESENSE 6ba30033b3 libm: Fix an issue that public header files are not exported
Fix an issue that math library header files are not exported by make export.
Create symbolic links of libmcs, newlib and openlibm header to nuttx/include.
2023-11-23 16:32:53 +01:00
SPRESENSE 63182d43b9 libm/newlib: Change the download site to https
Change newlib download site from ftp to more secure https.
2023-11-10 16:28:13 +08:00
chao an 5026a96cfa nxstyle: cleanup UTF-8 Unicode to ASCII
Signed-off-by: chao an <anchao@xiaomi.com>
2023-09-18 11:54:17 -04:00
yanghuatao 7ea52505c2 libm/libmcs: Fix clang build download libmcs warning
VELAPLATFO-16865

Fix warnings:
CC:  libmcs/libmcs/libm/common/fenv.c libmcs/libmcs/libm/common/fenv.c:26:15: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
int fegetround()
              ^
               void
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-09-18 23:00:38 +08:00
yanghuatao 88193d3ad5 libm/libmcs: Fix clang build libmcs warning
VELAPLATFO-15795

Fix warnings:
1 warning generated.
CC:  libmcs/libmcs/libm/mathd/lrintd.c libmcs/libmcs/libm/mathd/lrintd.c:141:20: warning: implicit conversion from 'unsigned long long' to 'long' changes value from 9223372036854775808 to 0 [-Wconstant-conversion]
            return __MIN_LONG;
            ~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:50:24: note: expanded from macro '__MIN_LONG'
    #define __MIN_LONG 0x8000000000000000L
                       ^~~~~~~~~~~~~~~~~~~
libmcs/libmcs/libm/mathd/lrintd.c:144:20: warning: implicit conversion from 'long long' to 'long' changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
            return __MAX_LONG;
            ~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:49:24: note: expanded from macro '__MAX_LONG'
    #define __MAX_LONG 0x7FFFFFFFFFFFFFFFL
                       ^~~~~~~~~~~~~~~~~~~
2 warnings generated.
CC:  libmcs/libmcs/libm/mathd/lroundd.c libmcs/libmcs/libm/mathd/lroundd.c:123:20: warning: implicit conversion from 'unsigned long long' to 'long' changes value from 9223372036854775808 to 0 [-Wconstant-conversion]
            return __MIN_LONG;
            ~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:50:24: note: expanded from macro '__MIN_LONG'
    #define __MIN_LONG 0x8000000000000000L
                       ^~~~~~~~~~~~~~~~~~~
libmcs/libmcs/libm/mathd/lroundd.c:126:20: warning: implicit conversion from 'long long' to 'long' changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
            return __MAX_LONG;
            ~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:49:24: note: expanded from macro '__MAX_LONG'
    #define __MAX_LONG 0x7FFFFFFFFFFFFFFFL
                       ^~~~~~~~~~~~~~~~~~~
2 warnings generated.
CC:  libmcs/libmcs/libm/mathf/lrintf.c libmcs/libmcs/libm/mathf/lrintf.c:67:20: warning: implicit conversion from 'unsigned long long' to 'long' changes value from 9223372036854775808 to 0 [-Wconstant-conversion]
            return __MIN_LONG;
            ~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:50:24: note: expanded from macro '__MIN_LONG'
    #define __MIN_LONG 0x8000000000000000L
                       ^~~~~~~~~~~~~~~~~~~
libmcs/libmcs/libm/mathf/lrintf.c:70:20: warning: implicit conversion from 'long long' to 'long' changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
            return __MAX_LONG;
            ~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:49:24: note: expanded from macro '__MAX_LONG'
    #define __MAX_LONG 0x7FFFFFFFFFFFFFFFL
                       ^~~~~~~~~~~~~~~~~~~
2 warnings generated.
CC:  libmcs/libmcs/libm/mathf/lroundf.c libmcs/libmcs/libm/mathf/lroundf.c:32:20: warning: implicit conversion from 'unsigned long long' to 'long' changes value from 9223372036854775808 to 0 [-Wconstant-conversion]
            return __MIN_LONG;
            ~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:50:24: note: expanded from macro '__MIN_LONG'
    #define __MIN_LONG 0x8000000000000000L
                       ^~~~~~~~~~~~~~~~~~~
libmcs/libmcs/libm/mathf/lroundf.c:34:20: warning: implicit conversion from 'long long' to 'long' changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
            return __MAX_LONG;
            ~~~~~~ ^~~~~~~~~~
/mnt/yang/vela_keystore_sim/nuttx/libs/libm/libmcs/libmcs/libm/include/internal_config.h:49:24: note: expanded from macro '__MAX_LONG'
    #define __MAX_LONG 0x7FFFFFFFFFFFFFFFL

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-09-18 21:02:39 +08:00
Roy Feng e90d58c3da esp32: Use newlib-esp32
When we are using newlib as libm, we can consider newlib-esp32 for esp32
hardware. An it contains some optimization for esp32 hardware.
Besides, two small issues has been fixed.
1. add the tar ball to .gitignore
2. Fix the some build warnings
2023-09-14 19:33:50 +08:00
yinshengkai 7115b6adad libm: ignore git submodules
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-09-07 11:27:00 +03:00
Xin Xu e152391022 Apply suggestions from code review
Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-27 21:41:53 +08:00
xuxin19 27c0e12d25 cmake:support newlib cmake build
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-08-27 21:41:53 +08:00
yanghuatao 3ccc5f0f76 libm/newlib: fix newlib build error
Fix error :
nuttx/libs/libm/newlib/include/math.h:89:8: error: ‘_Thread_local’ does not name a type; did you mean ‘thread_local’?
   89 | extern _Thread_local int _tls_gamma_signgam;
      |        ^~~~~~~~~~~~~
      |        thread_local
In file included from /mnt/nuttx/include/libcxx/math.h:300,
                 from /mnt/nuttx/include/libcxx/cmath:308,
                 from /mnt/nuttx/include/libcxx/charconv:79,
                 from libcxx/src/string.cpp:10:
/mnt/nuttx/libs/libm/newlib/include/math.h:89:8: error: ‘_Thread_local’ does not name a type; did you mean ‘thread_local’?
   89 | extern _Thread_local int _tls_gamma_signgam;

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-08-08 19:41:58 -03:00
raiden00pl 24c44b35d5 cmake: support arm specific libm 2023-07-14 21:33:53 +08:00
yanghuatao cd5e1169df libm/libmcs: Fix undefined symbol `fesetround'
Fix build error:apps/interpreters/quickjs/quickjs/quickjs.c:11852:(.text.js_ecvt1.constprop.0+0xfc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `fesetround'

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-07-11 00:25:16 +08:00
chao an 6ee9ec7656 build: add initial cmake build system
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)

------------------

How to test

From within nuttx/. Configure:

cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja

(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja

This uses ninja generator (install with sudo apt install ninja-build). To build:

$ cmake --build build

menuconfig:

$ cmake --build build -t menuconfig

--------------------------

2. cmake/build: reformat the cmake style by cmake-format

https://github.com/cheshirekow/cmake_format

$ pip install cmakelang

$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done

Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:50:48 +08:00
Xiang Xiao 7990f90915 Indent the define statement by two spaces
follow the code style convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-21 09:52:08 -03:00
Petro Karashchenko ede3e3e4c5 libs/libm/libmcs: add newline at the end of file
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-05-19 02:40:38 +08:00
Xiang Xiao bf391eaec2 libm/arm: Remove the compiler specific #warning
let ld report the error instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-18 15:44:28 +03:00
simbit18 0b6d51a3b2 libs/libm/bin/Makefile: fix nxstyle
fix error: Relative file path does not match actual file
2023-05-18 19:31:12 +08:00
simbit18 3208519f93 libs/libm/kbin/Makefile: fix nxstyle
fix error: Relative file path does not match actual file
2023-05-18 19:31:12 +08:00
simbit18 a51412ea6e libs/libm/Makefile: fix nxstyle
fix error: Relative file path does not match actual file
2023-05-18 19:31:12 +08:00
yanghuatao e9dfa0094f libm/libmcs: add math library libmcs support
add math library libmcs support
(1)open menuconfig  (2)close math.h:build setup->Customize Header Files->math.h (3) select libmcs:Library Rountines->Select math library->Math Library fram LibmCS (4)build

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-04-29 13:47:28 +08:00
yanghuatao 6d5f8caf53 libm/openlibm: add math library openlibm support.
add math library openlibm support
(1)open menuconfig  (2)close math.h:build setup->Customize Header Files->math.h (3) select openlibm:Library Rountines->Select math library->Math Library fram openlibm (4)build

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-04-25 20:37:00 +08:00
yanghuatao 826dd87f30 libm/newlib: add newlib/libm support
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-04-24 10:32:53 +08:00