Commit Graph

138 Commits

Author SHA1 Message Date
simbit18 d1789d84e8 fix nxstyle
fix Relative file path does not match actual file.
2024-05-13 22:24:36 +02:00
Philippe Leduc 3dc6b4c9bd Add basic support for locales in order to C++ streams to build and work for simple cases (POSIX / C locale).
Fix build with C++ GCC toolchain
2024-04-29 17:34:10 +08:00
xuxin19 859247c224 cmake:enhance set_source_files_properties for NuttX CMake module
Because `set_source_files_properties` in cmake will overwrite the properties instead of appending them.
This module implements addition and deletion by
first `getting_source_file_property` and then `set_source_files_properties`

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-04-18 14:57:58 -03:00
xuxin19 2c9d46f176 cmake:enable libxx for CMake build
distinguish whether to add the CXX header file search path
according to the target Language.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-03-15 01:28:53 +08:00
wangmingrong d4b5991589 libcxxabi: Path <cxxabi.h> not found
./helloxx_main.cxx:29:10: fatal error: cxxabi.h: No such file or directory
   29 | #include <cxxabi.h>
      |          ^~~~~~~~~~
CONFIG_LIBCXXABI is turned on, but the library include is not linked to nuttx/include, causing the compilation to fail.

Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2024-03-14 22:47:55 +08:00
trns1997 54e9e582d5 Use C++ standard lib from toolchain
Signed-off-by: trns1997 <trns1997@gmail.com>
2024-03-06 08:42:44 +08:00
Petro Karashchenko 5495ff4d78 libs/libxx: add patch to remove mach/mach_time.h inclusion
Inclusion of mach/mach_time.h by libcxx/src/chrono.cpp breaks
the build on latest MACOS dues to https://forums.developer.apple.com/forums/thread/746737
The interface from mach/mach_time.h is not referenced in chrono.cpp
so it is safe to remove it

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-02-16 10:42:23 -08:00
Zhe Weng b8e0423b74 libcxx: Fix CMake compile with correct CMAKE_CXX_STANDARD
It seems libcxx needs C++20 from 12.0.0 to 17.0.6: 3b625060fc

But we're setting CMAKE_CXX_STANDARD to 17, errors on my side:

nuttx/libs/libxx/libcxx/src/include/to_chars_floating_point.h:122:46: error: ‘bit_cast’ is not a member of ‘std’
  122 |     const _Uint_type _Uint_value    = _VSTD::bit_cast<_Uint_type>(_Value);
      |                                              ^~~~~~~~
nuttx/libs/libxx/libcxx/src/memory_resource_init_helper.h:2:8: error: ‘constinit’ does not name a type
    2 | static constinit ResourceInitHelper res_init _LIBCPP_INIT_PRIORITY_MAX;
      |        ^~~~~~~~~
nuttx/libs/libxx/libcxx/src/memory_resource_init_helper.h:2:8: note: C++20 ‘constinit’ only available with ‘-std=c++20’ or ‘-std=gnu++20’

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-01-16 21:54:30 -08:00
YAMAMOTO Takashi 7d6612d0e5 libcxxabi.cmake: fix build error
This tries to mirror the following change.
```
commit c260fee516
Author: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Date:   Tue Aug 31 14:47:13 2021 -0300

    libs/libxx: Enforce RTTI for building libcxxabi

    It is okay for the application to be built without RTTI (-fno-rrti), but
    libcxxabi requires RTTI at least for the library.

    Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
```
2024-01-04 07:20:04 -08:00
YAMAMOTO Takashi bb053f137d libcxxabi.cmake: remove a patch which no longer exists
the patch has been removed in the following change.
```
commit 4f90a6140c
Author: Stuart Ianna <stuart.ianna@motec.com.au>
Date:   Mon Jan 23 09:08:00 2023 +1100

    libcxx: Remove exiting patches and update libcxx version to 15.0.7

     - Add __config_site for NuttX.
       In libcxx 12.0.0. CMake concatenated __config_site with _config,
       which enabled NuttX to build without its inclusion. In 15.0.7, this
       file is configured by CMake and included explicitly in __config.
     - Add additional include directories.
     - Mute always_inline warning.
     - Make the download of libcxx/libcxxabi configurable
```
2024-01-04 07:20:04 -08:00
YAMAMOTO Takashi 23db901bb3 libcxxabi.cmake: fix download
don't forget to expand CONFIG_LIBCXXABI_VERSION
2024-01-04 07:20:04 -08:00
YAMAMOTO Takashi 3e4bc9bcef libcxx.defs: appease "expr: syntax error" messages with clang 2024-01-04 13:01:42 +01:00
xuxin19 87553e71f8 cmake build file support with libcxx 17.0.6
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-12-18 20:38:10 -08:00
ThomasNS 224be61f5a upgrade llvm version to 17.0.6 and set default nuttx math lib as default 2023-12-17 03:39:26 -08:00
zhanghongyu 68a6f1090c libcxx.cmake: remove useless code
removes test code that was accidentally incorporated earlier.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-12-14 03:02:15 -08:00
zhanghongyu fb5c9975cc libcxx: fix build error.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-12-06 07:56:17 -08:00
raiden00pl 5b87fdfb9d Documentation: remove all migrated READMEs 2023-10-29 21:03:54 -03:00
Stuart Ianna ad9f6b79e0 libs/libcxx: Silence warnings when building libcxx.
Silence two warnings when building libcxx with GCC 12.2.0 and std=c++2b:

