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

[BUG] arch/xtensa: wrong definition for _int32_t and _uint32_t #15755

Open
1 task done
tmedicci opened this issue Feb 4, 2025 · 4 comments
Open
1 task done

[BUG] arch/xtensa: wrong definition for _int32_t and _uint32_t #15755

tmedicci opened this issue Feb 4, 2025 · 4 comments
Labels
Arch: xtensa Issues related to the Xtensa architecture Area: Kernel Kernel issues OS: Linux Issues related to Linux (building system, etc) Type: Bug Something isn't working

Comments

@tmedicci
Copy link
Contributor

tmedicci commented Feb 4, 2025

Description / Steps to reproduce the issue

Summary

One of the commits introduced by #2222 (c18f074) changes the definition of _int32_t and _uint32_t with the following commit message:

xtensa: Change _int32_t from long to int to match the compiler

This change, however, doesn't seem to be true, generating problems to compile newlib, for instance, due to incompatible compiler and NuttX definitions.

How to Reproduce?

Just try to build an xtensa device with newlib. We can use ESP32-S3, for instance:

$ make -j distclean && ./tools/configure.sh esp32s3-devkit:nsh && kconfig-tweak -d LIBM_TOOLCHAIN && kconfig-tweak -e LIBM_NEWLIB && make olddefconfig -s -j && make -j bootloader && make flash ESPTOOL_PORT=/dev/ttyUSB0
...
CC:  newlib/newlib/newlib/libm/complex/cproj.c In file included from /home/tiago/Documents/work/espressif/projects/nuttx/nuttxspace_alfa/nuttx/include/sys/types.h:34,
                 from /home/tiago/Documents/work/espressif/projects/nuttx/nuttxspace_alfa/nuttx/include/stddef.h:30,
                 from /home/tiago/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/xtensa-esp32s3-elf/sys-include/sys/cdefs.h:47,
                 from newlib/newlib/newlib/libm/complex/cproj.c:71:
/home/tiago/Documents/work/espressif/projects/nuttx/nuttxspace_alfa/nuttx/include/stdint.h:178:29: error: conflicting types for 'int32_t'; have '_int32_t' {aka 'int'}
  178 | typedef _int32_t            int32_t;
      |                             ^~~~~~~
<command-line>: note: previous declaration of 'int32_t' with type 'int32_t' {aka 'long int'}
/home/tiago/Documents/work/espressif/projects/nuttx/nuttxspace_alfa/nuttx/include/stdint.h:179:29: error: conflicting types for 'uint32_t'; have '_uint32_t' {aka 'unsigned int'}
  179 | typedef _uint32_t           uint32_t;
      |                             ^~~~~~~~
