From: Michael Rolnik <mrolnik@gmail.com>
AVR core types are:
- avr1
- avr2
- avr25
- avr3
- avr31
- avr35
- avr4
- avr5
- avr51
- avr6
- avrtiny
- xmega2
- xmega3
- xmega4
- xmega5
- xmega6
- xmega7
Each core type covers multiple AVR MCUs, mentioned in the comments
before definition of particular AVR core type (part of this patch).
AVR core type defines shared features that are valid for all AVR
MCUs belonging in that type.
[AM: Split a larger AVR introduction patch into logical units]
Suggested-by: Aleksandar Markovic <aleksandar.m.mail@gmail.com>
Co-developed-by: Michael Rolnik <mrolnik@gmail.com>
Co-developed-by: Sarah Harris <S.E.Harris@kent.ac.uk>
Signed-off-by: Michael Rolnik <mrolnik@gmail.com>
Signed-off-by: Sarah Harris <S.E.Harris@kent.ac.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Aleksandar Markovic <aleksandar.m.mail@gmail.com>
Acked-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
target/avr/cpu.c | 560 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 560 insertions(+)
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
index f2632a3..aff9eec 100644
--- a/target/avr/cpu.c
+++ b/target/avr/cpu.c
@@ -215,3 +215,563 @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
cc->gdb_num_core_regs = 35;
cc->gdb_core_xml_file = "avr-cpu.xml";
}
+
+/*
+ * Setting features of AVR core type avr1
+ * --------------------------------------
+ *
+ * This type of AVR core is present in the following AVR MCUs:
+ *
+ * at90s1200, attiny11, attiny12, attiny15, attiny28
+ */
+static void avr_avr1_initfn(Object *obj)
+{
+ AVRCPU *cpu = AVR_CPU(obj);
+ CPUAVRState *env = &cpu->env;
+
+ set_avr_feature(env, AVR_FEATURE_LPM);
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
+}
+
+/*
+ * Setting features of AVR core type avr2
+ * --------------------------------------
+ *
+ * This type of AVR core is present in the following AVR MCUs:
+ *
+ * at90s2313, at90s2323, at90s2333, at90s2343, attiny22, attiny26, at90s4414,
+ * at90s4433, at90s4434, at90s8515, at90c8534, at90s8535
+ */
+static void avr_avr2_initfn(Object *obj)
+{
+ AVRCPU *cpu = AVR_CPU(obj);
+ CPUAVRState *env = &cpu->env;
+
+ set_avr_feature(env, AVR_FEATURE_LPM);
+ set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
+ set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
+ set_avr_feature(env, AVR_FEATURE_SRAM);
+ set_avr_feature(env, AVR_FEATURE_BREAK);
+
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
+}
+
+/*
+ * Setting features of AVR core type avr25
+ * --------------------------------------
+ *
+ * This type of AVR core is present in the following AVR MCUs:
+ *
+ * ata5272, ata6616c, attiny13, attiny13a, attiny2313, attiny2313a, attiny24,
+ * attiny24a, attiny4313, attiny44, attiny44a, attiny441, attiny84, attiny84a,
+ * attiny25, attiny45, attiny85, attiny261, attiny261a, attiny461, attiny461a,
+ * attiny861, attiny861a, attiny43u, attiny87, attiny48, attiny88, attiny828,
+ * attiny841, at86rf401
+ */
+static void avr_avr25_initfn(Object *obj)
+{
+ AVRCPU *cpu = AVR_CPU(obj);
+ CPUAVRState *env = &cpu->env;
+
+ set_avr_feature(env, AVR_FEATURE_LPM);
+ set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
+ set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
+ set_avr_feature(env, AVR_FEATURE_SRAM);
+ set_avr_feature(env, AVR_FEATURE_BREAK);
+
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
+ set_avr_feature(env, AVR_FEATURE_LPMX);
+ set_avr_feature(env, AVR_FEATURE_MOVW);
+}
+
+/*
+ * Setting features of AVR core type avr3
+ * --------------------------------------
+ *
+ * This type of AVR core is present in the following AVR MCUs:
+ *
+ * at43usb355, at76c711
+ */
+static void avr_avr3_initfn(Object *obj)
+{
+ AVRCPU *cpu = AVR_CPU(obj);
+ CPUAVRState *env = &cpu->env;
+
+ set_avr_feature(env, AVR_FEATURE_LPM);
+ set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
+ set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
+ set_avr_feature(env, AVR_FEATURE_SRAM);
+ set_avr_feature(env, AVR_FEATURE_BREAK);
+
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
+ set_avr_feature(env, AVR_FEATURE_JMP_CALL);
+}
+
+/*
+ * Setting features of AVR core type avr31
+ * --------------------------------------
+ *
+ * This type of AVR core is present in the following AVR MCUs:
+ *
+ * atmega103, at43usb320
+ */
+static void avr_avr31_initfn(Object *obj)
+{
+ AVRCPU *cpu = AVR_CPU(obj);
+ CPUAVRState *env = &cpu->env;
+
+ set_avr_feature(env, AVR_FEATURE_LPM);
+ set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
+ set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
+ set_avr_feature(env, AVR_FEATURE_SRAM);
+ set_avr_feature(env, AVR_FEATURE_BREAK);
+
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
+ set_avr_feature(env, AVR_FEATURE_RAMPZ);
+ set_avr_feature(env, AVR_FEATURE_ELPM);
+ set_avr_feature(env, AVR_FEATURE_JMP_CALL);
+}
+
+/*
+ * Setting features of AVR core type avr35
+ * --------------------------------------
+ *
+ * This type of AVR core is present in the following AVR MCUs:
+ *
+ * ata5505, ata6617c, ata664251, at90usb82, at90usb162, atmega8u2, atmega16u2,
+ * atmega32u2, attiny167, attiny1634
+ */
+static void avr_avr35_initfn(Object *obj)
+{
+ AVRCPU *cpu = AVR_CPU(obj);
+ CPUAVRState *env = &cpu->env;
+
+ set_avr_feature(env, AVR_FEATURE_LPM);
+ set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
+ set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
+ set_avr_feature(env, AVR_FEATURE_SRAM);
+ set_avr_feature(env, AVR_FEATURE_BREAK);
+
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
+ set_avr_feature(env, AVR_FEATURE_JMP_CALL);
+ set_avr_feature(env, AVR_FEATURE_LPMX);
+ set_avr_feature(env, AVR_FEATURE_MOVW);
+}
+
+/*
+ * Setting features of AVR core type avr4
+ * --------------------------------------
+ *
+ * This type of AVR core is present in the following AVR MCUs:
+ *
+ * ata6285, ata6286, ata6289, ata6612c, atmega8, atmega8a, atmega48, atmega48a,
+ * atmega48p, atmega48pa, atmega48pb, atmega88, atmega88a, atmega88p,
+ * atmega88pa, atmega88pb, atmega8515, atmega8535, atmega8hva, at90pwm1,
+ * at90pwm2, at90pwm2b, at90pwm3, at90pwm3b, at90pwm81
+ */
+static void avr_avr4_initfn(Object *obj)
+{
+ AVRCPU *cpu = AVR_CPU(obj);
+ CPUAVRState *env = &cpu->env;
+
+ set_avr_feature(env, AVR_FEATURE_LPM);
+ set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
+ set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
+ set_avr_feature(env, AVR_FEATURE_SRAM);
+ set_avr_feature(env, AVR_FEATURE_BREAK);
+
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
+ set_avr_feature(env, AVR_FEATURE_LPMX);
+ set_avr_feature(env, AVR_FEATURE_MOVW);
+ set_avr_feature(env, AVR_FEATURE_MUL);
+}
+
+/*
+ * Setting features of AVR core type avr5
+ * --------------------------------------
+ *
+ * This type of AVR core is present in the following AVR MCUs:
+ *
+ * ata5702m322, ata5782, ata5790, ata5790n, ata5791, ata5795, ata5831, ata6613c,
+ * ata6614q, ata8210, ata8510, atmega16, atmega16a, atmega161, atmega162,
+ * atmega163, atmega164a, atmega164p, atmega164pa, atmega165, atmega165a,
+ * atmega165p, atmega165pa, atmega168, atmega168a, atmega168p, atmega168pa,
+ * atmega168pb, atmega169, atmega169a, atmega169p, atmega169pa, atmega16hvb,
+ * atmega16hvbrevb, atmega16m1, atmega16u4, atmega32a, atmega32, atmega323,
+ * atmega324a, atmega324p, atmega324pa, atmega325, atmega325a, atmega325p,
+ * atmega325pa, atmega3250, atmega3250a, atmega3250p, atmega3250pa, atmega328,
+ * atmega328p, atmega328pb, atmega329, atmega329a, atmega329p, atmega329pa,
+ * atmega3290, atmega3290a, atmega3290p, atmega3290pa, atmega32c1, atmega32m1,
+ * atmega32u4, atmega32u6, atmega406, atmega64, atmega64a, atmega640, atmega644,
+ * atmega644a, atmega644p, atmega644pa, atmega645, atmega645a, atmega645p,
+ * atmega6450, atmega6450a, atmega6450p, atmega649, atmega649a, atmega649p,
+ * atmega6490, atmega16hva, atmega16hva2, atmega32hvb, atmega6490a, atmega6490p,
+ * atmega64c1, atmega64m1, atmega64hve, atmega64hve2, atmega64rfr2,
+ * atmega644rfr2, atmega32hvbrevb, at90can32, at90can64, at90pwm161, at90pwm216,
+ * at90pwm316, at90scr100, at90usb646, at90usb647, at94k, m3000
+ */
+static void avr_avr5_initfn(Object *obj)
+{
+ AVRCPU *cpu = AVR_CPU(obj);
+ CPUAVRState *env = &cpu->env;
+
+ set_avr_feature(env, AVR_FEATURE_LPM);
+ set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
+ set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
+ set_avr_feature(env, AVR_FEATURE_SRAM);
+ set_avr_feature(env, AVR_FEATURE_BREAK);
+
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
+ set_avr_feature(env, AVR_FEATURE_JMP_CALL);
+ set_avr_feature(env, AVR_FEATURE_LPMX);
+ set_avr_feature(env, AVR_FEATURE_MOVW);
+ set_avr_feature(env, AVR_FEATURE_MUL);
+}
+
+/*
+ * Setting features of AVR core type avr51
+ * --------------------------------------
+ *
+ * This type of AVR core is present in the following AVR MCUs:
+ *
+ * atmega128, atmega128a, atmega1280, atmega1281, atmega1284, atmega1284p,
+ * atmega128rfa1, atmega128rfr2, atmega1284rfr2, at90can128, at90usb1286,
+ * at90usb1287
+ */
+static void avr_avr51_initfn(Object *obj)
+{
+ AVRCPU *cpu = AVR_CPU(obj);
+ CPUAVRState *env = &cpu->env;
+
+ set_avr_feature(env, AVR_FEATURE_LPM);
+ set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
+ set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
+ set_avr_feature(env, AVR_FEATURE_SRAM);
+ set_avr_feature(env, AVR_FEATURE_BREAK);
+
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
+ set_avr_feature(env, AVR_FEATURE_RAMPZ);
+ set_avr_feature(env, AVR_FEATURE_ELPMX);
+ set_avr_feature(env, AVR_FEATURE_ELPM);
+ set_avr_feature(env, AVR_FEATURE_JMP_CALL);
+ set_avr_feature(env, AVR_FEATURE_LPMX);
+ set_avr_feature(env, AVR_FEATURE_MOVW);
+ set_avr_feature(env, AVR_FEATURE_MUL);
+}
+
+/*
+ * Setting features of AVR core type avr6
+ * --------------------------------------
+ *
+ * This type of AVR core is present in the following AVR MCUs:
+ *
+ * atmega2560, atmega2561, atmega256rfr2, atmega2564rfr2
+ */
+static void avr_avr6_initfn(Object *obj)
+{
+ AVRCPU *cpu = AVR_CPU(obj);
+ CPUAVRState *env = &cpu->env;
+
+ set_avr_feature(env, AVR_FEATURE_LPM);
+ set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
+ set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
+ set_avr_feature(env, AVR_FEATURE_SRAM);
+ set_avr_feature(env, AVR_FEATURE_BREAK);
+
+ set_avr_feature(env, AVR_FEATURE_3_BYTE_PC);
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
+ set_avr_feature(env, AVR_FEATURE_RAMPZ);
+ set_avr_feature(env, AVR_FEATURE_EIJMP_EICALL);
+ set_avr_feature(env, AVR_FEATURE_ELPMX);
+ set_avr_feature(env, AVR_FEATURE_ELPM);
+ set_avr_feature(env, AVR_FEATURE_JMP_CALL);
+ set_avr_feature(env, AVR_FEATURE_LPMX);
+ set_avr_feature(env, AVR_FEATURE_MOVW);
+ set_avr_feature(env, AVR_FEATURE_MUL);
+}
+
+/*
+ * Setting features of AVR core type avrtiny
+ * --------------------------------------
+ *
+ * This type of AVR core is present in the following AVR MCUs:
+ *
+ * attiny4, attiny5, attiny9, attiny10, attiny20, attiny40
+ */
+static void avr_avrtiny_initfn(Object *obj)
+{
+ AVRCPU *cpu = AVR_CPU(obj);
+ CPUAVRState *env = &cpu->env;
+
+ set_avr_feature(env, AVR_FEATURE_LPM);
+ set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
+ set_avr_feature(env, AVR_FEATURE_BREAK);
+
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
+ set_avr_feature(env, AVR_FEATURE_1_BYTE_SP);
+}
+
+/*
+ * Setting features of AVR core type xmega2
+ * --------------------------------------
+ *
+ * This type of AVR core is present in the following AVR MCUs:
+ *
+ * atxmega8e5, atxmega16a4, atxmega16d4, atxmega16e5, atxmega32a4, atxmega32c3,
+ * atxmega32d3, atxmega32d4, atxmega16a4u, atxmega16c4, atxmega32a4u,
+ * atxmega32c4, atxmega32e5
+ */
+static void avr_xmega2_initfn(Object *obj)
+{
+ AVRCPU *cpu = AVR_CPU(obj);
+ CPUAVRState *env = &cpu->env;
+
+ set_avr_feature(env, AVR_FEATURE_LPM);
+ set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
+ set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
+ set_avr_feature(env, AVR_FEATURE_SRAM);
+ set_avr_feature(env, AVR_FEATURE_BREAK);
+
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
+ set_avr_feature(env, AVR_FEATURE_JMP_CALL);
+ set_avr_feature(env, AVR_FEATURE_LPMX);
+ set_avr_feature(env, AVR_FEATURE_MOVW);
+ set_avr_feature(env, AVR_FEATURE_MUL);
+ set_avr_feature(env, AVR_FEATURE_RMW);
+}
+
+/*
+ * Setting features of AVR core type xmega3
+ * --------------------------------------
+ *
+ * This type of AVR core is present in the following AVR MCUs:
+ *
+ * attiny212, attiny214, attiny412, attiny414, attiny416, attiny417, attiny814,
+ * attiny816, attiny817, attiny1614, attiny1616, attiny1617, attiny3214,
+ * attiny3216, attiny3217, atmega808, atmega809, atmega1608, atmega1609,
+ * atmega3208, atmega3209, atmega4808, atmega4809
+ */
+static void avr_xmega3_initfn(Object *obj)
+{
+ AVRCPU *cpu = AVR_CPU(obj);
+ CPUAVRState *env = &cpu->env;
+
+ set_avr_feature(env, AVR_FEATURE_LPM);
+ set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
+ set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
+ set_avr_feature(env, AVR_FEATURE_SRAM);
+ set_avr_feature(env, AVR_FEATURE_BREAK);
+
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
+ set_avr_feature(env, AVR_FEATURE_JMP_CALL);
+ set_avr_feature(env, AVR_FEATURE_LPMX);
+ set_avr_feature(env, AVR_FEATURE_MOVW);
+ set_avr_feature(env, AVR_FEATURE_MUL);
+ set_avr_feature(env, AVR_FEATURE_RMW);
+}
+
+/*
+ * Setting features of AVR core type xmega4
+ * --------------------------------------
+ *
+ * This type of AVR core is present in the following AVR MCUs:
+ *
+ * atxmega64a3, atxmega64d3, atxmega64a3u, atxmega64a4u, atxmega64b1,
+ * atxmega64b3, atxmega64c3, atxmega64d4
+ */
+static void avr_xmega4_initfn(Object *obj)
+{
+ AVRCPU *cpu = AVR_CPU(obj);
+ CPUAVRState *env = &cpu->env;
+
+ set_avr_feature(env, AVR_FEATURE_LPM);
+ set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
+ set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
+ set_avr_feature(env, AVR_FEATURE_SRAM);
+ set_avr_feature(env, AVR_FEATURE_BREAK);
+
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
+ set_avr_feature(env, AVR_FEATURE_ELPMX);
+ set_avr_feature(env, AVR_FEATURE_ELPM);
+ set_avr_feature(env, AVR_FEATURE_JMP_CALL);
+ set_avr_feature(env, AVR_FEATURE_LPMX);
+ set_avr_feature(env, AVR_FEATURE_MOVW);
+ set_avr_feature(env, AVR_FEATURE_MUL);
+ set_avr_feature(env, AVR_FEATURE_RMW);
+}
+
+/*
+ * Setting features of AVR core type xmega5
+ * --------------------------------------
+ *
+ * This type of AVR core is present in the following AVR MCUs:
+ *
+ * atxmega64a1, atxmega64a1u
+ */
+static void avr_xmega5_initfn(Object *obj)
+{
+ AVRCPU *cpu = AVR_CPU(obj);
+ CPUAVRState *env = &cpu->env;
+
+ set_avr_feature(env, AVR_FEATURE_LPM);
+ set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
+ set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
+ set_avr_feature(env, AVR_FEATURE_SRAM);
+ set_avr_feature(env, AVR_FEATURE_BREAK);
+
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
+ set_avr_feature(env, AVR_FEATURE_RAMPD);
+ set_avr_feature(env, AVR_FEATURE_RAMPX);
+ set_avr_feature(env, AVR_FEATURE_RAMPY);
+ set_avr_feature(env, AVR_FEATURE_RAMPZ);
+ set_avr_feature(env, AVR_FEATURE_ELPMX);
+ set_avr_feature(env, AVR_FEATURE_ELPM);
+ set_avr_feature(env, AVR_FEATURE_JMP_CALL);
+ set_avr_feature(env, AVR_FEATURE_LPMX);
+ set_avr_feature(env, AVR_FEATURE_MOVW);
+ set_avr_feature(env, AVR_FEATURE_MUL);
+ set_avr_feature(env, AVR_FEATURE_RMW);
+}
+
+/*
+ * Setting features of AVR core type xmega6
+ * --------------------------------------
+ *
+ * This type of AVR core is present in the following AVR MCUs:
+ *
+ * atxmega128a3, atxmega128d3, atxmega192a3, atxmega192d3, atxmega256a3,
+ * atxmega256a3b, atxmega256a3bu, atxmega256d3, atxmega128a3u, atxmega128b1,
+ * atxmega128b3, atxmega128c3, atxmega128d4, atxmega192a3u, atxmega192c3,
+ * atxmega256a3u, atxmega256c3, atxmega384c3, atxmega384d3
+ */
+static void avr_xmega6_initfn(Object *obj)
+{
+ AVRCPU *cpu = AVR_CPU(obj);
+ CPUAVRState *env = &cpu->env;
+
+ set_avr_feature(env, AVR_FEATURE_LPM);
+ set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
+ set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
+ set_avr_feature(env, AVR_FEATURE_SRAM);
+ set_avr_feature(env, AVR_FEATURE_BREAK);
+
+ set_avr_feature(env, AVR_FEATURE_3_BYTE_PC);
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
+ set_avr_feature(env, AVR_FEATURE_RAMPZ);
+ set_avr_feature(env, AVR_FEATURE_EIJMP_EICALL);
+ set_avr_feature(env, AVR_FEATURE_ELPMX);
+ set_avr_feature(env, AVR_FEATURE_ELPM);
+ set_avr_feature(env, AVR_FEATURE_JMP_CALL);
+ set_avr_feature(env, AVR_FEATURE_LPMX);
+ set_avr_feature(env, AVR_FEATURE_MOVW);
+ set_avr_feature(env, AVR_FEATURE_MUL);
+ set_avr_feature(env, AVR_FEATURE_RMW);
+}
+
+/*
+ * Setting features of AVR core type xmega7
+ * --------------------------------------
+ *
+ * This type of AVR core is present in the following AVR MCUs:
+ *
+ * atxmega128a1, atxmega128a1u, atxmega128a4u
+ */
+static void avr_xmega7_initfn(Object *obj)
+{
+ AVRCPU *cpu = AVR_CPU(obj);
+ CPUAVRState *env = &cpu->env;
+
+ set_avr_feature(env, AVR_FEATURE_LPM);
+ set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
+ set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
+ set_avr_feature(env, AVR_FEATURE_SRAM);
+ set_avr_feature(env, AVR_FEATURE_BREAK);
+
+ set_avr_feature(env, AVR_FEATURE_3_BYTE_PC);
+ set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
+ set_avr_feature(env, AVR_FEATURE_RAMPD);
+ set_avr_feature(env, AVR_FEATURE_RAMPX);
+ set_avr_feature(env, AVR_FEATURE_RAMPY);
+ set_avr_feature(env, AVR_FEATURE_RAMPZ);
+ set_avr_feature(env, AVR_FEATURE_EIJMP_EICALL);
+ set_avr_feature(env, AVR_FEATURE_ELPMX);
+ set_avr_feature(env, AVR_FEATURE_ELPM);
+ set_avr_feature(env, AVR_FEATURE_JMP_CALL);
+ set_avr_feature(env, AVR_FEATURE_LPMX);
+ set_avr_feature(env, AVR_FEATURE_MOVW);
+ set_avr_feature(env, AVR_FEATURE_MUL);
+ set_avr_feature(env, AVR_FEATURE_RMW);
+}
+
+typedef struct AVRCPUInfo {
+ const char *name;
+ void (*initfn)(Object *obj);
+} AVRCPUInfo;
+
+
+static void avr_cpu_list_entry(gpointer data, gpointer user_data)
+{
+ const char *typename = object_class_get_name(OBJECT_CLASS(data));
+
+ qemu_printf("%s\n", typename);
+}
+
+void avr_cpu_list(void)
+{
+ GSList *list;
+ list = object_class_get_list_sorted(TYPE_AVR_CPU, false);
+ g_slist_foreach(list, avr_cpu_list_entry, NULL);
+ g_slist_free(list);
+}
+
+#define DEFINE_AVR_CPU_TYPE(model, initfn) \
+ { \
+ .parent = TYPE_AVR_CPU, \
+ .instance_init = initfn, \
+ .name = AVR_CPU_TYPE_NAME(model), \
+ }
+
+static const TypeInfo avr_cpu_type_info[] = {
+ {
+ .name = TYPE_AVR_CPU,
+ .parent = TYPE_CPU,
+ .instance_size = sizeof(AVRCPU),
+ .instance_init = avr_cpu_initfn,
+ .class_size = sizeof(AVRCPUClass),
+ .class_init = avr_cpu_class_init,
+ .abstract = true,
+ },
+ DEFINE_AVR_CPU_TYPE("avrtiny", avr_avrtiny_initfn),
+ DEFINE_AVR_CPU_TYPE("avr1", avr_avr1_initfn),
+ DEFINE_AVR_CPU_TYPE("avr2", avr_avr2_initfn),
+ DEFINE_AVR_CPU_TYPE("avr25", avr_avr25_initfn),
+ DEFINE_AVR_CPU_TYPE("avr3", avr_avr3_initfn),
+ DEFINE_AVR_CPU_TYPE("avr31", avr_avr31_initfn),
+ DEFINE_AVR_CPU_TYPE("avr35", avr_avr35_initfn),
+ DEFINE_AVR_CPU_TYPE("avr4", avr_avr4_initfn),
+ DEFINE_AVR_CPU_TYPE("avr5", avr_avr5_initfn),
+ DEFINE_AVR_CPU_TYPE("avr51", avr_avr51_initfn),
+ DEFINE_AVR_CPU_TYPE("avr6", avr_avr6_initfn),
+ DEFINE_AVR_CPU_TYPE("xmega2", avr_xmega2_initfn),
+ DEFINE_AVR_CPU_TYPE("xmega3", avr_xmega3_initfn),
+ DEFINE_AVR_CPU_TYPE("xmega4", avr_xmega4_initfn),
+ DEFINE_AVR_CPU_TYPE("xmega5", avr_xmega5_initfn),
+ DEFINE_AVR_CPU_TYPE("xmega6", avr_xmega6_initfn),
+ DEFINE_AVR_CPU_TYPE("xmega7", avr_xmega7_initfn),
+};
+
+
+DEFINE_TYPES(avr_cpu_type_info)
--
2.7.4
These cores have unresolved review comment:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg674105.html
https://www.mail-archive.com/qemu-devel@nongnu.org/msg674259.html
and:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg676046.html
As we don't want a bad start with this architecture, remove them.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Based-on: <1581040680-308-1-git-send-email-aleksandar.markovic@rt-rk.com>
Side note: typo in the subject "definitions"
---
target/avr/cpu.c | 96 ------------------------------------------------
1 file changed, 96 deletions(-)
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
index 8a084c750f..b3d661142d 100644
--- a/target/avr/cpu.c
+++ b/target/avr/cpu.c
@@ -216,77 +216,6 @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
cc->gdb_core_xml_file = "avr-cpu.xml";
}
-/*
- * Setting features of AVR core type avr1
- * --------------------------------------
- *
- * This type of AVR core is present in the following AVR MCUs:
- *
- * at90s1200, attiny11, attiny12, attiny15, attiny28
- */
-static void avr_avr1_initfn(Object *obj)
-{
- AVRCPU *cpu = AVR_CPU(obj);
- CPUAVRState *env = &cpu->env;
-
- set_avr_feature(env, AVR_FEATURE_LPM);
- set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
- set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
-}
-
-/*
- * Setting features of AVR core type avr2
- * --------------------------------------
- *
- * This type of AVR core is present in the following AVR MCUs:
- *
- * at90s2313, at90s2323, at90s2333, at90s2343, attiny22, attiny26, at90s4414,
- * at90s4433, at90s4434, at90s8515, at90c8534, at90s8535
- */
-static void avr_avr2_initfn(Object *obj)
-{
- AVRCPU *cpu = AVR_CPU(obj);
- CPUAVRState *env = &cpu->env;
-
- set_avr_feature(env, AVR_FEATURE_LPM);
- set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
- set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
- set_avr_feature(env, AVR_FEATURE_SRAM);
- set_avr_feature(env, AVR_FEATURE_BREAK);
-
- set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
- set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
-}
-
-/*
- * Setting features of AVR core type avr25
- * --------------------------------------
- *
- * This type of AVR core is present in the following AVR MCUs:
- *
- * ata5272, ata6616c, attiny13, attiny13a, attiny2313, attiny2313a, attiny24,
- * attiny24a, attiny4313, attiny44, attiny44a, attiny441, attiny84, attiny84a,
- * attiny25, attiny45, attiny85, attiny261, attiny261a, attiny461, attiny461a,
- * attiny861, attiny861a, attiny43u, attiny87, attiny48, attiny88, attiny828,
- * attiny841, at86rf401
- */
-static void avr_avr25_initfn(Object *obj)
-{
- AVRCPU *cpu = AVR_CPU(obj);
- CPUAVRState *env = &cpu->env;
-
- set_avr_feature(env, AVR_FEATURE_LPM);
- set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
- set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
- set_avr_feature(env, AVR_FEATURE_SRAM);
- set_avr_feature(env, AVR_FEATURE_BREAK);
-
- set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
- set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
- set_avr_feature(env, AVR_FEATURE_LPMX);
- set_avr_feature(env, AVR_FEATURE_MOVW);
-}
-
/*
* Setting features of AVR core type avr3
* --------------------------------------
@@ -499,27 +428,6 @@ static void avr_avr6_initfn(Object *obj)
set_avr_feature(env, AVR_FEATURE_MUL);
}
-/*
- * Setting features of AVR core type avrtiny
- * --------------------------------------
- *
- * This type of AVR core is present in the following AVR MCUs:
- *
- * attiny4, attiny5, attiny9, attiny10, attiny20, attiny40
- */
-static void avr_avrtiny_initfn(Object *obj)
-{
- AVRCPU *cpu = AVR_CPU(obj);
- CPUAVRState *env = &cpu->env;
-
- set_avr_feature(env, AVR_FEATURE_LPM);
- set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
- set_avr_feature(env, AVR_FEATURE_BREAK);
-
- set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
- set_avr_feature(env, AVR_FEATURE_1_BYTE_SP);
-}
-
/*
* Setting features of AVR core type xmega2
* --------------------------------------
@@ -754,10 +662,6 @@ static const TypeInfo avr_cpu_type_info[] = {
.class_init = avr_cpu_class_init,
.abstract = true,
},
- DEFINE_AVR_CPU_TYPE("avrtiny", avr_avrtiny_initfn),
- DEFINE_AVR_CPU_TYPE("avr1", avr_avr1_initfn),
- DEFINE_AVR_CPU_TYPE("avr2", avr_avr2_initfn),
- DEFINE_AVR_CPU_TYPE("avr25", avr_avr25_initfn),
DEFINE_AVR_CPU_TYPE("avr3", avr_avr3_initfn),
DEFINE_AVR_CPU_TYPE("avr31", avr_avr31_initfn),
DEFINE_AVR_CPU_TYPE("avr35", avr_avr35_initfn),
--
2.21.1
On Friday, February 7, 2020, Philippe Mathieu-Daudé <philmd@redhat.com>
wrote:
> These cores have unresolved review comment:
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg674105.html
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg674259.html
> and:
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg676046.html
>
> As we don't want a bad start with this architecture, remove them.
>
>
I agree with underlying motivation of your fixup.
Still, the division of AVR cores into avr1, avr2, ... , xmega7 is here to
stay. The reason is that because such coding is a part of ELF header, and
this means they will stay forever (as they are approved by some kind of ELF
comitee, and are meant not to be ever changed in future).
Rather than deleting definitions and references of core types we know we
don't support (or, at least, don't fully support), let's think of some less
intrusive way - for example, checking core type of executable given via
CLI, and refusing to emulate, if we know we still have some issues with the
core type in question.
For example, "avrtiny" type is missing handling the fact that it has 16
register instead of 32 registers, like otger AVR core types. But, other
AVRFeatures of "avrtiny" are correctly identified, and it would be a shame
to delete them now and force someone in future to reinvent the wheel. Just
refusing to emulate "avrtiny" seems a better approach to me.
Aleksandar
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Based-on: <1581040680-308-1-git-send-email-aleksandar.markovic@rt-rk.com>
>
> Side note: typo in the subject "definitions"
> ---
> target/avr/cpu.c | 96 ------------------------------------------------
> 1 file changed, 96 deletions(-)
>
> diff --git a/target/avr/cpu.c b/target/avr/cpu.c
> index 8a084c750f..b3d661142d 100644
> --- a/target/avr/cpu.c
> +++ b/target/avr/cpu.c
> @@ -216,77 +216,6 @@ static void avr_cpu_class_init(ObjectClass *oc, void
> *data)
> cc->gdb_core_xml_file = "avr-cpu.xml";
> }
>
> -/*
> - * Setting features of AVR core type avr1
> - * --------------------------------------
> - *
> - * This type of AVR core is present in the following AVR MCUs:
> - *
> - * at90s1200, attiny11, attiny12, attiny15, attiny28
> - */
> -static void avr_avr1_initfn(Object *obj)
> -{
> - AVRCPU *cpu = AVR_CPU(obj);
> - CPUAVRState *env = &cpu->env;
> -
> - set_avr_feature(env, AVR_FEATURE_LPM);
> - set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
> - set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
> -}
> -
> -/*
> - * Setting features of AVR core type avr2
> - * --------------------------------------
> - *
> - * This type of AVR core is present in the following AVR MCUs:
> - *
> - * at90s2313, at90s2323, at90s2333, at90s2343, attiny22, attiny26,
> at90s4414,
> - * at90s4433, at90s4434, at90s8515, at90c8534, at90s8535
> - */
> -static void avr_avr2_initfn(Object *obj)
> -{
> - AVRCPU *cpu = AVR_CPU(obj);
> - CPUAVRState *env = &cpu->env;
> -
> - set_avr_feature(env, AVR_FEATURE_LPM);
> - set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
> - set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
> - set_avr_feature(env, AVR_FEATURE_SRAM);
> - set_avr_feature(env, AVR_FEATURE_BREAK);
> -
> - set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
> - set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
> -}
> -
> -/*
> - * Setting features of AVR core type avr25
> - * --------------------------------------
> - *
> - * This type of AVR core is present in the following AVR MCUs:
> - *
> - * ata5272, ata6616c, attiny13, attiny13a, attiny2313, attiny2313a,
> attiny24,
> - * attiny24a, attiny4313, attiny44, attiny44a, attiny441, attiny84,
> attiny84a,
> - * attiny25, attiny45, attiny85, attiny261, attiny261a, attiny461,
> attiny461a,
> - * attiny861, attiny861a, attiny43u, attiny87, attiny48, attiny88,
> attiny828,
> - * attiny841, at86rf401
> - */
> -static void avr_avr25_initfn(Object *obj)
> -{
> - AVRCPU *cpu = AVR_CPU(obj);
> - CPUAVRState *env = &cpu->env;
> -
> - set_avr_feature(env, AVR_FEATURE_LPM);
> - set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
> - set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
> - set_avr_feature(env, AVR_FEATURE_SRAM);
> - set_avr_feature(env, AVR_FEATURE_BREAK);
> -
> - set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
> - set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
> - set_avr_feature(env, AVR_FEATURE_LPMX);
> - set_avr_feature(env, AVR_FEATURE_MOVW);
> -}
> -
> /*
> * Setting features of AVR core type avr3
> * --------------------------------------
> @@ -499,27 +428,6 @@ static void avr_avr6_initfn(Object *obj)
> set_avr_feature(env, AVR_FEATURE_MUL);
> }
>
> -/*
> - * Setting features of AVR core type avrtiny
> - * --------------------------------------
> - *
> - * This type of AVR core is present in the following AVR MCUs:
> - *
> - * attiny4, attiny5, attiny9, attiny10, attiny20, attiny40
> - */
> -static void avr_avrtiny_initfn(Object *obj)
> -{
> - AVRCPU *cpu = AVR_CPU(obj);
> - CPUAVRState *env = &cpu->env;
> -
> - set_avr_feature(env, AVR_FEATURE_LPM);
> - set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
> - set_avr_feature(env, AVR_FEATURE_BREAK);
> -
> - set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
> - set_avr_feature(env, AVR_FEATURE_1_BYTE_SP);
> -}
> -
> /*
> * Setting features of AVR core type xmega2
> * --------------------------------------
> @@ -754,10 +662,6 @@ static const TypeInfo avr_cpu_type_info[] = {
> .class_init = avr_cpu_class_init,
> .abstract = true,
> },
> - DEFINE_AVR_CPU_TYPE("avrtiny", avr_avrtiny_initfn),
> - DEFINE_AVR_CPU_TYPE("avr1", avr_avr1_initfn),
> - DEFINE_AVR_CPU_TYPE("avr2", avr_avr2_initfn),
> - DEFINE_AVR_CPU_TYPE("avr25", avr_avr25_initfn),
> DEFINE_AVR_CPU_TYPE("avr3", avr_avr3_initfn),
> DEFINE_AVR_CPU_TYPE("avr31", avr_avr31_initfn),
> DEFINE_AVR_CPU_TYPE("avr35", avr_avr35_initfn),
> --
> 2.21.1
>
>
Hi Aleksandar,
On 2/8/20 8:10 AM, Aleksandar Markovic wrote:
> On Friday, February 7, 2020, Philippe Mathieu-Daudé <philmd@redhat.com
> <mailto:philmd@redhat.com>> wrote:
>
> These cores have unresolved review comment:
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg674105.html
> <https://www.mail-archive.com/qemu-devel@nongnu.org/msg674105.html>
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg674259.html
> <https://www.mail-archive.com/qemu-devel@nongnu.org/msg674259.html>
> and:
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg676046.html
> <https://www.mail-archive.com/qemu-devel@nongnu.org/msg676046.html>
>
> As we don't want a bad start with this architecture, remove them.
>
>
> I agree with underlying motivation of your fixup.
>
> Still, the division of AVR cores into avr1, avr2, ... , xmega7 is here
> to stay. The reason is that because such coding is a part of ELF header,
> and this means they will stay forever (as they are approved by some kind
> of ELF comitee, and are meant not to be ever changed in future).
I am not removing anything ELF related. We don't have any machine using
CPU avrtiny/avr1/avr2/avr25 so AFAIK I'm simply removing unreviewed dead
code.
> Rather than deleting definitions and references of core types we know we
> don't support (or, at least, don't fully support), let's think of some
> less intrusive way - for example, checking core type of executable given
> via CLI, and refusing to emulate, if we know we still have some issues
> with the core type in question.
>
> For example, "avrtiny" type is missing handling the fact that it has 16
> register instead of 32 registers, like otger AVR core types. But, other
> AVRFeatures of "avrtiny" are correctly identified, and it would be a
> shame to delete them now and force someone in future to reinvent the
> wheel. Just refusing to emulate "avrtiny" seems a better approach to me.
It is hard to follow you, this port is contributed by hobbyist and you
appeared lately in the review process and asked to raised the quality to
a professional level. Now professionals are taking extra care to review
little details as the CPU features implemented by each core, and you are
saying we shouldn't delete incorrect code?
I am not saying we will never accept these cores, I'm proposing to start
with reviewed cores, so we don't delay the merge if this port. There are
already a lot of cores to use:
DEFINE_AVR_CPU_TYPE("avr3", avr_avr3_initfn),
DEFINE_AVR_CPU_TYPE("avr31", avr_avr31_initfn),
DEFINE_AVR_CPU_TYPE("avr35", avr_avr35_initfn),
DEFINE_AVR_CPU_TYPE("avr4", avr_avr4_initfn),
DEFINE_AVR_CPU_TYPE("avr5", avr_avr5_initfn),
DEFINE_AVR_CPU_TYPE("avr51", avr_avr51_initfn),
DEFINE_AVR_CPU_TYPE("avr6", avr_avr6_initfn),
DEFINE_AVR_CPU_TYPE("xmega2", avr_xmega2_initfn),
DEFINE_AVR_CPU_TYPE("xmega3", avr_xmega3_initfn),
DEFINE_AVR_CPU_TYPE("xmega4", avr_xmega4_initfn),
DEFINE_AVR_CPU_TYPE("xmega5", avr_xmega5_initfn),
DEFINE_AVR_CPU_TYPE("xmega6", avr_xmega6_initfn),
DEFINE_AVR_CPU_TYPE("xmega7", avr_xmega7_initfn),
Then it will be less stressful to correct/review/add the avr1/2/tiny
cores. This seems simpler than keep respining 30 patches during the next
6 months. I don't want the community to get tired and loose interest in
this port, we already spent a fair amount of time to get it merged.
Regards,
Phil.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com
> <mailto:philmd@redhat.com>>
> ---
> Based-on:
> <1581040680-308-1-git-send-email-aleksandar.markovic@rt-rk.com
> <mailto:1581040680-308-1-git-send-email-aleksandar.markovic@rt-rk.com>>
>
> Side note: typo in the subject "definitions"
> ---
> target/avr/cpu.c | 96 ------------------------------------------------
> 1 file changed, 96 deletions(-)
>
> diff --git a/target/avr/cpu.c b/target/avr/cpu.c
> index 8a084c750f..b3d661142d 100644
> --- a/target/avr/cpu.c
> +++ b/target/avr/cpu.c
> @@ -216,77 +216,6 @@ static void avr_cpu_class_init(ObjectClass *oc,
> void *data)
> cc->gdb_core_xml_file = "avr-cpu.xml";
> }
>
> -/*
> - * Setting features of AVR core type avr1
> - * --------------------------------------
> - *
> - * This type of AVR core is present in the following AVR MCUs:
> - *
> - * at90s1200, attiny11, attiny12, attiny15, attiny28
> - */
> -static void avr_avr1_initfn(Object *obj)
> -{
> - AVRCPU *cpu = AVR_CPU(obj);
> - CPUAVRState *env = &cpu->env;
> -
> - set_avr_feature(env, AVR_FEATURE_LPM);
> - set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
> - set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
> -}
> -
> -/*
> - * Setting features of AVR core type avr2
> - * --------------------------------------
> - *
> - * This type of AVR core is present in the following AVR MCUs:
> - *
> - * at90s2313, at90s2323, at90s2333, at90s2343, attiny22, attiny26,
> at90s4414,
> - * at90s4433, at90s4434, at90s8515, at90c8534, at90s8535
> - */
> -static void avr_avr2_initfn(Object *obj)
> -{
> - AVRCPU *cpu = AVR_CPU(obj);
> - CPUAVRState *env = &cpu->env;
> -
> - set_avr_feature(env, AVR_FEATURE_LPM);
> - set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
> - set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
> - set_avr_feature(env, AVR_FEATURE_SRAM);
> - set_avr_feature(env, AVR_FEATURE_BREAK);
> -
> - set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
> - set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
> -}
> -
> -/*
> - * Setting features of AVR core type avr25
> - * --------------------------------------
> - *
> - * This type of AVR core is present in the following AVR MCUs:
> - *
> - * ata5272, ata6616c, attiny13, attiny13a, attiny2313, attiny2313a,
> attiny24,
> - * attiny24a, attiny4313, attiny44, attiny44a, attiny441, attiny84,
> attiny84a,
> - * attiny25, attiny45, attiny85, attiny261, attiny261a, attiny461,
> attiny461a,
> - * attiny861, attiny861a, attiny43u, attiny87, attiny48, attiny88,
> attiny828,
> - * attiny841, at86rf401
> - */
> -static void avr_avr25_initfn(Object *obj)
> -{
> - AVRCPU *cpu = AVR_CPU(obj);
> - CPUAVRState *env = &cpu->env;
> -
> - set_avr_feature(env, AVR_FEATURE_LPM);
> - set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
> - set_avr_feature(env, AVR_FEATURE_ADIW_SBIW);
> - set_avr_feature(env, AVR_FEATURE_SRAM);
> - set_avr_feature(env, AVR_FEATURE_BREAK);
> -
> - set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
> - set_avr_feature(env, AVR_FEATURE_2_BYTE_SP);
> - set_avr_feature(env, AVR_FEATURE_LPMX);
> - set_avr_feature(env, AVR_FEATURE_MOVW);
> -}
> -
> /*
> * Setting features of AVR core type avr3
> * --------------------------------------
> @@ -499,27 +428,6 @@ static void avr_avr6_initfn(Object *obj)
> set_avr_feature(env, AVR_FEATURE_MUL);
> }
>
> -/*
> - * Setting features of AVR core type avrtiny
> - * --------------------------------------
> - *
> - * This type of AVR core is present in the following AVR MCUs:
> - *
> - * attiny4, attiny5, attiny9, attiny10, attiny20, attiny40
> - */
> -static void avr_avrtiny_initfn(Object *obj)
> -{
> - AVRCPU *cpu = AVR_CPU(obj);
> - CPUAVRState *env = &cpu->env;
> -
> - set_avr_feature(env, AVR_FEATURE_LPM);
> - set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
> - set_avr_feature(env, AVR_FEATURE_BREAK);
> -
> - set_avr_feature(env, AVR_FEATURE_2_BYTE_PC);
> - set_avr_feature(env, AVR_FEATURE_1_BYTE_SP);
> -}
> -
> /*
> * Setting features of AVR core type xmega2
> * --------------------------------------
> @@ -754,10 +662,6 @@ static const TypeInfo avr_cpu_type_info[] = {
> .class_init = avr_cpu_class_init,
> .abstract = true,
> },
> - DEFINE_AVR_CPU_TYPE("avrtiny", avr_avrtiny_initfn),
> - DEFINE_AVR_CPU_TYPE("avr1", avr_avr1_initfn),
> - DEFINE_AVR_CPU_TYPE("avr2", avr_avr2_initfn),
> - DEFINE_AVR_CPU_TYPE("avr25", avr_avr25_initfn),
> DEFINE_AVR_CPU_TYPE("avr3", avr_avr3_initfn),
> DEFINE_AVR_CPU_TYPE("avr31", avr_avr31_initfn),
> DEFINE_AVR_CPU_TYPE("avr35", avr_avr35_initfn),
> --
> 2.21.1
>
On Sat, Feb 8, 2020 at 3:06 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote: > > Hi Aleksandar, > > On 2/8/20 8:10 AM, Aleksandar Markovic wrote: > > On Friday, February 7, 2020, Philippe Mathieu-Daudé <philmd@redhat.com > > <mailto:philmd@redhat.com>> wrote: > > > > These cores have unresolved review comment: > > https://www.mail-archive.com/qemu-devel@nongnu.org/msg674105.html > > <https://www.mail-archive.com/qemu-devel@nongnu.org/msg674105.html> > > https://www.mail-archive.com/qemu-devel@nongnu.org/msg674259.html > > <https://www.mail-archive.com/qemu-devel@nongnu.org/msg674259.html> > > and: > > https://www.mail-archive.com/qemu-devel@nongnu.org/msg676046.html > > <https://www.mail-archive.com/qemu-devel@nongnu.org/msg676046.html> > > > > As we don't want a bad start with this architecture, remove them. > > > > > > I agree with underlying motivation of your fixup. > > > > Still, the division of AVR cores into avr1, avr2, ... , xmega7 is here > > to stay. The reason is that because such coding is a part of ELF header, > > and this means they will stay forever (as they are approved by some kind > > of ELF comitee, and are meant not to be ever changed in future). > > I am not removing anything ELF related. We don't have any machine using > CPU avrtiny/avr1/avr2/avr25 so AFAIK I'm simply removing unreviewed dead > code. > The portion of the code that classifies AVR cores is and should remain as independent as possible of the machine-related code. In other words, my point is that your fixup is inadequate. We should not touch the portion of the code that enumarates AVR core types, except to add some TODO notes as noted during review. If one wants to remove "dead" code as defined by you, one should leave just two AVR core types and also eliminate at least half of "AVRFeatures", which is absurd. There is much less intrusive solution to this, that will also provide guarantee that we never emulate the code that we know has some issues, or support for it is not completed yet. You should read more carefully previous reviews, and you'll see that Michael and I agreed that support for "avrtiny" cores will be provided in some point in future, but this doesn't mean we should delete that AVR type from the current code. I hope I am clear enough to you now. :) Regards, Aleksandar
© 2016 - 2025 Red Hat, Inc.