Reavershark / esp-dlang

D toolchain builder for running D code on esp boards + example projects
Boost Software License 1.0
1 stars 1 forks source link

Suggest: compiler alternative for D #5

Open kassane opened 6 months ago

kassane commented 6 months ago

Add GDC/GCC on docker-build using this flags (see Configured with)

Espressif/LLVM have xtensa-ABI (windowed) partial support, but GCC [upstream and fork] have both xtensa-ABI (call0 & windowed)

./gcc/esp32s3-gdc/bin/xtensa-esp32s3-elf-gdc --help=target
The following options are target specific:
  -mabi=call0                 Use call0 ABI.
  -mabi=windowed              Use windowed registers ABI.
  -malways-memw               Always emit a MEMW before a load and after a store operation. Used to debug
                              memory coherency issues.
  -mauto-litpools             Relax literals in assembler and place them automatically in the text section.
  -mconst16                   Use CONST16 instruction to load constants.
  -mdisable-hardware-atomics  Call built-in functions for atomic operations instead of using hardware atomic
                              instructions. This option can be used if atomic operations on some memory
                              regions need to be emulated in software.
  -mdynconfig=                Directory or path to dynconfig library.
  -mextra-l32r-costs=         Set extra memory access cost for L32R instruction, in clock-cycle units.
  -mfix-esp32-psram-cache-issue Work around a PSRAM cache issue in the ESP32 ECO1 chips.
  -mfix-esp32-psram-cache-strategy= Specify a psram cache fix strategy.
  -mforce-no-pic              Disable position-independent code (PIC) for use in OS kernel code.
  -mfused-madd                Same as -ffp-contract=fast (or, in negated form, -ffp-contract=off).  Uses of
                              this option are diagnosed.
  -mlongcalls                 Use indirect CALLXn instructions for large programs.
  -mlra                       Use LRA instead of reload (transitional).
  -mno-serialize-volatile     Do not serialize volatile memory references with MEMW instructions.
  -mtarget-align              Automatically align branch targets to reduce branch penalties.
  -mtext-section-literals     Intersperse literal pools with code in the text section.

  Psram cache fix strategies (for use with -mfix-esp32-psram-cache-strategy= option):
    dupldst memw nops

src: https://github.com/espressif/gcc src: https://github.com/espressif/crosstool-ng

$> /root/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp-elf-gcc -v
Using built-in specs.
COLLECT_GCC=/root/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp-elf-gcc
COLLECT_LTO_WRAPPER=/root/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../libexec/gcc/xtensa-esp-elf/13.2.0/lto-wrapper
Target: xtensa-esp-elf
Configured with: /builds/idf/crosstool-NG/.build/xtensa-esp-elf/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=xtensa-esp-elf --prefix=/builds/idf/crosstool-NG/builds/xtensa-esp-elf --exec_prefix=/builds/idf/crosstool-NG/builds/xtensa-esp-elf --with-local-prefix=/builds/idf/crosstool-NG/builds/xtensa-esp-elf/xtensa-esp-elf --with-headers=/builds/idf/crosstool-NG/builds/xtensa-esp-elf/xtensa-esp-elf/include --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG esp-13.2.0_20230928' --disable-__cxa_atexit --enable-cxx-flags=-ffunction-sections --disable-libgomp --disable-libmudflap --disable-libmpx --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libstdcxx-verbose --with-gmp=/builds/idf/crosstool-NG/.build/xtensa-esp-elf/buildtools --with-mpfr=/builds/idf/crosstool-NG/.build/xtensa-esp-elf/buildtools --with-mpc=/builds/idf/crosstool-NG/.build/xtensa-esp-elf/buildtools --with-isl=/builds/idf/crosstool-NG/.build/xtensa-esp-elf/buildtools --enable-lto --enable-target-optspace --without-long-double-128 --disable-nls --enable-multiarch --enable-languages=c,c++ --disable-libstdcxx-verbose --enable-threads=posix --enable-gcov-custom-rtio --enable-libstdcxx-time=yes
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.2.0 (crosstool-NG esp-13.2.0_20230928)

Result

./gcc/esp32s3-gdc/bin/xtensa-esp32s3-elf-gdc -v
Using built-in specs.
COLLECT_GCC=./gcc/esp32s3-gdc/bin/xtensa-esp32s3-elf-gdc
COLLECT_LTO_WRAPPER=/home/kassane/gcc/esp32s3-gdc/bin/../libexec/gcc/xtensa-esp32s3-elf/13.2.0/lto-wrapper
Target: xtensa-esp32s3-elf
Configured with: ./configure --target=xtensa-esp32s3-elf --enable-languages=c,d,lto
Thread model: single
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (GCC)

cc: @Reavershark

kassane commented 6 months ago

Thread model: posix - similar to espressif toolchain

$ ./xtensa-esp-gdc/bin/xtensa-esp-elf-gdc -v
Using built-in specs.
COLLECT_GCC=./xtensa-esp-gdc/bin/xtensa-esp-elf-gdc
COLLECT_LTO_WRAPPER=/home/kassane/xtensa-esp-gdc/bin/../libexec/gcc/xtensa-esp-elf/13.2.0/lto-wrapper
Target: xtensa-esp-elf
Configured with: ./configure --target=xtensa-esp-elf --enable-languages=c,d,lto --enable-lto --enable-target-optspace --without-long-double-128 --disable-nls --enable-multiarch --disable-libstdcxx-verbose --enable-threads=posix --enable-gcov-custom-rtio --enable-libstdcxx-time=yes --disable-__cxa_atexit --enable-cxx-flags=-ffunction-sections --disable-libgomp --disable-libmudflap --disable-libmpx --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libstdcxx-verbose
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (GCC)
Reavershark commented 2 months ago

I do want to attempt using gdc in the future though.