Forum Discussion
Altera_Forum
Honored Contributor
21 years agoProble opening the /dev/epcs_controller device
Hi all,
My application can not open the /dev/epcs_controller device for reading the EPCS flash. We do NOT have the probleem during debugging/running inside the NIOS IDE (thus downloading codes onto the board). However, after we program the application (using the flash programming tool) onto the EPCS flash, our application could not open the EPCS flash device. The rare thing is that the application CAN run, but can NOT open the mentioned EPCS device! Hope someone has an answer! Regards, Kwok Wong16 Replies
- Altera_Forum
Honored Contributor
The same problem occurs if we use "small footprint drivers".
In this case, the problem occurs, even during debugging with the NIOS IDE. - Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by kwokwong@Dec 29 2004, 11:31 AM the same problem occurs if we use "small footprint drivers".in this case, the problem occurs, even during debugging with the nios ide. --- Quote End --- Who helps?
- Altera_Forum
Honored Contributor
what device and design are you using?
- Altera_Forum
Honored Contributor
We are using CYCLONE device.
I don'nt know what you mean by 'design'. Below is part of the system.h. /* * system configuration * */ # define ALT_SYSTEM_NAME "secure_box"# define ALT_CPU_NAME "cpu"# define ALT_CPU_ARCHITECTURE "altera_nios2"# define ALT_DEVICE_FAMILY "CYCLONE"# define SECURE_BOX_V1_1# define ALT_STDIN "/dev/jtag_uart"# define ALT_STDOUT "/dev/jtag_uart"# define ALT_STDERR "/dev/jtag_uart"# define ALT_CPU_FREQ 40000000# define ALT_IRQ_BASE NULL /* * processor configuration * */ # define NIOS2_CPU_IMPLEMENTATION "tiny" # define NIOS2_ICACHE_SIZE 0# define NIOS2_DCACHE_SIZE 0# define NIOS2_ICACHE_LINE_SIZE 0# define NIOS2_DCACHE_LINE_SIZE 0 # define NIOS2_EXCEPTION_ADDR 0x00080020# define NIOS2_RESET_ADDR 0x00040800 - Altera_Forum
Honored Contributor
Kwok,
At the risk of stating the obvious, do you have an EPCS hardware component in your system? Is it called epcs? The way to check is to look in your system.h if it does not contain the line # define EPCS_CONTROLLER_NAME "/dev/epcs" Then you don't have the correct hardware in your system. For future reference if you post the system.h, post it all, as the odds on you picking the correct section are remote - Altera_Forum
Honored Contributor
TO_BE_DONE
- Altera_Forum
Honored Contributor
Kwok,
The next likely place to look is in the initialisation code for the EPCS device. I suggest you take a look at the function alt_epcs_flash_init which can be found in the file nios2\components\altera_avalon_epcs_flash_controller\Hal\src\altera_avalon_epcs_flash_controller.c My guess is that this function is failing, which will cause the device not to be registerred and therefore you will get a null file pointer. - Altera_Forum
Honored Contributor
How can I do this if I am not running the program with the NIOS IDE debugger?
Or should I call the epcs register function myself? - Altera_Forum
Honored Contributor
Kwok,
You can either use the debugger to debug the code running in flash you'll need hardware breakpoints for this. If you don't have this there are many things you could do, such as write different patterns to the LEDs as you progress through the function etc. - Altera_Forum
Honored Contributor
I would like to call the alt_epcs_flash_* functions directly (thus not using HAL).
But I got link errors: undefined references to these functions. I am sure that these functions do exist and are called in alt_sys_init(). Apparently these functions will be linked later in the make process. Can anyone tell me how to workaround these?