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: 
Adventurer
Adventurer
1,318 Views
Registered: ‎07-25-2018

Microblaze exucution issue

Jump to solution

I have instantiated a microblaze IP in my design. I have brought out the DLMB,ILMB,CLK and Reset as interface ports and I have instantiated the Microblaze RTL in our own custom design. We have our own Instruction and Data memory modules to which ILMB and DLMB are connected respectively. I aslo have a microblaze toolchain in which I compile C code  and generate a .mem file. This file gets loaded into the Instruction memory of Microblaze and once we take Microblaze out of reset we can see Microblaze executing the instructions correctly in VCS simulations.

 

When I synthesize the design and try to execute the same Microblaze code on silicon I don't see the Microblaze executing anything on silicon.

Is there anything I might be missing...like the boot code of microblaze(mostly the toolchain should generate it correctly)

Any idea if the way I use Microblaze is correct(simulations seem to be working correctly) but not sure if it is a good idea to hook up th microblaze to our own instruction memories. Thanks and appreciate your help.

0 Kudos
1 Solution

Accepted Solutions
Adventurer
Adventurer
1,283 Views
Registered: ‎07-25-2018

Re: Microblaze exucution issue

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

View solution in original post

0 Kudos
14 Replies
Moderator
Moderator
1,304 Views
Registered: ‎09-12-2007

Re: Microblaze exucution issue

Jump to solution
Are you associating the elf in vivado, or through the debugger in SDK.


Assuming you have done this correctly, can check if the bram is getting updated? You can read this via XSCT:
connect
targets
What is the status of the microblaze?
Is it running? Or in reset? If it is reset, then check your
Reset polarity. If running, the try command below:

targets X (where x is the microblaze target)
stop
mrd 0x00000000 0x20

This assumes your LMB is at 0x00000000.

Does this match you elf?
0 Kudos
Adventurer
Adventurer
1,297 Views
Registered: ‎07-25-2018

Re: Microblaze exucution issue

Jump to solution

I am not associating any elf file in vivado. The loading of the binary(elf file) which resides on the host is done by the firmware into the instruction memory. After this we take the microblaze out of reset.

 

Is it necessary for the elf file to associate during the synthesis. Wont the above method of loading the binary into the instruction memory via the firmware work for microblaze?

0 Kudos
Moderator
Moderator
1,295 Views
Registered: ‎09-12-2007

Re: Microblaze exucution issue

Jump to solution
You method should be fine too.

Can you check if the beam is getting populated correctly?

The microblaze will start to fetch instruction from the boot vector address set in the microblaze. This is 0x00000000 by default, so make sure this matches the location where you are loading elf to.

Also, what is the status of the microblaze in the xsct
? This will tell use if your reset polarity is correct.

0 Kudos
Adventurer
Adventurer
1,279 Views
Registered: ‎07-25-2018

Re: Microblaze exucution issue

Jump to solution

Thanks much for the response. I actually inserted chipscope and probing the ILMB and DLAM address and data buses. I am able to see the Microblaze getting out of reset and starts fetching instruction using the ILMB address bus. The first mismatch occurs in 672nd clk cycle where the microblaze ILMB address bus has 'h528 on the ILMB addr bus in silicon whereas it has address 'h558 in simulation(simulations are passing perfectly fine).

 

Any idea what can be the potential reason for this mismatch to occur?

0 Kudos
Adventurer
Adventurer
1,258 Views
Registered: ‎07-25-2018

Re: Microblaze exucution issue

Jump to solution

I see that in both silicon and simulation the instruction(opcode) fetched from address 'h528 is exactly the same , but after executing this instruction in simulation microblaze is feteching the next instruction from address 'h558 whereas in silicon it is fetching it from address 'h52c...any reason why it would behave differently in simulation and silicon? Thanks.

0 Kudos
Moderator
Moderator
1,240 Views
Registered: ‎09-12-2007

Re: Microblaze exucution issue

Jump to solution
It is hard to tell how your application should behave based on debugging via HW.

However, at least you know it is executing.

The best way to debug your SW is via the SDK debugger and step through your code to see how it is behaving
0 Kudos
Adventurer
Adventurer
1,186 Views
Registered: ‎07-25-2018

Re: Microblaze exucution issue

Jump to solution

Thanks for the response. Further debugging of the application on silicon using chipscope and Xilinx SDK debugger, I found out that my application is not even entering the main function on the silicon. In simulations I see it jumps to the address of the main function by taking a branch whereas in silicon it doesn't take the branch and never ever enters the main function. The opcodes that appear on the Instruction bus are exactly the same in simulation and silicon but the behavior for those instructions seem to be different.

Have you seen such kind of behavior before? What is your suggestion on how to debug this case?

Thanks and appreciate your help.

0 Kudos
Moderator
Moderator
1,156 Views
Registered: ‎09-12-2007

Re: Microblaze exucution issue

Jump to solution
How are you downloading the elf? Can you do this in the debugger and try step through your code?
0 Kudos
Adventurer
Adventurer
1,150 Views
Registered: ‎07-25-2018

Re: Microblaze exucution issue

Jump to solution

There is a firmware which gets built in petalinux and that's loads the .mem file into the INstruction memory that we hooked up to the microblaze ilmb bus. Once the .mem file gets written into the memory we also read out. The read contents match with the data written.

 

Also any idea if Microblaze requires any include files , right now I juts have a c code which only has a void main function and no headers

0 Kudos
Moderator
Moderator
1,026 Views
Registered: ‎09-12-2007

Re: Microblaze exucution issue

Jump to solution
Ok, I recommend that you debug this in the SDK debugger to validate your sw. You can use the elf just to make sure your application is correct
0 Kudos
Adventurer
Adventurer
1,016 Views
Registered: ‎07-25-2018

Re: Microblaze exucution issue

Jump to solution

My sw is nothing but addition of 2 numbers. Validation of sw is not my concern, the concern is the Microblaze is doing its initialization routines after which it should go the the address of the main function. Instead it returns to address 0x0 and performs its initialization routines again. The branch/jump to main never happens. Are there any switches I can use in my makefile which gets rid of this initialization routines and jumps directly to my main function address?

0 Kudos
Adventurer
Adventurer
1,284 Views
Registered: ‎07-25-2018

Re: Microblaze exucution issue

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

View solution in original post

0 Kudos
964 Views
Registered: ‎08-30-2018

Re: Microblaze exucution issue

Jump to solution

what is the max frequency that microblaze can work on ?

 

0 Kudos
Adventurer
Adventurer
952 Views
Registered: ‎07-25-2018

Re: Microblaze exucution issue

Jump to solution
I am running at about 125Mhz
0 Kudos