当前位置: 首页 > article >正文

开源RTOS(实时操作系统):nuttx 编译

开源RTOS(实时操作系统):nuttx 编译

手册:Installing — NuttX latest documentation

源码:GitHub - apache/nuttx: Apache NuttX is a mature, real-time embedded operating system (RTOS)

Installing

The first step to get started with NuttX is to install a series of required tools, a toolchain for the architecture you will be working with and, finally, download NuttX source code itself.

Prerequisites

First, install the following set of system dependencies according to your Operating System:

Linux (debian based)Linux (Fedora / RPM based)macOSWindows / WSLWindows/Cygwin

Run the following command to install packages:

$ sudo apt install \
$ bison flex gettext texinfo libncurses5-dev libncursesw5-dev xxd \
$ git gperf automake libtool pkg-config build-essential gperf genromfs \
$ libgmp-dev libmpc-dev libmpfr-dev libisl-dev binutils-dev libelf-dev \
$ libexpat1-dev gcc-multilib g++-multilib picocom u-boot-tools util-linux

KConfig frontend

NuttX configuration system uses KConfig which is exposed via a series of interactive menu-based frontends, part of the kconfig-frontends package. Depending on your OS you may use a precompiled package or you will have to build it from source, which is available in the NuttX tools repository:

Ubuntu 20.04 LTS and laterUbuntu 18.04 LTS and earlierFedoramacOS

$ sudo apt install kconfig-frontends

NuttX also supports kconfiglib by default, which is a Kconfig tool implemented in Python 2/3. Compared with kconfig-frontends, kconfiglib provides NuttX with the possibility of multi-platform support(configure NuttX in Windows native/Visual Studio), and also kconfiglib has a stronger Kconfig syntax check, this will help developers to avoid some Kconfig syntax errors. Install kconfiglib via following command:

sudo apt install python3-kconfiglib

If you are a working on Windows, which also need the support of windows-curses:

pip install windows-curses

Toolchain

To build Apache NuttX you need the appropriate toolchain according to your target platform. Some Operating Systems such as Linux distribute toolchains for various architectures. This is usually an easy choice however you should be aware that in some cases the version offered by your OS may have problems and it may be better to use a widely used build from another source.

The following example shows how to install a toolchain for ARM architecture:

Ubuntu (deb)macOSFrom arm.com

$ sudo apt install gcc-arm-none-eabi binutils-arm-none-eabi

Tip

There are hints on how to get the latest tool chains for most supported architectures in the Apache NuttX CI helper script and Docker container

Todo

Required toolchain should be part of each arch documentation (see relevant issue).

Download NuttX

Apache NuttX is actively developed on GitHub. There are two main repositories, nuttx and apps, where the latter is technically optional (but recommended for complete set of features). If you intend to contribute changes, you need the absolute latest version or you simply prefer to work using git, you should clone these repositories (recommended). Otherwise you can choose to download any stable release archive.

Clone git repositoriesDownload stable release

$ mkdir nuttxspace
$ cd nuttxspace
$ git clone https://github.com/apache/nuttx.git nuttx
$ git clone https://github.com/apache/nuttx-apps apps

The development source code is also available as a compressed archive, should you need it:

$ mkdir nuttxspace
$ cd nuttxspace
$ curl -L https://github.com/apache/nuttx/tarball/master -o nuttx.tar.gz
$ curl -L https://github.com/apache/nuttx-apps/tarball/master -o apps.tar.gz
$ tar zxf nuttx.tar.gz --one-top-level=nuttx --strip-components 1
$ tar zxf apps.tar.gz --one-top-level=apps --strip-components 1

There are also .zip archives available (useful for Windows users): just replace tarball with zipball.

在Windows10的WSL Ubuntu22.04环境下实践安装Nuttx 

首先进入WSL

安装基本库

sudo apt install \
bison flex gettext texinfo libncurses5-dev libncursesw5-dev xxd \
git gperf automake libtool pkg-config build-essential gperf genromfs \
libgmp-dev libmpc-dev libmpfr-dev libisl-dev binutils-dev libelf-dev \
libexpat1-dev gcc-multilib g++-multilib picocom u-boot-tools util-linux

 安装KConfig frontend

sudo apt install kconfig-frontends

安装工具链

sudo apt install gcc-arm-none-eabi binutils-arm-none-eabi

这个占用空间较大,需要2.5G空间

下载源代码

mkdir nuttxspace
cd nuttxspace
git clone https://github.com/apache/nuttx.git nuttx
git clone https://github.com/apache/nuttx-apps apps

如果github抽风,可以使用镜像加速

使用make进行编译

初始化配置

cd nuttx
./tools/configure.sh -L | less

