Merge branch 'upgrade_clang_toolchain' into 'master'

Upgrade clang toolchain version to 'esp-17.0.1_20240419'

See merge request espressif/esp-idf!29811
This commit is contained in:
Alexey Gerenkov 2024-05-14 21:47:06 +08:00
commit 8b93323da6
36 changed files with 428 additions and 435 deletions

View File

@ -56,7 +56,7 @@
variables:
IDF_TOOLCHAIN: clang
TEST_BUILD_OPTS_EXTRA: ""
TEST_DIR: tools/test_apps/system/cxx_pthread_bluetooth
TEST_DIR: tools/test_apps/system/clang_build_test
script:
# CI specific options start from "--parallel-count xxx". could ignore when running locally
- run_cmd python tools/ci/ci_build_apps.py $TEST_DIR -v
@ -143,7 +143,7 @@ build_clang_test_apps_esp32s3:
# For RISCV clang generates '.linker-options' sections of type 'llvm_linker_options' in asm files.
# See (https://llvm.org/docs/Extensions.html#linker-options-section-linker-options).
# Binutils gas ignores them with warning.
# TODO: LLVM-112, Use integrated assembler.
# TODO: LLVM-333, Use integrated assembler.
TEST_BUILD_OPTS_EXTRA: "--ignore-warning-str 'Warning: unrecognized section type'"
build_clang_test_apps_esp32c3:
@ -164,11 +164,30 @@ build_clang_test_apps_esp32c6:
extends:
- .build_clang_test_apps_riscv
- .rules:build
# TODO: c6 builds fail in master due to missing headers
allow_failure: true
variables:
IDF_TARGET: esp32c6
build_clang_test_apps_esp32c5:
extends:
- .build_clang_test_apps_riscv
- .rules:build
variables:
IDF_TARGET: esp32c5
build_clang_test_apps_esp32h2:
extends:
- .build_clang_test_apps_riscv
- .rules:build
variables:
IDF_TARGET: esp32h2
build_clang_test_apps_esp32p4:
extends:
- .build_clang_test_apps_riscv
- .rules:build
variables:
IDF_TARGET: esp32p4
######################
# Build System Tests #
######################

View File

@ -83,6 +83,12 @@ variables:
# This is used only if CI_PYTHON_TOOL_REPO is not empty.
CI_PYTHON_TOOL_BRANCH: ""
# Set this variable to Clang toolchain distro URL to be used.
# NOTE: We have separate toolchains for Xtensa and RISCV, therefore jobs for one arch will fail.
# This is OK as far as we use CI_CLANG_DISTRO_URL for pre-release tests purposes only.
# Keep the variable empty when not used.
CI_CLANG_DISTRO_URL: ""
# Set this variable to specify the file name for the known failure cases.
KNOWN_FAILURE_CASES_FILE_NAME: "master.txt"
@ -152,7 +158,7 @@ variables:
fi
# Install esp-clang if necessary
if [[ "$IDF_TOOLCHAIN" == "clang" ]]; then
if [[ "$IDF_TOOLCHAIN" == "clang" && -z "$CI_CLANG_DISTRO_URL" ]]; then
$IDF_PATH/tools/idf_tools.py --non-interactive install esp-clang
fi
@ -167,7 +173,7 @@ variables:
source ./export.sh
# Custom clang
# Custom clang toolchain
if [[ ! -z "$CI_CLANG_DISTRO_URL" ]]; then
echo "Using custom clang from ${CI_CLANG_DISTRO_URL}"
wget $CI_CLANG_DISTRO_URL

View File

