Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions cpu/esp32/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -268,25 +268,17 @@ LINKFLAGS += -T$(BINDIR)/memory.ld
LINKFLAGS += -T$(BINDIR)/sections.ld

LINKFLAGS += -T$(ESP32_SDK_DIR)/components/soc/$(CPU_FAM)/ld/$(CPU_FAM).peripherals.ld
LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.api.ld
LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.ld
LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.api.ld
LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.libgcc.ld

ifneq (,$(filter esp32 esp32s2,$(CPU_FAM)))
LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.newlib-data.ld
LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.newlib-funcs.ld
LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.newlib-time.ld
ifeq (esp32s2,$(CPU_FAM))
LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.spiflash.ld
else ifeq (esp32c3,$(CPU_FAM))
LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.libgcc.ld
LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.newlib.ld
LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.version.ld
LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.eco3.ld
else ifeq (esp32s3,$(CPU_FAM))
LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.libgcc.ld
LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.newlib.ld
LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.version.ld
else
$(error Unknown link flags for ESP32x SoC variant (family): $(CPU_FAM))
endif

LINKFLAGS += -nostdlib -lgcc -Wl,-gc-sections
Expand Down
7 changes: 7 additions & 0 deletions cpu/esp32/include/sys/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ extern "C" {
*/
#undef _POSIX_THREADS

/*
* To avoid type conflicts between the `pthread_rwlockattr_t` definition
* in RIOT's `pthread` implementation and newlibc's `sys/_pthreadtypes.h`,
* the macro `_POSIX_READER_WRITER_LOCKS` must be undefined.
*/
#undef _POSIX_READER_WRITER_LOCKS

#ifdef __cplusplus
}
#endif
Expand Down
26 changes: 0 additions & 26 deletions cpu/esp32/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,32 +278,6 @@ extern struct __lock __attribute__((alias("s_shared_mutex"))) __lock___arc4rando

void IRAM syscalls_init_arch(void)
{
#if defined(_RETARGETABLE_LOCKING)
/* initialization of static locking variables in ROM, different ROM
* versions of newlib use different locking variables */
#if defined(CPU_FAM_ESP32)
extern _lock_t __sfp_lock;
extern _lock_t __sinit_lock;
extern _lock_t __env_lock_object;
extern _lock_t __tz_lock_object;

__sfp_lock = (_lock_t)&s_shared_rmutex;
__sinit_lock = (_lock_t)&s_shared_rmutex;
__env_lock_object = (_lock_t)&s_shared_mutex;
__tz_lock_object = (_lock_t)&s_shared_rmutex;
#elif defined(CPU_FAM_ESP32S2)
extern _lock_t __sinit_recursive_mutex;
extern _lock_t __sfp_recursive_mutex;

__sinit_recursive_mutex = (_lock_t)&s_shared_rmutex;
__sfp_recursive_mutex = (_lock_t)&s_shared_rmutex;
#else
/* TODO: Other platforms don't provide access to these ROM variables.
* It could be necessary to call `esp_rom_newlib_init_common_mutexes`. For
* the moment it doesn't seems to be necessary to call this function. */
#endif
#endif /* _RETARGETABLE_LOCKING */

/* initialize and enable the system timer in us (TMG0 is enabled by default) */
timer_hal_init(&sys_timer, TIMER_SYSTEM_GROUP, TIMER_SYSTEM_INDEX);
timer_hal_set_divider(&sys_timer, rtc_clk_apb_freq_get() / MHZ);
Expand Down
Loading