Commit graph

69 commits

Author SHA1 Message Date
yaojingwei
bbd6931d61 nuttx/audio: add fake audio driver.
The fake audio driver aims to easily simulate the functions of audio driver through reading and writing files.
With it, you can conveniently customize and define various capture or playback audio drivers for debugging or automated testing.

Signed-off-by: yaojingwei <yaojingwei@xiaomi.com>
2024-12-20 11:47:08 -03:00
xuxin19
dc8bde8dd5 cmake(enhance):Enhance romfs so that RAWS files can be added in any location
1.make the generation sequence of etc romfs no longer bound to the board
2.RCRAWS RCSRCS can be added from any directory
3.enable dynamic files, files generated during the compilation process,
    and ensure the correct time order

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-12-02 19:59:02 +08:00
xuxin19
cfe78ad74e cmake(enhance):enhance NuttX cmake target dependencies and link_library modules
Enhance CMake's add_dependencies for Nuttx so that
different targets can call dependencies without errors when they are not traversed.

In addition, since we do not call link_library directly,
we increment nuttx_link_library to inherit the PUBLIC property

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-11-22 15:16:07 -03:00
xuxin19
6d629b3b36 cmake:bugfix kconfig menu in cmake cannot be generated recursively
the ${MENUCONFIG} file in the output directory is enough,
as invoking nuttx_generate_kconfig() will generate this
file in the output directory.
Since we are collecting these files recursively,
the nuttx_generate_kconfig() function of the parent directory
will be called after all the subdirectories' nuttx_generate_kconfig()
functions have been invoked.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-11-18 17:01:43 +08:00
xuxin19
3ae822c098 cmake:remove no need target_link_library in static target
the link_library of the static target will cause PRIVATE to be inherited to nuttx,
resulting in duplicate linking and definition problems.
because all target static libraries will eventually be linked, there is no need to specify it explicitly.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-11-14 01:26:38 +08:00
xuxin19
00dd223601 cmake(bugfix):no need to deleted products gen in binary dir
keeping intermediate products in the binary directory helps debugging

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-11-13 02:36:18 +08:00
xuxin19
4f895b3300 cmake(enhance):add NuttX CMake extensions module
Wrapped CMake native method is nuttx_cmake module
It can be quickly called in the build system

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-11-12 15:30:21 -03:00
xuxin19
acb5058428 cmake(bugfix):fix directory not being successfully added when adding romfs
board content should overwrite common content

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-11-10 00:49:23 +08:00
xuxin19
ba56c6c102 cmake(bugfix):make sure the extra_lib only added once
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-11-04 18:19:15 +08:00
chao an
e3689cbb2f CMake/preprocess: fix typo PREPROCES -> PREPROCESS
correct the marco define from PREPROCES to PREPROCESS

Signed-off-by: chao an <anchao@lixiang.com>
2024-10-29 17:41:01 +08:00
guoshichao
65aa5415a7 cmake: fix the fdiagnostics-color handle issue
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-10-19 14:32:35 +08:00
simbit18
791d7c97d0 cmake: Renamed savedefconfig with refreshsilent
Renamed savedefconfig -> refreshsilent name more consistent with the refresh stage for cmake on github.

Added new savedefconfig to fix
https://github.com/apache/nuttx/issues/14281
2024-10-18 22:14:50 +08:00
xuxin19
57bfd02cef build ci:add msvc windows native ci workflow
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-13 10:25:19 +08:00
xuxin19
2a51f4e394 cmake(feat):support define additional config option for CMake
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-13 02:08:38 +08:00
xuxin19
7b807a3947 cmake:fix x86_64 cmake configured warning
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-13 02:08:38 +08:00
anjiahao
fa59adde40 Simplify BOARD_MEMORY_RANGE initialization logic
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-09 15:41:48 +08:00
xuxin19
8efe6cb235 cmake:enhance compile options for custom toolchain,implement the REVERSE
opt of `add_compile_options()`