@ -601,7 +601,7 @@ static esp_err_t s_spi_slave_hd_setup_priv_trans(spi_host_device_t host, spi_sla
if (((uint32_t)orig_trans->data) | (byte_len & (alignment - 1))) {
ESP_RETURN_ON_FALSE(orig_trans->flags & SPI_SLAVE_HD_TRANS_DMA_BUFFER_ALIGN_AUTO, ESP_ERR_INVALID_ARG, TAG, "data buffer addr&len not align to %d, or not dma_capable", alignment);
byte_len = (byte_len + alignment - 1) & (~(alignment - 1)); // up align to alignment
ESP_LOGD(TAG, "Re-allocate %s buffer of len %ld for DMA", (chan == SPI_SLAVE_CHAN_TX) ? "TX" : "RX", byte_len);
ESP_LOGD(TAG, "Re-allocate %s buffer of len %" PRIu32 " for DMA", (chan == SPI_SLAVE_CHAN_TX) ? "TX" : "RX", byte_len);
priv_trans->aligned_buffer = heap_caps_aligned_alloc(64, byte_len, MALLOC_CAP_DMA);
if (priv_trans->aligned_buffer == NULL) {
return ESP_ERR_NO_MEM;

View File

@ -470,7 +470,7 @@ dw_gdma_lli_handle_t dw_gdma_link_list_get_item(dw_gdma_link_list_handle_t list,
return lli;
}
esp_err_t dw_gdma_lli_set_next(dw_gdma_lli_handle_t lli, dw_gdma_lli_handle_t next)
esp_err_t dw_gdma_lli_set_next(dw_gdma_link_list_item_t *lli, dw_gdma_lli_handle_t next)
{
ESP_RETURN_ON_FALSE(lli && next, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
@ -534,7 +534,7 @@ esp_err_t dw_gdma_channel_set_block_markers(dw_gdma_channel_handle_t chan, dw_gd
return ESP_OK;
}
esp_err_t dw_gdma_lli_config_transfer(dw_gdma_lli_handle_t lli, dw_gdma_block_transfer_config_t *config)
esp_err_t dw_gdma_lli_config_transfer(dw_gdma_link_list_item_t *lli, dw_gdma_block_transfer_config_t *config)
{
ESP_RETURN_ON_FALSE(lli && config, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
@ -567,7 +567,7 @@ esp_err_t dw_gdma_lli_config_transfer(dw_gdma_lli_handle_t lli, dw_gdma_block_tr
return ESP_OK;
}
esp_err_t dw_gdma_lli_set_block_markers(dw_gdma_lli_handle_t lli, dw_gdma_block_markers_t markers)
esp_err_t dw_gdma_lli_set_block_markers(dw_gdma_link_list_item_t *lli, dw_gdma_block_markers_t markers)
{
ESP_RETURN_ON_FALSE_ISR(lli, ESP_ERR_INVALID_ARG, TAG, "invalid argument");

View File

@ -126,7 +126,7 @@ static void check_huk_risk_level(void)
"It is recommended to immediately regenerate HUK in order"
"to avoid permanently losing the deployed keys", huk_risk_level);
} else {
ESP_LOGI(TAG, "HUK Risk level - %d within acceptable limit (%d)", huk_risk_level, KEY_MGR_HUK_RISK_ALERT_LEVEL);
ESP_LOGI(TAG, "HUK Risk level - %" PRId8 " within acceptable limit (%" PRIu32 ")", huk_risk_level, (uint32_t)KEY_MGR_HUK_RISK_ALERT_LEVEL);
}
}
@ -135,7 +135,7 @@ static bool check_huk_info_validity(const esp_key_mgr_huk_info_t *huk_info)
{
uint32_t calc_crc = esp_rom_crc32_le(0, huk_info->info, KEY_MGR_HUK_INFO_SIZE);
if (calc_crc != huk_info->crc) {
ESP_LOGE(TAG, "Calculated CRC for HUK %lX does not match with %lX", calc_crc, huk_info->crc);
ESP_LOGE(TAG, "Calculated CRC for HUK %" PRIx32 " does not match with %" PRIx32, calc_crc, huk_info->crc);
return false;
}
return true;
@ -145,7 +145,7 @@ static bool check_key_info_validity(const esp_key_mgr_key_info_t *key_info)
{
uint32_t calc_crc = esp_rom_crc32_le(0, key_info->info, KEY_MGR_KEY_RECOVERY_INFO_SIZE);
if (calc_crc != key_info->crc) {
ESP_LOGE(TAG, "Calculated CRC for Key info %lX does not match with %lX", calc_crc, key_info->crc);
ESP_LOGE(TAG, "Calculated CRC for Key info %" PRIx32 " does not match with %" PRIx32, calc_crc, key_info->crc);
return false;
}
return true;

View File

@ -363,6 +363,7 @@ void modem_clock_select_lp_clock_source(periph_module_t module, modem_clock_lpcl
#if SOC_BT_SUPPORTED
case PERIPH_BT_MODULE:
{
#if CONFIG_IDF_TARGET_ESP32H2
bool rc_clk_en = true;
bool selected = (src == MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL) ||
@ -396,6 +397,7 @@ void modem_clock_select_lp_clock_source(periph_module_t module, modem_clock_lpcl
}
#endif
break;
}
#endif // SOC_BT_SUPPORTED
case PERIPH_COEX_MODULE:

View File

@ -438,7 +438,7 @@ esp_err_t esp_pm_configure(const void* vconfig)
/* Maximum SOC APB clock frequency is 40 MHz, maximum Modem (WiFi,
* Bluetooth, etc..) APB clock frequency is 80 MHz */
int apb_clk_freq = esp_clk_apb_freq() / MHZ;
#if CONFIG_ESP_WIFI_ENABLED || CONFIG_BT_ENABLED || CONFIG_IEEE802154_ENABLED
#if (CONFIG_ESP_WIFI_ENABLED || CONFIG_BT_ENABLED || CONFIG_IEEE802154_ENABLED) && SOC_PHY_SUPPORTED
apb_clk_freq = MAX(apb_clk_freq, MODEM_REQUIRED_MIN_APB_CLK_FREQ / MHZ);
#endif
int apb_max_freq = MIN(max_freq_mhz, apb_clk_freq); /* CPU frequency in APB_MAX mode */

View File

@ -276,7 +276,7 @@ static inline uint32_t mcpwm_ll_intr_get_status(mcpwm_dev_t *mcpwm)
* @brief Clear MCPWM interrupt status by mask
*
* @param mcpwm Peripheral instance address
* @param mask Interupt status mask
* @param mask Interrupt status mask
*/
__attribute__((always_inline))
static inline void mcpwm_ll_intr_clear_status(mcpwm_dev_t *mcpwm, uint32_t mask)
@ -1745,6 +1745,7 @@ static inline uint32_t mcpwm_ll_group_get_clock_prescale(mcpwm_dev_t *mcpwm)
} else if (mcpwm == &MCPWM1) {
return HAL_FORCE_READ_U32_REG_FIELD(HP_SYS_CLKRST.peri_clk_ctrl20, reg_mcpwm1_clk_div_num) + 1;
}
return 0;
}
static inline uint32_t mcpwm_ll_timer_get_clock_prescale(mcpwm_dev_t *mcpwm, int timer_id)

View File

@ -76,7 +76,7 @@ void mipi_dsi_hal_configure_phy_pll(mipi_dsi_hal_context_t *hal, uint32_t phy_cl
mipi_dsi_hal_phy_write_register(hal, 0x18, 0x80 | (((pll_M - 1) >> 5) & 0x0F));
// update the real lane bit rate
hal->lane_bit_rate_mbps = ref_freq_mhz * pll_M / pll_N;
HAL_LOGD("dsi_hal", "phy pll: ref=%luHz, lane_bit_rate=%luMbps, M=%d, N=%d, hsfreqrange=%d",
HAL_LOGD("dsi_hal", "phy pll: ref=%" PRIu32 "Hz, lane_bit_rate=%" PRIu32 "Mbps, M=%" PRId16 ", N=%" PRId8 ", hsfreqrange=%" PRId8,
phy_clk_src_freq_hz, hal->lane_bit_rate_mbps, pll_M, pll_N, hs_freq_sel);
}

View File

@ -68,6 +68,7 @@ list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_heap_impl")
list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_syscalls_impl")
list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_pthread_impl")
list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_assert_impl")
list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_getentropy_impl")
target_link_libraries(${COMPONENT_LIB} INTERFACE "${EXTRA_LINK_FLAGS}")
# Forces the linker to include newlib_init.c

View File

@ -19,302 +19,153 @@ entries:
# The following libs are either used in a lot of places or in critical
# code. (such as panic or abort)
# Thus, they shall always be placed in IRAM.
if IDF_TOOLCHAIN = "gcc": # TODO: IDF-8134
libc_a-itoa (noflash)
libc_a-memcmp (noflash)
libc_a-memcpy (noflash)
libc_a-memset (noflash)
libc_a-strcat (noflash)
libc_a-strcmp (noflash)
libc_a-strlen (noflash)
else:
lib_a-itoa (noflash)
lib_a-memcmp (noflash)
lib_a-memcpy (noflash)
lib_a-memset (noflash)
lib_a-strcat (noflash)
lib_a-strcmp (noflash)
lib_a-strlen (noflash)
libc_a-itoa (noflash)
libc_a-memcmp (noflash)
libc_a-memcpy (noflash)
libc_a-memset (noflash)
libc_a-strcat (noflash)
libc_a-strcmp (noflash)
libc_a-strlen (noflash)
if SPIRAM_CACHE_LIBJMP_IN_IRAM = y:
if IDF_TOOLCHAIN = "gcc":
libc_a-longjmp (noflash)
libc_a-setjmp (noflash)
else:
lib_a-longjmp (noflash)
lib_a-setjmp (noflash)
libc_a-longjmp (noflash)
libc_a-setjmp (noflash)
if SPIRAM_CACHE_LIBMATH_IN_IRAM = y:
if IDF_TOOLCHAIN = "gcc":
libc_a-abs (noflash)
libc_a-div (noflash)
libc_a-labs (noflash)
libc_a-ldiv (noflash)
libc_a-quorem (noflash)
libc_a-s_fpclassify (noflash)
libc_a-sf_nan (noflash)
else:
lib_a-abs (noflash)
lib_a-div (noflash)
lib_a-labs (noflash)
lib_a-ldiv (noflash)
lib_a-quorem (noflash)
lib_a-s_fpclassify (noflash)
lib_a-sf_nan (noflash)
libc_a-abs (noflash)
libc_a-div (noflash)
libc_a-labs (noflash)
libc_a-ldiv (noflash)
libc_a-quorem (noflash)
libc_a-s_fpclassify (noflash)
libc_a-sf_nan (noflash)
if SPIRAM_CACHE_LIBNUMPARSER_IN_IRAM = y:
if IDF_TOOLCHAIN = "gcc":
libc_a-utoa (noflash)
libc_a-atoi (noflash)
libc_a-atol (noflash)
libc_a-strtol (noflash)
libc_a-strtoul (noflash)
else:
lib_a-utoa (noflash)
lib_a-atoi (noflash)
lib_a-atol (noflash)
lib_a-strtol (noflash)
lib_a-strtoul (noflash)
libc_a-utoa (noflash)
libc_a-atoi (noflash)
libc_a-atol (noflash)
libc_a-strtol (noflash)
libc_a-strtoul (noflash)
if SPIRAM_CACHE_LIBIO_IN_IRAM = y:
if IDF_TOOLCHAIN = "gcc":
libc_a-wcrtomb (noflash)
libc_a-fvwrite (noflash)
libc_a-wbuf (noflash)
libc_a-wsetup (noflash)
libc_a-fputwc (noflash)
libc_a-wctomb_r (noflash)
libc_a-ungetc (noflash)
libc_a-makebuf (noflash)
libc_a-fflush (noflash)
libc_a-refill (noflash)
libc_a-sccl (noflash)
else:
lib_a-wcrtomb (noflash)
lib_a-fvwrite (noflash)
lib_a-wbuf (noflash)
lib_a-wsetup (noflash)
lib_a-fputwc (noflash)
lib_a-wctomb_r (noflash)
lib_a-ungetc (noflash)
lib_a-makebuf (noflash)
lib_a-fflush (noflash)
lib_a-refill (noflash)
lib_a-sccl (noflash)
libc_a-wcrtomb (noflash)
libc_a-fvwrite (noflash)
libc_a-wbuf (noflash)
libc_a-wsetup (noflash)
libc_a-fputwc (noflash)
libc_a-wctomb_r (noflash)
libc_a-ungetc (noflash)
libc_a-makebuf (noflash)
libc_a-fflush (noflash)
libc_a-refill (noflash)
libc_a-sccl (noflash)
if SPIRAM_CACHE_LIBTIME_IN_IRAM = y:
if IDF_TOOLCHAIN = "gcc":
libc_a-asctime (noflash)
libc_a-asctime_r (noflash)
libc_a-ctime (noflash)
libc_a-ctime_r (noflash)
libc_a-lcltime (noflash)
libc_a-lcltime_r (noflash)
libc_a-gmtime (noflash)
libc_a-gmtime_r (noflash)
libc_a-strftime (noflash)
libc_a-mktime (noflash)
libc_a-tzset_r (noflash)
libc_a-tzset (noflash)
libc_a-time (noflash)
libc_a-gettzinfo (noflash)
libc_a-systimes (noflash)
libc_a-month_lengths (noflash)
libc_a-timelocal (noflash)
libc_a-tzvars (noflash)
libc_a-tzlock (noflash)
libc_a-tzcalc_limits (noflash)
libc_a-strptime (noflash)
else:
lib_a-asctime (noflash)
lib_a-asctime_r (noflash)
lib_a-ctime (noflash)
lib_a-ctime_r (noflash)
lib_a-lcltime (noflash)
lib_a-lcltime_r (noflash)
lib_a-gmtime (noflash)
lib_a-gmtime_r (noflash)
lib_a-strftime (noflash)
lib_a-mktime (noflash)
lib_a-tzset_r (noflash)
lib_a-tzset (noflash)
lib_a-time (noflash)
lib_a-gettzinfo (noflash)
lib_a-systimes (noflash)
lib_a-month_lengths (noflash)
lib_a-timelocal (noflash)
lib_a-tzvars (noflash)
lib_a-tzlock (noflash)
lib_a-tzcalc_limits (noflash)
lib_a-strptime (noflash)
libc_a-asctime (noflash)
libc_a-asctime_r (noflash)
libc_a-ctime (noflash)
libc_a-ctime_r (noflash)
libc_a-lcltime (noflash)
libc_a-lcltime_r (noflash)
libc_a-gmtime (noflash)
libc_a-gmtime_r (noflash)
libc_a-strftime (noflash)
libc_a-mktime (noflash)
libc_a-tzset_r (noflash)
libc_a-tzset (noflash)
libc_a-time (noflash)
libc_a-gettzinfo (noflash)
libc_a-systimes (noflash)
libc_a-month_lengths (noflash)
libc_a-timelocal (noflash)
libc_a-tzvars (noflash)
libc_a-tzlock (noflash)
libc_a-tzcalc_limits (noflash)
libc_a-strptime (noflash)
if SPIRAM_CACHE_LIBCHAR_IN_IRAM = y:
if IDF_TOOLCHAIN = "gcc":
libc_a-ctype_ (noflash)
libc_a-toupper (noflash)
libc_a-tolower (noflash)
libc_a-toascii (noflash)
libc_a-strupr (noflash)
libc_a-bzero (noflash)
libc_a-isalnum (noflash)
libc_a-isalpha (noflash)
libc_a-isascii (noflash)
libc_a-isblank (noflash)
libc_a-iscntrl (noflash)
libc_a-isdigit (noflash)
libc_a-isgraph (noflash)
libc_a-islower (noflash)
libc_a-isprint (noflash)
libc_a-ispunct (noflash)
libc_a-isspace (noflash)
libc_a-isupper (noflash)
else:
lib_a-ctype_ (noflash)
lib_a-toupper (noflash)
lib_a-tolower (noflash)
lib_a-toascii (noflash)
lib_a-strupr (noflash)
lib_a-bzero (noflash)
lib_a-isalnum (noflash)
lib_a-isalpha (noflash)
lib_a-isascii (noflash)
lib_a-isblank (noflash)
lib_a-iscntrl (noflash)
lib_a-isdigit (noflash)
lib_a-isgraph (noflash)
lib_a-islower (noflash)
lib_a-isprint (noflash)
lib_a-ispunct (noflash)
lib_a-isspace (noflash)
lib_a-isupper (noflash)
libc_a-ctype_ (noflash)
libc_a-toupper (noflash)
libc_a-tolower (noflash)
libc_a-toascii (noflash)
libc_a-strupr (noflash)
libc_a-bzero (noflash)
libc_a-isalnum (noflash)
libc_a-isalpha (noflash)
libc_a-isascii (noflash)
libc_a-isblank (noflash)
libc_a-iscntrl (noflash)
libc_a-isdigit (noflash)
libc_a-isgraph (noflash)
libc_a-islower (noflash)
libc_a-isprint (noflash)
libc_a-ispunct (noflash)
libc_a-isspace (noflash)
libc_a-isupper (noflash)
if SPIRAM_CACHE_LIBMEM_IN_IRAM = y:
if IDF_TOOLCHAIN = "gcc":
libc_a-memccpy (noflash)
libc_a-memchr (noflash)
libc_a-memmove (noflash)
libc_a-memrchr (noflash)
else:
lib_a-memccpy (noflash)
lib_a-memchr (noflash)
lib_a-memmove (noflash)
lib_a-memrchr (noflash)
libc_a-memccpy (noflash)
libc_a-memchr (noflash)
libc_a-memmove (noflash)
libc_a-memrchr (noflash)
if SPIRAM_CACHE_LIBSTR_IN_IRAM = y:
if IDF_TOOLCHAIN = "gcc":
libc_a-strcasecmp (noflash)
libc_a-strcasestr (noflash)
libc_a-strchr (noflash)
libc_a-strcoll (noflash)
libc_a-strcpy (noflash)
libc_a-strcspn (noflash)
libc_a-strdup (noflash)
libc_a-strdup_r (noflash)
libc_a-strlcat (noflash)
libc_a-strlcpy (noflash)
libc_a-strlwr (noflash)
libc_a-strncasecmp (noflash)
libc_a-strncat (noflash)
libc_a-strncmp (noflash)
libc_a-strncpy (noflash)
libc_a-strndup (noflash)
libc_a-strndup_r (noflash)
libc_a-strnlen (noflash)
libc_a-strrchr (noflash)
libc_a-strsep (noflash)
libc_a-strspn (noflash)
libc_a-strstr (noflash)
libc_a-strtok_r (noflash)
libc_a-strupr (noflash)
else:
lib_a-strcasecmp (noflash)
lib_a-strcasestr (noflash)
lib_a-strchr (noflash)
lib_a-strcoll (noflash)
lib_a-strcpy (noflash)
lib_a-strcspn (noflash)
lib_a-strdup (noflash)
lib_a-strdup_r (noflash)
lib_a-strlcat (noflash)
lib_a-strlcpy (noflash)
lib_a-strlwr (noflash)
lib_a-strncasecmp (noflash)
lib_a-strncat (noflash)
lib_a-strncmp (noflash)
lib_a-strncpy (noflash)
lib_a-strndup (noflash)
lib_a-strndup_r (noflash)
lib_a-strnlen (noflash)
lib_a-strrchr (noflash)
lib_a-strsep (noflash)
lib_a-strspn (noflash)
lib_a-strstr (noflash)
lib_a-strtok_r (noflash)
lib_a-strupr (noflash)
libc_a-strcasecmp (noflash)
libc_a-strcasestr (noflash)
libc_a-strchr (noflash)
libc_a-strcoll (noflash)
libc_a-strcpy (noflash)
libc_a-strcspn (noflash)
libc_a-strdup (noflash)
libc_a-strdup_r (noflash)
libc_a-strlcat (noflash)
libc_a-strlcpy (noflash)
libc_a-strlwr (noflash)
libc_a-strncasecmp (noflash)
libc_a-strncat (noflash)
libc_a-strncmp (noflash)
libc_a-strncpy (noflash)
libc_a-strndup (noflash)
libc_a-strndup_r (noflash)
libc_a-strnlen (noflash)
libc_a-strrchr (noflash)
libc_a-strsep (noflash)
libc_a-strspn (noflash)
libc_a-strstr (noflash)
libc_a-strtok_r (noflash)
libc_a-strupr (noflash)
if SPIRAM_CACHE_LIBRAND_IN_IRAM = y:
if IDF_TOOLCHAIN = "gcc":
libc_a-srand (noflash)
libc_a-rand (noflash)
libc_a-rand_r (noflash)
else:
lib_a-srand (noflash)
lib_a-rand (noflash)
lib_a-rand_r (noflash)
libc_a-srand (noflash)
libc_a-rand (noflash)
libc_a-rand_r (noflash)
if SPIRAM_CACHE_LIBENV_IN_IRAM = y:
if IDF_TOOLCHAIN = "gcc":
libc_a-environ (noflash)
libc_a-envlock (noflash)
libc_a-getenv_r (noflash)
else:
lib_a-environ (noflash)
lib_a-envlock (noflash)
lib_a-getenv_r (noflash)
libc_a-environ (noflash)
libc_a-envlock (noflash)
libc_a-getenv_r (noflash)
if SPIRAM_CACHE_LIBFILE_IN_IRAM = y:
lock (noflash)
isatty (noflash)
creat (noflash)
if IDF_TOOLCHAIN = "gcc":
libc_a-fclose (noflash)
libc_a-open (noflash)
libc_a-close (noflash)
libc_a-creat (noflash)
libc_a-read (noflash)
libc_a-rshift (noflash)
libc_a-sbrk (noflash)
libc_a-stdio (noflash)
libc_a-syssbrk (noflash)
libc_a-sysclose (noflash)
libc_a-sysopen (noflash)
libc_a-sysread (noflash)
libc_a-syswrite (noflash)
libc_a-impure (noflash)
libc_a-fwalk (noflash)
libc_a-findfp (noflash)
else:
lib_a-fclose (noflash)
lib_a-open (noflash)
lib_a-close (noflash)
lib_a-creat (noflash)
lib_a-read (noflash)
lib_a-rshift (noflash)
lib_a-sbrk (noflash)
lib_a-stdio (noflash)
lib_a-syssbrk (noflash)
lib_a-sysclose (noflash)
lib_a-sysopen (noflash)
lib_a-sysread (noflash)
lib_a-syswrite (noflash)
lib_a-impure (noflash)
lib_a-fwalk (noflash)
lib_a-findfp (noflash)
libc_a-fclose (noflash)
libc_a-open (noflash)
libc_a-close (noflash)
libc_a-creat (noflash)
libc_a-read (noflash)
libc_a-rshift (noflash)
libc_a-sbrk (noflash)
libc_a-stdio (noflash)
libc_a-syssbrk (noflash)
libc_a-sysclose (noflash)
libc_a-sysopen (noflash)
libc_a-sysread (noflash)
libc_a-syswrite (noflash)
libc_a-impure (noflash)
libc_a-fwalk (noflash)
libc_a-findfp (noflash)
if SPIRAM_CACHE_LIBMISC_IN_IRAM = y:
if IDF_TOOLCHAIN = "gcc":
libc_a-raise (noflash)
libc_a-system (noflash)
else:
lib_a-raise (noflash)
lib_a-system (noflash)
libc_a-raise (noflash)
libc_a-system (noflash)

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -28,3 +28,8 @@ int getentropy(void *buffer, size_t length)
return 0;
}
void newlib_include_getentropy_impl(void)
{
// Linker hook, exists for no other purpose
}

View File

@ -136,13 +136,8 @@ void esp_newlib_init(void)
syscall_table_ptr = &s_stub_table;
#endif
#if __NEWLIB__ > 4 || ( __NEWLIB__ == 4 && __NEWLIB_MINOR__ > 1 ) /* TODO: IDF-8134 */
memset(&__sglue, 0, sizeof(__sglue));
_global_impure_ptr = _GLOBAL_REENT;
#else
static struct _reent s_reent;
_GLOBAL_REENT = &s_reent;
#endif
/* Ensure that the initialization of sfp is prevented until esp_newlib_init_global_stdio() is explicitly invoked. */
_GLOBAL_REENT->__cleanup = esp_cleanup_r;

View File

@ -1,23 +1,14 @@
/*
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#if __NEWLIB__ > 4 || ( __NEWLIB__ == 4 && __NEWLIB_MINOR__ > 1 ) /* TODO: IDF-8134 */
#define _REENT_BACKWARD_BINARY_COMPAT
#define _REENT_SDIDINIT(_ptr) ((_ptr)->_reserved_0)
#define _REENT_SGLUE(_ptr) (__sglue)
#else
#define _REENT_CLEANUP(_ptr) ((_ptr)->__cleanup)
#define _REENT_STDIN(_ptr) ((_ptr)->_stdin)
#define _REENT_STDOUT(_ptr) ((_ptr)->_stdout)
#define _REENT_STDERR(_ptr) ((_ptr)->_stderr)
#define _REENT_SDIDINIT(_ptr) ((_ptr)->__sdidinit)
#define _REENT_SGLUE(_ptr) ((_ptr)->__sglue)
#endif
#include_next<sys/reent.h>
@ -25,23 +16,11 @@
extern "C" {
#endif
#if __NEWLIB__ > 4 || ( __NEWLIB__ == 4 && __NEWLIB_MINOR__ > 1 ) /* TODO: IDF-8134 */
extern void __sinit(struct _reent *);
extern struct _glue __sglue;
extern struct _reent * _global_impure_ptr;
#else /* __NEWLIB__ > 4 || ( __NEWLIB__ == 4 && __NEWLIB_MINOR__ > 1 ) */
/* This function is not part of the newlib API, it is defined in libc/stdio/local.h
* There is no nice way to get __cleanup member populated while avoiding __sinit,
* so extern declaration is used here.
*/
extern void _cleanup_r(struct _reent *);
#endif /* __NEWLIB__ > 4 || ( __NEWLIB__ == 4 && __NEWLIB_MINOR__ > 1 ) */
#ifdef __cplusplus
}
#endif

View File

@ -337,16 +337,9 @@
# define XTHAL_GET_INTERRUPT() ({ int __interrupt; \
__asm__ __volatile__("rsr.interrupt %0" : "=a"(__interrupt)); \
__interrupt; })
#ifdef __clang__
// TODO: LLVM-195. Currently clang does not support INTSET alias for INTERRUPT special reg
# define XTHAL_SET_INTSET(v) do { int __interrupt = (int)(v); \
__asm__ __volatile__("wsr.interrupt %0" :: "a"(__interrupt):"memory"); \
} while(0)
#else
# define XTHAL_SET_INTSET(v) do { int __interrupt = (int)(v); \
__asm__ __volatile__("wsr.intset %0" :: "a"(__interrupt):"memory"); \
} while(0)
#endif
# define XTHAL_SET_INTCLEAR(v) do { int __interrupt = (int)(v); \
__asm__ __volatile__("wsr.intclear %0" :: "a"(__interrupt):"memory"); \
} while(0)
@ -376,7 +369,7 @@
# define XTHAL_SET_CCOMPARE(n,v) do {/*nothing*/} while(0)
#endif
/* New functions added to accomodate XEA3 and allow deprecation of older
/* New functions added to accommodate XEA3 and allow deprecation of older
functions. For this release they just map to the older ones. */
/* Enables the specified interrupt. */
@ -440,7 +433,7 @@ static inline unsigned XTHAL_COMPARE_AND_SET( int *addr, int testval, int setva
: "=a"(result) : "0" (setval), "a" (testval), "a" (addr)
: "memory");
#elif XCHAL_HAVE_INTERRUPTS
int tmp = 0; // clang complains on unitialized var
int tmp = 0; // clang complains on uninitialized var
__asm__ __volatile__ (
" rsil %4, 15 \n" // %4 == saved ps
" l32i %0, %3, 0 \n" // %0 == value to test, return val

View File

@ -5,12 +5,14 @@ set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_ASM_COMPILER clang)
set(CMAKE_LINKER xtensa-esp32-elf-clang-ld)
set(CMAKE_AR llvm-ar)
set(CMAKE_RANLIB llvm-ranlib)
set(CMAKE_OBJDUMP xtensa-esp32-elf-objdump)
set(CMAKE_OBJDUMP xtensa-esp32-elf-clang-objdump)
remove_duplicated_flags("--target=xtensa-esp-elf -mcpu=esp32 ${CMAKE_C_FLAGS}"
remove_duplicated_flags("--target=xtensa-esp-elf -mcpu=esp32 \
${CMAKE_C_FLAGS}"
UNIQ_CMAKE_C_FLAGS)
set(CMAKE_C_FLAGS "${UNIQ_CMAKE_C_FLAGS}"
CACHE STRING "C Compiler Base Flags"
@ -23,8 +25,16 @@ set(CMAKE_CXX_FLAGS "${UNIQ_CMAKE_CXX_FLAGS}"
CACHE STRING "C++ Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=xtensa-esp-elf -mcpu=esp32 -Xassembler --longcalls ${CMAKE_ASM_FLAGS}"
remove_duplicated_flags("--target=xtensa-esp-elf -mcpu=esp32 -Xassembler --longcalls \
${CMAKE_ASM_FLAGS}"
UNIQ_CMAKE_ASM_FLAGS)
set(CMAKE_ASM_FLAGS "${UNIQ_CMAKE_ASM_FLAGS}"
CACHE STRING "Assembler Base Flags"
FORCE)
remove_duplicated_flags("--ld-path=xtensa-esp32-elf-clang-ld -z noexecstack \
${CMAKE_EXE_LINKER_FLAGS}"
UNIQ_CMAKE_EXE_LINKER_FLAGS)
set(CMAKE_EXE_LINKER_FLAGS "${UNIQ_CMAKE_EXE_LINKER_FLAGS}"
CACHE STRING "Linker Base Flags"
FORCE)

View File

@ -5,28 +5,36 @@ set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_ASM_COMPILER clang)
set(CMAKE_LINKER riscv32-esp-elf-clang-ld)
set(CMAKE_AR llvm-ar)
set(CMAKE_RANLIB llvm-ranlib)
set(CMAKE_OBJDUMP riscv32-esp-elf-objdump)
set(CMAKE_OBJDUMP riscv32-esp-elf-clang-objdump)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc -mabi=ilp32 \
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_C_FLAGS}"
UNIQ_CMAKE_C_FLAGS)
set(CMAKE_C_FLAGS "${UNIQ_CMAKE_C_FLAGS}"
CACHE STRING "C Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc -mabi=ilp32 \
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_CXX_FLAGS}"
UNIQ_CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${UNIQ_CMAKE_CXX_FLAGS}"
CACHE STRING "C++ Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc -mabi=ilp32 \
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_ASM_FLAGS}"
UNIQ_CMAKE_ASM_FLAGS)
set(CMAKE_ASM_FLAGS "${UNIQ_CMAKE_ASM_FLAGS}"
CACHE STRING "Assembler Base Flags"
FORCE)
remove_duplicated_flags("--ld-path=riscv32-esp-elf-clang-ld -z noexecstack \
${CMAKE_EXE_LINKER_FLAGS}"
UNIQ_CMAKE_EXE_LINKER_FLAGS)
set(CMAKE_EXE_LINKER_FLAGS "${UNIQ_CMAKE_EXE_LINKER_FLAGS}"
CACHE STRING "Linker Base Flags"
FORCE)

View File

@ -5,28 +5,36 @@ set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_ASM_COMPILER clang)
set(CMAKE_LINKER riscv32-esp-elf-clang-ld)
set(CMAKE_AR llvm-ar)
set(CMAKE_RANLIB llvm-ranlib)
set(CMAKE_OBJDUMP riscv32-esp-elf-objdump)
set(CMAKE_OBJDUMP riscv32-esp-elf-clang-objdump)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc -mabi=ilp32 \
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_C_FLAGS}"
UNIQ_CMAKE_C_FLAGS)
set(CMAKE_C_FLAGS "${UNIQ_CMAKE_C_FLAGS}"
CACHE STRING "C Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc -mabi=ilp32 \
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_CXX_FLAGS}"
UNIQ_CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${UNIQ_CMAKE_CXX_FLAGS}"
CACHE STRING "C++ Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc -mabi=ilp32 \
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_ASM_FLAGS}"
UNIQ_CMAKE_ASM_FLAGS)
set(CMAKE_ASM_FLAGS "${UNIQ_CMAKE_ASM_FLAGS}"
CACHE STRING "Assembler Base Flags"
FORCE)
remove_duplicated_flags("--ld-path=riscv32-esp-elf-clang-ld -z noexecstack \
${CMAKE_EXE_LINKER_FLAGS}"
UNIQ_CMAKE_EXE_LINKER_FLAGS)
set(CMAKE_EXE_LINKER_FLAGS "${UNIQ_CMAKE_EXE_LINKER_FLAGS}"
CACHE STRING "Linker Base Flags"
FORCE)

