qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Launching Standalone in QEMU-Microblaze


From: Edgar E. Iglesias
Subject: Re: [Qemu-devel] Launching Standalone in QEMU-Microblaze
Date: Mon, 3 Jul 2017 11:12:00 +0200
User-agent: Mutt/1.5.24 (2015-08-30)

On Mon, Jul 03, 2017 at 07:23:23AM +0000, Ormaetxea Xabier wrote:
> Hello!

Hi!

> 
> I'm trying to run QEMU-Microblaze (Little-endian) with a standalone app in 
> some different ways, but none of them works for me:
> 
> 
> 1)      I have created my own .DTB from my system design (.HDF), just a 
> microblaze connected to the Uartlite AXI, leds, interrupt controller, and a 
> gpio. Using the board support package I've made a simple c-based program (at 
> the end of the message):
> 
> Run it with ./qemu-system-microblazeel -M microblaze-fdt-plnx -dtb 
> system-top.dtb -kernel fibonacci.elf (-s -S)         #(-s -S just to debug it)
> 
> Invalid MicroBlaze version number: (null)           #Don't think it's a 
> problem
> Bar ram offset 9000528f
> Aborted (core dumped)


This indicates that you've linked your standalone app to some RAM you expect
to exist at around 0x90005000, but there's none.
You'll need to check that you are linking your standalone program correctly.
The baremetal BSP needs to match the HW.

> 
> 
> 2)      I use a mb.dtb that I found on the internet. Same c-based program. 
> Run it with the debugger:
> 
> ./qemu-system-microblazeel -M microblaze-fdt-plnx -dtb mb.dtb -kernel 
> fibonacci.elf (-s -S)
> 
> Lets my debug it (doesn't fail booting), but in the first step:
> Bad ram pointer
> 
> I suppose this isn't my option cause the .dtb is created for another 
> microblaze-based design.
> 
> 
> 3)      I use the same design (.HDF), but run it for the Spartan 3a dsp 1800 
> option:
> 
> ./qemu-system-microblazeel -kernel fibonacci.elf (-s -S)
> 
> Runs "properly" -> I mean properly because I can follow on the debugger that 
> the steps are correctly made:
> _start -> _start1 -> main -> fibonacci -> xil_printf -> xil_printf ... -> 
> xil_printf -> _exit
> 
> But doesn't print nothing. And doesn't write in memory as asked (*addrPtr = 
> 0x150) :
> In the qemu shell:
> (qemu) x 0xC0000000
> C0000000: 0x00000000        #When it should be 0x00000150


Try adding the -serial stdio commandline option to QEMU.

> 
> 
> 4)      Modifying my system design to be similar to the Spartan board design:
> MEMORY_BASEADDR 0x90000000
> FLASH_BASEADDR 0xa0000000
> INTC_BASEADDR 0x81800000
> TIMER_BASEADDR 0x83c00000
> UARTLITE_BASEADDR 0x84000000
> ETHLITE_BASEADDR 0x81000000
>                 I get exactly the same result as in the (3) case.
> 
> So here they go my questions:
> 
> -          Am I doing it right? Is this the method of running a standalone 
> program over a microblaze?

Kind of but I get the impression that your bare-metal application is targeting
different hardware than what you are instructing QEMU to create.


> 
> -          How can I make the program print something?
> 
> -          Im not sure if the problem is that it doesn't write on memory, or 
> I am the one who fails reading it from the shell, because if I change the 
> writing position to (0x84000008, uart status position) I get the error (qemu: 
> hardware error: write to UART STATUS?) -> that means im writing (or trying, 
> at least). How can I write on memory (and read after it, so I know it works)?

I didn't quite understand why you wrote to 0xC0000000?
The spartan design in QEMU has nothing at that address.
Try 0x90000000 instead.

Best regards,
Edgar


> 
> Thank you in advance! Really appreciate your Job! (I'm sorry if my problem 
> it's a simple one, I'm new at it)
> 
> #include <stdio.h>
> #include "platform.h"
> #include "xil_printf.h"
> 
> void fibonacci(int d){
>        u32 a=1;
>        u32 b=0;
>        u32 em=0;
>        u32 *addrPtr = 0xC0000000;
> 
> for(int num=0; num<d; num++){
>        for(int i=0; i<a; i++){
>        }
>        for(int c=0; c<b; c++){
>        }
>        em = a+b;
>        xil_printf(em);
>        *addrPtr = 0x150;
>        addrPtr+=1;
>        b=a;
>        a=em;
>        }
> }
> 
> 
> int main()
> {
>     init_platform();
>     int i=35;
>     fibonacci(i);
>     cleanup_platform();
>     return 0;
> }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]