Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12409 Discussions

wrong "fd->length" (flash device)

Altera_Forum
Honored Contributor II
807 Views

Hi, I'm using a CFI Flash memory.

When I interrogate the Flash, by : 

[code=c]

flash_region* regions;

alt_flash_fd* fd;

int number_of_regions = 0;

int ret_code = 0;

int i = 0;

 

int size = 0; // taille de la flash calculée à partir des infos de régions flash

 

// ouverture de la flash

fd = alt_flash_open_dev(FLASH_GENERIC_TRISTATE_CONTROLL ER_NAME);

 

// affichage d'info sur la flash

if (fd)

{

ret_code = alt_get_flash_info(fd, &regions, &number_of_regions);

if (number_of_regions )

{

printf("Flash information :\n");

printf("\tlength : %i\n", fd->length);

 

for (i=0 ; i < number_of_regions ; i++)

{

printf("\tregion_info[%i]\n", i);

printf("\t\toffset : %i\n", fd->region_info[i].offset);

printf("\t\tregion_size : %i\n", fd->region_info[i].region_size);

printf("\t\tnumber_of_blocks : %i\n", fd->region_info[i].number_of_blocks);

printf("\t\tblock_size : %i\n", fd->region_info[i].block_size);

}

}

}

[/code]

 

It says

Flash information :

length : [color =red] 4194304[/color]

region_info[0]

offset : 0

region_size : 4128768

number_of_blocks : 63

block_size : 65536

region_info[1]

offset : 4128768

region_size : 65536

number_of_blocks : 8

block_size : 8192

The addition regions gives size 4194304 Bytes, but the length gives 4194304 words (=16 bits)

 

I have 2 differents flash (32Mb and 64Mb) and they give both 4194304 words

 

fd->length is not calculated by CFI information but by QSYS. 

Can someone confirm this ?

0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
80 Views

By a# define MACRO in altera_avalon_cfi_flash.h : #define ALTERA_AVALON_CFI_FLASH_INSTANCE(name, dev) ... 

(fd -> length) takes information from the system.h <-- generated by BSP <-- generated with QSYS <-- flash information "embeddedsw.CMacro.SIZE" in "module_assignement" when editing the flash component in Qsys Editor. 

 

So, (fd -> length) does NOT take information from CFI flash. 

 

I put here because It may help someone else debugging.
Reply