View File

@ -0,0 +1,40 @@
include($ENV{IDF_PATH}/tools/cmake/utilities.cmake)
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_ASM_COMPILER clang)
set(CMAKE_LINKER riscv32-esp-elf-clang-ld)
set(CMAKE_AR llvm-ar)
set(CMAKE_RANLIB llvm-ranlib)
set(CMAKE_OBJDUMP riscv32-esp-elf-clang-objdump)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imac_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_C_FLAGS}"
UNIQ_CMAKE_C_FLAGS)
set(CMAKE_C_FLAGS "${UNIQ_CMAKE_C_FLAGS}"
CACHE STRING "C Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imac_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_CXX_FLAGS}"
UNIQ_CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${UNIQ_CMAKE_CXX_FLAGS}"
CACHE STRING "C++ Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imac_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_ASM_FLAGS}"
UNIQ_CMAKE_ASM_FLAGS)
set(CMAKE_ASM_FLAGS "${UNIQ_CMAKE_ASM_FLAGS}"
CACHE STRING "Assembler Base Flags"
FORCE)
remove_duplicated_flags("--ld-path=riscv32-esp-elf-clang-ld -z noexecstack \
${CMAKE_EXE_LINKER_FLAGS}"
UNIQ_CMAKE_EXE_LINKER_FLAGS)
set(CMAKE_EXE_LINKER_FLAGS "${UNIQ_CMAKE_EXE_LINKER_FLAGS}"
CACHE STRING "Linker Base Flags"
FORCE)

