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: 
Highlighted
Adventurer
Adventurer
409 Views
Registered: ‎07-25-2018

Microblaze not going into main function

Jump to solution

I have a simple C code which performs addition of 2 numbers. I am using mb-gcc utilitu to generate the elf file and then the data2mem utility to generate the .mem file. I have a firmware which loads the .mem file into the instruction memory of microblaze and then takes the microblaze out of reset. I see that microblaze begins executing and start fetching instructions by adding chipscope on ILMB bus. The problem is it never goes into the main function. Below is my C code .

int main()

{ int i=1,j=2,k;

  k=i+j;

 return 0;

}

What can be the potential causes of this problem. The same .mem file passes in simulation and microblaze jumps to the address of the main function in a VCS simulation but in silicon it just loops back to address 0x0 and starts exeucting its initialization routines again.
Please note I posted it in another forum but again posting this here because I suspect it might be some toolchain issue.

0 Kudos
1 Solution

Accepted Solutions
Adventurer
Adventurer
374 Views
Registered: ‎07-25-2018

Re: Microblaze not going into main function

Jump to solution

OK finally solved this problem. Found out the micorblaze was not returning correctly from the unnecessary constructor code.

Forced microblaze to not execute the constructor code by hacing the binary file and now everything works fine.

Basically I guess this is a toolchain related bug which unnecessarily inserts the constructor code in .c files which is not required

0 Kudos
1 Reply
Adventurer
Adventurer
375 Views
Registered: ‎07-25-2018

Re: Microblaze not going into main function

Jump to solution

OK finally solved this problem. Found out the micorblaze was not returning correctly from the unnecessary constructor code.

Forced microblaze to not execute the constructor code by hacing the binary file and now everything works fine.

Basically I guess this is a toolchain related bug which unnecessarily inserts the constructor code in .c files which is not required

0 Kudos