Altera_Forum
Honored Contributor
20 years agoHow to get along with memory access errors?
Hello,
Im working long time with NIOS Processor and getting more and more in trouble with memory access errors. I tried several things to get allong with it, but the problem still resists and comes over again and again. Typical Situation: I have somewhere in my programm a memory access error, by crossing ranges of an array or using invalid pointers, have some buffer overflow or anything simular. Because NIOS Processor doesn't have MMU, it does not detect anything! Because NIOS C Compiler cannot check ranges or detect invalid pointers, i get not told about such errors in right time. What gets caused by the Memory Access Error: - Sometime, nothing - Sometime, LIBC Functions never return or fail - Sometime, LWIP Stack stops working, and my socket server waites forever - Sometime, Stack gets corrupted and Programm hangs up or does strange things - Sometime, everything hangs up - Sometime, Some Data gets corrupted The behaviour is not or hardly reproducable and it takes long time to find the reasonable error. I tried several things to get along this : - avoid using unsave string opartions - used an own memory management to avoid libc dependency - register every used memory block and manged them in a list - reduce pointer and dynamical memory usage - using more and more constant pointer and constant definitions - using wrappers for all memory functions (strcpy, malloc, free, ...) and checked every write access to memory, compare with the list of registered memory blocks - checked every pointer on function entry if valid and if it points to registered memory blocks - this worked fine but it doesn't found every error and it takes about 80% cpu usage - tried to use ISS for running testcases, but it's limited and i have problems in combination with uCOS - tried to apply a boundary check patch to the gcc compiler, but i failed (anyone succeed?) - tried to work out a plattform independend layer and switch development to x86 plattform, but messed up with to much work and failed - tried to start using uclinux but failed, i did not get running the linux kernel for our customized board So, at this state, i feel helpless getting along memory access errors... http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif I'm interessed, how you guys get along with such thing when programming on nios? Regards, Marek