View File

@ -5,28 +5,36 @@ set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_ASM_COMPILER clang)
set(CMAKE_LINKER riscv32-esp-elf-clang-ld)
set(CMAKE_AR llvm-ar)
set(CMAKE_RANLIB llvm-ranlib)
set(CMAKE_OBJDUMP riscv32-esp-elf-objdump)
set(CMAKE_OBJDUMP riscv32-esp-elf-clang-objdump)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imac -mabi=ilp32 \
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imac_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_C_FLAGS}"
UNIQ_CMAKE_C_FLAGS)
set(CMAKE_C_FLAGS "${UNIQ_CMAKE_C_FLAGS}"
CACHE STRING "C Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imac -mabi=ilp32 \
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imac_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_CXX_FLAGS}"
UNIQ_CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${UNIQ_CMAKE_CXX_FLAGS}"
CACHE STRING "C++ Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imac -mabi=ilp32 \
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imac_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_ASM_FLAGS}"
UNIQ_CMAKE_ASM_FLAGS)
set(CMAKE_ASM_FLAGS "${UNIQ_CMAKE_ASM_FLAGS}"
CACHE STRING "Assembler Base Flags"
FORCE)
remove_duplicated_flags("--ld-path=riscv32-esp-elf-clang-ld -z noexecstack \
${CMAKE_EXE_LINKER_FLAGS}"
UNIQ_CMAKE_EXE_LINKER_FLAGS)
set(CMAKE_EXE_LINKER_FLAGS "${UNIQ_CMAKE_EXE_LINKER_FLAGS}"
CACHE STRING "Linker Base Flags"
FORCE)

