main: Move initialization of board_data to the stack

When the board_data is initialized at compile time, it is placed into
the data section, which doesn't get relocated by the linker. The resulting
address of the board_data that is passed to board_init lies within reserved
memory and the device crashes.
This commit is contained in:
famfo
2025-04-04 15:57:39 +03:00
committed by Ivaylo Ivanov
parent d3865c371b
commit 21bf08f9d4

View File

@@ -8,23 +8,23 @@
#include <string.h>
#include <lib/debug.h>
/*
* Provide an empty board config that has
* to be filled in the board files
* TODO: figure out why having it in
* the board files makes devices reboot.
*/
struct board_data board = {
.name = "default",
.ops = {
[BOARD_OP_INIT] = BOARD_OP_INIT,
[BOARD_OP_LATE_INIT] = BOARD_OP_LATE_INIT,
[BOARD_OP_DRIVER_SETUP] = BOARD_OP_DRIVER_SETUP,
}
};
void main(void* dt, void* kernel, void* ramdisk)
{
/*
* Provide an empty board config that has
* to be filled in the board files
* TODO: figure out why having it in
* the board files makes devices reboot.
*/
struct board_data board = {
.name = "default",
.ops = {
[BOARD_OP_INIT] = BOARD_OP_INIT,
[BOARD_OP_LATE_INIT] = BOARD_OP_LATE_INIT,
[BOARD_OP_DRIVER_SETUP] = BOARD_OP_DRIVER_SETUP,
}
};
/* Initialize SoC and Board specific peripherals/quirks */
init_board_funcs(&board);