Hi Mell,
On my system the two files you need to edit are in these locations:
C:\altera\kits\nios2_60\components\ecos\ecos-current\packages\devs\flash\sopc\altera_avalon_am29lv065d_flash\current\src\altera_avalon_am29lv065d_flash.c C:\altera\kits\nios2_60\components\ecos\ecos-current\packages\devs\flash\amd\am29xxxxx\current\include\flash_am29xxxxx_parts.inl The file called altera_avalon_am29lv065d_flash.c contains a definition of the flash geometry that is being used. Near the top of the file you will find some code like this:
# define CYGNUM_FLASH_INTERLEAVE (1)
# define CYGNUM_FLASH_SERIES (1)
# define CYGNUM_FLASH_WIDTH (8)
# define CYGNUM_FLASH_BASE altera_avalon_am29lv065d_base
You need to add a line to this to specify that the flash is being used in 8-bit mode, like so:
#define CYGNUM_FLASH_INTERLEAVE (1)# define CYGNUM_FLASH_SERIES (1)# define CYGNUM_FLASH_WIDTH (8)# define CYGNUM_FLASH_16AS8 (1)# define CYGNUM_FLASH_BASE altera_avalon_am29lv065d_base
The second file called flash_am29xxxxx_parts.inl contains the settings required to drive the flash. It consists of a long list of flash settings. The defines in the previous file cause parts of the second file to be enabled. We need to add a new section to flash_am29xxxxx_parts.inl to describe the flash being used in 8-bit mode.
Search for this code in the file (Somewhere around line 560):
#else // 16 bit devices
# ifdef CYGHWR_DEVS_FLASH_AMD_AM29LV128
{ // AM29LV128
device_id : FLASHWORD(0x227e),
block_size : 0x10000 * CYGNUM_FLASH_INTERLEAVE,
block_count: 256,
device_size: 0x1000000 * CYGNUM_FLASH_INTERLEAVE,
base_mask : ~(0x1000000 * CYGNUM_FLASH_INTERLEAVE - 1),
bootblock : false,
banked : false,
bufsiz : 16
},# endif
This is the existing code for 16-bit access to the flash. You need to add an 8-bit section before the# else statement like so:
#ifdef CYGHWR_DEVS_FLASH_AMD_AM29LV128
{ // AM29LV128
long_device_id: true,
device_id : FLASHWORD(0x7e),
device_id2 : FLASHWORD(0x12),
device_id3 : FLASHWORD(0x00),
block_size : 0x10000 * CYGNUM_FLASH_INTERLEAVE,
block_count: 256,
device_size: 0x1000000 * CYGNUM_FLASH_INTERLEAVE,
base_mask : ~(0x1000000 * CYGNUM_FLASH_INTERLEAVE - 1),
bootblock : false,
banked : false,
bufsiz : 16
},# endif
# else // 16 bit devices
# ifdef CYGHWR_DEVS_FLASH_AMD_AM29LV128
{ // AM29LV128
device_id : FLASHWORD(0x227e),
block_size : 0x10000 * CYGNUM_FLASH_INTERLEAVE,
block_count: 256,
device_size: 0x1000000 * CYGNUM_FLASH_INTERLEAVE,
base_mask : ~(0x1000000 * CYGNUM_FLASH_INTERLEAVE - 1),
bootblock : false,
banked : false,
bufsiz : 16
},# endif
The tabs have been messed up by pasting into this message. If I knew how to send attachments through this forum then I would send these files to you. You could send me a "personal message" through the forum with your email address and I could then send the files directly to you.
Mike