View File

@ -0,0 +1,40 @@
include($ENV{IDF_PATH}/tools/cmake/utilities.cmake)
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_ASM_COMPILER clang)
set(CMAKE_LINKER riscv32-esp-elf-clang-ld)
set(CMAKE_AR llvm-ar)
set(CMAKE_RANLIB llvm-ranlib)
set(CMAKE_OBJDUMP riscv32-esp-elf-clang-objdump)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imac_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_C_FLAGS}"
UNIQ_CMAKE_C_FLAGS)
set(CMAKE_C_FLAGS "${UNIQ_CMAKE_C_FLAGS}"
CACHE STRING "C Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imac_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_CXX_FLAGS}"
UNIQ_CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${UNIQ_CMAKE_CXX_FLAGS}"
CACHE STRING "C++ Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imac_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_ASM_FLAGS}"
UNIQ_CMAKE_ASM_FLAGS)
set(CMAKE_ASM_FLAGS "${UNIQ_CMAKE_ASM_FLAGS}"
CACHE STRING "Assembler Base Flags"
FORCE)
remove_duplicated_flags("--ld-path=riscv32-esp-elf-clang-ld -z noexecstack \
${CMAKE_EXE_LINKER_FLAGS}"
UNIQ_CMAKE_EXE_LINKER_FLAGS)
set(CMAKE_EXE_LINKER_FLAGS "${UNIQ_CMAKE_EXE_LINKER_FLAGS}"
CACHE STRING "Linker Base Flags"
FORCE)

