Skip to content

Commit 19be404

Browse files
agattidpgeorge
authored andcommitted
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>
1 parent 87099b5 commit 19be404

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

ports/qemu/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Available boards are:
5959
| ----------------- | ------------ | ------------------------ |
6060
| `MICROBIT` | `arm` | `microbit` |
6161
| `MPS2_AN385` | `arm` | `mps2-an385` |
62+
| `MPS2_AN500` | `arm` | `mps2-an500` |
6263
| `NETDUINO2` | `arm` | `netduino2` |
6364
| `SABRELITE` | `arm` | `sabrelite` |
6465
| `VIRT_RV32` | `riscv32` | `virt` |
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
QEMU_ARCH = arm
2+
QEMU_MACHINE = mps2-an500
3+
4+
CFLAGS += -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16
5+
CFLAGS += -DQEMU_SOC_MPS2
6+
CFLAGS += -DMICROPY_HW_MCU_NAME='"Cortex-M7"'
7+
8+
LDSCRIPT = mcu/arm/mps2.ld
9+
10+
SRC_BOARD_O = shared/runtime/gchelper_native.o shared/runtime/gchelper_thumb2.o
11+
12+
MPY_CROSS_FLAGS += -march=armv7emdp
13+
14+
MICROPY_FLOAT_IMPL = double
15+
SUPPORTS_HARDWARE_FP_DOUBLE = 1

ports/qemu/mcu/arm/startup.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ __attribute__((naked)) void Reset_Handler(void) {
4747
for (uint32_t *dest = &_sbss; dest < &_ebss;) {
4848
*dest++ = 0;
4949
}
50+
#if MICROPY_HW_FPU && defined(__ARM_ARCH_ISA_THUMB) && __ARM_ARCH == 7
51+
// initialise the FPU (full access to CP10 and CP11, as per B3.2.20)
52+
*((volatile uint32_t *)0xE000ED88) |= 0x00F00000;
53+
__asm volatile ("dsb");
54+
__asm volatile ("isb");
55+
#endif
5056
// jump to board initialisation
5157
void _start(void);
5258
_start();

0 commit comments

Comments
 (0)