esp32c2: Support riscv floating-point library selection

This commit is contained in:
Wu Zheng Hui 2022-05-08 17:57:40 +08:00 committed by morris
parent 03aeac1dde
commit 0580d68b69
5 changed files with 32 additions and 2 deletions

21
Kconfig
View File

@ -278,6 +278,26 @@ mainmenu "Espressif IoT Development Framework Configuration"
endchoice # assertions
choice COMPILER_FLOAT_LIB_FROM
prompt "Compiler float lib source"
default COMPILER_FLOAT_LIB_FROM_RVFPLIB if ESP_ROM_HAS_RVFPLIB
default COMPILER_FLOAT_LIB_FROM_GCCLIB
help
In the soft-fp part of libgcc, riscv version is written in C,
and handles all edge cases in IEEE754, which makes it larger
and performance is slow.
RVfplib is an optimized RISC-V library for FP arithmetic on 32-bit
integer processors, for single and double-precision FP.
RVfplib is "fast", but it has a few exceptions from IEEE 754 compliance.
config COMPILER_FLOAT_LIB_FROM_GCCLIB
bool "libgcc"
config COMPILER_FLOAT_LIB_FROM_RVFPLIB
depends on ESP_ROM_HAS_RVFPLIB
bool "librvfp"
endchoice # COMPILER_FLOAT_LIB_FROM
config COMPILER_OPTIMIZATION_ASSERTION_LEVEL
int
default 0 if COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
@ -418,7 +438,6 @@ mainmenu "Espressif IoT Development Framework Configuration"
If enabled, RTL files will be produced during compilation. These files
can be used by other tools, for example to calculate call graphs.
endmenu # Compiler Options
menu "Component config"

View File

@ -58,7 +58,11 @@ if(target STREQUAL "linux")
else()
target_linker_script(${COMPONENT_LIB} INTERFACE "${target}/${ld_folder}/${target}.rom.ld")
rom_linker_script("api")
rom_linker_script("libgcc")
if(CONFIG_COMPILER_FLOAT_LIB_FROM_GCCLIB)
rom_linker_script("libgcc")
else()
rom_linker_script("rvfp")
endif()
endif()
idf_build_get_property(time_t_size TIME_T_SIZE)

View File

@ -22,3 +22,7 @@ config ESP_ROM_HAS_RETARGETABLE_LOCKING
config ESP_ROM_GET_CLK_FREQ
bool
default y
config ESP_ROM_HAS_RVFPLIB
bool
default y

View File

@ -11,3 +11,4 @@
#define ESP_ROM_UART_CLK_IS_XTAL (1) // UART clock source is selected to XTAL in ROM
#define ESP_ROM_HAS_RETARGETABLE_LOCKING (1) // ROM was built with retargetable locking
#define ESP_ROM_GET_CLK_FREQ (1) // Get clk frequency with rom function `ets_get_cpu_frequency`
#define ESP_ROM_HAS_RVFPLIB (1) // ROM has the rvfplib

View File

@ -0,0 +1,2 @@
CONFIG_IDF_TARGET="esp32c2"
CONFIG_COMPILER_FLOAT_LIB_FROM_GCCLIB=y