qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Launching Standalone in QEMU-Microblaze
@ 2017-07-03  7:23 Ormaetxea Xabier
  2017-07-03  9:12 ` Edgar E. Iglesias
  0 siblings, 1 reply; 2+ messages in thread
From: Ormaetxea Xabier @ 2017-07-03  7:23 UTC (permalink / raw)
  To: qemu-devel@nongnu.org

Hello!

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)


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


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?

-          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)?

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;
}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] Launching Standalone in QEMU-Microblaze
  2017-07-03  7:23 [Qemu-devel] Launching Standalone in QEMU-Microblaze Ormaetxea Xabier
@ 2017-07-03  9:12 ` Edgar E. Iglesias
  0 siblings, 0 replies; 2+ messages in thread
From: Edgar E. Iglesias @ 2017-07-03  9:12 UTC (permalink / raw)
  To: Ormaetxea Xabier; +Cc: qemu-devel@nongnu.org

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;
> }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-03  9:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-03  7:23 [Qemu-devel] Launching Standalone in QEMU-Microblaze Ormaetxea Xabier
2017-07-03  9:12 ` Edgar E. Iglesias

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).