<command-line>: note: previous declaration of 'uint32_t' with type 'uint32_t' {aka 'long unsigned int'}
make[1]: *** [Makefile:53: bin//cproj.o] Error 1
make: *** [tools/LibTargets.mk:206: libs/libm/libm.a] Error 2

The Error

Check the error for uint32_t:

/home/tiago/Documents/work/espressif/projects/nuttx/nuttxspace_alfa/nuttx/include/stdint.h:179:29: error: conflicting types for 'uint32_t'; have '_uint32_t' {aka 'unsigned int'}
  179 | typedef _uint32_t           uint32_t;
      |                             ^~~~~~~~
<command-line>: note: previous declaration of 'uint32_t' with type 'uint32_t' {aka 'long unsigned int'}

We are defining uint32_t at include/stdint.h as _uint32_t. _uint32_t is defined as unsigned int at arch/xtensa/include/types.h (after the changes introduced by #2222), but uint32_t was previously defined as long unsigned int by the compiler:

<command-line>: note: previous declaration of 'uint32_t' with type 'uint32_t' {aka 'long unsigned int'}

In fact, the compiler's definition seems to be wrong currently at arch/xtensa/include/types.h:

xtensa-esp32-elf-gcc -dM -E - < /dev/null | grep __UINT32_TYPE__
#define __UINT32_TYPE__ long unsigned int

Proposed Solution

Reverting c18f074 enables newlib to be built. On the other hand, a lot of warnings due to the expected format:

misc/ramdisk.c:241:9: warning: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'blkcnt_t' {aka 'long unsigned int'} [-Wformat=]
  241 |   finfo("sector: %" PRIuOFF " nsectors: %u sectorsize: %d\n",
      |         ^~~~~~~~~~~
  242 |         start_sector, nsectors, dev->rd_sectsize);
      |         ~~~~~~~~~~~~
      |         |
      |         blkcnt_t {aka long unsigned int}

Suppositions

I would say that we had such warnings in the past and #2222 tried to silent them all. The easiest way of silencing xtensa-related format warnings was to simply change the _uint32_t definition. This is a quite old change and we have built xtensa devices so far relying on the wrong definition (instead of fixing variables types when needed).

@yamt , do you recall how did you test the compiler's definition (as stated by c18f074)?

What should we do? Try to fix them all?

On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

Manjaro

NuttX Version

master

Issue Architecture

[Arch: xtensa]

Issue Area

[Area: Kernel]

Host information

NuttX CFLAGS:
-fno-common
-Wall
-Wstrict-prototypes
-Wshadow
-Wundef
-Wno-attributes
-Wno-unknown-pragmas
-Wno-psabi
-Os
-fno-strict-aliasing
-fomit-frame-pointer
-ffunction-sections
-fdata-sections -g
-fno-strength-reduce
-mlongcalls
-isystem /home/tiago/Documents/work/espressif/projects/nuttx/nuttxspace_alfa/nuttx/include
-isystem /home/tiago/Documents/work/espressif/projects/nuttx/nuttxspace_alfa/nuttx/include/newlib
-D__NuttX__
-DNDEBUG

NuttX CXXFLAGS:
-fno-common
-Wall
-Wshadow
-Wundef
-Wno-attributes
-Wno-unknown-pragmas
-nostdinc++
-Wno-psabi
-std=\gnu++17
-fno-exceptions
-fcheck-new
-fno-rtti
-Os
-fno-strict-aliasing
-fomit-frame-pointer
-ffunction-sections
-fdata-sections -g
-fno-strength-reduce
-mlongcalls
-isystem /home/tiago/Documents/work/espressif/projects/nuttx/nuttxspace_alfa/nuttx/include/cxx
-isystem /home/tiago/Documents/work/espressif/projects/nuttx/nuttxspace_alfa/nuttx/include/newlib
-isystem /home/tiago/Documents/work/espressif/projects/nuttx/nuttxspace_alfa/nuttx/include
-D__NuttX__
-DNDEBUG

NuttX LDFLAGS:
-nostdlib
--gc-sections
--cref
-Map=/home/tiago/Documents/work/espressif/projects/nuttx/nuttxspace_alfa/nuttx/nuttx.map
--print-memory-usage

NuttX configuration options:
CONFIG_HOST_LINUX=y
CONFIG_APPS_DIR=../apps
CONFIG_BASE_DEFCONFIG=\esp32s3-devkit:nsh-dirty
CONFIG_BUILD_FLAT=y
CONFIG_INTELHEX_BINARY=y
CONFIG_OUTPUT_STRIP_PATHS=y
CONFIG_ARCH_HAVE_STDARG_H=y
CONFIG_ARCH_HAVE_SETJMP=y
CONFIG_ARCH_NONE_DEBUG_H=y
CONFIG_FORTIFY_SOURCE=0
CONFIG_NDEBUG=y
CONFIG_DEBUG_ALERT=y
CONFIG_ARCH_HAVE_STACKCHECK=y
CONFIG_STACK_USAGE_WARNING=0
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_SYMBOLS_LEVEL=-g
CONFIG_ARCH_HAVE_CUSTOMOPT=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_LTO_NONE=y
CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y
CONFIG_DEBUG_LINK_MAP=y
CONFIG_ARCH_XTENSA=y
CONFIG_ARCH=\xtensa
CONFIG_ARCH_CHIP=\esp32s3
CONFIG_ESPRESSIF_CHIP_SERIES=\esp32s3
CONFIG_ESPRESSIF_NUM_CPUS=2
CONFIG_ESPRESSIF_SIMPLE_BOOT=y
CONFIG_ESPRESSIF_FLASH_MODE_DIO=y
CONFIG_ESPRESSIF_FLASH_FREQ_40M=y
CONFIG_ARCH_CHIP_ESP32S3=y
CONFIG_ARCH_FAMILY_LX7=y
CONFIG_XTENSA_CP_INITSET=0x0001
CONFIG_XTENSA_TOOLCHAIN_ESP=y
CONFIG_ARCH_CHIP_ESP32S3WROOM1N4=y
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=240
CONFIG_ESP32S3_INSTRUCTION_CACHE_16KB=y
CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE=0x4000
CONFIG_ESP32S3_INSTRUCTION_CACHE_8WAYS=y
CONFIG_ESP32S3_ICACHE_ASSOCIATED_WAYS=8
CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_32B=y
CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_SIZE=32
CONFIG_ESP32S3_DATA_CACHE_32KB=y
CONFIG_ESP32S3_DATA_CACHE_SIZE=0x8000
CONFIG_ESP32S3_DATA_CACHE_8WAYS=y
CONFIG_ESP32S3_DCACHE_ASSOCIATED_WAYS=8
CONFIG_ESP32S3_DATA_CACHE_LINE_32B=y
CONFIG_ESP32S3_DATA_CACHE_LINE_SIZE=32
CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM=0
CONFIG_ESP32S3_FLASH_4M=y
CONFIG_ESP32S3_FLASH_DETECT=y
CONFIG_ESP32S3_UART=y
CONFIG_ESP32S3_RTC=y
CONFIG_ESP32S3_UART0=y
CONFIG_ESP32S3_UART0_TXPIN=43
CONFIG_ESP32S3_UART0_RXPIN=44
CONFIG_ESP32S3_RTC_CLK_INT_RC=y
CONFIG_ESP32S3_SYSTEM_BBPLL_RECALIB=y
CONFIG_ESP32S3_FLASH_MODE_DIO=y
CONFIG_ESP32S3_FLASH_FREQ_40M=y
CONFIG_ESP32S3_FLASH_FREQ=40
CONFIG_ESP32S3_FLASH_SAMPLE_MODE_STR=y
CONFIG_ARCH_TOOLCHAIN_GNU=y
CONFIG_ARCH_VECNOTIRQ=y
CONFIG_ARCH_HAVE_TEXT_HEAP=y
CONFIG_ARCH_HAVE_TEXT_HEAP_SEPARATE_DATA_ADDRESS=y
CONFIG_ARCH_HAVE_TEXT_HEAP_WORD_ALIGNED_READ=y
CONFIG_ARCH_HAVE_COPY_SECTION=y
CONFIG_ARCH_HAVE_MULTICPU=y
CONFIG_ARCH_HAVE_FPU=y
CONFIG_ARCH_HAVE_MPU=y
CONFIG_ARCH_HAVE_RESET=y
CONFIG_ARCH_HAVE_TESTSET=y
CONFIG_ARCH_HAVE_THREAD_LOCAL=y
CONFIG_ARCH_HAVE_SYSCALL_HOOKS=y
CONFIG_ARCH_HAVE_BACKTRACE=y
CONFIG_ARCH_HAVE_PERF_EVENTS=y
CONFIG_ARCH_HAVE_CPUINFO=y
CONFIG_ARCH_CPUINFO_FREQ_KHZ=0
CONFIG_ARCH_HAVE_TCBINFO=y
CONFIG_ARCH_FPU=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_STACKDUMP_MAX_LENGTH=0
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_ARCH_HAVE_INTERRUPTSTACK=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_BOOT_RUNFROMFLASH=y
CONFIG_RAM_START=0x20000000
CONFIG_RAM_SIZE=114688
CONFIG_FLASH_START=0x0
CONFIG_FLASH_SIZE=0
CONFIG_ARCH_BOARD_ESP32S3_DEVKIT=y
CONFIG_ARCH_BOARD=\esp32s3-devkit
CONFIG_ARCH_HAVE_LEDS=y
CONFIG_ARCH_HAVE_BUTTONS=y
CONFIG_ESP32S3_DEVKITC_1_V10=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_BOARD_CRASHDUMP_NONE=y
CONFIG_BOARDCTL=y
CONFIG_BOARDCTL_MKRD=y
CONFIG_BOARD_MEMORY_RANGE=\
CONFIG_DISABLE_OS_API=y
CONFIG_USEC_PER_TICK=10000
CONFIG_START_YEAR=2011
CONFIG_START_MONTH=12
CONFIG_START_DAY=6
CONFIG_PREALLOC_TIMERS=4
CONFIG_IRQ_NWORKS=8
CONFIG_IRQ_WORK_SECTION=\
CONFIG_IRQ_WORK_STACKSIZE=2048
CONFIG_INIT_ENTRY=y
CONFIG_INIT_ARGS=\
CONFIG_INIT_STACKSIZE=3072
CONFIG_INIT_PRIORITY=100
CONFIG_INIT_ENTRYPOINT=\nsh_main
CONFIG_INIT_ENTRYNAME=\nsh_main
CONFIG_RR_INTERVAL=200
CONFIG_TASK_NAME_SIZE=31
CONFIG_SCHED_WAITPID=y
CONFIG_PTHREAD_MUTEX_ROBUST=y
CONFIG_PTHREAD_MUTEX_DEFAULT_PRIO_NONE=y
CONFIG_SCHED_CPULOAD_NONE=y
CONFIG_SCHED_CPULOAD_TICKSPERSEC=100
CONFIG_SCHED_PROFILE_TICKSPERSEC=1000
CONFIG_SCHED_STACK_RECORD=0
CONFIG_DEV_CONSOLE=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=8
CONFIG_FILE_STREAM=y
CONFIG_SIG_PREALLOC_ACTIONS=4
CONFIG_SIG_ALLOC_ACTIONS=1
CONFIG_SIG_PREALLOC_IRQ_ACTIONS=8
CONFIG_PREALLOC_MQ_MSGS=8
CONFIG_PREALLOC_MQ_IRQ_MSGS=8
CONFIG_MQ_MAXMSGSIZE=32
CONFIG_DEFAULT_TASK_STACKSIZE=2048
CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_PTHREAD_STACK_MIN=256
CONFIG_PTHREAD_STACK_DEFAULT=2048
CONFIG_PID_INITIAL_COUNT=16
CONFIG_ARCH_HAVE_I2CRESET=y
CONFIG_DEV_NULL=y
CONFIG_DEV_ZERO=y
CONFIG_DEV_OPTEE_NONE=y
CONFIG_DRVR_MKRD=y
CONFIG_ARCH_HAVE_SERIAL_TERMIOS=y
CONFIG_SERIAL=y
CONFIG_SERIAL_CONSOLE=y
CONFIG_MCU_SERIAL=y
CONFIG_STANDARD_SERIAL=y
CONFIG_SERIAL_NPOLLWAITERS=4
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_UART0_SERIALDRIVER=y
CONFIG_UART0_RXBUFSIZE=256
CONFIG_UART0_TXBUFSIZE=256
CONFIG_UART0_BAUD=115200
CONFIG_UART0_BITS=8
CONFIG_UART0_PARITY=0
CONFIG_UART0_2STOP=0
CONFIG_SYSLOG=y
CONFIG_SYSLOG_DEFAULT_MASK=0xff
CONFIG_SYSLOG_CRLF=y
CONFIG_SYSLOG_MAX_CHANNELS=1
CONFIG_SYSLOG_BUFFER=y
CONFIG_SYSLOG_BUFSIZE=64
CONFIG_SYSLOG_DEVPATH=/dev/ttyS1
CONFIG_SYSLOG_DEFAULT=y
CONFIG_FS_NEPOLL_DESCRIPTORS=8
CONFIG_FS_LOCK_BUCKET_SIZE=0
CONFIG_SENDFILE_BUFSIZE=512
CONFIG_FS_REFCOUNT=y
CONFIG_FS_BACKTRACE=0
CONFIG_FS_MQUEUE_VFS_PATH=/var/mqueue
CONFIG_FS_MQUEUE_NPOLLWAITERS=4
CONFIG_FS_ANONMAP=y
CONFIG_FS_PROCFS=y
CONFIG_NXFONTS_PACKEDMSFIRST=y
CONFIG_MM_DEFAULT_MANAGER=y
CONFIG_MM_DEFAULT_ALIGNMENT=8
CONFIG_MM_REGIONS=1
CONFIG_MM_MAP_COUNT_MAX=1024
CONFIG_MM_BACKTRACE=-1
CONFIG_MM_FREE_DELAYCOUNT_MAX=0
CONFIG_MM_HEAP_BIGGEST_COUNT=30
CONFIG_MM_HEAP_MEMPOOL_THRESHOLD=-1
CONFIG_BINFMT_ELF_RELOCATABLE=y
CONFIG_STDIO_BUFFER_SIZE=64
CONFIG_STDIO_LINEBUFFER=y
CONFIG_NUNGET_CHARS=2
CONFIG_LIBC_FLOATINGPOINT=y
CONFIG_LIBC_LONG_LONG=y
CONFIG_ARCH_LOWPUTC=y
CONFIG_LIBC_ARCH_MEMCHR=y
CONFIG_LIBC_ARCH_MEMCPY=y
CONFIG_LIBC_ARCH_MEMCMP=y
CONFIG_LIBC_ARCH_MEMMOVE=y
CONFIG_LIBC_ARCH_MEMSET=y
CONFIG_LIBC_ARCH_STRCHR=y
CONFIG_LIBC_ARCH_STRCMP=y
CONFIG_LIBC_ARCH_STRCPY=y
CONFIG_LIBC_ARCH_STRLCPY=y
CONFIG_LIBC_ARCH_STRNCPY=y
CONFIG_LIBC_ARCH_STRLEN=y
CONFIG_LIBC_ARCH_STRNLEN=y
CONFIG_LIBC_PREVENT_STRING_KERNEL=y
CONFIG_LIBC_PREVENT_MEMCHR_KERNEL=y
CONFIG_LIBC_PREVENT_MEMCMP_KERNEL=y
CONFIG_LIBC_PREVENT_MEMCPY_KERNEL=y
CONFIG_LIBC_PREVENT_MEMMOVE_KERNEL=y
CONFIG_LIBC_PREVENT_MEMSET_KERNEL=y
CONFIG_LIBC_PREVENT_STRCAT_KERNEL=y
CONFIG_LIBC_PREVENT_STRCASECMP_KERNEL=y
CONFIG_LIBC_PREVENT_STRCHR_KERNEL=y
CONFIG_LIBC_PREVENT_STRCHRNUL_KERNEL=y
CONFIG_LIBC_PREVENT_STRCMP_KERNEL=y
CONFIG_LIBC_PREVENT_STRCPY_KERNEL=y
CONFIG_LIBC_PREVENT_STRLCAT_KERNEL=y
CONFIG_LIBC_PREVENT_STRLEN_KERNEL=y
CONFIG_LIBC_PREVENT_STRLCPY_KERNEL=y
CONFIG_LIBC_PREVENT_STRNCASECMP_KERNEL=y
CONFIG_LIBC_PREVENT_STRNCAT_KERNEL=y
CONFIG_LIBC_PREVENT_STRNLEN_KERNEL=y
CONFIG_LIBC_PREVENT_STRNCMP_KERNEL=y
CONFIG_LIBC_PREVENT_STRNCPY_KERNEL=y
CONFIG_LIBC_PREVENT_STRRCHR_KERNEL=y
CONFIG_LIBC_RAND_ORDER=1
CONFIG_LIBC_HOMEDIR=/
CONFIG_LIBC_TMPDIR=/tmp
CONFIG_LIBC_MAX_TMPFILE=32
CONFIG_LIBC_MAX_EXITFUNS=0
CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=2048
CONFIG_LIBC_HOSTNAME=\
CONFIG_LIBC_OPEN_MAX=256
CONFIG_NAME_MAX=32
CONFIG_PATH_MAX=256
CONFIG_LINE_MAX=64
CONFIG_LIBC_STRERROR_ERRNUM=y
CONFIG_LIBC_STRSIGNAL=y
CONFIG_TLS_NELEM=0
CONFIG_TLS_TASK_NELEM=0
CONFIG_TLS_NCLEANUP=0
CONFIG_LIBC_GAISTRERROR_ERRNUM=y
CONFIG_LIBC_FTOK_VFS_PATH=/var/ftok
CONFIG_LIBC_MEMFD_ERROR=y
CONFIG_LIBC_TEMPBUFFER=y
CONFIG_LIBC_MAX_TEMPBUFFER=2
CONFIG_LIBC_TEMPBUFFER_MALLOC=y
CONFIG_LIBC_MUTEX_BACKTRACE=0
CONFIG_BUILTIN=y
CONFIG_STREAM_OUT_BUFFER_SIZE=64
CONFIG_STREAM_HEXDUMP_BUFFER_SIZE=128
CONFIG_STREAM_BASE64_BUFFER_SIZE=128
CONFIG_LIBC_INLINE_QUEUE=y
CONFIG_LIBM_NEWLIB=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_LIBCXXMINI=y
CONFIG_CXX_STANDARD=\gnu++17
CONFIG_BUILTIN_TOOLCHAIN=y
CONFIG_COVERAGE_NONE=y
CONFIG_COVERAGE_DEFAULT_PREFIX_STRIP=\99
CONFIG_COVERAGE_DEFAULT_PREFIX=/data
CONFIG_PROFILE_NONE=y
CONFIG_NSH_LIBRARY=y
CONFIG_NSH_PROMPT_STRING=\nsh>
CONFIG_NSH_PROMPT_MAX=32
CONFIG_NSH_PROMPT_ENV=\PS1
CONFIG_NSH_PROMPT_SUFFIX=>
CONFIG_NSH_READLINE=y
CONFIG_NSH_MAXARGUMENTS=7
CONFIG_NSH_NESTDEPTH=3
CONFIG_NSH_ALIAS=y
CONFIG_NSH_ALIAS_MAX_AMOUNT=1
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_DISABLE_DATE=y
CONFIG_NSH_DISABLE_LOSMART=y
CONFIG_NSH_DISABLE_LOMTD=y
CONFIG_NSH_DISABLE_MB=y
CONFIG_NSH_DISABLE_MH=y
CONFIG_NSH_DISABLE_MW=y
CONFIG_NSH_DISABLE_TIMEDATECTL=y
CONFIG_NSH_CODECS_BUFSIZE=128
CONFIG_NSH_PROC_MOUNTPOINT=/proc
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_SYSINITSCRIPT=\init.d/rc.sysinit
CONFIG_NSH_INITSCRIPT=\init.d/rcS
CONFIG_NSH_SCRIPT_REDIRECT_PATH=\
CONFIG_NSH_CONSOLE=y
CONFIG_NSH_ARCHINIT=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_NSH_PRIORITY=100
CONFIG_SYSTEM_NSH_STACKSIZE=2048
CONFIG_SYSTEM_NSH_PROGNAME=\nsh
CONFIG_SYSTEM_READLINE=y
CONFIG_READLINE_HAVE_EXTMATCH=y
CONFIG_READLINE_ECHO=y

Host system OS:
Linux tiago-latitude5430 6.11.11-1-MANJARO #1 SMP PREEMPT_DYNAMIC Thu 05 Dec 2024 16:26:44 +0000 x86_64

Host system PATH:
/home/tiago/.espressif/tools/xtensa-esp-elf-gdb/12.1_20231023/xtensa-esp-elf-gdb/bin
/home/tiago/.espressif/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin
/home/tiago/.espressif/tools/xtensa-esp32s2-elf/esp-12.2.0_20230208/xtensa-esp32s2-elf/bin
/home/tiago/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin
/home/tiago/esp-qemu/build
/home/tiago/Downloads/xpack-riscv-none-elf-gcc-13.2.0-2/bin
/home/tiago/Documents/work/espressif/projects/nuttx/bin
/home/tiago/gems/bin
/home/tiago/.local/bin
/usr/local/bin
/usr/bin
/var/lib/snapd/snap/bin
/usr/local/sbin
/usr/lib/emscripten
/var/lib/flatpak/exports/bin
/usr/lib/jvm/default/bin
/usr/bin/site_perl
/usr/bin/vendor_perl
/usr/bin/core_perl

Espressif specific information:

Toolchain version:
esp32: Bootloader image not found
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: clang version 18.1.8
gcc: gcc (GCC) 14.2.1 20240910
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: Not found
riscv64-unknown-elf-gcc: Not found

Esptool version:
4.8.dev4

HAL version:
sync/release_v5.1.c-nuttx-20230814-1576-g87ccbf88b6

CHIP ID:
ESP32-S3 has no Chip ID. Reading MAC instead.

Flash ID:
Manufacturer: 20
Device: 4017

Security information:
Flags: 0x00000000 (0b0)
Key Purposes: (0 0 0 0 0 0 12)
Chip ID: 9
API Version: 0
Secure Boot: Disabled
Flash Encryption: Disabled
SPI Boot Crypt Count (SPI_BOOT_CRYPT_CNT): 0x0

Flash status:
0x0200

Verification

  • I have verified before submitting the report.
@tmedicci tmedicci added the Type: Bug Something isn't working label Feb 4, 2025
@github-actions github-actions bot added Arch: xtensa Issues related to the Xtensa architecture Area: Kernel Kernel issues OS: Linux Issues related to Linux (building system, etc) labels Feb 4, 2025
@yamt
Copy link
Contributor

yamt commented Feb 5, 2025

@yamt , do you recall how did you test the compiler's definition (as stated by c18f074)?

i don't remember what exactly i used. i guess it was xtensa-esp32-elf-gcc -dM -E - < /dev/null | grep INT32_TYPE or something like that.

it seems that the esp-provided compiler has changed its configuration at some point.
i guess you or your colleagues can have a better idea about it than i have.

spacetanuki% .espressif.old/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc --version
xtensa-esp32-elf-gcc (crosstool-NG esp-2020r3) 8.4.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

spacetanuki% .espressif.old/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -dM -E - < /dev/null|grep INT32_TYPE
#define __INT32_TYPE__ int
#define __UINT32_TYPE__ unsigned int
spacetanuki% 
(venv) spacetanuki% xtensa-esp32-elf-gcc --version
xtensa-esp32-elf-gcc (crosstool-NG esp-12.2.0_20230208) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

(venv) spacetanuki% xtensa-esp32-elf-gcc -dM -E - < /dev/null|grep INT32_TYPE
#define __INT32_TYPE__ long int
#define __UINT32_TYPE__ long unsigned int
(venv) spacetanuki% 

What should we do? Try to fix them all?

adapt to the configuration used by the latest esp toolchain?
ie. make it long.

@yamt
Copy link
Contributor

yamt commented Feb 5, 2025

What should we do? Try to fix them all?

adapt to the configuration used by the latest esp toolchain? ie. make it long.

or, restore the toolchain configuration if the change was not intentional.

@tmedicci
Copy link
Contributor Author

tmedicci commented Feb 5, 2025

@yamt , do you recall how did you test the compiler's definition (as stated by c18f074)?

i don't remember what exactly i used. i guess it was xtensa-esp32-elf-gcc -dM -E - < /dev/null | grep INT32_TYPE or something like that.

it seems that the esp-provided compiler has changed its configuration at some point. i guess you or your colleagues can have a better idea about it than i have.

spacetanuki% .espressif.old/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc --version
xtensa-esp32-elf-gcc (crosstool-NG esp-2020r3) 8.4.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

spacetanuki% .espressif.old/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -dM -E - < /dev/null|grep INT32_TYPE
#define __INT32_TYPE__ int
#define __UINT32_TYPE__ unsigned int
spacetanuki% 
(venv) spacetanuki% xtensa-esp32-elf-gcc --version
xtensa-esp32-elf-gcc (crosstool-NG esp-12.2.0_20230208) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

(venv) spacetanuki% xtensa-esp32-elf-gcc -dM -E - < /dev/null|grep INT32_TYPE
#define __INT32_TYPE__ long int
#define __UINT32_TYPE__ long unsigned int
(venv) spacetanuki% 

What should we do? Try to fix them all?

adapt to the configuration used by the latest esp toolchain? ie. make it long.

Thanks for the information!

or, restore the toolchain configuration if the change was not intentional.

I don't think it's an option. Check https://docs.espressif.com/projects/esp-idf/en/stable/esp32/migration-guides/release-5.x/5.0/gcc.html#espressif-toolchain-changes for the associated information:

This change now matches upstream GCC which long integers for int32_t and uint32_t on Xtensa, RISC-V, and other architectures.

So, I think we should change it on NuttX and provide a compiler's version check.

@yamt
Copy link
Contributor

yamt commented Feb 6, 2025

So, I think we should change it on NuttX and provide a compiler's version check.

yes, it makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: xtensa Issues related to the Xtensa architecture Area: Kernel Kernel issues OS: Linux Issues related to Linux (building system, etc) Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants