I need to have a large amount of data in MCU's memory, somewhat about 20kB. This is just an array of uint8_t.
But even with much smaller array I cannot figure out what is happening.
Code: Select all
bool Changed[AREA_H_CNT][AREA_W_CNT];
static WORKING_AREA(waLcdThread, 256);
static msg_t LcdThread(void *arg) {
(void)arg;
chRegSetThreadName("Lcd");
while(1) {
for(uint8_t xc=0; xc<AREA_W_CNT; xc++) {
for(uint8_t yc=0; yc<AREA_H_CNT; yc++) {
if(Changed[yc][xc]) {
Changed[yc][xc] = false;
uint8_t x = xc * AREA_H, y = yc * AREA_W;
Uart.Printf("%u; %u; %u; %u\r", xc, yc, x, y);
chThdSleepMilliseconds(99);
} // if changed
} // xc
} // yc
} // while 1
return 0;
}
At initialization (not shown here) all array members are set to true.
The thread just iterates the array, and, when true is found, changes it to false and prints indexes.
Since nobody else sets values back to true, I should see all indexes printed once. And I really do - when AREA_H_CNT and AREA_W_CNT are 3 and 15, respectively. But when I increase the values, it seems that several array members are not changing. Therefore I have their indexes printed eternally.
Definitely this relates to memory allocation, but I do not understand why. Changed[][] is outside the thread, and I want it remain there - since in nearest future I will need mentioned 20kB array. I do not want OS switching such a context
What am I missing?
Thank you in advance.