add global moudle `nuttx_remove_compile_options()`.
define custom board toolchain introduction.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-09 13:48:11 +08:00
anjiahao
e9e01506d3 dlcn:need select MODULES when compile
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-08 19:56:33 +08:00
wangmingrong1
b0581b7a46 cmake/multiple link: cmake supports multiple link global variables out of bounds
1. Modify the original symbol table cmake file, the same as the cmake file for multiple links
2. Added global variable out-of-bounds detection shadow area multiple linking process

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-08 16:55:45 +08:00
wangmingrong1
447a73003c cmake/allsyms: Generate empty files using scripts instead of implementing them within cmake files
The function of generating an empty symbol table has been implemented in tools/mkallsyms.py. Makefile is implemented in python script. Cmake needs to be consistent with Makefile.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-08 16:55:45 +08:00
simbit18
7db9b47465 Cmake: Improved setconfig support for setting multiple parameters
Improved setconfig support for setting multiple parameters for the .config

Added Cmake and Ninja version info

Modified savedefconfig now behaves with the same logic as the tools/refresh.sh script used for the update stage (make build) on GitHub.
2024-10-07 18:45:22 +08:00
guoshichao
ff4ad07576 greenhills: add cmake support
1. refactor the ghs/gcc/clang/armclang toolchain management in CMake
2. unify the cmake toolchain naming style
3. support greenhills build procedure with CMake
4. add protect build for greenhills and gnu toolchain with CMake

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-10-01 11:48:09 +08:00
xuxin19
45277dac3e cmake:refactor CMake add_romfs module to support ABS path
Add support for etc files with absolute paths
usages:
```
 add_board_rcsrcs(${CMAKE_CURRENT_SOURCE_DIR}/etc/build.prop)
``
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-27 09:55:50 +08:00
xuxin19
49bdd62aa3 cmake:bugfix fix cmake CPP options get NULL in add_romfs
CMake Error at cmake/nuttx_add_romfs.cmake:60 (string):
  string sub-command REPLACE requires at least four arguments.
Call Stack (most recent call first):
  boards/sim/sim/sim/src/CMakeLists.txt:68 (nuttx_add_romfs)

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-27 09:55:50 +08:00
xuxin19
5095955591 cmake(bugfix):make sure the extra lib only added once
avoid duplicate definitions of target when
`nuttx_add_extra_library` is called between different models at the same time

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-24 21:06:26 +08:00
xuxin19
1d3dd328dd modify BUILD_LOADABLE to MODULES which backwards-compatible Kernel
maintains the same semantics as Kernel’s module build
and compatible with Kconfiglib implementation.

The problem of kconfiglib not being able to use tri-states is this:
linux is here torvalds/linux@6dd85ff
The module option is extracted from one of the triate three states into a MODULE keyword.
Kconfiglib supports the default implementation of module to be MODULE for compatibility with the linux kernel, and triate degenerates into bool two states
Refer to this code: 061e71f7d7/kconfiglib.py (L4274-L4284)

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-19 08:32:03 +08:00
xuxin19
ab488800bb cmake:enhance the module for adding extra libraries
change the extra library from a file to an import target;
this will avoid differences in the handling of static libraries
between different versions of cmake and different platforms.

after unifying as a target, extra libraries can be
handled as the same as other compiled libraries

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:01:07 +08:00
xuxin19
1603e40607 cmake:bugfix refine gen sim link script to independent cmake module
fix SIM start crash on Ubuntu22,
becase the previous CMake linker script has missing handling of
C++ global constructor sections in the new Glibc version on ubuntu22

it will cause a prior c++ constructor call error:
0x00000000400317f6 in nxsched_get_stackinfo (pid=0, stackinfo=0x7fffffffdbc0) at /media/liujinye/ssd/vela-dev/nuttx/sched/sched/sched_get_stackinfo.c:101
0x000000004002de0d in tls_get_info () at /media/liujinye/ssd/vela-dev/nuttx/libs/libc/tls/tls_getinfo.c:61
0x000000004002ddc8 in task_get_info () at /media/liujinye/ssd/vela-dev/nuttx/libs/libc/tls/task_getinfo.c:50
0x000000004002c74e in atexit_register (type=4, func=0x40044eac <CHelloWorld::~CHelloWorld()>, arg=0x40061418 <g_HelloWorld>, dso=0x40060000)
 at /media/liujinye/ssd/vela-dev/nuttx/libs/libc/stdlib/lib_atexit.c:68
0x000000004002ca34 in __cxa_atexit (func=0x40044eac <CHelloWorld::~CHelloWorld()>, arg=0x40061418 <g_HelloWorld>, dso_handle=0x40060000)
 at /media/liujinye/ssd/vela-dev/nuttx/libs/libc/stdlib/lib_atexit.c:268
0x000000004004502b in __static_initialization_and_destruction_0 () at /media/liujinye/ssd/vela-dev/apps/examples/helloxx/helloxx_main.cxx:93
0x000000004004503e in _GLOBAL__sub_I_helloxx_main () at /media/liujinye/ssd/vela-dev/apps/examples/helloxx/helloxx_main.cxx:129
0x00007ffff7829ebb in call_init (env=<optimized out>, argv=0x7fffffffdd18, argc=1) at ../csu/libc-start.c:145
 __libc_start_main_impl (main=0x40004dc8 <main>, argc=1, argv=0x7fffffffdd18, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
    stack_end=0x7fffffffdd08) at ../csu/libc-start.c:379
0x0000000040004285 in _start ()

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:01:07 +08:00
xuxin19
9cbdf69fb0 cmake:refactor cmake binary include_arch dir into include
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:01:07 +08:00
Alin Jerpelea
41537fe90f cmake: 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-09-10 11:34:40 +08:00
simbit18
ebbd585f97 cmake/nuttx_kconfig.cmake: fixed the correct .config path in the build folder
Fixing the correct .config path during the setconfig process.

changed ${NUTTX_DIR} -> ${CMAKE_BINARY_DIR}

see https://github.com/apache/nuttx/pull/13175#issuecomment-2320360957
2024-08-30 23:47:11 +08:00
simbit18
1661a66843 [cmake]: added initial support for MSYS2
Currently concerns only arm.

tools/ci/testlist/msys2.dat:
At the moment I only added the board nucleo-l152re:nsh

.github/workflows/build.yml:
Enabled cmake for msys2
2024-08-27 21:36:12 +08:00
Pietro Albini
c19cbdf8d6 cmake: fix invalid syntax when generating version.h from tags
When building from git tags, the version number in `include/version.h`
is extracted from the output of `git describe`. While that is correct,
cmake was not configured to strip trailing whitespace from the command
output, which resulted in the version number being `12.5.1\n`.

That broke the generation of `include/version.h`, as the `\n` resulted
in the terminating quote being in a new line. This commit fixes that by
instructing cmake to strip trailing whitespace.
2024-08-21 23:32:09 +08:00
xuxin19
b328b35e2b cmake:bugfix fix CMake post_build phase time orderless
[1209/1210] cd cmake_out && arm-none-eabi-objcopy -O binary nuttx nuttx.bin && arm-none-eabi-objcopy -O binary nuttx vela_core1.bin && cp nuttx vela_core1.elf && cp nuttx.hex vela_core1.hex && cp nuttx.map vela_core1.mapfile
FAILED: boards/exclude_board/CMakeFiles/nuttx_post_build /home/work/ssd1/workspace/MiRTOS-car-dev-CI/cmake_out/boards/exclude_board/CMakeFiles/nuttx_post_build
cd cmake_out && arm-none-eabi-objcopy -O binary nuttx nuttx.bin && arm-none-eabi-objcopy -O binary nuttx vela_core1.bin && cp nuttx vela_core1.elf && cp nuttx.hex vela_core1.hex && cp nuttx.map vela_core1.mapfile
cp: cannot stat 'nuttx.hex': No such file or directory
[1210/1210] Generating nuttx.hex
ninja: build stopped: subcommand failed.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-21 01:53:09 +08:00
xuxin19
b1b66ce491 cmake:add unified timing control phase apps_context for apps build
solve the interdependency problem of cross-target dependency generation.
like Makefile base, a PHONY context target is used as a dependency for timing order.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-21 01:53:09 +08:00
fanjiangang
5e9358b782 make/disassembly: generate disassembly file
Create the nuttx.asm in the disassembly format using the objdump program.

NOTE:
'>', objdump doesn't take arguments for output file,
but result is printed to standard out, and is redirected.

Signed-off-by: fanjiangang <fanjiangang@lixiang.com>
Signed-off-by: chao an <anchao@lixiang.com>
2024-08-16 15:22:25 +08:00
xuxin19
b325ae6391 cmake: add_application supports only registration but not compilation
for sources that have implemented multiple prog_main,
there is a situation where you don't need to add source files but need to register.
the add_application method is enhanced so that it can be registered without entering SRCS.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 16:05:27 +02:00
xuxin19
cd46d27489 cmake:Remove Unix-specific code and replace it with cmake script to support cross-platform
the Unix-specific commands used in the CMake implementation of savedefconfig are not
supported on the Windows platform, which will cause compatibility issues.

replace it with CMake implementation, which can be cross-platform and has been verified on Windows.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 14:02:28 +08:00
chao an
7e2b25d45e cmake/boards: fix build break on custom board
Special string filters can be ignored normally

Loaded configuration '.config'
Minimal configuration saved to 'defconfig.tmp'
gmake[3]: *** [CMakeFiles/savedefconfig.dir/build.make:73: CMakeFiles/savedefconfig] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:17869: CMakeFiles/savedefconfig.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:17876: CMakeFiles/savedefconfig.dir/rule] Error 2
gmake: *** [Makefile:208: savedefconfig] Error 2

Signed-off-by: chao an <anchao@lixiang.com>
2024-07-17 15:09:07 +08:00
chao an
fc716802c0 cmake/add_library: enable library install by default
enable library install by default to support nuttx export for cmake

nuttx$ cmake --install build  --prefix $PWD/build/staging/
-- Install configuration: ""
-- Installing: nuttx/build/staging/lib/libarch.a
-- Installing: nuttx/build/staging/lib/libbinfmt.a
-- Installing: nuttx/build/staging/lib/libdrivers.a
-- Installing: nuttx/build/staging/lib/libfs.a
...

Signed-off-by: chao an <anchao@lixiang.com>
2024-07-02 16:50:18 +08:00
xuxin19
f8437d52b7 cmake:bugfix refine sim cmake redefine symbols
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-06-29 17:59:54 -03:00
simbit18
d1789d84e8 fix nxstyle
fix Relative file path does not match actual file.
2024-05-13 22:24:36 +02:00
chao an
c4017a4b22 cmake/romfs: separate c flags to avoid compile fail
riscv-none-elf-gcc: warning:  -Wstrict-prototypes: linker input file unused because linking not done
riscv-none-elf-gcc: error:  -Wstrict-prototypes: linker input file not found: No such file or directory

Signed-off-by: chao an <anchao@lixiang.com>
2024-05-09 23:45:23 +08:00
xuxin19
9eac74330a cmake:bugfix __KERNEL__ should not be defined in libc,mm.. in FLAT mode
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-05-02 16:03:09 +08:00
xuxin19
94d8fba629 cmake:bugfix generate config.h contain ; characters will be handled incorrectly
`;` is treated as a list separator in CMake.
the file(STRING) function will read the wrong .config value
string(REGEX REPLACE) will also incorrectly handle lines containing `;`
so here we can only parse character by character.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-04-29 11:14:48 -03: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
4b11d37cf7 cmake-bugfix:add santity check for target depends and change
inter_library header inheritance level

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-04-18 14:57:58 -03:00
xuxin19
6960f1b967 cmake:change add_dep to nuttx_add_dep for nuttx_add_application
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-04-18 14:57:58 -03:00
xuxin19
1bc50b53bb cmake:implement ALLSYMS feat of CMake version
when declaring the target to be `nuttx`,create an empty allsyms source file for it;
when the target is declared as something else,the link behavior of the `nuttx` target is cloned
and added to actually generate the allsyms file.
finally use allsyms_nuttx to overwrite the already generated nuttx
and regenerate binary outputs

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-04-03 10:16:21 -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