View File

@ -5,28 +5,36 @@ set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_ASM_COMPILER clang)
set(CMAKE_LINKER riscv32-esp-elf-clang-ld)
set(CMAKE_AR llvm-ar)
set(CMAKE_RANLIB llvm-ranlib)
set(CMAKE_OBJDUMP riscv32-esp-elf-objdump)
set(CMAKE_OBJDUMP riscv32-esp-elf-clang-objdump)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc -mabi=ilp32 \
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_C_FLAGS}"
UNIQ_CMAKE_C_FLAGS)
set(CMAKE_C_FLAGS "${UNIQ_CMAKE_C_FLAGS}"
CACHE STRING "C Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc -mabi=ilp32 \
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_CXX_FLAGS}"
UNIQ_CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${UNIQ_CMAKE_CXX_FLAGS}"
CACHE STRING "C++ Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc -mabi=ilp32 \
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_ASM_FLAGS}"
UNIQ_CMAKE_ASM_FLAGS)
set(CMAKE_ASM_FLAGS "${UNIQ_CMAKE_ASM_FLAGS}"
CACHE STRING "Assembler Base Flags"
FORCE)
remove_duplicated_flags("--ld-path=riscv32-esp-elf-clang-ld -z noexecstack \
${CMAKE_EXE_LINKER_FLAGS}"
UNIQ_CMAKE_EXE_LINKER_FLAGS)
set(CMAKE_EXE_LINKER_FLAGS "${UNIQ_CMAKE_EXE_LINKER_FLAGS}"
CACHE STRING "Linker Base Flags"
FORCE)

View File

@ -5,28 +5,36 @@ set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_ASM_COMPILER clang)
set(CMAKE_LINKER riscv32-esp-elf-clang-ld)
set(CMAKE_AR llvm-ar)
set(CMAKE_RANLIB llvm-ranlib)
set(CMAKE_OBJDUMP riscv32-esp-elf-objdump)
set(CMAKE_OBJDUMP riscv32-esp-elf-clang-objdump)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc -mabi=ilp32 \
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_C_FLAGS}"
UNIQ_CMAKE_C_FLAGS)
set(CMAKE_C_FLAGS "${UNIQ_CMAKE_C_FLAGS}"
CACHE STRING "C Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc -mabi=ilp32 \
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_CXX_FLAGS}"
UNIQ_CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${UNIQ_CMAKE_CXX_FLAGS}"
CACHE STRING "C++ Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc -mabi=ilp32 \
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imc_zicsr_zifencei -mabi=ilp32 -no-integrated-as \
${CMAKE_ASM_FLAGS}"
UNIQ_CMAKE_ASM_FLAGS)
set(CMAKE_ASM_FLAGS "${UNIQ_CMAKE_ASM_FLAGS}"
CACHE STRING "Assembler Base Flags"
FORCE)
remove_duplicated_flags("--ld-path=riscv32-esp-elf-clang-ld -z noexecstack \
${CMAKE_EXE_LINKER_FLAGS}"
UNIQ_CMAKE_EXE_LINKER_FLAGS)
set(CMAKE_EXE_LINKER_FLAGS "${UNIQ_CMAKE_EXE_LINKER_FLAGS}"
CACHE STRING "Linker Base Flags"
FORCE)

View File

@ -0,0 +1,40 @@
include($ENV{IDF_PATH}/tools/cmake/utilities.cmake)
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_ASM_COMPILER clang)
set(CMAKE_LINKER riscv32-esp-elf-clang-ld)
set(CMAKE_AR llvm-ar)
set(CMAKE_RANLIB llvm-ranlib)
set(CMAKE_OBJDUMP riscv32-esp-elf-clang-objdump)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imafc_zicsr_zifencei -mabi=ilp32f -no-integrated-as \
${CMAKE_C_FLAGS}"
UNIQ_CMAKE_C_FLAGS)
set(CMAKE_C_FLAGS "${UNIQ_CMAKE_C_FLAGS}"
CACHE STRING "C Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imafc_zicsr_zifencei -mabi=ilp32f -no-integrated-as \
${CMAKE_CXX_FLAGS}"
UNIQ_CMAKE_CXX_FLAGS)
set(CMAKE_CXX_FLAGS "${UNIQ_CMAKE_CXX_FLAGS}"
CACHE STRING "C++ Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=riscv32-esp-elf -march=rv32imafc_zicsr_zifencei -mabi=ilp32f -no-integrated-as \
${CMAKE_ASM_FLAGS}"
UNIQ_CMAKE_ASM_FLAGS)
set(CMAKE_ASM_FLAGS "${UNIQ_CMAKE_ASM_FLAGS}"
CACHE STRING "Assembler Base Flags"
FORCE)
remove_duplicated_flags("--ld-path=riscv32-esp-elf-clang-ld -z noexecstack \
${CMAKE_EXE_LINKER_FLAGS}"
UNIQ_CMAKE_EXE_LINKER_FLAGS)
set(CMAKE_EXE_LINKER_FLAGS "${UNIQ_CMAKE_EXE_LINKER_FLAGS}"
CACHE STRING "Linker Base Flags"
FORCE)

View File

