- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Provided "/dev/ext_flash" is correctly the name of the sopc device as reported in system.h file (I think you have already checked it...), maybe the problem is that your flash device is not included in the driver CFI table.
What's your flash device part number? Read the de2 board documentation and look if there's a driver patch for the flash. I had to do the same with another eval board. You can also try run in debug mode and step into alt_flash_open_dev in order to find out where the problem exactly is.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
what is driver CFI table? the flash part number is 29LV800TE-90PFTN 0441 F84. where to find the de2 board documentation? how to do the step in debug mode? sorry, i am new in this. thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Compile all in debug mode.
Place a breakpoint on alt_flash_open_dev function. Launch the program with "Debug as..." instead of "Run as... Wait until the breakpoint hits. Then step into the function and find the point where the driver generates the error.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i tried but i didnt see any error msg. where to see the error msg?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You must step the driver code until you find a function returning a zero or negative value, while it is intended to return a positive one.
Probably this is one of the functions in altera_avalon_cfi_flash_table.c, or in any other altera_avalon_cfi_flash*.c.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i can use the flash if i am using de2 control panel. why?

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page