From 3182a1398a02a930396bd0192bda2a9ed3dacd6f Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Wed, 2 Aug 2023 21:42:08 +0000 Subject: [PATCH] target/cortex_m: Add Realtek Real-M200 and M300 These cores are advertised as M23 and M33 compatible, but are identified by the Realtek implementor id. These cores are found on the RTL872xD family, at least. Raw CPUIDs: Real-M200 (KM0): 721cd200 Real-M300 (KM4): 721fd220 Change-Id: I4106ccb7e8c562f98072a71e9e818f57999d664e Signed-off-by: Karl Palsson Reviewed-on: https://review.openocd.org/c/openocd/+/7846 Tested-by: jenkins Reviewed-by: Antonio Borneo --- src/target/arm.h | 1 + src/target/cortex_m.c | 11 +++++++++++ src/target/cortex_m.h | 2 ++ 3 files changed, 14 insertions(+) diff --git a/src/target/arm.h b/src/target/arm.h index f3abd6cba..28e533019 100644 --- a/src/target/arm.h +++ b/src/target/arm.h @@ -61,6 +61,7 @@ enum arm_arch { /** Known ARM implementor IDs */ enum arm_implementor { ARM_IMPLEMENTOR_ARM = 0x41, + ARM_IMPLEMENTOR_REALTEK = 0x72, }; /** diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c index 87a884552..014ceaeba 100644 --- a/src/target/cortex_m.c +++ b/src/target/cortex_m.c @@ -111,6 +111,17 @@ static const struct cortex_m_part_info cortex_m_parts[] = { .arch = ARM_ARCH_V8M, .flags = CORTEX_M_F_HAS_FPV5, }, + { + .impl_part = REALTEK_M200_PARTNO, + .name = "Real-M200 (KM0)", + .arch = ARM_ARCH_V8M, + }, + { + .impl_part = REALTEK_M300_PARTNO, + .name = "Real-M300 (KM4)", + .arch = ARM_ARCH_V8M, + .flags = CORTEX_M_F_HAS_FPV5, + }, }; /* forward declarations */ diff --git a/src/target/cortex_m.h b/src/target/cortex_m.h index 806ff5910..b5d1da7f2 100644 --- a/src/target/cortex_m.h +++ b/src/target/cortex_m.h @@ -56,6 +56,8 @@ enum cortex_m_impl_part { CORTEX_M33_PARTNO = ARM_MAKE_CPUID(ARM_IMPLEMENTOR_ARM, 0xD21), CORTEX_M35P_PARTNO = ARM_MAKE_CPUID(ARM_IMPLEMENTOR_ARM, 0xD31), CORTEX_M55_PARTNO = ARM_MAKE_CPUID(ARM_IMPLEMENTOR_ARM, 0xD22), + REALTEK_M200_PARTNO = ARM_MAKE_CPUID(ARM_IMPLEMENTOR_REALTEK, 0xd20), + REALTEK_M300_PARTNO = ARM_MAKE_CPUID(ARM_IMPLEMENTOR_REALTEK, 0xd22), }; /* Relevant Cortex-M flags, used in struct cortex_m_part_info.flags */