Git Product home page Git Product logo

Comments (7)

GregIthaca avatar GregIthaca commented on June 12, 2024 1

In my case, the binary includes VFP instructions. It was originally built for STM32F405, which happens to be a supported target for core QEMU, so I sort of assumed that all would work OK. After the configurable_machine.c patch below (to a slightly older version, so it doesn't apply directly to the current development branch) it seemed to work for my needs.

499c499
<     if (!strcmp(cpu_type, "cortex-m3")) {
---
>     if (!strcmp(cpu_type, "cortex-m3") || !strcmp(cpu_type, "cortex-m4")) {
508c508,512
<         qdev_prop_set_string(dstate, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m3"));
---
>         if (!strcmp(cpu_type, "cortex-m3")) {
>             qdev_prop_set_string(dstate, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m3"));
>         } else {
>             qdev_prop_set_string(dstate, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m4"));
>         }

from avatar2.

albrecht-flo avatar albrecht-flo commented on June 12, 2024 1

Yes but QEmu would still be able to run those firmwares, as long as it provides a superset implementing all operations present in the firmware.
It is not an exact replication but in most cases it should be sufficient.

from avatar2.

aurelf avatar aurelf commented on June 12, 2024

The error message is indeed lacking clarity, but IIRC the support for M4 isn't complete. Is that correct @mariusmue @rawsample ?

from avatar2.

rawsample avatar rawsample commented on June 12, 2024

Hi,

Indeed the error message is not clear.
If your binary doesn't make usage of cortex-m4 additional features such as FPU, DSP, etc., you should be able to use the cortex-m3 core for emulation.

Simply changing the option to cortex-m4 would not solve the issue because avatar2 python part has no knowledge of it: https://github.com/avatartwo/avatar2/blob/main/avatar2/archs/arm.py

from avatar2.

aurelf avatar aurelf commented on June 12, 2024

I discussed with a student here (Florian) he seem to have a fix for that and will come back here soon about it.

from avatar2.

albrecht-flo avatar albrecht-flo commented on June 12, 2024

On the QEMU side my idea is pretty much what @GregIthaca proposes, QEMU has support for the full cortex-m4 with FPU and DSP.

On the python side a quickfix would be to add this architecture in arm.py:

class ARM_CORTEX_M4(ARM_CORTEX_M3):
    cpu_model = 'cortex-m4'

Although this will NOT transfer the state of the FPU, it will transfer all the other state as the M4 and M3 overlap in most things, just the FPU adds new registers to the M4.
Although, the FPU is an optional feature, we might want to have 2 separate architectures, one with and one without the FPU registers?

from avatar2.

GregIthaca avatar GregIthaca commented on June 12, 2024

Yes, unfortunately it's potentially even more complicated than that, since some core version could theoretically implement only portions of the VFP. But based on the contents of the QEMU cpu->isar.mvfr0 = 0x10110021 (here) QEMU is going to assume that M4=VFPv2.

from avatar2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.