Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
1,038 Views

Problem with Advanced Bootcopier

I am trying to implement the advanced boot copier in my Nios Design and at the moment I am not able get it work. 

 

First of all I included the advanced_boot_copier.h to my design and set the advanced_boot_copier.c as my main programm. In the next step I modified this files so they match with my design. 

I choose #define BOOT_METHOD BOOT_EPCS_FROM_ONCHIP_ROMAnd also rename the base adress to my EPCS Controller. 

 

Then I generated an application programm. Just Hello World via jtag uart. 

 

I took the .elf file like in the Applikation AN458 mentioned and convert it via the make_flash_image_script into a .bin file with the expected header for the bootloader. 

 

Now I generate from the bin file a flash file with the location 0x00060000.  

 

And programmed it into the epcs flash with the nios2-flash-programmer. 

 

I used the Eclipse enviroment to debug my bootloader and it get stuck at the point where it should copy the content of my epcs flash. 

 

Now from the debugger I can see that I get at this point in the programm the following length and address values: 

length =0xd9c00815 

address =0xb307a 

 

I think these values must be wrong the length defines the byte length of the software image didn't it? 

 

So I checked the bin file with a hex editor. 

A modified sreenshot is in the attachment. 

I am wondering why the bytes in the .bin files are inverted from right to left 

But besites that, it seems ok. In my opinion the programm reads the right values. Is there maybe a mistake in the make_flash_image_script script. Did I have to change something there. 

 

Did anyone here have had the same problem or knows a solution?
0 Kudos
6 Replies
Altera_Forum
Honored Contributor I
81 Views

The data is 'little-endian'.

Altera_Forum
Honored Contributor I
81 Views

 

--- Quote Start ---  

The data is 'little-endian'. 

--- Quote End ---  

 

 

Ok but the generated length of about 3 GBytes cannot be right. An so there must be a mistake in the script or do I have to edit the script in someway?
Altera_Forum
Honored Contributor I
81 Views

I think i just found something. Did I have to modefy the flash_base and flash_end variables in the make_image_flash_script ? 

I will try it tomorrow but maybe someone can give me a hint if this is maybe the solution for my problem. 

 

Regards Tobias
Altera_Forum
Honored Contributor I
81 Views

I'd look at the program sections in the elf file and see if the numbers match. It might be that the imiage is trying to cover a massive gap in the address space. 

 

IIRC the EPCS boot code can only load to a contiguous address block (this really should be fixed by Altera) so usually all the initialised data is linked to physical addresses that follow the code - and the first code the nios runs copies it into the required places. 

This just doesn't work unless you are loading into SDRAM (assumed to be big).
Altera_Forum
Honored Contributor I
81 Views

 

--- Quote Start ---  

I'd look at the program sections in the elf file and see if the numbers match. It might be that the imiage is trying to cover a massive gap in the address space. 

 

IIRC the EPCS boot code can only load to a contiguous address block (this really should be fixed by Altera) so usually all the initialised data is linked to physical addresses that follow the code - and the first code the nios runs copies it into the required places. 

This just doesn't work unless you are loading into SDRAM (assumed to be big). 

--- Quote End ---  

 

 

 

I will look up the elf file tommorow. The second thning shuld not be a problem because I am loading my application code into a 128 kByte SDRAM.
Altera_Forum
Honored Contributor I
81 Views

Ok its working now I just edited flash_base and flash_end in the make_flash_image_script.sh file and now the calculations for the length are correct. 

 

Thanks for all your help.
Reply