gcc __attribute__((constructor)): Remove hacked calling, move ctor sections to flash

More hacky moving of parts of .rodata to flash, until we can move all of
it.

Candidate fix for #128
This commit is contained in:
Angus Gratton 2016-02-09 16:06:25 +11:00
parent 2badeed523
commit b61b62136b
4 changed files with 33 additions and 46 deletions

View file

@ -407,6 +407,9 @@ void sdk_user_init_task(void *params) {
vTaskDelete(NULL);
}
extern void (*__init_array_start)(void);
extern void (*__init_array_end)(void);
// .Lfunc009 -- .irom0.text+0x5b4
static void user_start_phase2(void) {
uint8_t *buf;
@ -437,6 +440,12 @@ static void user_start_phase2(void) {
uart_flush_txfifo(0);
uart_flush_txfifo(1);
// Call gcc constructor functions
void (**ctor)(void);
for ( ctor = &__init_array_start; ctor != &__init_array_end; ++ctor) {
(*ctor)();
}
if (phy_info[0] != 5) {
// Bad version byte. Discard what we read and use default values
// instead.