Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp32: Compile error regarding assert statement in esp-hal-3rdparty code #12111

Closed
dumitrache-adrian92 opened this issue Apr 9, 2024 · 8 comments

Comments

@dumitrache-adrian92
Copy link

Tested on two devkits, one with an esp32-WROOM and one with an esp32-WROVER.

Setting up NuttX like this:

./tools/configure.sh -l esp32-{devkitc, sparrow-kit}:nsh
make -j16 EXTRAFLAGS="-DESP32_IGNORE_CHIP_REVISION_CHECK"

will lead to the following error:

Espressif HAL for 3rd Party Platforms: 966f1bbf7d80d3fac9a43f414e864985cbcfd680
CC:  chip/esp-hal-3rdparty/components/efuse/esp32/esp_efuse_table.c In file included from chip/esp-hal-3rdparty/components/efuse/esp32/esp_efuse_fields.c:16:
<path>/nuttxspace/nuttx/arch/xtensa/src/chip/esp-hal-3rdparty/components/soc/include/soc/chip_revision.h:36:66: error: expected ',' before ')' token
 _Static_assert(CONFIG_ESP_REV_MIN_FULL <= CONFIG_ESP_REV_MAX_FULL);
                                                                  ^
CC:  chip/esp-hal-3rdparty/components/efuse/esp32/esp_efuse_utility.c make[1]: *** [Makefile:144: chip/esp-hal-3rdparty/components/efuse/esp32/esp_efuse_fields.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [tools/LibTargets.mk:164: arch/xtensa/src/libarch.a] Error 2
make: *** Waiting for unfinished jobs....
CC:  chip/esp-hal-3rdparty/components/efuse/esp32/esp_efuse_fields.c In file included from chip/esp-hal-3rdparty/components/efuse/esp32/esp_efuse_fields.c:16:
<path>/nuttxspace/nuttx/arch/xtensa/src/chip/esp-hal-3rdparty/components/soc/include/soc/chip_revision.h:36:66: error: expected ',' before ')' token
 _Static_assert(CONFIG_ESP_REV_MIN_FULL <= CONFIG_ESP_REV_MAX_FULL);
                                                                  ^
make[1]: *** [Makefile:144: chip/esp-hal-3rdparty/components/efuse/esp32/esp_efuse_fields.o] Error 1
make: *** [tools/LibTargets.mk:164: arch/xtensa/src/libarch.a] Error 2

Basically that assert doesn't have the error argument.

I made a simple fix on a personal repo, and it seems to work (I simply added the necessary argument):

make -j16 EXTRAFLAGS="-DESP32_IGNORE_CHIP_REVISION_CHECK" ESP_HAL_3RDPARTY_URL="https://github.com/dumitrache-adrian92/esp-hal-3rdparty.git" ESP_HAL_3RDPARTY_VERSION="9e8144ccf86281c8897c9507e4eeda8e1e904367"

I'm not sure how to contribute to the esp-hal-3rdparty repo though (since it doesn't seem to be pull request based). I can take care of this if anyone explains the process to me since I couldn't find any info.

@acassis
Copy link
Contributor

acassis commented Apr 9, 2024

@dumitrache-adrian92 I think esp-hal-3rdparty are maintained directly by Espressif

@tmedicci please take a look

@tmedicci
Copy link
Contributor

tmedicci commented Apr 9, 2024

Hi @dumitrache-adrian92 ,

That's strange... We continuously test the boards with ESP32_IGNORE_CHIP_REVISION_CHECK set on our internal CI. I double-checked locally and found no trouble (I used the exact commands you posted).

