UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor rosh
Visitor
7,037 Views
Registered: ‎06-12-2011

Bootloader Issue - (reference : XAPP482)

Hi guys,

 

I hope someone can please help me out.

 

I have an application, which is too large to fit into BRAM. I'm using a PROM to store the application (Microblaze) and have used a bootloader to download the application and store in SDRAM (using MPMC).

 

I've followed the guidelines given in XAPP482.

 

- converted ELF to MEM.

- added MEM to MCS using the xapp482.exe tool (added syncword)

- read all data after syncword to end of PROM - -> copy to SDRAM_BASEADDRESS

- jump to SDRAM base address after copying is finished.

 

    int (*func_ptr) ();

     func_ptr = PROG_START_ADDR;
    // jump to start execution code at the address PROG_START_ADDR (MPMC BASEADDRESS)
    func_ptr();

 

 

the issue is that after the JUMP, the program resets itself.

 

then i changed the Generate linker settings. I put all sections (of the app that runs from SDRAM) except the boot and vector sections to mpmc_0_C_MPMC_BASEADDRESS. including the stack + heap.

 

Now - after the jump is made - the program stops working.

 

 

I've had a look at the other people having issues with XAPP482, and i've tried all what they have suggested (like putting the interrupt handler, reset, exception handler remapping to the SDRAM App, but nothing seems to work.

 

I'm not sure how to debug and fix this issue (I'm not familiar how to use XMD). Please give me some suggestions.

 

Many Thanks

Rosh

0 Kudos
8 Replies
Explorer
Explorer
7,026 Views
Registered: ‎08-14-2007

Re: Bootloader Issue - (reference : XAPP482)

Are you using caches?  Have you flushed them before the jump?

Martin Thompson
martin.j.thompson@trw.com
http://www.conekt.co.uk/capabilities/electronic-hardware
0 Kudos
Instructor
Instructor
7,021 Views
Registered: ‎08-14-2007

Re: Bootloader Issue - (reference : XAPP482)

Looking at a very similar system where I had a similar problem, I was not clearing the cache.

However in the end my actual problem was with the integrity of the data transferred by the

MPMC directly into the external memory.  In the end I debugged this using a checksum

which was checked by the bootloader.  The bootloader itself was a very small program

that basically waited for the external load to complete (looped on a GPIO line) and then

looped through the DDR2 memory adding up the area that was downloaded.  My bootloader

added a checksum so the overall total should be zero.  Using this method I eventually

found that the data being transferred was occasionally corrupted (when it didn't work,

the checksum also failed).  In my case the problem was not in the MPMC logic but an

external interface where the data was sent from a host processor.

 

If you build your system with the JTAG debugger, you can also use the SDK to view

the external memory after it loads.  That would easily show problems like byte swapping

(a common issue in MicroBlaze projects) but is a bit harder for finding the occasional

bad byte.

 

HTH,

Gabor

-- Gabor
0 Kudos
Visitor bd3lk
Visitor
7,014 Views
Registered: ‎08-17-2011

Re: Bootloader Issue - (reference : XAPP482)

Hi - thanks for your replies.

 

No - MicroBlaze Cache is disabled.

 

thanks Gabor - I'll try to figure out how to build the system with the JTAG - is this by using XMD ??

 

for every byte transfered - I do check the the location of SDRAM written to and verify that the data was written correctly - but like you say it could be a byte swapping (but the method in XAPP482 should take care of this)

 

thanks

Rosh

0 Kudos
Instructor
Instructor
7,012 Views
Registered: ‎08-14-2007

Re: Bootloader Issue - (reference : XAPP482)

My point about checking the memory was that if you use the MicroBlaze to check the memory,

rather than reading it back through the external MPMC port, you will be able to see if there are

byte swap issues.  Also I know that at some point the endianness of the NPI bus was changed

so the newer versions of MPMC do a byte swap between the NPI port and memory.  If XAP482

was designed for an earlier version of MPMC, then there could be a swapping issue.

 

-- Gabor

