qemu/arm: Add definition for the MPS2_AN500 machine.

This commit introduces a new target for the QEMU port called
"MPS2_AN500", an ARMv7-M machine with a Cortex-M7 CPU and
single-/double-precision floating point unit.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit is contained in:
Alessandro Gatti 2025-07-24 15:36:28 +02:00 committed by Damien George
parent 87099b5731
commit 19be404ad8
3 changed files with 22 additions and 0 deletions

View file

@ -59,6 +59,7 @@ Available boards are:
| ----------------- | ------------ | ------------------------ |
| `MICROBIT` | `arm` | `microbit` |
| `MPS2_AN385` | `arm` | `mps2-an385` |
| `MPS2_AN500` | `arm` | `mps2-an500` |
| `NETDUINO2` | `arm` | `netduino2` |
| `SABRELITE` | `arm` | `sabrelite` |
| `VIRT_RV32` | `riscv32` | `virt` |

View file

@ -0,0 +1,15 @@
QEMU_ARCH = arm
QEMU_MACHINE = mps2-an500
CFLAGS += -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16
CFLAGS += -DQEMU_SOC_MPS2
CFLAGS += -DMICROPY_HW_MCU_NAME='"Cortex-M7"'
LDSCRIPT = mcu/arm/mps2.ld
SRC_BOARD_O = shared/runtime/gchelper_native.o shared/runtime/gchelper_thumb2.o
MPY_CROSS_FLAGS += -march=armv7emdp
MICROPY_FLOAT_IMPL = double
SUPPORTS_HARDWARE_FP_DOUBLE = 1

View file

@ -47,6 +47,12 @@ __attribute__((naked)) void Reset_Handler(void) {
for (uint32_t *dest = &_sbss; dest < &_ebss;) {
*dest++ = 0;
}
#if MICROPY_HW_FPU && defined(__ARM_ARCH_ISA_THUMB) && __ARM_ARCH == 7
// initialise the FPU (full access to CP10 and CP11, as per B3.2.20)
*((volatile uint32_t *)0xE000ED88) |= 0x00F00000;
__asm volatile ("dsb");
__asm volatile ("isb");
#endif
// jump to board initialisation
void _start(void);
_start();