Could you please double-check the compiler being used? The easiest way to do that is by running the nxdiag application (https://nuttx.apache.org/docs/latest/platforms/xtensa/esp32/boards/esp32-devkitc/index.html#nxdiag)

@dumitrache-adrian92
Copy link
Author

dumitrache-adrian92 commented Apr 10, 2024

@tmedicci, sure:

nsh> nxdiag --all
Nxdiag Report:

NuttX RTOS info:
        Hostname: 
        Release: 12.4.0
        Build: 7f1e80f0de-dirty Apr 10 2024 08:48:44
        Arch: xtensa
        Defconfig: esp32-devkitc:nsh-dirty

Host system OS:
        Ubuntu 23.10 Linux cave 6.5.0-27-generic #28-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar  7 18:21:00 UTC 2024 x86_64 x86_64

@pkarashchenko
Copy link
Contributor

I just tried to compile this on MAC with the latest master and it built successfully.

@tmedicci
Copy link
Contributor

Can you please run this defconfig directly:

./tools/configure.sh -l esp32-devkitc:nxdiag

or, at least, enable the following configs in your setup:

CONFIG_SYSTEM_NXDIAG_COMP_FLAGS=y
CONFIG_SYSTEM_NXDIAG_CONF=y
CONFIG_SYSTEM_NXDIAG_ESPRESSIF=y
CONFIG_SYSTEM_NXDIAG_HOST_PATH=y

Particularly, I'm interest in such nxdiag output (which is missing in your last message):

Espressif specific information:

Bootloader version:
        esp32: v5.1-dev-3972-g1559b6309f
        esp32s2: Bootloader image not found
        esp32s3: Bootloader image not found
        esp32c2: Bootloader image not found
        esp32c3: Bootloader image not found
        esp32c6: v5.1-dev-3972-g1559b6309f
        esp32h2: Bootloader image not found

Toolchain version:
        clang: clang version 16.0.6
        gcc: gcc (GCC) 13.2.1 20230801
        xtensa-esp32-elf-gcc: xtensa-esp32-elf-gcc (crosstool-NG esp-12.2.0_20230208) 12.2.0
        xtensa-esp32s2-elf-gcc: xtensa-esp32s2-elf-gcc (crosstool-NG esp-12.2.0_20230208) 12.2.0
        xtensa-esp32s3-elf-gcc: xtensa-esp32s3-elf-gcc (crosstool-NG esp-12.2.0_20230208) 12.2.0
        riscv32-esp-elf-gcc: riscv32-esp-elf-gcc (crosstool-NG esp-12.2.0_20230208) 12.2.0
        riscv64-unknown-elf-gcc: riscv64-unknown-elf-gcc (SiFive GCC-Metal 10.2.0-2020.12.8) 10.2.0

Esptool version: 4.7.0

HAL version: sync/release_v5.1.c-nuttx-20230814-50-g966f1bbf7d

@dumitrache-adrian92
Copy link
Author

@tmedicci

Nxdiag Report:

Espressif specific information:

Bootloader version:
        esp32: v5.1-dev-3972-g1559b6309f
        esp32s2: Bootloader image not found
        esp32s3: Bootloader image not found
        esp32c2: Bootloader image not found
        esp32c3: Bootloader image not found
        esp32c6: Bootloader image not found
        esp32h2: Bootloader image not found

Toolchain version:
        clang: Not found
        gcc: gcc (Ubuntu 13.2.0-4ubuntu3) 13.2.0
        xtensa-esp32-elf-gcc: xtensa-esp32-elf-gcc (crosstool-NG esp-2020r2) 8.2.0
        xtensa-esp32s2-elf-gcc: Not found
        xtensa-esp32s3-elf-gcc: Not found
        riscv32-esp-elf-gcc: Not found
        riscv64-unknown-elf-gcc: Not found

Esptool version: 4.7.0

HAL version: sync/release_v5.1.c-nuttx-20230814-55-g9e8144ccf8

Note the HAL version is different because I had to use my own repo to compile.

@tmedicci
Copy link
Contributor

@tmedicci

Nxdiag Report:

Espressif specific information:

Bootloader version:
        esp32: v5.1-dev-3972-g1559b6309f
        esp32s2: Bootloader image not found
        esp32s3: Bootloader image not found
        esp32c2: Bootloader image not found
        esp32c3: Bootloader image not found
        esp32c6: Bootloader image not found
        esp32h2: Bootloader image not found

Toolchain version:
        clang: Not found
        gcc: gcc (Ubuntu 13.2.0-4ubuntu3) 13.2.0
        xtensa-esp32-elf-gcc: xtensa-esp32-elf-gcc (crosstool-NG esp-2020r2) 8.2.0
        xtensa-esp32s2-elf-gcc: Not found
        xtensa-esp32s3-elf-gcc: Not found
        riscv32-esp-elf-gcc: Not found
        riscv64-unknown-elf-gcc: Not found

Esptool version: 4.7.0

HAL version: sync/release_v5.1.c-nuttx-20230814-55-g9e8144ccf8

Note the HAL version is different because I had to use my own repo to compile.

Hi @dumitrache-adrian92 , I'm sorry, I thought I answered about this issue...

Your problem is related to the compiler version you are using. We recommend you to use the same version NuttX uses for the CI. You can check it here : https://github.com/apache/nuttx/blob/master/tools/ci/docker/linux/Dockerfile#L212

Currently:

xtensa-esp32-elf-gcc --version 
xtensa-esp32-elf-gcc (crosstool-NG esp-12.2.0_20230208) 12.2.0

Can you please update it and let us know if your problem has gone? I'll update the documentation to highlight this.

@dumitrache-adrian92
Copy link
Author

Hello, that was indeed the problem. Thank you for the help! Not sure how I ended up getting such an old version of the compiler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants