• 0
dnovick

Microblaze Hello World app running main() twice?

Question

I've done quite a bit of work with using the Cortex A9 on the Zeboard, and as such am at home in the tools flow. I also have a Nexys4 DDR, and need a processor for a project I'm working on...so I figured I'd give the Microblaze a whirl. I did the Hello World tutorial that is on the Digilent site...pretty straightforward, except for one strange bit of behavior:

 

When I run my hello world app, main runs twice, both in debug and  release mode. I stepped through the code, and it appears that somewhere in cleanup_platform(), main gets invoked again (recursively). This ends up running init_platform() again, as well as printing my message to the screen twice.

I am going to see if I can track down where in cleanup_platform() this is happening, but was wondering if somebody else has seen this, and can offer an explanation and/or fix?

My design is completely according to the tutorial right now...I haven't added any of my own HW logic or additional SW code yet.

 

UPDATE: I did some further debugging, and it looks like this happens during the call to Xil_ICacheInvalidate() (xil_cache.c). Getting more specific is difficult as it appears to happen some time during the loop in microblaze_invalidate_icache.S line 70. I'm no expert with the MB ISA yet, but can certainly deduce that this is walking each cache line, and I'm assuming, marking them as invalid. 

While doing this debugging, I actually got the processor into a state where this recursive call into main would continue as long as I'd let it, each time, printing out a new message. Very strange.

 

 

Thanks,

Dave

 

Edited by dnovick

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi @dnovick,

Just to verify you are using the getting started with microblaze tutorial for the Nexys 4 DDR here. What version of Vivado are you using? Have you tried redoing the project to make sure that you didn't miss something? Also to clarify, when you run as->run configurations it prints hello world twice? I just did the tutorial in Vivado 2016.4 with no issue that I can see. I have attached screen shots as well as my project.

cheers,

Jon

nexys4DDR_gsmb.zip

Hello_world_nexys_4DDR.jpg

Hello_world_nexys_4DDR_2.jpg

Share this post


Link to post
Share on other sites
  • 0

Thanks for the response.

So, at first I thought it was the same tutorial, but then realized it's actually the one here:

https://reference.digilentinc.com/learn/programmable-logic/tutorials/nexys-4-getting-started-with-microblaze/start

This looks like an error on my part. I mistakenly went to the non-DDR version of the board on the Digilent web site, and clicked through to that tutorial, which is slightly different. While I didn't take the time to do a step by step comparison, it looks like there's quite a bit that's different. My apologies for the goof.

Now that said...after posting my original question and just working around the issue for the rest of the day, I came back to work on things later, only to have the problem no longer manifesting itself...at least for now.

So whether the problem was caused by using the wrong tutorial, or because the SDK debug environment was in a bad state, or a combination of both, I cannot say. For now, I'm just going to go back and use the right version of the tutorial and rule that out as a cause. If the problem shows up again later, I'll revisit the issue.

Dave

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now