哇塞,这个支持的实在太多了!光esp的就这么多:

  esp32c3-devkit:efuseesp32c3-devkit:watchdogesp32c3-devkit:pwmesp32c3-devkit:gdbstubesp32c3-devkit:moduleesp32c3-devkit:watcheresp32c3-devkit:wifiesp32c3-devkit:romfsesp32c3-devkit:ticklessesp32c3-devkit:coremarkesp32c3-devkit:sotestesp32c3-devkit:bmp180esp32c3-devkit:randomesp32c3-devkit:rtcesp32c3-devkit:bleesp32c3-devkit:twaiesp32c3-devkit:ostestesp32c3-devkit:usbconsoleesp32c3-devkit:autopmesp32c3-devkit:oneshotesp32c3-devkit:pmesp32c3-devkit:knshesp32c3-devkit:gpioesp32c3-devkit:nvcfgdataesp32c3-devkit:sta_softapesp32c3-devkit:nshesp32c3-devkit:lvglesp32c3-devkit:timeresp32c3-devkit:mcuboot_slot_confirmesp32c3-devkit:cxxesp32c3-devkit:spiflashesp32c3-devkit:cryptoesp32c3-devkit:uidesp32c3-devkit:elfesp32c3-devkit:adcesp32c3-devkit-rust-1:nshesp32c3-devkit-rust-1:brickmatchesp32h2-devkit:i2cesp32h2-devkit:efuseesp32h2-devkit:watchdogesp32h2-devkit:pwmesp32h2-devkit:timersesp32h2-devkit:ticklessesp32h2-devkit:i2scharesp32h2-devkit:bmp180esp32h2-devkit:spiesp32h2-devkit:randomesp32h2-devkit:rtcesp32h2-devkit:buttonsesp32h2-devkit:twaiesp32h2-devkit:ostestesp32h2-devkit:qencoderesp32h2-devkit:captureesp32h2-devkit:usbconsoleesp32h2-devkit:motoresp32h2-devkit:gpioesp32h2-devkit:nshesp32h2-devkit:temperature_sensoresp32h2-devkit:rmtesp32h2-devkit:spiflashesp32h2-devkit:sdmesp32h2-devkit:mcuboot_nshesp32h2-devkit:adcesp32c3-xiao:wifiesp32c3-xiao:bleesp32c3-xiao:usbnshesp32c3-xiao:gpioesp32c3-xiao:nshesp32c3-generic:i2cesp32c3-generic:efuseesp32c3-generic:watchdogesp32c3-generic:pwmesp32c3-generic:timersesp32c3-generic:nimbleesp32c3-generic:wifiesp32c3-generic:ticklessesp32c3-generic:i2scharesp32c3-generic:bmp180esp32c3-generic:spiesp32c3-generic:randomesp32c3-generic:rtcesp32c3-generic:buttonsesp32c3-generic:bleesp32c3-generic:twaiesp32c3-generic:ostestesp32c3-generic:usbconsoleesp32c3-generic:gpioesp32c3-generic:sta_softapesp32c3-generic:nshesp32c3-generic:temperature_sensoresp32c3-generic:rmtesp32c3-generic:spiflashesp32c3-generic:sdmesp32c3-generic:mcuboot_nshesp32c3-generic:adcesp32c6-devkitm:i2cesp32c6-devkitm:efuseesp32c6-devkitm:watchdogesp32c6-devkitm:pwmesp32c6-devkitm:timersesp32c6-devkitm:wifiesp32c6-devkitm:ticklessesp32c6-devkitm:i2scharesp32c6-devkitm:bmp180esp32c6-devkitm:spiesp32c6-devkitm:randomesp32c6-devkitm:rtcesp32c6-devkitm:buttonsesp32c6-devkitm:spislvesp32c6-devkitm:twaiesp32c6-devkitm:ostestesp32c6-devkitm:usbconsoleesp32c6-devkitm:gpioesp32c6-devkitm:sta_softapesp32c6-devkitm:nshesp32c6-devkitm:rmtesp32c6-devkitm:spiflashesp32c6-devkitm:mcuboot_nshesp32c6-devkitc:i2cesp32c6-devkitc:efuseesp32c6-devkitc:watchdogesp32c6-devkitc:pwmesp32c6-devkitc:timersesp32c6-devkitc:mpu60x0esp32c6-devkitc:wifiesp32c6-devkitc:ticklessesp32c6-devkitc:i2scharesp32c6-devkitc:bmp180esp32c6-devkitc:spiesp32c6-devkitc:randomesp32c6-devkitc:rtcesp32c6-devkitc:buttonsesp32c6-devkitc:spislvesp32c6-devkitc:twaiesp32c6-devkitc:ostestesp32c6-devkitc:qencoderesp32c6-devkitc:captureesp32c6-devkitc:usbconsoleesp32c6-devkitc:motoresp32c6-devkitc:gpioesp32c6-devkitc:sta_softapesp32c6-devkitc:nshesp32c6-devkitc:temperature_sensoresp32c6-devkitc:rmtesp32c6-devkitc:spiflashesp32c6-devkitc:sdmesp32c6-devkitc:mcuboot_nshesp32c6-devkitc:adcesp32c6-xiao:wifiesp32c6-xiao:usbnshesp32c6-xiao:gpioesp32c6-xiao:nshesp32s3-eye:i2cesp32s3-eye:wifiesp32s3-eye:usbnshesp32s3-eye:gpioesp32s3-eye:nshesp32s3-eye:lcdesp32s3-lcd-ev:buttonsesp32s3-lcd-ev:ws2812esp32s3-lcd-ev:audioesp32s3-lcd-ev:nshesp32s3-lcd-ev:lcdesp32s3-lcd-ev:lvglesp32s3-lhcbit:usbnshesp32s3-korvo-2:rtptoolsesp32s3-korvo-2:sdmmcesp32s3-korvo-2:audioesp32s3-korvo-2:nshesp32s3-box:lvgl-3esp32s3-box:buttonsesp32s3-box:nshesp32s3-box:touchscreenesp32s3-box:lvglesp32s3-devkit:psram_octalesp32s3-devkit:i2cesp32s3-devkit:watchdogesp32s3-devkit:pwmesp32s3-devkit:nxlooperesp32s3-devkit:usb_deviceesp32s3-devkit:wifiesp32s3-devkit:pythonesp32s3-devkit:qemu_toywasmesp32s3-devkit:sdmmcesp32s3-devkit:ticklessesp32s3-devkit:psram_quadesp32s3-devkit:ksta_softapesp32s3-devkit:coremarkesp32s3-devkit:sotestesp32s3-devkit:i2scharesp32s3-devkit:spiesp32s3-devkit:randomesp32s3-devkit:smpesp32s3-devkit:qemu_openethesp32s3-devkit:rtcesp32s3-devkit:buttonsesp32s3-devkit:bleesp32s3-devkit:twaiesp32s3-devkit:qencoderesp32s3-devkit:audioesp32s3-devkit:captureesp32s3-devkit:txtableesp32s3-devkit:usbnshesp32s3-devkit:psram_usrheapesp32s3-devkit:oneshotesp32s3-devkit:adbesp32s3-devkit:pmesp32s3-devkit:knshesp32s3-devkit:motoresp32s3-devkit:blewifiesp32s3-devkit:gpioesp32s3-devkit:sta_softapesp32s3-devkit:nshesp32s3-devkit:usbmscesp32s3-devkit:qemu_debugesp32s3-devkit:temperature_sensoresp32s3-devkit:timeresp32s3-devkit:rmtesp32s3-devkit:eth_lan9250esp32s3-devkit:stackesp32s3-devkit:cxxesp32s3-devkit:spiflashesp32s3-devkit:sdmesp32s3-devkit:toywasmesp32s3-devkit:mcuboot_nshesp32s3-devkit:elfesp32s3-devkit:fastbootesp32s3-devkit:adcesp32s3-xiao:usbnshesp32s3-xiao:comboesp32s3-meadow:usbnshesp32s3-meadow:nshlckfb-szpi-esp32s3:pwmlckfb-szpi-esp32s3:usb_devicelckfb-szpi-esp32s3:pca9557lckfb-szpi-esp32s3:txtablelckfb-szpi-esp32s3:adblckfb-szpi-esp32s3:gpiolckfb-szpi-esp32s3:nshlckfb-szpi-esp32s3:psramlckfb-szpi-esp32s3:lcdlckfb-szpi-esp32s3:lvgllckfb-szpi-esp32s3:fastbootesp32-wrover-kit:nxesp32-wrover-kit:wifiesp32-wrover-kit:ledsesp32-wrover-kit:lcd1602esp32-wrover-kit:bmp180esp32-wrover-kit:rtcesp32-wrover-kit:buttonsesp32-wrover-kit:autopmesp32-wrover-kit:oneshotesp32-wrover-kit:luaesp32-wrover-kit:mmcsdspiesp32-wrover-kit:gpioesp32-wrover-kit:nshesp32-wrover-kit:lvglesp32-devkitc:efuseesp32-devkitc:watchdogesp32-devkitc:ms5611esp32-devkitc:pwmesp32-devkitc:nxlooperesp32-devkitc:mcuboot_update_agentesp32-devkitc:modbusesp32-devkitc:softapesp32-devkitc:moduleesp32-devkitc:nxdiagesp32-devkitc:watcheresp32-devkitc:wifiesp32-devkitc:ticklessesp32-devkitc:coremarkesp32-devkitc:mcp2515esp32-devkitc:wifishareesp32-devkitc:ledsesp32-devkitc:sotestesp32-devkitc:mqttcesp32-devkitc:i2scharesp32-devkitc:bmp280esp32-devkitc:max6675esp32-devkitc:randomesp32-devkitc:smpesp32-devkitc:qemu_openethesp32-devkitc:rtcesp32-devkitc:buttonsesp32-devkitc:wamr_wasi_debugesp32-devkitc:bleesp32-devkitc:twaiesp32-devkitc:ostestesp32-devkitc:qencoderesp32-devkitc:audioesp32-devkitc:captureesp32-devkitc:dacesp32-devkitc:autopmesp32-devkitc:snakeesp32-devkitc:psram_usrheapesp32-devkitc:oneshotesp32-devkitc:pmesp32-devkitc:knshesp32-devkitc:motoresp32-devkitc:wifi_smpesp32-devkitc:blewifiesp32-devkitc:espnowesp32-devkitc:sta_softapesp32-devkitc:nshesp32-devkitc:psramesp32-devkitc:timeresp32-devkitc:mcuboot_slot_confirmesp32-devkitc:rmtesp32-devkitc:cxxesp32-devkitc:spiflashesp32-devkitc:sdmesp32-devkitc:wifinshesp32-devkitc:mcuboot_nshesp32-devkitc:elfesp32-devkitc:brickmatchesp32-devkitc:adcttgo_lora_esp32:sx127xttgo_lora_esp32:nshttgo_t_display_esp32:lvgl_fbttgo_t_display_esp32:nshttgo_t_display_esp32:lvgl_lcdesp32-audio-kit:wifiesp32-audio-kit:audioesp32-audio-kit:nshesp32-pico-kit:nshesp32-2432S028:nshesp32-2432S028:lvglesp32-ethernet-kit:ethernetesp32-ethernet-kit:wifiesp32-ethernet-kit:rtcesp32-ethernet-kit:buttonsesp32-ethernet-kit:autopmesp32-ethernet-kit:oneshotesp32-ethernet-kit:nshesp32-sparrow-kit:wifiesp32-sparrow-kit:mqttcesp32-sparrow-kit:nshesp32-lyrat:nxrecorderesp32-lyrat:rtptoolsesp32-lyrat:wifiesp32-lyrat:buttonsesp32-lyrat:audioesp32-lyrat:mmcsdspiesp32-lyrat:nshesp32s2-kaluga-1:i2cesp32s2-kaluga-1:watchdogesp32s2-kaluga-1:nxlooperesp32s2-kaluga-1:rtcesp32s2-kaluga-1:buttonsesp32s2-kaluga-1:twaiesp32s2-kaluga-1:audioesp32s2-kaluga-1:nshesp32s2-kaluga-1:lvgl_ili9341esp32s2-kaluga-1:lvgl_st7789esp32s2-saola-1:i2cesp32s2-saola-1:watchdogesp32s2-saola-1:pwmesp32s2-saola-1:nxlooperesp32s2-saola-1:wifiesp32s2-saola-1:coremarkesp32s2-saola-1:sotestesp32s2-saola-1:i2scharesp32s2-saola-1:randomesp32s2-saola-1:rtcesp32s2-saola-1:buttonsesp32s2-saola-1:twaiesp32s2-saola-1:ostestesp32s2-saola-1:qencoderesp32s2-saola-1:audioesp32s2-saola-1:oneshotesp32s2-saola-1:gpioesp32s2-saola-1:sta_softapesp32s2-saola-1:nshesp32s2-saola-1:temperature_sensoresp32s2-saola-1:timeresp32s2-saola-1:rmtesp32s2-saola-1:cxxesp32s2-saola-1:spiflashesp32s2-saola-1:sdmesp32s2-saola-1:mcuboot_nshesp32s2-saola-1:adc

