It works with 127, but crashes with 128. If you sum up the required memory it is 128 * 128 * 4 bytes = 65536 bytes = 64 kbytes. I guess that's the maximum stack size. You shouldn't allocate such arrays on the stack anyways.

Just make array a global variable or allocate it with sys_malloc and release it with sys_free.


Always learn from history, to be sure you make the same mistakes again...