2021-07-06 06:16 AM
Hello everyone,
I am trying to replace a simple code in C inside a STM32H7 that goes like this:
function(0, &array[0]);
function(1, &array[1]);
function(2, &array[2]);
function(3, &array[3]);
function(4, &array[4]);
with
enum_variable_t index ;
for(index = FIRST_ENUM ; index < LAST_ENUM; index ++)
{
function((uint16_t)index , &array[index]);
}
However, some data is corrupted due to this simple change, I thought it might be an optimization problem but I can't solve it by including the (-O) flag. Any advice would be of great help.
Regards
Alan
Solved! Go to Solution.
2021-07-07 01:03 AM
Hello Alan,
Great !! I think the SPI was afraid about us :) ! Have a nice day and a lot of fun with STM32.
Best regards,
Christophe
2021-07-07 02:08 AM
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'
2021-07-09 05:30 AM
Quick update
I have changed all global variables to volatile and now everything works as intended.
Regards!