Forum Discussion
5 Replies
- Altera_Forum
Honored Contributor
This works for me (with an epcs64):
alt_flash_fd* m_hEpcs; m_hEpcs = alt_flash_open_dev("/dev/epcs_controller"); Make sure your NIOS has an "EPCS Serial Flash Controller" module installed. - Altera_Forum
Honored Contributor
epcs mode is installed ,and maybe I selected the small C library, but if i don't selected the small C library iterm, there is not enough on-chip memory to run. so small C library should be selected. my software is Nois 9.1, how to do?
- Altera_Forum
Honored Contributor
I was surfing a different question when I came across your answer:
http://www.altera.com/literature/hb/nios2/n2cpu_nii51012.pdf#page=4 hal system library The Altera-provided driver implements a HAL flash device driver that integrates into the HAL system library for Nios II systems. Programs call the familiar HAL API functions to program the EPCS memory. You do not need to know the details of the underlying drivers to use them. The driver for the EPCS device is excluded when the reduced device drivers option is enabled in a BSP or system library. To force inclusion of the EPCS drivers in a BSP with the reduced device drivers option enabled, you can define the preprocessor symbol, ALT_USE_EPCS_FLASH, before including the header, as follows: # define ALT_USE_EPCS_FLASH# include <altera_avalon_epcs_flash_controller.h> Hope this helps, -Terry - Altera_Forum
Honored Contributor
Actually reading and writing support of EPCS takes a lot of space if you use onchip memory for example EP3C25. For my design I made some changes in reading and writing routines and I am able to use small library and read/write to EPCS.
I should mention that if you use EPCS for booting your image and you want to use it for data storage, there is some problems. You need to communicate with EPCS using ALtera's IP core of remote update. How to do it externally it seems that is hidden by Altera (I do not know why). Other solution. If you do not use remote update IP core.. you can access to EPCS as ordinary serial flash.. In forum a lot of info what kind of chips can change EPCS and using them data throu SPI you can access to FLASH.. Good luck - Altera_Forum
Honored Contributor
I have written a simple program to write and read the epcs flash that takes approx 6KB of space using the hello_world_small as my starting template. I am running this on the EP3C16 (DE0) board where I've declared an 8KB onchip ram.
I couldn't get the serial flash working until I modified my alt_sys_init.c file and added: # define ALT_USE_EPCS_FLASH before the line:# include "altera_avalon_epcs_flash_controller.h" According to the documentation, it sounded like I needed to do this in my main.c file prior to calling main(). Perhaps they meant my alt_sys_init.c file... anyways, this worked. Cheers, -Terry