one part of the program looks like the following simplified excerpt:
Code: Select all
typedef struct A {
int valA;
char strA[10];
} A;
typedef struct B {
int valB;
char strB[10];
} B;
typedef struct col {
A* structA;
B* structB;
} col;
void app_main(void) {
A structA;
B structB;
col mycol = {
.structA = &structA,
.structB = &structB,
};
printf("Address: %p\n", &mycol); // prints 0x3ffbaf10
printf("Address: %p\n", mycol.A); //prints 0x3ffb60d8
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, ESP_EVENT_ANY_ID, &ip_event_handler, &mycol));
}
When I check the pointer addresses of mycol within ip_event_handler(), the address of mycol is the correct one (0x3ffb60d8) but
//within the event handler
printf("Address in ip_event_handler: %p\n", mycol->A);
prints 0x8008c8f0 instead of the expected 0x3ffb60d8, causing further memory access to fail. Do you have any idea, what is happening here or what I might do wrong? The 0x800... address seems pretty weird to me...
Maybe some background on what I am trying to accomplish: I need to pass several parameters to the event_handler, so I am combining them in a struct to realize this.
Thanks for you help!
Tom