libcxx/src/charconv.cpp_CXXFLAGS += -Wno-attributes
 - Results from libcxx fallback to use __always_inline__ when exclude_from_explicit_instantiation isn't available.

libcxx/src/locale.cpp_CXXFLAGS += -Wno-attributes
 - Results from the expansion of _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS. Should be fine to ignore.
2023-10-26 09:07:17 +02:00
Lee Lup Yuen 6cad7e9582 arm, arm64, xtensa, libxx: Change sed -r to sed -E to support macOS
When we build NuttX on macOS, it shows many `sed` messages (and the build still completes successfully):

```text
$ tools/configure.sh pinephone:nsh
$ make
sed: illegal option -- r
```

This is due to the Makefiles executing `sed -r` which is not a valid option on macOS.

This PR proposes to change `sed -r` to `sed -E` because:

- `sed -E` on macOS is equivalent to `sed -r` on Linux

- `sed -E` and `sed -r` are aliases according to the GNU `sed` Manual

- `sed -E` is already used in nuttx_add_romfs.cmake, nuttx_add_symtab.cmake and process_config.sh
2023-10-10 11:36:32 +03:00
SPRESENSE bf6606f80c libxx: Use gnu++20 option only if using libcxx
Fix an issue that gnu++20 option is always used.
Essentially, when cxx is not used, gnu++17 should be retained.
2023-10-05 13:09:20 +08:00
Xiang Xiao 381c7dd747 Fix error: unknown warning option '-Wno-unqualified-std-cast-call'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-24 08:40:10 +03:00
Stuart Ianna 4f90a6140c libcxx: Remove exiting patches and update libcxx version to 15.0.7
- Add __config_site for NuttX.
   In libcxx 12.0.0. CMake concatenated __config_site with _config,
   which enabled NuttX to build without its inclusion. In 15.0.7, this
   file is configured by CMake and included explicitly in __config.
 - Add additional include directories.
 - Mute always_inline warning.
 - Make the download of libcxx/libcxxabi configurable
2023-09-24 08:40:10 +03:00
Xiang Xiao d6453cfc3c libxx: Change the default value of CXX_STANDARD to gnu++20
since llvm libcxx 15.0.7 require c++20 feature to pass the build

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-24 08:40:10 +03:00
Petro Karashchenko 587f01a5e2 libs/libxx/libcxx: fix CI compilation issue reported on MACOS
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-09-19 01:17:17 +08:00
dongjiuzhu1 4763ca849a libxx/libcxx: select PTHREAD_MUTEX_TYPES to support recursive mutex
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-18 15:34:44 +08:00
wangming9 61a38ca680 libs/libxx/libcxx: Fix compilation warnings
Summary
Workaround the following warning with "GCC 12"
CXX:  libcxxabi/src/cxa_demangle.cpp In file included from libcxx/src/locale.cpp:15:
In member function 'std::__1::_EnableIf<std::__1::__is_cpp17_forward_iterator<_ForwardIterator>::value> std::__1::basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = const wchar_t*; _CharT = wchar_t; _Traits = std::__1::char_traits<wchar_t>; _Allocator = std::__1::allocator<wchar_t>]',    inlined from 'std::__1::basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator, _InputIterator) [with _InputIterator = const wchar_t*; <template-parameter-2-2> = void; _CharT = wchar_t; _Traits = std::__1::char_traits<wchar_t>; _Allocator = std::__1::allocator<wchar_t>]' at include/libcxx/string:2182:11,
    inlined from 'virtual int std::__1::collate_byname<wchar_t>::do_compare(const char_type*, const char_type*, const char_type*, const char_type*) const' at libcxx/src/locale.cpp:764:33:
include/libcxx/string:2156:35: warning: 'lhs' may be used uninitialized [-Wmaybe-uninitialized]
 2156 |         this->__throw_length_error();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~

include/libcxx/new:237:24: warning: argument 1 value '18446744073709551599' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
  237 |   return ::operator new(__args...);
      |          ~~~~~~~~~~~~~~^~~~~~~~~~~