-- Gabor
0 Kudos
Highlighted
Visitor rosh
Visitor
6,991 Views
Registered: ‎06-12-2011

Re: Bootloader Issue - (reference : XAPP482)

Yes I wasn't abe to figure out why the code hangs - but managed to execute the code from SDRAM by downloading it from XMD - so something better than nothing.

Thanks for all the help.

0 Kudos
Instructor
Instructor
6,976 Views
Registered: ‎08-14-2007

Re: Bootloader Issue - (reference : XAPP482)

A good exercise may be to load the code with XMD and then use the MPMC port to

verify the code in the same manner your original bootloader did.  If there is a byte

swapping issue, you'll see it right away.

 

It may be easy enough to remove the write process from your existing boot loader

to use it just as a boot verifier.

 

-- Gabor

-- Gabor
0 Kudos
Explorer
Explorer
6,362 Views
Registered: ‎02-17-2013

Re: Bootloader Issue - (reference : XAPP482)

Hey 

I search steps in order to realise a bootloader for my spartan 6. I start unfortunately I lost in the informations in the internet. 

When I execute this command I have a leak of memory. 

/home/mayotte/Xilinx/14.4/ISE_DS/ISE/bin/lin64/data2mem -bm system.bmm -bt system.bit -bd boot_esssai.elf output.bit

 

I place an examle of error that I can see in the console this is the latest. Do you have an idea why I have a leak of memory. 

 

INTERNAL_ERROR:Data2MEM:45 - Memory allocation leak of 8 bytes at 0x019B15F8 for 'CharPtrArrayType' data.
Total memory in use at allocation was 7605 bytes.
Source file "StringUtils.c", line number 901.

Memory contents:

019B15F8: 00 00 00 00 00 00 00 00

 

I have spartan 6 and I want programme the flash with a file who contains the  .elf and the .bit. I think  that with the impact 14.4 I load the file output.bit in the cable SPI. Unfortunately the file output.bit did'nt generate. I want know if I must add code in the main.c I download a project in this website of xilinx and in the file testApp.c they add this lines of code. 

I don't understand Do you can help me ? 

#include "xparameters.h"
#include "xbasic_types.h"
#include <xtmrctr_l.h>


#define PROG_START_ADDR 0x80200000
#define DATAREAD 0x0
#define ADDRREAD 0x1

 

 

/*****************************************************************************
* Function name : main (void)
* returns : Void
* Created by : SUS
* Date Created : 04/07/2004
* Description : Reads Platform FLASH device serially 32 time and puts it
* : into 32-bit word. Then it looks for a USERSYNC word.
* : Once a USERSYNC word is found it expects to find a address
* : location. The data is continually read and copied into the
* : memory start at memory location stated after the USERSYNC word.
* : this continues until another USERSYNC word or end of data is
* : detected. If a another USERSYNC word is found then the process
* : of copying data is repeated. A end of data is detected by
* : finding a match to the END_USER_DATA from the 32-bit data.
* :
*****************************************************************************/
int entry (void) {

// Function point that is used at the end of the program to jump to the
// address location stated by PROG_START_ADDR
int (*func_ptr) ();

unsigned int tim, data;

 


print("-- Entering bootloader main() --\n\r");

//to copy the contents from the PROM to the specified memory locations
print("\n\rCopying software contents from the PROM to the specified memory locations\n\r");
promread(ADDRREAD);

print("\n\rCompleted copying software contents\n\r");

//Jumping to address specified by PROG_START_ADDR in bootloader sw project.
//The RUN_FROM_SRAM project is should be setup to start at the PROG_START_ADDR.

// function point that is set to point to the address of PROG_START_ADDR
func_ptr = PROG_START_ADDR;
// jump to start execution code at the address PROG_START_ADDR
func_ptr();

return 0;
}

Best Regards. 

0 Kudos
Explorer
Explorer
6,360 Views
Registered: ‎02-17-2013

Re: Bootloader Issue - (reference : XAPP482)

xapp482.exe for linux 64  bits exists or not ? 

0 Kudos