RAM EXCEED ISSUE

Currently I am working on a open thread project. 

Right now I am facing an issue in which my board/code is getting reset every time after I have done some changes in my previous code.

code description:

I have taken a array of global structure 

io_card_control_t io_card_configuration[10]

sub structure of global structure is:

typedef enum {
DIGITAL_INPUT = 1,
ANALOG_INPUT,
NTC,
}input_type_t;

typedef enum {
DIGITAL_OUTPUT = 1,
ANALOG_OUTPUT,
}output_type_t;

typedef enum {
CHANNEL0 = 0,
CHANNEL1,
CHANNEL2,
CHANNEL3,
}channel_t;

typedef enum {
SENSING = 0,
OPENLOOP,
CLOSEDLOOP,
}io_device_type_t;

typedef struct {
input_type_t input_type;
channel_t channel;
float Ai;
float Bi;
uint8_t mode;
}input_port_t;

typedef struct {
output_type_t output_type;
channel_t channel;
float Ao;
float Bo;
uint8_t Min;
uint8_t Max;
}output_port_t;

typedef enum {
AI_AO = 1,
AI_DO,
DI_DO,
}closed_loop_control_type_t;

typedef struct {
uint32_t serial_id;
io_device_type_t type_of_actuation;
input_port_t input_port;
output_port_t output_port;
closed_loop_control_type_t closed_loop_control;
float default_state;
}activated_configuration_t;

typedef struct {
activated_configuration_t config;
PID_t pid;
controller_state_t controller_state;
on_off_control_t on_off_control;
bool OperatingMode;
}io_card_control_t;
total size of the global structure is 154 bytes

In this I have a one sub structure:
typedef struct {
output_type_t output_type;
channel_t channel;
float Ao;
float Bo;
uint8_t Min;
uint8_t Max;
}output_port_t;

when I change datatype uint8_t Min and uint8_t Max to float, my board/code start resetting.
I have also try to change the Ao and Bo datatype to uint8_t and Min-Max to float (In this condition code is working fine)
but when Max, Min, Ao, Bo changed to float, again the code start resetting.

I'm assuming - this might be happening due to RAM consumption is exceeding available RAM.


Memory description while compiling the code with CLion is:

Linking target: _build/nrf52840_xxaa.out
   text    data     bss     dec     hex filename
 434672    2280  112332  549284   861a4 _build/nrf52840_xxaa.out

I need to confirm if I'm thinking in the right direction. How can I monitor runtime consumption of RAM ? 

Thank you 

Related