列出所有的esp32c3

./tools/configure.sh -L |grep esp32c3esp32c3-devkit:efuseesp32c3-devkit:watchdogesp32c3-devkit:pwmesp32c3-devkit:gdbstubesp32c3-devkit:moduleesp32c3-devkit:watcheresp32c3-devkit:wifiesp32c3-devkit:romfsesp32c3-devkit:ticklessesp32c3-devkit:coremarkesp32c3-devkit:sotestesp32c3-devkit:bmp180esp32c3-devkit:randomesp32c3-devkit:rtcesp32c3-devkit:bleesp32c3-devkit:twaiesp32c3-devkit:ostestesp32c3-devkit:usbconsoleesp32c3-devkit:autopmesp32c3-devkit:oneshotesp32c3-devkit:pmesp32c3-devkit:knshesp32c3-devkit:gpioesp32c3-devkit:nvcfgdataesp32c3-devkit:sta_softapesp32c3-devkit:nshesp32c3-devkit:lvglesp32c3-devkit:timeresp32c3-devkit:mcuboot_slot_confirmesp32c3-devkit:cxxesp32c3-devkit:spiflashesp32c3-devkit:cryptoesp32c3-devkit:uidesp32c3-devkit:elfesp32c3-devkit:adcesp32c3-devkit-rust-1:nshesp32c3-devkit-rust-1:brickmatchesp32c3-xiao:wifiesp32c3-xiao:bleesp32c3-xiao:usbnshesp32c3-xiao:gpioesp32c3-xiao:nshesp32c3-generic:i2cesp32c3-generic:efuseesp32c3-generic:watchdogesp32c3-generic:pwmesp32c3-generic:timersesp32c3-generic:nimbleesp32c3-generic:wifiesp32c3-generic:ticklessesp32c3-generic:i2scharesp32c3-generic:bmp180esp32c3-generic:spiesp32c3-generic:randomesp32c3-generic:rtcesp32c3-generic:buttonsesp32c3-generic:bleesp32c3-generic:twaiesp32c3-generic:ostestesp32c3-generic:usbconsoleesp32c3-generic:gpioesp32c3-generic:sta_softapesp32c3-generic:nshesp32c3-generic:temperature_sensoresp32c3-generic:rmtesp32c3-generic:spiflashesp32c3-generic:sdmesp32c3-generic:mcuboot_nshesp32c3-generic:adc

