Greetings, I’m new to platform IO and I’ve been making a small program with an Arduino UNO, my program is supposed to perform certain actions based on changing parameters, I’ve a structure and functions to quickly change this parameters.
Because these are predefined, they should be loaded from FLASH memory, I’m used to codewarrior eclipse (using nxp microcontrollers) where to force data to the ROM you would write the const keyword when declaring it, however on platform IO using the const keyword does not seem to force memory to the flash.
How does one force variables to the flash on PlatformIO?
here are some definitions I’m using that don’t result in data being written to flash:
struct s_data_motor_config_general{
const bool dir;
const unsigned int pulse_width;
}typedef motor_config;
struct s_data_motor_config_indexed{
const motor_index idx;
const motor_config mot_cfg;
}typedef motor_config_indexed;
struct s_data_motor_config_group{
const motor_config_indexed config_array[TOTAL_MOTORS];
const unsigned int amount;
}typedef motor_config_group;
const motor_config_group mcfgg_array[6]={
{ {{ mot_x, {ADVANCE, 2} }, { mot_y, {ADVANCE, 4} }, { mot_z, {ADVANCE, 8} }}, 3 },
{ {{ mot_x, {RECEDE, 2} }, { mot_y, {RECEDE, 4} }, { mot_z, {RECEDE, 8} }}, 3 },
{ {{ mot_x, {ADVANCE, 8} }, { mot_y, {RECEDE, 2} }, { mot_z, {ADVANCE, 8} }}, 3 },
{ {{ mot_x, {RECEDE, 1} }, { mot_y, {RECEDE, 2} }, { mot_z, {RECEDE, 3} }}, 3 },
{ {{ mot_x, {ADVANCE, 2} }, { mot_y, {RECEDE, 3} }, { mot_z, {RECEDE, 4} }}, 3 },
{ {{ mot_x, {RECEDE, 3} }, { mot_y, {ADVANCE, 4} }, { mot_z, {RECEDE, 5} }}, 3 }
};