@ -5,13 +5,14 @@ set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_ASM_COMPILER clang)
set(CMAKE_LINKER xtensa-esp32s2-elf-clang-ld)
set(CMAKE_AR llvm-ar)
set(CMAKE_RANLIB llvm-ranlib)
set(CMAKE_OBJDUMP xtensa-esp32s2-elf-objdump)
set(CMAKE_OBJDUMP xtensa-esp32s2-elf-clang-objdump)
remove_duplicated_flags("--target=xtensa-esp-elf -mcpu=esp32s2 ${CMAKE_C_FLAGS}"
remove_duplicated_flags("--target=xtensa-esp-elf -mcpu=esp32s2 \
${CMAKE_C_FLAGS}"
UNIQ_CMAKE_C_FLAGS)
set(CMAKE_C_FLAGS "${UNIQ_CMAKE_C_FLAGS}"
CACHE STRING "C Compiler Base Flags"
@ -24,8 +25,16 @@ set(CMAKE_CXX_FLAGS "${UNIQ_CMAKE_CXX_FLAGS}"
CACHE STRING "C++ Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=xtensa-esp-elf -mcpu=esp32s2 -Xassembler --longcalls ${CMAKE_ASM_FLAGS}"
remove_duplicated_flags("--target=xtensa-esp-elf -mcpu=esp32s2 -Xassembler --longcalls \
${CMAKE_ASM_FLAGS}"
UNIQ_CMAKE_ASM_FLAGS)
set(CMAKE_ASM_FLAGS "${UNIQ_CMAKE_ASM_FLAGS}"
CACHE STRING "Assembler Base Flags"
FORCE)
remove_duplicated_flags("--ld-path=xtensa-esp32s2-elf-clang-ld -z noexecstack \
${CMAKE_EXE_LINKER_FLAGS}"
UNIQ_CMAKE_EXE_LINKER_FLAGS)
set(CMAKE_EXE_LINKER_FLAGS "${UNIQ_CMAKE_EXE_LINKER_FLAGS}"
CACHE STRING "Linker Base Flags"
FORCE)

View File

@ -5,12 +5,14 @@ set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_ASM_COMPILER clang)
set(CMAKE_LINKER xtensa-esp32s3-elf-clang-ld)
set(CMAKE_AR llvm-ar)
set(CMAKE_RANLIB llvm-ranlib)
set(CMAKE_OBJDUMP xtensa-esp32s3-elf-objdump)
set(CMAKE_OBJDUMP xtensa-esp32s3-elf-clang-objdump)
remove_duplicated_flags("--target=xtensa-esp-elf -mcpu=esp32s3 ${CMAKE_C_FLAGS}"
remove_duplicated_flags("--target=xtensa-esp-elf -mcpu=esp32s3 \
${CMAKE_C_FLAGS}"
UNIQ_CMAKE_C_FLAGS)
set(CMAKE_C_FLAGS "${UNIQ_CMAKE_C_FLAGS}"
CACHE STRING "C Compiler Base Flags"
@ -23,8 +25,16 @@ set(CMAKE_CXX_FLAGS "${UNIQ_CMAKE_CXX_FLAGS}"
CACHE STRING "C++ Compiler Base Flags"
FORCE)
remove_duplicated_flags("--target=xtensa-esp-elf -mcpu=esp32s3 -Xassembler --longcalls ${CMAKE_ASM_FLAGS}"
remove_duplicated_flags("--target=xtensa-esp-elf -mcpu=esp32s3 -Xassembler --longcalls \
${CMAKE_ASM_FLAGS}"
UNIQ_CMAKE_ASM_FLAGS)
set(CMAKE_ASM_FLAGS "${UNIQ_CMAKE_ASM_FLAGS}"
CACHE STRING "Assembler Base Flags"
FORCE)
remove_duplicated_flags("--ld-path=xtensa-esp32s3-elf-clang-ld -z noexecstack \
${CMAKE_EXE_LINKER_FLAGS}"
UNIQ_CMAKE_EXE_LINKER_FLAGS)
set(CMAKE_EXE_LINKER_FLAGS "${UNIQ_CMAKE_EXE_LINKER_FLAGS}"
CACHE STRING "Linker Base Flags"
FORCE)

View File

@ -11,18 +11,18 @@ tools/test_apps/system/build_test:
- if: CONFIG_NAME == "usb_console_ets_printf" AND SOC_USB_OTG_SUPPORTED != 1
- if: CONFIG_NAME == "phy_multiple_init_data" AND IDF_TARGET == "esp32p4" # Update with caps here when IDF-7460 is resolved
tools/test_apps/system/clang_build_test:
enable:
- if: IDF_TARGET in ["esp32", "esp32s2", "esp32s3", "esp32c2", "esp32c3", "esp32c5", "esp32c6", "esp32h2", "esp32p4"]
temporary: true
reason: the other targets are not supported yet
tools/test_apps/system/cxx_no_except:
enable:
- if: IDF_TARGET == "esp32" or IDF_TARGET == "esp32c3"
temporary: true
reason: the other targets are not tested yet
tools/test_apps/system/cxx_pthread_bluetooth:
enable:
- if: IDF_TARGET in ["esp32", "esp32c2", "esp32c3", "esp32s2", "esp32s3"]
temporary: true
reason: the other targets are not supported yet
tools/test_apps/system/eh_frame:
enable:
- if: IDF_TARGET in ["esp32c2", "esp32c3"]

View File

@ -0,0 +1,4 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
This project is for testing if the application can be built with Clang toolchain.

View File

@ -1,3 +1,3 @@
idf_component_register(SRCS "cpp_pthread.cpp"
idf_component_register(SRCS "test_main.cpp"
INCLUDE_DIRS "."
PRIV_REQUIRES pthread bt)

View File

@ -80,7 +80,7 @@ esp_pthread_cfg_t create_config(const char *name, int core_id, int stack, int pr
extern "C" void app_main(void)
{
// Create a thread using deafult values that can run on any core
// Create a thread using default values that can run on any core
auto cfg = esp_pthread_get_default_config();
esp_pthread_set_cfg(&cfg);
std::thread any_core(thread_func_any_core);

View File

@ -1,51 +0,0 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- |
# C++ pthread Example
(See the README.md file in the upper level 'examples' directory for more information about examples.)
Support for the [C++ threads](http://www.cplusplus.com/reference/thread/thread/) in ESP-IDF is implemented on top of the [ESP-pthread](https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/system/esp_pthread.html#overview) component. Thus, C++ threads created using the standard thread class constructor will automatically inherit the current ESP-pthread configuration. This example demonstrates how to leverage the thread configuration functions provided by ESP-pthread (e.g., `esp_pthread_get_default_config()` and `esp_pthread_set_cfg()`) to modify the stack sizes, priorities, names, and core affinities of the C++ threads.
**Note: Due to the use of the C++ threads, this example is written in C++ instead of C.**
## How to use example
### Hardware Required
This example should be able to run on any commonly available ESP32 development board.
### Configure the project
```
idf.py menuconfig
```
* The default ESP-pthread configuration may also be modified under `Component config > PThreads`
### Build and Flash
Build the project and flash it to the board, then run monitor tool to view serial output:
```
idf.py -p PORT flash monitor
```
(Replace PORT with the name of the serial port to use.)
(To exit the serial monitor, type ``Ctrl-]``.)
See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
## Example Output
The following log output should appear when the example runs (note that the bootloader log has been omitted).
```
...
I (380) Thread 1: Core id: 0, prio: 5, minimum free stack: 2068 bytes.
I (0) pthread: This thread (with the default name) may run on any core.Core id: 1, prio: 5, minimum free stack: 2056 bytes.
I (390) Thread 1: This is the INHERITING thread with the same parameters as our parent, including name. Core id: 0, prio: 5, minimum free stack: 2092 bytes.
I (410) Thread 2: Core id: 1, prio: 5, minimum free stack: 2088 bytes.
I (410) main: core id: 0, prio: 1, minimum free stack: 2928 bytes.
```

View File

@ -257,41 +257,40 @@
"clang",
"--version"
],
"version_regex": "version\\s*([0-9\\.]+)\\s*\\([^\\s]+\\s*(\\w{10}).+\\)",
"version_regex_replace": "\\1-\\2",
"version_regex": "\\([^\\s]+\\s+([0-9a-zA-Z\\.\\-_]+)\\)",
"versions": [
{
"linux-amd64": {
"sha256": "3dbd8dd290913a93e8941da8a451ecd49f9798cc2d74bb9b63ef5cf5c4fee37f",
"size": 215176120,
"url": "https://github.com/espressif/llvm-project/releases/download/esp-16.0.0-20230516/llvm-esp-16.0.0-20230516-linux-amd64.tar.xz"
"sha256": "c4d4bef40532b777907bdf35cf10d91432a4c6b8351ee0a21cf3332fc9aabdb1",
"size": 296940300,
"url": "https://github.com/espressif/llvm-project/releases/download/esp-17.0.1_20240419/clang-esp-17.0.1_20240419-x86_64-linux-gnu.tar.xz"
},
"linux-arm64": {
"sha256": "4b115af6ddd04a9bffc1908fc05837998ee71d450891d741c446186f2aa9b961",
"size": 222261932,
"url": "https://github.com/espressif/llvm-project/releases/download/esp-16.0.0-20230516/llvm-esp-16.0.0-20230516-linux-arm64.tar.xz"
"sha256": "200d12bca443f8c751dfdd8e0abdc388832820ca8ebfff86952302146b972cf9",
"size": 286403588,
"url": "https://github.com/espressif/llvm-project/releases/download/esp-17.0.1_20240419/clang-esp-17.0.1_20240419-aarch64-linux-gnu.tar.xz"
},
"linux-armhf": {
"sha256": "935082bb0704420c5ca42b35038bba8702135348a50cac454ae2fb55af0b4c32",
"size": 214888520,
"url": "https://github.com/espressif/llvm-project/releases/download/esp-16.0.0-20230516/llvm-esp-16.0.0-20230516-linux-armhf.tar.xz"
"sha256": "9731b04ef704748a2579ead5960a556e85ffd536d69b41022cbf2d5e59fa178c",
"size": 286907980,
"url": "https://github.com/espressif/llvm-project/releases/download/esp-17.0.1_20240419/clang-esp-17.0.1_20240419-arm-linux-gnueabihf.tar.xz"
},
"macos": {
"sha256": "d9824acafd3e7b1d17ace084243b82a95bbdcb149a26b085bba487ab3d3716d7",
"size": 182440672,
"url": "https://github.com/espressif/llvm-project/releases/download/esp-16.0.0-20230516/llvm-esp-16.0.0-20230516-macos.tar.xz"
"sha256": "02ebf1c3efc8b3514b774a5c02c51a5cdd23d6d35769c1a1698006bb41e25a97",
"size": 272744196,
"url": "https://github.com/espressif/llvm-project/releases/download/esp-17.0.1_20240419/clang-esp-17.0.1_20240419-x86_64-apple-darwin.tar.xz"
},
"macos-arm64": {
"sha256": "ed5621396dc3e48413e14e8b6caed8e2993e7f2ab5fca1410081f40c940a1060",
"size": 171912324,
"url": "https://github.com/espressif/llvm-project/releases/download/esp-16.0.0-20230516/llvm-esp-16.0.0-20230516-macos-arm64.tar.xz"
"sha256": "c422ebe6c497182020e9bb9e5896f415d3bc7635b4d996c7f16fb060124c28c2",
"size": 252779444,
"url": "https://github.com/espressif/llvm-project/releases/download/esp-17.0.1_20240419/clang-esp-17.0.1_20240419-aarch64-apple-darwin.tar.xz"
},
"name": "16.0.1-fe4f10a809",
"name": "esp-17.0.1_20240419",
"status": "recommended",
"win64": {
"sha256": "598c8241c8bf10fd1be8bd21845307cfc404e127041b4ba4e828350a88692883",
"size": 243979484,
"url": "https://github.com/espressif/llvm-project/releases/download/esp-16.0.0-20230516/llvm-esp-16.0.0-20230516-win64.tar.xz"
"sha256": "341d3eed6881fbea19910fee5254a2f9c5406d2948bf0814a1c567d8c65dadcb",
"size": 410784492,
"url": "https://github.com/espressif/llvm-project/releases/download/esp-17.0.1_20240419/clang-esp-17.0.1_20240419-x86_64-w64-mingw32.tar.xz"
}
}
]