Hi Yannick, Corvin,
On 11/11/25 11:28, Corvin Köhne wrote:
From: YannickV <[email protected]>
This commit introduces a new machine, derived from xilinx-zynq-a9.
While retaining the foundational architecture, unnecessary peripherals
have been removed and the remaining peripherals have been adapted to
match the CX7200's hardware layout and behavior.
Signed-off-by: YannickV <[email protected]>
---
hw/arm/Kconfig | 18 ++
hw/arm/beckhoff_CX7200.c | 443 +++++++++++++++++++++++++++++++++++++++
hw/arm/meson.build | 1 +
3 files changed, 462 insertions(+)
create mode 100644 hw/arm/beckhoff_CX7200.c
+static void beckhoff_cx7200_init(MachineState *machine)
+{
+ CX7200MachineState *cx7200_machine = CX7200_MACHINE(machine);
[...]
+ n = beckhoff_cx7200_init_spi_flashes(0xE0006000, pic[58 - IRQ_OFFSET],
+ false, 0);
+ n = beckhoff_cx7200_init_spi_flashes(0xE0007000, pic[81 - IRQ_OFFSET],
+ false, n);
+ n = beckhoff_cx7200_init_spi_flashes(0xE000D000, pic[51 - IRQ_OFFSET],
+ true, n);
[...]
+ beckhoff_cx7200_binfo.ram_size = machine->ram_size;
+ beckhoff_cx7200_binfo.board_id = 0xd32;
+ beckhoff_cx7200_binfo.loader_start = 0;
+ beckhoff_cx7200_binfo.board_setup_addr = BOARD_SETUP_ADDR;
+ beckhoff_cx7200_binfo.write_board_setup =
beckhoff_cx7200_write_board_setup;
+
+ arm_load_kernel(cx7200_machine->cpu[0], machine, &beckhoff_cx7200_binfo);
+}
+
+static void beckhoff_cx7200_machine_class_init(ObjectClass *oc, void *data)
+{
+ mc->desc = "Beckhoff IPC based on the Xilinx Zynq Platform Baseboard";
+ prop = object_class_property_add_str(oc, "boot-mode", NULL,
+ beckhoff_cx7200_set_boot_mode);
+ object_class_property_set_description(oc, "boot-mode",
+ "Supported boot modes:"
+ " jtag qspi sd nor");
+ object_property_set_default_str(prop, "qspi");
+}
+
+static const TypeInfo beckhoff_cx7200_machine_type = {
+ .name = TYPE_CX7200_MACHINE,
A lot of code is duplicated from hw/arm/xilinx_zynq.c; this does not
sounds right. Can't you have your machine inherit from TYPE_ZYNQ_MACHINE
and expand it in a .instance_init() handler?
If this isn't possible, then we need to refactor hw/arm/xilinx_zynq.c:
- extract TYPE_ZYNQ_SOC from TYPE_ZYNQ_MACHINE
- have TYPE_CX7200_MACHINE use TYPE_ZYNQ_SOC
+ .parent = TYPE_MACHINE,
+ .class_init = beckhoff_cx7200_machine_class_init,
+ .instance_size = sizeof(CX7200MachineState),
+};
Regards,
Phil.