配置  esp32c3-devkit:nsh

cd nuttx
./tools/configure.sh -l   esp32c3-devkit:nsh

完成显示:

 configuration written to .config

make menuconfig

cd nuttx
make menuconfig

出现菜单界面

对于ammy 也就是Ubuntu 22.04版本,需要加上参数make CONFIG_LIBM=y

在library Routines里加上本地math库的支持:

选择-> Library Routines (库函数) -> Select math library (Math library from NuttX)  -> Math library from NuttX 

设好后,保存退出

make

make

make输出

make
Create version.h
LN: platform/board to /home/skywalk/github/nuttxspace/apps/platform/dummy
Register: dd
Register: dumpstack
Register: nsh
Register: sh
CPP:  /home/skywalk/github/nuttxspace/nuttx/boards/risc-v/esp32c3-legacy/esp32c3-devkit/../common/scripts/esp32c3_rom.ld-> /home/skywalk/github/nuttxspace/nuttx/boards/risc-v/esp32c3-legacy/esp32c3-devkit/../common/scripts/esp32c3_rom.ld.tmCPP:  /home/skywalk/github/nuttxspace/nuttx/boards/risc-v/esp32c3-legacy/esp32c3-devkit/../common/scripts/flat_memory.ld-> /home/skywalk/github/nuttxspace/nuttx/boards/risc-v/esp32c3-legacy/esp32c3-devkit/../common/scripts/flat_memory.ld.tmCPP:  /home/skywalk/github/nuttxspace/nuttx/boards/risc-v/esp32c3-legacy/esp32c3-devkit/../common/scripts/legacy_sections.ld-> /home/skywalk/github/nuttxspace/nuttx/boards/risc-v/esp32c3-legacy/esp32c3-devkit/../common/scripts/legacy_sectioLD: nuttx
Memory region         Used Size  Region Size  %age Used
     iram0_0_seg:        6624 B     321296 B      2.06%
     irom0_0_seg:      107028 B    4194272 B      2.55%
     dram0_0_seg:       13792 B     321296 B      4.29%
     drom0_0_seg:      147892 B    4194272 B      3.53%
         rtc_seg:          0 GB         8 KB      0.00%