Signed-off-by: wangming9 <wangming9@xiaomi.com>
2023-09-09 17:08:23 +03:00
xuxin19 48d95b8d82 cmake:replace custom_patch_target with PATCH_COMMAND
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-08-24 17:46:43 +02:00
chao an ba2601deb6 Toolchain: strict GCC version check from GCC-12.2 to GCC-12
Toolchain related detection errors are still not resolved on GCC-12.3

Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-23 23:52:17 +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
fangxinyong f1e37a4987 libs/libxx: remove redundant code
Follow the change: https://github.com/apache/nuttx/pull/9151,
that is no need to deal with zero size in C++ allocator.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-05-03 19:54:19 +08:00
chao an b8780fe906 arch/arm: relax compiler check for workaround with "GCC 12.2"
1. relax compiler check for workaround with "GCC 12.2"
2. export GCCVER to environment

Signed-off-by: chao an <anchao@xiaomi.com>
2023-04-24 19:00:52 +03:00
Petro Karashchenko a261439b8b libs/libx: relax compiler check for workaround with "GCC 12.2"
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-03-21 21:59:30 -03:00
Karel Kočí 62661600b2 treewide: add DOWNLOAD variable as unification of curl call
This is a followup to the commit
03b164f59c.
2023-03-08 17:05:05 +08:00
YAMAMOTO Takashi e9158efd42 libcxx.defs: Disable a warning and explain why 2023-02-27 23:55:52 +08:00
chao an 5fac313df7 libs/libxx: Fix typo in shell expressions
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-22 01:05:46 +08:00
chao an 1d41182755 libs/libxx: check GCC version before set special flags
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-21 15:33:18 +08:00
chao an e29d275ef8 libs/libcxx: Workaround -Wmaybe-uninitialized warning with "GCC 12.2"
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-20 19:26:55 +08:00
Xiang Xiao 7d66a16c53 Minor style clean up
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-28 19:53:20 +02:00
Xiang Xiao 82550887c2 c++: Change the default value of CXX_STANDARD from c++17 to gnu++17
since many 3rd party code use some gnu c++ extension

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-19 08:21:48 +01:00
Xiang Xiao f64da13e9b libxx: Add CXX_STANDARD to select -std=c++??
and default to "c++17"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-16 15:41:57 +02:00
Xiang Xiao 4be9ec774b Don't download tarballs if a local git repo found
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-05 10:47:36 +01:00
yinshengkai 95d9abcf58 tools: replace DEFINE script to Makefile variable
In the past, predefined macros were generated by define.sh scripts
Now they are generated by concatenating environment variables

In this way, when executing makefile, no shell command will be executed,
it will improve the speed of executing makfile

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-03 19:59:55 +08:00
Huang Qi e0185faa78 Don't download tarballs if a local git repo found
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-08-28 03:07:58 +08:00
Peter van der Perk f64677b8c9 Add Embedded Template Library (ETL) support 2022-08-05 09:38:48 +08:00
Jiuzhu Dong 035840a770 libc/wchar: remove unnecessary config
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-27 00:36:49 +08:00
Ville Juven a54c3d13f9 sched: Remove SCHED_ATEXIT / SCHED_ONEXIT
Remove the kernel side implementations altogether. These will be
replaced by user land implementations.
2022-05-25 15:28:43 +08:00
Ville Juven 622677d4a1 libc: Implement exit, atexit, on_exit and cxa_exit on the user side
For CONFIG_BUILD_KERNEL using the sched/task/task_exithook implementation
will just not work. It calls user code with kernel privileges which is
a bit of a security issue.
2022-05-25 15:28:43 +08:00
Xiang Xiao b39d70fe25 libxxmini: Fix error: use of undeclared identifier 'nullptr'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-19 23:23:01 +03:00
Xiang Xiao f7f8a21486 libs: Move aeabi_atexit from libxx/ to libc/machine/arm/
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-13 00:13:03 +03:00
Xiang Xiao 4ae7f4c1f6 libs: Move libxx_impure.cxx from libs/libxx/ to libs/libc/misc/
to fix the gcov link error:
arm-none-eabi-ld: /home/xiaoxiang/vela/prebuilts/gcc/linux/arm/bin/../lib/gcc/arm-none-eabi/10.3.1/thumb/v7e-m/nofp/libgcov.a(_gcov.o): in function `gcov_error_exit':
libgcov-driver.c:(.text+0x7c): undefined reference to `_impure_ptr'
arm-none-eabi-ld: /home/xiaoxiang/vela/prebuilts/gcc/linux/arm/bin/../lib/gcc/arm-none-eabi/10.3.1/thumb/v7e-m/nofp/libgcov.a(_gcov.o): in function `get_gcov_error_file':
libgcov-driver.c:(.text+0x1e0): undefined reference to `_impure_ptr'
arm-none-eabi-ld: /home/xiaoxiang/vela/prebuilts/gcc/linux/arm/bin/../lib/gcc/arm-none-eabi/10.3.1/thumb/v7e-m/nofp/libgcov.a(_gcov.o): in function `gcov_exit_open_gcda_file.isra.0':
libgcov-driver.c:(.text+0x660): undefined reference to `_impure_ptr'

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-06 14:43:57 -03:00