- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello:
I am having issues linking my code with the calls to the EPCS functions. Here is the error I get at link time: Linking project.elf... obj/source/monitor.o(.text+0x1588): In function `Process_Command_String(char*)': ../source/monitor.cpp:2135: undefined reference to `alt_epcs_flash_get_info(alt_flash_dev*, flash_region**, int*)' obj/source/monitor.o(.text+0x15a4):../source/monitor.cpp:2138: undefined reference to `alt_epcs_flash_write(alt_flash_dev*, int, void const*, int)' collect2: ld returned 1 exit status make: *** [project.elf] Error 1 Build completed in 10.313 seconds I have included the file "altera_avalon_epcs_flash_controller.h" in my source code and have included the symbol ALT_USE_EPCS_FLASH in my system library properties. Any help would be appreciated.Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just a thought, but have you a) put an EPCS controller component into your SOPC builder project? and b) have you in the BSP settings enabled the driver for the EPCS controller?
You shouldn't need to change anything yourself in system.h (if that's what you mean with system library properties) - that will change automatically each time to go through the BSP properties page, so at least every time you regenerate your SOPC Builder project.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hell simonkbrown:
Yes, I have an EPCS controller in the SOPC builder project. I also added the ALT_USE_EPCS_FLASH symbol on the BPS settings, under the C/C++ Build page, Tool Settings tab, Nios II Compiler, Preprocessor. Any other clues?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I meant "Hello simonkbrown:"
not "Hell simonkbrown:"- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reassurance re: hell/hello. :-)
I should have said that I use the Nios2-Studio rather than Nios2 IDE, so not sure exactly how to set the relevant options if that's what you're using. With the build tools it does a number of things for me in the BSP properties page, namely lists all my SOPC objects and lists drivers available for them and whether I want to enable them or not. Having selected the "altera avalon epcs flash controller driver" it then puts various lines in my "system.h" file that define it's name, device name, controller base address, etc. It also adds a line into alt_sys_init.c: ALTERA_AVALON_EPCS_FLASH_CONTROLLER_INSTANCE ( EPCS_FLASH_CONTROLLER, epcs_flash_controller); which creates an instance of the epcs flash controller called "EPCS_FLASH_CONTROLLER" that sets up various objects for accessing it, including the "open", "read" and "write" function call hooks so that when you're talking to this device it knows how to access it. I'm afraid I got bored of Nios2 IDE taking for ever to even decide whether it should compile a file that I never really got the hang of using it. Apologies if you are actually using Nios2 Studio but your reference to the BSP Settings pages didn't ring any bells with what I've got. Ok, some inaccuracies in the above, I use: alt_flash_open_dev to open the device, alt_read_flash to read from it, alt_flash_close_dev to close it alt_erase_flash_block to erase a block and alt_write_flash_block to write a block. Looking back through my code, I use the same calls to talk to my CFI flash as the EPCS flash, so the device creation in the system.h does do something to help it work out which flash you're trying to talk to when you open that device. Not sure that's much use to you, but hope it helps somehow. Cheers, Simon- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you included sys/alt_flash.h and sys/alt_flash_dev.h?? I have also implemented the driver over the NIOS2 IDE, but I have also to implement the two above to get it working. Code looks like this:
...# include "sys/alt_flash.h"# include "sys/alt_flash_dev.h" ... alt_flash_fd* any_epcs; char data_array_name[16]; int ret_code = 0; ... my_epcs = alt_flash_open_dev(EPCS_FLASH_CONTROLLER_0_NAME); ret_code = alt_read_flash(any_epcs, 0, data_array_name, 16); ... good luck!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks to everyone for your inputs. I followed simonkbrown's suggestions and used normal flash function calls to talk to the EPCS, and now it works.:)

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