Printing out array using for loop messes up the entire program

Hi, I'm using the Itsybisy NRF52840 Express board and building the program with west.

I'm trying to print out my array using for loop. Weirdly, if I print out the elements in for loop, the entire program stops and the red flash button (next to the rest button) blinks twice very fast and stops and repeats.

If I print out the same elements without a for loop, things work as predicted. Here is the code.

// Version 1: for loop stops the program
uint8_t image[19200] = {0,2,3, ...};

printk("Image: );
for (int i = 0; i < 3; i++) {
    printk("%u ", image[i]);
}
printk("\n");

// Version 2: predictive behavior
uint8_t image[19200] = {0,2,3, ...};

printk("Image: );
printk("%u ", image[0]);
printk("%u ", image[1]);
printk("%u ", image[2]);
printk("\n");

What could possibly be wrong? Any lead would be appreciated!

Related