qemu-arm
[Top][All Lists]
Advanced

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

Re: Arm Cortex M4 floating point


From: Mircea Cociuba
Subject: Re: Arm Cortex M4 floating point
Date: Tue, 18 Aug 2020 14:02:12 +0000 (UTC)

Yeah well, I am in the middle of the may-or-may-not-work territory, currenlty digging for food.

The best I can do is debug it remotly, and see what happens,here let me show you:

gcc params: -Wall -Werror -O2 -nostdlib -nostartfiles -ffreestanding  -mcpu=cortex-m4 -mhard-float -mfpu=vfpv4-d16 (to make sure I have FPU instructions)

the source code:

void PUT32 ( unsigned int, unsigned int );
#define UART0BASE 0x4000C000

int notmain ( void )
{
    unsigned int rx;
    
    
    unsigned char s[]="QEMU is not that interesting";
   
   //dummy FPU command 
    asm("vmov s15, r3"); // If you are to remove this, the qemu would print after I type the command continue in gdb, with this line, it shows nothing
    
    for(rx=0;rx<sizeof(s);rx++)
    {
        PUT32(UART0BASE+0x00,s[rx]);
    }    
    
    return(0);
}

Qemu starts like this :
qemu-system-arm -S -s -M lm3s811evb -cpu cortex-m4 -m 8K -nographic -kernel notmain.bin

I connect to the debugger 
gdb file notmain.elf

i get this "notmain.elf" is not a core dump: file format not recognized"

but it still works, see comment above for the asm instruction.

Must I manualy tell qemu that the FPU core is active? like set the registers accordingly?

Br, Mircea






Mircea Cociuba
"To be or not to be, that is not a question, it's FF".


On Tuesday, August 18, 2020, 04:28:51 PM GMT+3, Peter Maydell <peter.maydell@linaro.org> wrote:


On Tue, 18 Aug 2020 at 14:17, Mircea Cociuba <cociuba_mircea@yahoo.com> wrote:
>
> Hello, the netduinoplus2 is not part of the machine list in qemu "QEMU emulator version 4.2.0"
> in which one is it?
> in the 4.1.0 version release notes it says "ARM: FPU emulation support for Cortex-M CPUs, FPU fixes for Cortex-R5F"
>
> Now, is there an option to be passed to qemu to get the FPU working?

I think from 4.1.0 we mostly implemented the FPU for the benefit
of the Cortex-M33 model; we enabled it in the M4 but I don't
know if there are any board models that use it. (You can use
the M4 in the linux-user mode also).

You could either use a newer QEMU version, or see if the QEMU
you have supports a Cortex-M33 board and if that would be
suitable for your needs.

That said, I think looking at the code that the stellaris
board will put a Cortex-M4 in the emulated system if you
use -cpu cortex-m4, though if you do this you are wandering
into unsupported may-or-may-not-work territory. You don't
say what actually goes wrong. (In particular, make sure your
guest code actually enables the FPU via the relevant system
registers before trying to execute fp instructions.)


thanks
-- PMM


reply via email to

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