- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
A couple of questions that people might be able to help me out with. There seems to be a common issue with setting up the initial boot sequence for a NIOS boot loader and whilst there is a lot of information out there I seem to be going around in circles at the moment. Here is what I'm after. I have the following system: Flash, 0x00000000 to 0x007FFFFF (i.e. 8Mb worth) SDRAM, 0x01000000 to 0x01FFFFFF (i.e. 16Mb worth) EPCS mapped in as EPCS controller peripheral at location 0x00810800 NIOS II f core with flash/tri-state bridge and EPCS controller Reset address is set to the EPCS controller base address Exception address is set to 0x0100020 (i.e. into SDRAM) Now I want to put the configuration data (.sof) into the EPCS with a UBoot on top of it so that at boot up U-Boot will fire up from the EPCS, it (U-Boot) will then load an elf executable from the flash into sdram and execute it at a later point. When I boot up my current system I have succeeded in getting U-boot to be placed in the FLASH but not into the EPCS, in this arrangement it comes up correctly and the EPCS boot loader correctly loads u-boot out of flash and executes it. The problem I am having is getting all the parameters correct for scripting all of this so that I can get U-boot to come out of the epcs, can anyone suggest the correct steps to take (in script) to make the build happen, obviously I want to automate the, but it is being troublesome getting the correct parameters, also the quartus_pgm utility doesn't like running from within cygwin so this means having to shell out to win32 cmd to execute that, again anyway way around this? Regards, DWLink Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi DW,
I just started playing with this myself ... I'll let you know if I learn anything. --Scott- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi DW,
> Now I want to put the configuration data (.sof) into the EPCS with a > UBoot on top of it so that at boot up U-Boot will fire up from the EPCS ... snip ... > can anyone suggest the correct steps to take (in script) to make the > build happen 1. create the u-boot flash file with elf2flash and these parameters: --epcs --base=0x0 --end=0x7fffffff --flash=<the epcs chip designator> --input=u-boot --outfile=u-boot.flash --boot=<path to epcs bootloader srec> The bootloader srec is in the {install}/altera/kits/nios2/components/altera_nios2/boot_loader_epcs.srec 2. download u-boot to the epcs device. $ nios2-flash-programmer --epcs --input=u-boot.flash --sof=<path to pgm sof> 3. create the configuration flash file. $ sof2flash --epcs --input=<path to your system sof> --ofset=0x0 --output=config.flash 4. download the configuration flash file to the epcs device. $ nios2-flash-programmer --epcs --input=config.flash --sof=<path to pgm sof> --relocate Don't forget the "--relocate -- it's important ;-) ... and you should be good-to-go at this point. Hope this helps. Regards, --Scott- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry ... something I forgot ... you must define the symbol "__reset"
in u-boot to keep elf2flash happy: In file cpu/start.S: .text
.global _start
.global __reset
__reset:
_start:
Although this does seem a bit odd to me since using the --reset option with elf2flash when --epcs is specified causes an error. Regards --Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ahhhh, that got it.
I had got a little bit further but the specific set of commands I was using resulted in it being unable to fit the config and u-boot into the epcs4.. now it all fits, Thanks a lot.. regards, DW- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
> being unable to fit the config and u-boot into the epcs4.
Wow ... big design ... I'm using a full-blown u-boot (network support, jffs2/cramfs, hush parser, etc -- about 128K) and a design that's about 9K LEs ... it only occupies about half of my epcs4. Are you using compressed bit streams? Regards, --Scott- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No I think the problem with it not fitting was the order of programming, which was basically plain wrong. Now it seems to fit fine, full featured U-Boot, and a config of about 12000 LEs,
takes up about 300k bits so not too bad. Mind you I can't get the damn ethernet to work yet, but I think if I just threaten it with a large stick it'll be okay. Cheers for the help Scott,- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am using stratix NIOS board, new to uClinux and NIOS. I want to know which version of u-boot should I use. Can I get any guidelines on how to bring up u-boot on NIOS stratix board. regards, Rajendra- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Rajendra,
If you're using Nios, you can simply download u-boot from: http://www.sourceforge.net/projects/u-boot (http://www.sourceforge.net/projects/u-boot) then follow the directions in doc/README.dk1sxx. For Nios-II the source at: http://www.psyent.com/download (http://www.psyent.com/download) is the best bet. Build u-boot for the PK1C20 board: $ make distclean $ make PK1C20_config $ make You will need to edit include/configs/PK1C20.h to match you hardware configuration. Regards, --Scott- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am also thinking of putting u-boot in the EPCS. Is there any documentation that talks about the EPCS bootloader and how it works?
I am unclear on how it fits in/replaces the standard booting scheme and what the active players are. Do I need to have an ASMI or EPCS module in my project to make this work?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi tns1,
> I am also thinking of putting u-boot in the EPCS. I'm doing this now on one of my boards ... it works very nicely -- kudos to Altera :-) > Is there any documentation that talks about the EPCS > bootloader and how it works? See Chapter 12 of the "Nios II Processor Reference Handbook", and 1-6 of the "Nios II Flash Programmer User Guide" for a description: http://www.altera.com/literature/hb/nios2/...pu_nii51012.pdf (http://www.altera.com/literature/hb/nios2/n2cpu_nii51012.pdf) http://www.altera.com/literature/ug/ug_nio..._programmer.pdf (http://www.altera.com/literature/ug/ug_nios2_flash_programmer.pdf) > I am unclear on how it fits in/replaces the standard booting scheme > and what the active players are. Do I need to have an ASMI or EPCS > module in my project to make this work? Yes you need the EPCS component and you need to set your reset address in the EPCS component memory. The bootloader code in the EPCS component will then do its thing on reset. The actual code is in: {INSTALL_DIR}\kits\nios2\components\altera_nios2\sdk\src\boot_loader_sources - boot_loader.S (generic code for CFI or EPCS) - boot_loader_epcs_bits.S (epcs-specific code) The thing I like most about the EPCS bootloader : I can eliminate parallel flash altogether for some apps (or just de-pop) ... an epcs and some PSRAM & I'm done :-) Regards, --Scott- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great info.
A few things. The docs talk about the epcs bootloader ROM as if this is some FPGA onchip ROM whose contents are determined during project compilation. Yet I see from your steps above the epcs bootloader gets bundled with the u-boot image. Are there two bootloaders? How do you figure out how much app code you can fit? For my HW the data sheet says: EPCS1 = 131072 EPC4 = 115564 ; uncompressed spare = 15508 ; ignoring bootloader overhead 15KB is not enough for u-boot, but if both the config and app could be compressed, that would allow around 100KB of app code. Do you lose the ability to use compressed files when you program with the flash programmer?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi tns1,
> Are there two bootloaders? Sort-of ... the code in the epcs on-chip rom is built-in to the device configation. At reset, this code searches for the end of the config data in the epcs device, then loads the records that follow (which in this case would be u-boot). It then jumps to the u-boot entry point. The epcs u-boot command will tell you the size of the configuration data. > How do you figure out how much app code you can fit? In my case, it's purely observation ... my fpga configuration data is about 192 KB (compressed). I'm using an EPCS4 ... so that leaves me plenty of room for u-boot (which ends up being roughly another 128 KB). > Do you lose the ability to use compressed files when you program > with the flash programmer? I use compressed bit streams & haven't had any problems. Regards, --Scott- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Including the boot=<path> parameter with elf2flash command above does not seem necessary - the flash file is unchanged.
As far as I can tell, the epcs bootloader code that is running from the FPGA epcs module does it all. There would be no reason to add anything to the app image stored in the epcs chip other than some header info to tell it what chip maybe. My confusion on compressed files was that the actual sof,pof,jic files dont change size. If I use the map option in the file converter I can see there is a difference. I think the sof2flash will produce compressed output only if the sof is already compressed. The file converter produces compressed files but it only takes sof as input elf2flash does not compress so I don't think your u-boot image is compressed. I am referring to the cyclone (de)compression, not the epcs (de)compression only on epcs4 and up. It is looking like there is no way for application images stored in epcs1 to take advantage of the cyclone (de)compression scheme. It appears to be just for config data.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there an easy patch process to update a customized version of the u-boot src?
I just noticed I have an older version than appears on the psyent site.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi tns1,
> Is there an easy patch process to update a customized version of the u-boot src? Yes, see the section, "Submitting Patches" in the u-boot top level README file for details. But basically, create a patch file against the u-boot top-of-tree, then send the patch to the u-boot mailing list. To ensure a good experience, please do follow the instructions carefully. The lead project maintainer (Wolfgang) sets high standards for contributions ;-) > I just noticed I have an older version than appears on the psyent site. Please be aware that the u-boot sources at http://www.psyent.com/download (http://www.psyent.com/download) are *not* official. However, anything that shows up at psyent has been submitted to the u-boot project ... with the exception of a few very basic nips & tucks to eliminate compile time warnings. Since u-boot supports such a large number of architectures and boards, the maintainers receive a considerable number of patches. Because of this, some patches can literally take months to make it into the official source tree -- this why the psyent site exists -- to make the Nios CPU related patches available to the development community as soon as possible. As of 2005-Feb-10, the (3) patches required to bring the main u-boot source tree up to the psyent.com level are in the queue at positions 5, 8, and 23 out of a total of 129. When these patches are finally accepted into the main source tree, I'll announce it here in the Nios Forum. It would probably be best to wait until this time to add your specific board to the main source tree. Also, with Nios-II 1.1, there were several tool changes that result in compile time errors/warnings with the sources at psyent. These will be cleaned up and made available at psyent once the appropriate patch has been submitted to the u-boot project. I'm sure this post is much more than you bargained for ;-) ... but I hope it helps. Best Regards, --Scott PS -- once your board-specific code is in the main u-boot source tree, I'd be glad to make it available in the psyent distribution.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What I meant was, what tools do you use to merge different versions of two source trees?
I am currently using csdiff for comparing folders, and Compare It! to actually merge files. Surely there are better tools.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yikes! I guess I missed that by a long shot ;-)
I'm a diff/patch guy so I can't help much here. Although I recently started using Subversion with TortoiseSVN ... and it does include some very nice features to ease the pain. The reason I started using subversion was so I could maintain the original CVS metadata as part of my local revision control. Regards, --Scott- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have rebuilt my project with the epcs module and to reset from epcs. I have rebuilt u-boot with the epcs features added.
While I wait for those epcs4 compatible parts to arrive, I noticed: If the reset is set to epcs and there is no actual app code stored there, it locks on reset. I am wondering if the epcs bootloader is spinning in an endless loop, executing FF or what. I sort of expected the Nios to eventually find its way to 0x0 anyway where I have some code. If I use nios2-download to bypass the epcs boot, I can run u-boot and test the epcs features. If I try an 'epcs info', I get an 'device not found'. I must do an 'epcs read' before 'epcs info' will work. There was mention of an epcs chip select issue. Does the latest psyent code have this issue? The serial flash devices are getting larger all the time (8MByte!) and cheaper than parallel flash. I am thinking about storing multiple application images in the epcs. One way would be to boot u-boot and have it in turn load the select image from the epcs. This requires both u-boot and the app image to be sram resident at the same time - unclean. This is not the case with parallel flash since each image can have its own bootloader. I think a better way would be to have the epcs bootloader get its image offset parameter from a new writable (system or epcs) register. That way POR would always boot image0 (u-boot), which could then clean boot any other image. Has this been done? I see some posted IP about an 'upgraded epcs' but no docs.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well thanks for all the replies, one final question, now that U-boot is all fine and working well. I've got it using dhcp to download a file to sdram and can then put that into flash with no problems, the question is over how to format and encode it up so that uboot can correctly boot it.
Let's say it is a normal elf image (not linux, just plain nios). And my reset vectors are at 0x01000020 sdram goes from 0x01000000, uboot gets loaded and runs from 0x01C00000 now when i run dhcp I specify a download address of 0x01100000 (i.e clear of the interrupt trampoline). what i want to do is then flash this image (which I've done with no problems). and then later load and execute it using the bootm command, now the elf image is compiled to run at 0x01000000 with interrupts obviously at 0x01000020. So the question is what parameters should be used for mkimage to generate the correct type of img file for uboot to load and execute assuming these specified addresses? Regards,...- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
> What parameters should be used for mkimage to generate the correct type
> of img file for uboot to load and execute assuming these specified addresses? Assuming your application entry point is the at the start of your uncompressed binary image: $ mkimage -A nios2 -O linux -T kernel -C none -a 0x01000000 -e 0x01000000 -n "MyApp v0.1 2005-02-22" -d MyApp.bin MyApp.img Basically, you're just telling u-boot that your image is a linux kernel -- that fact that it's not really a kernel doesn't matter. When bootm is executed it will copy the image data to the load address then jump to the entry point after disabling interrupts (and a few other things). If you want to use compression, you can compress your binary file using gzip: $ gzip -c MyApp.bin >> MyApp.gz Then use "-C gzip" with mkimage and the compressed file (-d MyApp.gz). bootm will then decompress as it copies from flash. Regards, --Scott
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page