1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #12050 from gschorcht/cpu/esp32/fix_ctor_initialization

cpu/esp32: fix of global ctor initialization
This commit is contained in:
Juan I Carrano 2019-08-27 11:38:00 +02:00 committed by GitHub
commit 5ece3dc323
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,7 +93,6 @@ extern void bootloader_clock_configure(void);
/* forward declarations */
static void system_init(void);
static void do_global_ctors(void);
static void intr_matrix_clear(void);
typedef int32_t esp_err_t;
@ -279,8 +278,12 @@ static NORETURN void IRAM system_init (void)
/* Disable the hold flag of all RTC GPIO pins */
RTCCNTL.hold_force.val = 0;
/* execute constructors */
do_global_ctors();
/*
* initialization of newlib, includes the ctors initialization and
* and the execution of stdio_init in _init of newlib_syscalls_default
*/
extern void __libc_init_array(void);
__libc_init_array();
/* init watchdogs */
system_wdt_init();
@ -288,13 +291,6 @@ static NORETURN void IRAM system_init (void)
/* init random number generator */
srand(hwrand());
/*
* initialization as it should be called from newlibc (includes the
* execution of stdio_init)
*/
extern void _init(void);
_init();
/* add SPI RAM to heap if enabled */
#if CONFIG_SPIRAM_SUPPORT && CONFIG_SPIRAM_BOOT_INIT
spi_ram_heap_init();
@ -345,18 +341,6 @@ static NORETURN void IRAM system_init (void)
UNREACHABLE();
}
static void do_global_ctors(void)
{
#if 0 /* TODO when real ctors are used exist */
extern uint32_t* __init_array_start;
extern uint32_t* __init_array_end;
for (uint32_t* up = __init_array_end - 1; up >= __init_array_start; --up) {
void (*fp)(void) = (void (*)(void))up;
fp();
}
#endif
}
static void intr_matrix_clear(void)
{
/* attach all peripheral interrupt sources (Technical Reference, Table 7) */