Forum Discussion
Altera_Forum
Honored Contributor
21 years agoProgramming the EPCS
Hi All, We found a problem in the AVALON HAL. We are using a CFI flash from Spansion, when registering the Flash, the code will put the flash into Query Mode several times in a row. This causes th...
Altera_Forum
Honored Contributor
21 years agoHi all,
I have located the problem, I was using the right functions, but Alteras Avalon code is seriously buggy, as a matter of fact, I am pretty sure the code has not been tested... Here's the kind of code you'll find, if you dig into the HAL functions function A( int iCount ) { char buffer[4]; int a = 0; int b = 4; while ( iCount >= 0) { int c = iCount > b : 4 : iCount; buffer[a] = 0x0a; a += c; iCount -= c; } } assume you call A(16), then you will pass the bounds on the buffer, and overwrite the stack, furthermore you will enter an infinite loop. Now take a look at the alt_epcs_flash_memcmp function in altera_avalon_epcs_flash_controller.c file, you'll see the exact same construction. This kind of thing makes you wonder.... http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif