Shmuel,
What settings are you using in the IDE syslib? As told by Altera support:
"when you check on the “small C library” option and the “reduced device drivers” settings, the flash driver will not be initialized. You can refer to the file altera_avalon_cfi_flash.h line 143."
As a result, I was never able to succesfully open the flash device. I was trying to do something very similar as you are on a custom board. My system is based around a Cyclone part which configures and boots from a flash memory, Am29LV065, using the same config controller CPLD as provided with the development kits. I am running software strictly from the on-chip RAM.
Apparently, I am memory limited in my design. I reached an impasse with my problem. I can only get the software design to fit in on-chip memory if I use "small C library" and "reduced device drivers" which won't allow the use of the HAL flash routines. I have not found a way to increase availability of on-chip data ram on my Cyclone chip which is at 75% memory utilization and 55% logic utilization. I briefly tried running the software from the flash memory but was not able to get the software to run.
My workaround has been to write my own flash routines and writing only the functions I need.
Good luck and please post if you find a solution.
Thanks.
Steve