Forum Discussion

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

EPCS Flash

I am really a newbie to linux in general. I am working on a custom board that has an epcs64 device attached. From within cgi code wrote in "c" I need to access the epcs flash device and be able to over write the fgpa configuration. In addition, I may need to do software upgrades in a similar fashion. In order to eliminate some for seen problems, I have a custom bootloader that starts loading software from a particular offset in flash memory so the software isn't stored immediately following the fpga configuration.

I haven't been successful at finding any information that might help. Any help would be appreciated.

7 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Please check the wiki,

    http://nioswiki.jot.com/wikihome/operatingsystems/epcsguide (http://nioswiki.jot.com/wikihome/operatingsystems/epcsguide)

    http://nioswiki.jot.com/wikihome/operating...flashprogrammer (http://nioswiki.jot.com/wikihome/operatingsystems/flashprogrammer)

    You will setup the epcs as a mtd block devices, with mtd map file.

    Then you can update epcs by open, write, read, to the block device.

    I think the altera epcs bootloader works fine.

    You can study the altera supplied epcs bootloader code, then you will know how to compute the size of fpga configuration data. Or you may update both of them together.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    "You will setup the epcs as a mtd block devices, with mtd map file.

    Then you can update epcs by open, write, read, to the block device"

    I am not exactly sure what this means or how to do it. Could you give me some more help? Sorry if I am asking stupid questions but I seem to have a real lack of knowledge.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You need to edit struct epcs_partitions[] in file linux-2.6.x/drivers/mtd/maps/epcs_map.c .

    It divides the epcs to partitions, eg, fpga config, (+) kernel image, jffs2 etc.

    The epcs partitions will become device /dev/mtdblock0, /dev/mtdblock1 ...

    Then you can access each partition just like a regular file, or actually block device, with file operations such as open(),lseek(),read(),write() and close().

    Update the firmware means, write the file.

    Please read the wiki pages for details. It will be more clear when you walk through.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I have successfully modified the epcs_map.c file for my file partitions. However I seem to have run myself into more trouble. I want to be able to use netflash to update my epcs flash, but I am not finding much for documentation for netflash. Also, I struggled through compiling netflash (might have made a mistake fixing problems with the source code) and I tried this.

    netflash -r /dev/mtd0 192.168.1.100 (source file)

    My results were this

    netflash: ioclt(BMGETSIZEB) failed, error=25

    I also am trying to get tftp working also, but I appear to have something wronge there too. The cross compile app seems to work okay but I can never get a response back. Using ethereal I see the tftp request go out, but the response I see coming back is "port unreachable". If I tftp from a computer to the board, in ethereal again I seen the tftp request leave and I see a response back from uclinux that says "port unreachable". Any thoughts would be helpful.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Try it in another way,

    1. get the image with "wget" "ftpget" or "tftp".

    2. try with "cp" or "dd" , eg, "cp image.bin /dev/mtdblock0" .
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I have managed to figure out what I have done wrong in setting up netflash to work. But I have another problem I need to address. I am still looking for a simple way to upload/download file from a Windows computer to my custom board running uclinux. The goal is to find a reliable way to do this over an ethernet connection without having to install any special software on the PC with the custom board initiating the request for a file. Any ideas would be very helpful.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You may use ftpd on Nios2. I had enabled it in the default config of uClinux-dist. Just "inetd &" to start it.

    But you still need to make sure your /dev/mtdblock0 works.