Merge pull request #12050 from gschorcht/cpu/esp32/fix_ctor_initialization
cpu/esp32: fix of global ctor initialization
This commit is contained in:
commit
5ece3dc323
@ -93,7 +93,6 @@ extern void bootloader_clock_configure(void);
|
|||||||
|
|
||||||
/* forward declarations */
|
/* forward declarations */
|
||||||
static void system_init(void);
|
static void system_init(void);
|
||||||
static void do_global_ctors(void);
|
|
||||||
static void intr_matrix_clear(void);
|
static void intr_matrix_clear(void);
|
||||||
|
|
||||||
typedef int32_t esp_err_t;
|
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 */
|
/* Disable the hold flag of all RTC GPIO pins */
|
||||||
RTCCNTL.hold_force.val = 0;
|
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 */
|
/* init watchdogs */
|
||||||
system_wdt_init();
|
system_wdt_init();
|
||||||
@ -288,13 +291,6 @@ static NORETURN void IRAM system_init (void)
|
|||||||
/* init random number generator */
|
/* init random number generator */
|
||||||
srand(hwrand());
|
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 */
|
/* add SPI RAM to heap if enabled */
|
||||||
#if CONFIG_SPIRAM_SUPPORT && CONFIG_SPIRAM_BOOT_INIT
|
#if CONFIG_SPIRAM_SUPPORT && CONFIG_SPIRAM_BOOT_INIT
|
||||||
spi_ram_heap_init();
|
spi_ram_heap_init();
|
||||||
@ -345,18 +341,6 @@ static NORETURN void IRAM system_init (void)
|
|||||||
UNREACHABLE();
|
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)
|
static void intr_matrix_clear(void)
|
||||||
{
|
{
|
||||||
/* attach all peripheral interrupt sources (Technical Reference, Table 7) */
|
/* attach all peripheral interrupt sources (Technical Reference, Table 7) */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user