as described in the title, if I create a struct that is too big it fails in the initialisation in main.
If I break it up into smaller structs and initialise them separately with pointers inbetween them it works fine, so I don't think I am running out of chip memory. This happens around 12 members. I thought it might be a malloc call failing, but of course we don't really have malloc on bare metal.
Any ideas? Maybe a compiler flag?
Code: Select all
21 typedef struct{
22 char gear = 'P';
23 uint8_t gear_d = 0;
24 uint8_t gear_r = 0;
25 uint8_t gear_p = 0;
26 uint8_t gear_n = 0;
27 uint8_t start = 0;
28 int pre = 0;
29 int main = 0;
30 uint8_t brake = 0;
31 int throttle = 0;
32 int ac_present = 0;
33 int door_open = 0;
34 } inputs;
Code: Select all
238 extern "C" int main(void)
239 {
/// ... snip ...
// in main.cpp
262 input in; // this goes to void blocking_handler in libopencm3
263 v->in = ∈