Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

URGENT: Flash memory

Hello. I am doing a project regarding DMA. However I need to use flash memory on the DE2 Board. I have done the instantiation for the flash but I cannot use because it always return zero for the function alt_flash_open_dev().

Spec:

Altera DE2 Board with 1Mb flash memory.

Can I ask if it is possible to have someone to provide me a sample simple C-programming code on how to use flash? Like from beginning such as from library part till the end.

Just a simple one will do. Because I tried so many but cant get it to work. I left lots of threads regarding this but none is helping.

My code just to test alt_flash_open_dev()

--- Quote Start ---

# include <stdio.h> # include <stdlib.h># include <string.h># include "system.h" # include "altera_avalon_pio_regs.h" # include "alt_types.h" # include "altera_avalon_performance_counter.h"# include "sys/alt_flash.h" # include "sys/alt_flash_dev.h"

int main(void)

{

alt_flash_fd* fd;

alt_u8 flashname[30];

strcpy(flashname, "/dev/ext_flash");

fd = alt_flash_open_dev("/dev/ext_flash");

if (fd)

{

printf(" -Successfully opened %s\n", flashname);

}

else{

printf("The end\n");}

return 0;

}

--- Quote End ---

Thanks!

13 Replies