Altera_Forum
Honored Contributor
15 years agoalt_flash_open_dev
following is my code:
# 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; //int number_of_regions; //int block; //flash_region* regions; //int ret_code = 0x0; 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; } why the return of alt_flash_open_dev is always error where The end is printed? i am using altera de2 board. 1mb flash, reset vector is set to sdram as well as exception vector.