When gdb is being connected to QEmu, it will be attached to the first CPU cluster. However, the ZynqMP board has two clusters, those being of two different architectures. Therefore, when gdb is connecting to the ZynqMP, it receives the target descriptor of the first CPU cluster. Up to now, it was always the APU cluster, which is AARCH64.
When booting on a RPU, gdb will still connect to the APU. If gdb is supporting only ARM32, it will receive the APU target descriptor, resulting in: | (gdb) target remote :1234 | warning: while parsing target description (at line 1): Target | description specified unknown architecture "aarch64" Adjust the cluster-id based on the boot cpu will resolve the above issue; allowing a pure ARM32 toolchain to debug programs running on RPUs. Signed-off-by: Clément Chigot <chi...@adacore.com> --- hw/arm/xlnx-zynqmp.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index be33669f87..f23ace6446 100644 --- a/hw/arm/xlnx-zynqmp.c +++ b/hw/arm/xlnx-zynqmp.c @@ -221,7 +221,13 @@ static void xlnx_zynqmp_create_rpu(MachineState *ms, XlnxZynqMPState *s, object_initialize_child(OBJECT(s), "rpu-cluster", &s->rpu_cluster, TYPE_CPU_CLUSTER); - qdev_prop_set_uint32(DEVICE(&s->rpu_cluster), "cluster-id", 1); + + /* In order to connect gdb to the boot cpu, adjust the cluster-id. */ + if (!strncmp(boot_cpu, "rpu-cpu", 7)) { + qdev_prop_set_uint32(DEVICE(&s->rpu_cluster), "cluster-id", 0); + } else { + qdev_prop_set_uint32(DEVICE(&s->rpu_cluster), "cluster-id", 1); + } for (i = 0; i < num_rpus; i++) { const char *name; @@ -380,7 +386,6 @@ static void xlnx_zynqmp_init(Object *obj) object_initialize_child(obj, "apu-cluster", &s->apu_cluster, TYPE_CPU_CLUSTER); - qdev_prop_set_uint32(DEVICE(&s->apu_cluster), "cluster-id", 0); for (i = 0; i < num_apus; i++) { object_initialize_child(OBJECT(&s->apu_cluster), "apu-cpu[*]", @@ -475,6 +480,13 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) ram_size = memory_region_size(s->ddr_ram); + /* In order to connect gdb to the boot cpu, adjust the cluster-id. */ + if (!strncmp(boot_cpu, "apu-cpu", 7)) { + qdev_prop_set_uint32(DEVICE(&s->apu_cluster), "cluster-id", 0); + } else { + qdev_prop_set_uint32(DEVICE(&s->apu_cluster), "cluster-id", 1); + } + /* * Create the DDR Memory Regions. User friendly checks should happen at * the board level -- 2.34.1