Hey ! So, I'm actually developping a kernel, I'm parsing the dtb and now I can build fdt node with props, I want to store them to be able to access them for drivers init. So I use static mut array with struct to store node's info and props and another static mut array with u8 to store all props value. Problem is I only have 128kb of ram, and I overflow it with my static array. I don't know how can I store all of that.
Here's everything I'm doing to save the node and props it'll be clearer I'm not explaining problems well sorry
// Structure to define a property parsed from fdt
#[derive(Clone, Copy)]
pub struct Property {
name: [u8; 31],
off_value: usize,
value_len: usize,
}
// Structure to define a node parsed from fdt and use it outside the parsing, like for init drivers
#[derive(Clone, Copy)]
pub struct Node {
name: [u8; 31],
first_prop: usize,
prop_count: usize,
}
// Static to save all parsed node
static mut NODE_POOL: [Node; FDT_MAX_STACK] = [Node {
name: [0u8; 31],
first_prop: 0,
prop_count: 0,
}; FDT_MAX_STACK];
// Static to save all parsed properties, use the node.first_prop..node.first_prop + node.prop_count
// to get all props for a specific node.
static mut PROPERTIES_POOL: [Property; FDT_MAX_PROPS] = [Property {
name: [0u8; 31],
off_value: 0,
value_len: 0,
}; FDT_MAX_PROPS];
// Static to save all properties value to avoid saving them in a referenced slice in property
// struct
static mut PROPS_VALUE_POOL: [u8; 4096] = [0u8; 4096];
// Node and props count to iterate over the static pools
static mut NODE_COUNT: usize = 0;
static mut PROPS_COUNT: usize = 0;
// Current 'size' of the PROPS_VALUE_POOL to keep track and avoid overlapping props value
static mut PROPS_VALUE_MAX: usize = 0;