CP: nuttx.hex
MKIMAGE: ESP32-C3 binary
esptool.py not found. Please run: 'pip install esptool'
Run make again to create the nuttx.bin image.
make: *** [tools/Unix.mk:559: nuttx] Error 1 

按照提示,安装esptool

pip install esptool

然后再make

输出:

LD: nuttx
Memory region         Used Size  Region Size  %age Usediram0_0_seg:        6624 B     321296 B      2.06%irom0_0_seg:      107028 B    4194272 B      2.55%dram0_0_seg:       13792 B     321296 B      4.29%drom0_0_seg:      147892 B    4194272 B      3.53%rtc_seg:          0 GB         8 KB      0.00%
CP: nuttx.hex
MKIMAGE: ESP32-C3 binary
esptool.py -c esp32c3 elf2image -fs 4MB -fm dio -ff 40m -o nuttx.bin nuttx
esptool.py v4.8.1
Creating esp32c3 image...
Merged 1 ELF section
Successfully created esp32c3 image.
Generated: nuttx.bin (ESP32-C3 compatible)

使用Cmake

先安装cmake

sudo apt isntall cmake

cd nuttx
cmake -B build -DBOARD_CONFIG=esp32c3-devkit:nsh -GNinja

cmake -B build -DBOARD_CONFIG=esp32c3-devkit:nsh -GNinja

配置管理

cmake --build build -t menuconfig

 cmake失败

烧录

烧录之前安装esptool工具

pip install esptool

使用这条命令:

esptool --chip esp32c3 --port com3 --baud 460800 write_flash -z 0x0  E:\tmp\nuttx.bin

显示:

esptool --chip esp32c3 --port com3 --baud 460800 write_flash -z 0x0  E:\tmp\nuttx.bin
esptool.py v4.8.1
Serial port com3
Connecting...
Failed to get PID of a device on com3, using standard reset sequence.
.
Chip is ESP32-C3 (QFN32) (revision v0.4)
Features: WiFi, BLE
Crystal is 40MHz
MAC: e4:b0:63:22:df:68
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x0002afff...
Compressed 172640 bytes to 81799...
Wrote 172640 bytes (81799 compressed) at 0x00000000 in 2.3 seconds (effective 610.2 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

 也不知道是否成功了...

至少生成了文件:

-rwxr-xr-x  1 skywalk skywalk 2808092 May 17 19:08 nuttx
-rw-r--r--  1 skywalk skywalk  172640 May 17 19:08 nuttx.bin
-rw-r--r--  1 skywalk skywalk  369186 May 17 19:08 nuttx.hex
-rw-r--r--  1 skywalk skywalk      47 May 17 19:08 nuttx.manifest
-rw-r--r--  1 skywalk skywalk 1660487 May 17 19:08 nuttx.map

就先到这里吧! 

调试

编译报错ERROR: riscv64-unknown-elf-gcc failed: 1

make
Create version.h
LN: platform/board to /home/skywalk/github/nuttxspace/apps/platform/dummy
Register: dd
Register: dumpstack
Register: nsh
Register: sh
./stdlib/lib_strtold.c:42:10: fatal error: math.h: No such file or directory
   42 | #include <math.h>
      |          ^~~~~~~~
compilation terminated.
ERROR: riscv64-unknown-elf-gcc failed: 1
       command: riscv64-unknown-elf-gcc -MT bin/lib_strtold.o  -M '-fno-common' '-Wall' '-Wstrict-prototypes' '-Wshadow' '-Wundef' '-Wno-attributes' '-Wno-unknown-pragmas' '-Wno-psabi' '-Os' '-fno-strict-aliasing' '-fno-omit-frame-pointer' '-fno-optimize-sibling-calls' '-ffunction-sections' '-fdata-sections' '-nostdlib' '-g' '-march=rv32imc' '-mabi=ilp32' '-isystem' '/home/skywalk/github/nuttxspace/nuttx/include' '-D__NuttX__' '-DNDEBUG' '-D__KERNEL__' '-Werror=return-type' '-I' '/home/skywalk/github/nuttxspace/nuttx/libs/libc' ./stdlib/lib_strtold.c
make[2]: *** [/home/skywalk/github/nuttxspace/nuttx/tools/Config.mk:232: lib_strtold.ddc] Error 1
make[1]: *** [Makefile:202: .depend] Error 2
make: *** [tools/Unix.mk:660: pass2dep] Error 2

又重新make了一下,报错简化成:

make

CC:  stdlib/lib_strtold.c stdlib/lib_strtold.c:42:10: fatal error: math.h: No such file or directory
   42 | #include <math.h>
      |          ^~~~~~~~
compilation terminated.
make[1]: *** [Makefile:156: bin/lib_strtold.o] Error 1
make: *** [tools/LibTargets.mk:196: libs/libc/libc.a] Error 2

检查math.h 是否存在

find /usr/include -name math.h

find /usr/include -name math.h
/usr/include/newlib/math.h
/usr/include/newlib/c++/10.3.1/math.h
/usr/include/newlib/c++/10.3.1/tr1/math.h
/usr/include/math.h
/usr/include/c++/11/math.h
/usr/include/c++/11/tr1/math.h

检查编译器路径

echo | gcc -E -v -

看到这句

#include <...> search starts here:/usr/lib/gcc/x86_64-linux-gnu/11/include/usr/local/include/usr/include/x86_64-linux-gnu/usr/include

证明应该可以看到math.h文件啊!

检查这两项:

7. 检查环境变量

确保环境变量 CC 和 CFLAGS 没有错误配置。例如:

export CC=gcc
export CFLAGS="-I/usr/include"

8. 检查 Makefile 配置

检查 Makefile 中是否有错误的配置,例如缺少 -lm 链接数学库。在 Makefile 中添加以下内容:

LDFLAGS += -lm

问题解决

最终发现,这是已知的问题:`rv-virt:nsh64` can't build with stock gcc-riscv64-unknown-elf on Ubuntu Jammy · Issue #11341 · apache/nuttx 

This is a know issue. Ubuntu release of RISC-V GCC is compiled without math libs. We can do nothing with that, but you can enable NuttX native math libraries support via CONFIG_ LIBM=y and still use RISC-V GCC provided by Ubuntu apt or pick another more mature toolchain

👍1

 直接用命令:

make CONFIG_LIBM=y

哇塞,终于过去了 

cmake -B build -DBOARD_CONFIG=esp32c3-devkit:nsh -GNinja报错

cmake -B build -DBOARD_CONFIG=esp32c3-devkit:nsh -GNinja
CMake Error at CMakeLists.txt:89 (message):
  Kconfig environment depends on kconfiglib, Please install:

    (APT source)
      $ sudo apt install python3-kconfiglib
    or (pip source)
      $ pip install kconfiglib
    or (After Ubuntu 24.04)
      $ pip install kconfiglib --break-system-packages


-- Configuring incomplete, errors occurred!

 放弃cmake

make报错esptool.py not found. Please run: 'pip install esptool'

make
Create version.h
LN: platform/board to /home/skywalk/github/nuttxspace/apps/platform/dummy
Register: dd
Register: dumpstack
Register: nsh
Register: sh
CPP:  /home/skywalk/github/nuttxspace/nuttx/boards/risc-v/esp32c3-legacy/esp32c3-devkit/../common/scripts/esp32c3_rom.ld-> /home/skywalk/github/nuttxspace/nuttx/boards/risc-v/esp32c3-legacy/esp32c3-devkit/../common/scripts/esp32c3_rom.ld.tmCPP:  /home/skywalk/github/nuttxspace/nuttx/boards/risc-v/esp32c3-legacy/esp32c3-devkit/../common/scripts/flat_memory.ld-> /home/skywalk/github/nuttxspace/nuttx/boards/risc-v/esp32c3-legacy/esp32c3-devkit/../common/scripts/flat_memory.ld.tmCPP:  /home/skywalk/github/nuttxspace/nuttx/boards/risc-v/esp32c3-legacy/esp32c3-devkit/../common/scripts/legacy_sections.ld-> /home/skywalk/github/nuttxspace/nuttx/boards/risc-v/esp32c3-legacy/esp32c3-devkit/../common/scripts/legacy_sectioLD: nuttx
Memory region         Used Size  Region Size  %age Used
     iram0_0_seg:        6624 B     321296 B      2.06%
     irom0_0_seg:      107028 B    4194272 B      2.55%
     dram0_0_seg:       13792 B     321296 B      4.29%
     drom0_0_seg:      147892 B    4194272 B      3.53%
         rtc_seg:          0 GB         8 KB      0.00%
CP: nuttx.hex
MKIMAGE: ESP32-C3 binary
esptool.py not found. Please run: 'pip install esptool'
Run make again to create the nuttx.bin image.
make: *** [tools/Unix.mk:559: nuttx] Error 1

按照提示的运行

pip install esptool

相关文章:

开源RTOS(实时操作系统):nuttx 编译

开源RTOS&#xff08;实时操作系统&#xff09;&#xff1a;nuttx 编译 手册&#xff1a;Installing — NuttX latest documentation 源码&#xff1a;GitHub - apache/nuttx: Apache NuttX is a mature, real-time embedded operating system (RTOS) Installing The fir…...

python打包exe报错:处理文件时错误:Excel xlsx file; not supported

背景&#xff1a;最近用python写一个excel解析工具&#xff0c;然后打包成exe可执行文件的时候&#xff0c;遇到这样的问题 1.在我自己编译器运行是可以正常将上传后的excel进行解析&#xff0c;但是在打包成exe后&#xff0c;就无法正常解析excel 问题排查&#xff1a; 1.切换…...

VUE3 -综合实践(Mock+Axios+ElementPlus)

目录 前言 目标 1.工程创建 2.Mock 2.1 配置Mock 扩 展 2.2 定义模拟数据 2.3 创建Mock服务器 3.导入ElementPlus 4.表格页面搭建 5.动态路由跳转 6.详情页面的制作 前言 基于前文 VUE3详细入门&#xff0c;我们对VUE3的基本使用有了初步的了解&#xff0c;下…...

NDS3211HV单路H.264/HEVC/HD视频编码器

1产品概述 NDS3211HV单路高清编码器是一款功能强大的音/视频编码设备&#xff0c;支持2组立体声&#xff0c;同时还支持CC(CVBS)字幕。支持多种音频编码方式。该设备配备了多种音/视频输入接口&#xff1a;HD-SDI数字视频输入、HDMI高清输入&#xff08;支持CC&#xff09;、A…...

LeetCode热题100--206.反转链表--简单

1. 题目 给你单链表的头节点 head &#xff0c;请你反转链表&#xff0c;并返回反转后的链表。 示例 1&#xff1a; 输入&#xff1a;head [1,2,3,4,5] 输出&#xff1a;[5,4,3,2,1] 示例 2&#xff1a; 输入&#xff1a;head [1,2] 输出&#xff1a;[2,1] 示例 3&…...

来一个复古的技术FTP

背景 10年前的老代码&#xff0c;需要升级springboot框架&#xff0c;在升级过程中&#xff0c;测试业务流程里&#xff0c;有FTP的下载业务&#xff0c;不管测试环境如何测试&#xff0c;都没有成功&#xff0c;最后只能自己搭建一个FTP服务器&#xff0c;写一个ftp-demo来测试…...

OpenCV CUDA模块中矩阵操作------分布统计类

操作系统&#xff1a;ubuntu22.04 OpenCV版本&#xff1a;OpenCV4.9 IDE:Visual Studio Code 编程语言&#xff1a;C11 算法描述 在 OpenCV 的 CUDA 模块中&#xff0c;meanStdDev 函数用于计算矩阵的平均值&#xff08;Mean&#xff09;和标准差&#xff08;StdDev&#xff…...

OpenWebUI新突破,MCPO框架解锁MCP工具新玩法

大家好&#xff0c;Open WebUI 迎来重要更新&#xff0c;现已正式支持 MCP 工具服务器&#xff0c;但 MCP 工具服务器需由兼容 OpenAPI 的代理作为前端。mcpo 是一款实用代理&#xff0c;经测试&#xff0c;它能让开发者使用 MCP 服务器命令和标准 OpenAPI 服务器工具&#xff…...

go.mod关于go版本异常的处理

​ 1.私有仓库 go.mod 要注意module的配置mod地址&#xff0c;要与下载地址一致。 否则就算下载下来&#xff0c;就会比较后报错。 module test.com/devGroup/devProjectgo 1.22.2 2. 代码中的包引用地址。 要与module中的mod路径一致 package mainimport ("module …...

TRTC实时对话式AI解决方案,助力人机语音交互极致体验

近年来&#xff0c;AI热度持续攀升&#xff0c;无论是融资规模还是用户热度都大幅增长。2023 年&#xff0c;中国 AI 行业融资规模达2631亿人民币&#xff0c;较2022年上升51%&#xff1b;2024年第二季度&#xff0c;全球 AI 初创企业融资规模为 240 亿美金&#xff0c;较第一季…...

Linux安全篇 --firewalld

一、Firewalld 防火墙概述 1、Firewalld 简介 firewalld 的作用是为包过滤机制提供匹配规则(或称为策略)&#xff0c;通过各种不同的规则告诉netfilter 对来自指定源、前往指定目的或具有某些协议特征的数据包采取何种处理方式为了更加方便地组织和管理防火墙,firewalld 提供…...

系分论文《论系统需求分析方法及应用》

系统分析师论文范文系列 【摘要】 2022年6月&#xff0c;我作为系统分析师参与了某金融机构“智能信贷风控系统”的建设项目。该系统旨在通过对业务流程的数字化重构&#xff0c;优化信贷审批效率并降低风险。项目涉及信贷申请、资质审核、风险评估、额度审批等核心流程&#x…...

LIIGO ❤️ RUST: 12 YEARS

LIIGO &#x1f496; RUST: 12 YEARS 今天是RUST语言1.0发布十周年纪念日。十年前的今天&#xff0c;2015年的今天&#xff0c;Rust 1.0 正式发行。这是值得全球Rust支持者隆重纪念的日子。我借此机会衷心感谢Rust语言创始人Graydon Hoare&#xff0c;Mozilla公司&#xff0c;…...

SQL、Oracle 和 SQL Server 的比较与分析

SQL、Oracle 和 SQL Server 的比较与分析 一、基础概念 1. SQL (Structured Query Language) 定义&#xff1a;结构化查询语言&#xff0c;用于管理关系型数据库的标准语言类型&#xff1a; DDL (数据定义语言)&#xff1a;CREATE, ALTER, DROPDML (数据操作语言)&#xff1…...

Trivy:让你时刻掌控的开源安全扫描器

深入了解 Trivy:全面的安全扫描工具 在如今互联网快速发展的时代,软件的安全性显得尤为重要。随着应用程序的复杂性增加,其可能带来的安全漏洞也在不断增多。如何快速、准确地发现这些潜在威胁是每个开发者和运维人员心中的课题。今天,我们将为大家介绍一个开源的安全扫描…...

LlamaIndex 第八篇 MilvusVectorStore

本指南演示了如何使用 LlamaIndex 和 Milvus 构建一个检索增强生成&#xff08;RAG&#xff09;系统。 RAG 系统将检索系统与生成模型相结合&#xff0c;根据给定的提示生成新的文本。该系统首先使用 Milvus 等向量相似性搜索引擎从语料库中检索相关文档&#xff0c;然后使用生…...

2022河南CCPC(前四题)

签到题目 #include <bits/stdc.h> using namespace std; #define int long long #define PII pair<int,int> #define fi first #define se second #define endl \n #define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);void solve() {int n;cin>>…...

谷歌浏览器(Google Chrome)136.0.7103.93便携增强版|Win中文|安装教程

软件下载 【名称】&#xff1a;谷歌浏览器&#xff08;Google Chrome&#xff09;136.0.7103.93 【大小】&#xff1a;170M 【语言】&#xff1a;简体中文 【安装环境】&#xff1a;Win10/Win11 【夸克网盘下载链接】&#xff08;务必手机注册&#xff09;&#xff1a; h…...

高可用消息队列实战:AWS SQS 在分布式系统中的核心解决方案

引言&#xff1a;消息队列的“不可替代性” 在微服务架构和分布式系统盛行的今天&#xff0c;消息队列&#xff08;Message Queue&#xff09; 已成为解决系统解耦、流量削峰、异步处理等难题的核心组件。然而&#xff0c;传统的自建消息队列&#xff08;如RabbitMQ、Kafka&am…...

「Mac畅玩AIGC与多模态41」开发篇36 - 用 ArkTS 构建聚合搜索前端页面

一、概述 本篇基于上一节 Python 实现的双通道搜索服务&#xff08;聚合 SearxNG 本地知识库&#xff09;&#xff0c;构建一个完整的 HarmonyOS ArkTS 前端页面。用户可在输入框中输入关键词&#xff0c;实时查询本地服务 http://localhost:5001/search?q...&#xff0c;返…...

springCloud/Alibaba常用中间件之Seata分布式事务

文章目录 SpringCloud Alibaba:依赖版本补充Seata处理分布式事务(AT模式)AT模式介绍核心组件介绍AT的工作流程&#xff1a;两阶段提交&#xff08;**2PC**&#xff09; Seata-AT模式使用Seata(2.0.0)下载、配置和启动Seata案例实战前置代码添加全局注解 GlobalTransactional Sp…...

Datawhale FastAPI Web框架5月第1次笔记

原课程地址&#xff1a; FastAPI Web框架https://www.datawhale.cn/learn/summary/164本次难点&#xff1a; 切换python的版本为3.10 作业过程 启动&#xff1a; jupyter notebook 首先我们要确保自己的python版本是3.10 import sys print(sys.version) 第一个fastapi…...

操作系统:os概述

操作系统&#xff1a;OS概述 程序、进程与线程无极二级目录三级目录 程序、进程与线程 指令执行需要那些条件&#xff1f;CPU内存 需要数据和 无极 二级目录 三级目录...

LLaMA-Factory:环境准备

一、硬件和系统 操作系统: Ubuntu 24.04.2 LTS&#xff08;64位&#xff09;GPU: NVIDIA RTX 4090 笔记本 GPU&#xff0c;16GB显存CPU: 建议高性能多核 CPU&#xff08;如 Intel i7/i9 或 AMD Ryzen 7/9&#xff09;以支持数据预处理&#xff0c;我的是32核。RAM: 至少 32GB&…...

ArrayList-集合使用

自动扩容&#xff0c;集合的长度可以变化&#xff0c;而数组长度不变&#xff0c;集合更加灵活。 集合只能存引用数据类型&#xff0c;不能直接存基本数据类型&#xff0c;除非包装 ArrayList会拿[]展示数据...

一分钟用 MCP 上线一个 贪吃蛇 小游戏(CodeBuddy版)

我正在参加CodeBuddy「首席试玩官」内容创作大赛&#xff0c;本文所使用的 CodeBuddy 免费下载链接&#xff1a;腾讯云代码助手 CodeBuddy - AI 时代的智能编程伙伴 你好&#xff0c;我是悟空。 背景 上篇我们用 MCP 上线了一个 2048 小游戏&#xff0c;这次我们继续做一个 …...

pytorch小记(二十二):全面解读 PyTorch 的 `torch.cumprod`——累积乘积详解与实战示例

pytorch小记&#xff08;二十二&#xff09;&#xff1a;全面解读 PyTorch 的 torch.cumprod——累积乘积详解与实战示例 一、函数签名与参数说明二、基础用法1. 一维张量累积乘积2. 二维张量按行&#xff0f;按列累积 三、dtype 参数&#xff1a;避免整数溢出与提升精度四、典…...

TTS:F5-TTS 带有 ConvNeXt V2 的扩散变换器

1&#xff0c;项目简介 F5-TTS 于英文生成领域表现卓越&#xff0c;发音标准程度在本次评测软件中独占鳌头。再者&#xff0c;官方预设的多角色生成模式独具匠心&#xff0c;能够配置多个角色&#xff0c;一次性为多角色、多情绪生成对话式语音&#xff0c;别出心裁。 最低配置…...

强化学习笔记(一)基本概念

文章目录 1. 强化学习 (Reinforcement Learning, RL) 概述1.1 与监督学习 (Supervised Learning, SL) 的对比监督学习的特点:强化学习的特点: 2. 核心概念与术语2.1 策略 (Policy, π)2.2 价值函数 (Value Function)2.3 模型 (Model)2.4 回报 (Return, G)2.5 其他重要术语 3. 标…...

大型语言模型中的QKV与多头注意力机制解析

每周跟踪AI热点新闻动向和震撼发展 想要探索生成式人工智能的前沿进展吗&#xff1f;订阅我们的简报&#xff0c;深入解析最新的技术突破、实际应用案例和未来的趋势。与全球数同行一同&#xff0c;从行业内部的深度分析和实用指南中受益。不要错过这个机会&#xff0c;成为AI领…...