hw/rx: Add RX GDB simulator machine
cover hw/rx: Add RX GDB simulator machine
Hi Richard,
This is the RX series I was preparing for merge-request candidate, rebased over the last 3 months with some API updates addressed, from Yoshinori v32:
https://www.mail-archive.com/[email protected]/msg682290.html
Unfortunately we didn't sync with Yoshinori so he diverged and send another reworked series:
https://www.mail-archive.com/[email protected]/msg708102.html
I'm sorry the timing is so bad, but I let other maintainance duties invert priorities, delaying the RX hardware integration.
Changes are noted in [PMD: ...] comments before my S-o-b.
Patches missing review:
#1: target/rx/cpu: Remove unused headers
#9: hw/rx: Register R5F562N7 and R5F562N8 MCUs
Regard,
Phil.
Philippe Mathieu-Daudé (3):
target/rx/cpu: Remove unused headers
hw/rx: Register R5F562N7 and R5F562N8 MCUs
BootLinuxConsoleTest: Test the RX GDB simulator
Richard Henderson (1):
hw/rx: Honor -accel qtest
Yoshinori Sato (8):
MAINTAINERS: Add entry for RX hardware hw/intc: RX62N interrupt controller (ICUa) hw/timer: RX62N 8-Bit timer (TMR)
hw/timer: RX62N compare match timer (CMT) hw/char: RX62N serial communication interface (SCI) hw/rx: RX62N microcontroller (MCU)
hw/rx: Add RX GDB simulator
docs: Document the RX target
docs/system/target-rx.rst | 36 ++ docs/system/targets.rst | 1 + default-configs/rx-softmmu.mak | 1 + include/hw/char/renesas_sci.h | 51 +++ include/hw/intc/rx_icu.h | 76 ++++ include/hw/rx/rx62n.h | 78 +++++ include/hw/timer/renesas_cmt.h | 40 +++ include/hw/timer/renesas_tmr.h | 55 +++ target/rx/cpu.h | 2 - hw/char/renesas_sci.c | 350 +++++++++++++++++++ hw/intc/rx_icu.c | 397 +++++++++++++++++++++ hw/rx/rx-gdbsim.c | 198 +++++++++++ hw/rx/rx62n.c | 328 ++++++++++++++++++ hw/timer/renesas_cmt.c | 283 +++++++++++++++ hw/timer/renesas_tmr.c | 477 ++++++++++++++++++++++++++ MAINTAINERS | 15 + hw/Kconfig | 1 + hw/char/Kconfig | 3 + hw/char/Makefile.objs | 1 + hw/intc/Kconfig | 3 + hw/intc/Makefile.objs | 1 + hw/rx/Kconfig | 10 + hw/rx/Makefile.objs | 2 + hw/timer/Kconfig | 6 + hw/timer/Makefile.objs | 2 + tests/acceptance/machine_rx_gdbsim.py | 68 ++++ 26 files changed, 2483 insertions(+), 2 deletions(-) create mode 100644 docs/system/target-rx.rst create mode 100644 include/hw/char/renesas_sci.h create mode 100644 include/hw/intc/rx_icu.h create mode 100644 include/hw/rx/rx62n.h create mode 100644 include/hw/timer/renesas_cmt.h create mode 100644 include/hw/timer/renesas_tmr.h create mode 100644 hw/char/renesas_sci.c create mode 100644 hw/intc/rx_icu.c create mode 100644 hw/rx/rx-gdbsim.c create mode 100644 hw/rx/rx62n.c create mode 100644 hw/timer/renesas_cmt.c create mode 100644 hw/timer/renesas_tmr.c create mode 100644 hw/rx/Kconfig create mode 100644 hw/rx/Makefile.objs create mode 100644 tests/acceptance/machine_rx_gdbsim.py
Signature · 1 line
2.21.3
PATCH 1/12 target/rx/cpu: Remove unused headers
--- target/rx/cpu.h | 2 -- 1 file changed, 2 deletions(-)
target/rx/cpu.h +0 -2
@@ -19,8 +19,6 @@#ifndef RX_CPU_H #define RX_CPU_H -#include "qemu/bitops.h" -#include "qemu-common.h" #include "hw/registerfields.h" #include "cpu-qom.h"
Signature · 1 line
2.21.3
PATCH 2/12 MAINTAINERS: Add entry for RX hardware
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
Message-Id: <[email protected]>
--- MAINTAINERS | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
MAINTAINERS +15 -0
@@ -1238,6 +1238,21 @@ F: pc-bios/canyonlands.dt[sb] F: pc-bios/u-boot-sam460ex-20100605.bin F: roms/u-boot-sam460ex +RX Machines +----------- +rx-gdbsim +M: Yoshinori Sato <[email protected]> +S: Maintained +F: docs/system/target-rx.rst +F: hw/rx/ +F: hw/intc/rx_icu.c +F: hw/timer/renesas_*.c +F: hw/char/renesas_sci.c +F: include/hw/rx/ +F: include/hw/timer/renesas_*.h +F: include/hw/char/renesas_sci.h +F: tests/acceptance/machine_rx_gdbsim.py + SH4 Machines ------------ R2D
Signature · 1 line
2.21.3
PATCH 3/12 hw/intc: RX62N interrupt controller (ICUa)
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
This implementation supported only ICUa.
Hardware manual.
https://www.renesas.com/us/en/doc/products/mpumcu/doc/rx_family/r01uh0033ej0140_rx62n.pdf
Message-Id: <[email protected]>
--- include/hw/intc/rx_icu.h | 76 ++++++++ hw/intc/rx_icu.c | 397 +++++++++++++++++++++++++++++++++++++++ hw/intc/Kconfig | 3 + hw/intc/Makefile.objs | 1 + 4 files changed, 477 insertions(+) create mode 100644 include/hw/intc/rx_icu.h create mode 100644 hw/intc/rx_icu.c
include/hw/intc/rx_icu.h new file +76 -0
@@ -0,0 +1,76 @@ +/* +* RX Interrupt Control Unit +* +* Copyright (c) 2019 Yoshinori Sato +* +* SPDX-License-Identifier: GPL-2.0-or-later +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2 or later, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef HW_INTC_RX_ICU_H +#define HW_INTC_RX_ICU_H + +#include "hw/sysbus.h" + +enum TRG_MODE { +TRG_LEVEL =0 , +TRG_NEDGE =1 ,/* Falling */ +TRG_PEDGE =2 ,/* Raising */ +TRG_BEDGE =3 ,/* Both */ +}; + +struct IRQSource { +enum TRG_MODE sense; +int level; +}; + +enum { +/* Software interrupt request */ +SWI =27 , +NR_IRQS =256 +}; + +struct RXICUState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +MemoryRegion memory; +struct IRQSource src[NR_IRQS ]; +uint32_t nr_irqs; +uint8_t *map; +uint32_t nr_sense; +uint8_t *init_sense; + +uint8_t ir[NR_IRQS ]; +uint8_t dtcer[NR_IRQS ]; +uint8_t ier[NR_IRQS /8 ]; +uint8_t ipr[142 ]; +uint8_t dmasr[4 ]; +uint16_t fir; +uint8_t nmisr; +uint8_t nmier; +uint8_t nmiclr; +uint8_t nmicr; +int16_t req_irq; +qemu_irq _irq; +qemu_irq _fir; +qemu_irq _swi; +}; +typedef struct RXICUState RXICUState ; + +#define TYPE_RX_ICU "rx-icu" +#define RX_ICU (obj) OBJECT_CHECK(RXICUState, (obj), TYPE_RX_ICU) + +#endif /* RX_ICU_H */
hw/intc/rx_icu.c new file +397 -0
397 lines not on this page · raw message
hw/intc/Kconfig +3 -0
@@ -61,3 +61,6 @@ config S390_FLIC_KVM config OMPIC bool + +config RX_ICU + bool
hw/intc/Makefile.objs +1 -0
@@ -20,6 +20,7 @@ common-obj-$(CONFIG_ARM_GIC) += arm_gicv3_dist.o common-obj-$(CONFIG_ARM_GIC) += arm_gicv3_redist.o common-obj-$(CONFIG_ARM_GIC) += arm_gicv3_its_common.o common-obj-$(CONFIG_OPENPIC) += openpic.o +common-obj-$(CONFIG_RX_ICU) += rx_icu.o common-obj-y += intc.o obj-$(CONFIG_APIC) += apic.o apic_common.o
Signature · 1 line
2.21.3
PATCH 4/12 hw/timer: RX62N 8-Bit timer (TMR)
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
renesas_tmr: 8bit timer modules.
This part use many renesas's CPU.
Hardware manual.
https://www.renesas.com/us/en/doc/products/mpumcu/doc/rx_family/r01uh0033ej0140_rx62n.pdf
Message-Id: <[email protected]>
--- include/hw/timer/renesas_tmr.h | 55 ++++ hw/timer/renesas_tmr.c | 477 +++++++++++++++++++++++++++++++++ hw/timer/Kconfig | 3 + hw/timer/Makefile.objs | 1 + 4 files changed, 536 insertions(+) create mode 100644 include/hw/timer/renesas_tmr.h create mode 100644 hw/timer/renesas_tmr.c
include/hw/timer/renesas_tmr.h new file +55 -0
@@ -0,0 +1,55 @@ +/* +* Renesas 8bit timer Object +* +* Copyright (c) 2018 Yoshinori Sato +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef HW_TIMER_RENESAS_TMR_H +#define HW_TIMER_RENESAS_TMR_H + +#include "qemu/timer.h" +#include "hw/sysbus.h" + +#define TYPE_RENESAS_TMR "renesas-tmr" +#define RTMR (obj) OBJECT_CHECK(RTMRState, (obj), TYPE_RENESAS_TMR) + +enum timer_event { + cmia =0 , + cmib =1 , + ovi =2 , + none =3 , +TMR_NR_EVENTS =4 +}; + +enum { +TMR_CH =2 , +TMR_NR_IRQ =3 *TMR_CH +}; + +typedef struct RTMRState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +uint64_t input_freq; +MemoryRegion memory; + +int64_t tick; +uint8_t tcnt[TMR_CH ]; +uint8_t tcora[TMR_CH ]; +uint8_t tcorb[TMR_CH ]; +uint8_t tcr[TMR_CH ]; +uint8_t tccr[TMR_CH ]; +uint8_t tcor[TMR_CH ]; +uint8_t tcsr[TMR_CH ]; +int64_t div_round[TMR_CH ]; +uint8_t next[TMR_CH ]; +qemu_irq cmia[TMR_CH ]; +qemu_irq cmib[TMR_CH ]; +qemu_irq ovi[TMR_CH ]; +QEMUTimer timer[TMR_CH ]; +}RTMRState ; + +#endif
hw/timer/renesas_tmr.c new file +477 -0
477 lines not on this page · raw message
hw/timer/Kconfig +3 -0
@@ -35,3 +35,6 @@ config CMSDK_APB_TIMER config CMSDK_APB_DUALTIMER bool select PTIMER + +config RENESAS_TMR + bool
hw/timer/Makefile.objs +1 -0
@@ -23,6 +23,7 @@ common-obj-$(CONFIG_OMAP) += omap_gptimer.o common-obj-$(CONFIG_OMAP) += omap_synctimer.o common-obj-$(CONFIG_PXA2XX) += pxa2xx_timer.o common-obj-$(CONFIG_SH4) += sh_timer.o +common-obj-$(CONFIG_RENESAS_TMR) += renesas_tmr.o common-obj-$(CONFIG_DIGIC) += digic-timer.o common-obj-$(CONFIG_MIPS_CPS) += mips_gictimer.o
Signature · 1 line
2.21.3
PATCH 5/12 hw/timer: RX62N compare match timer (CMT)
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
renesas_cmt: 16bit compare match timer modules.
This part use many renesas's CPU.
Hardware manual.
https://www.renesas.com/us/en/doc/products/mpumcu/doc/rx_family/r01uh0033ej0140_rx62n.pdf
Message-Id: <[email protected]>
--- include/hw/timer/renesas_cmt.h | 40 +++++ hw/timer/renesas_cmt.c | 283 +++++++++++++++++++++++++++++++++ hw/timer/Kconfig | 3 + hw/timer/Makefile.objs | 1 + 4 files changed, 327 insertions(+) create mode 100644 include/hw/timer/renesas_cmt.h create mode 100644 hw/timer/renesas_cmt.c
include/hw/timer/renesas_cmt.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* Renesas Compare-match timer Object +* +* Copyright (c) 2019 Yoshinori Sato +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef HW_TIMER_RENESAS_CMT_H +#define HW_TIMER_RENESAS_CMT_H + +#include "qemu/timer.h" +#include "hw/sysbus.h" + +#define TYPE_RENESAS_CMT "renesas-cmt" +#define RCMT (obj) OBJECT_CHECK(RCMTState, (obj), TYPE_RENESAS_CMT) + +enum { +CMT_CH =2 , +CMT_NR_IRQ =1 *CMT_CH +}; + +typedef struct RCMTState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +uint64_t input_freq; +MemoryRegion memory; + +uint16_t cmstr; +uint16_t cmcr[CMT_CH ]; +uint16_t cmcnt[CMT_CH ]; +uint16_t cmcor[CMT_CH ]; +int64_t tick[CMT_CH ]; +qemu_irq cmi[CMT_CH ]; +QEMUTimer timer[CMT_CH ]; +}RCMTState ; + +#endif
hw/timer/renesas_cmt.c new file +283 -0
283 lines not on this page · raw message
hw/timer/Kconfig +3 -0
@@ -38,3 +38,6 @@ config CMSDK_APB_DUALTIMER config RENESAS_TMR bool + +config RENESAS_CMT + bool
hw/timer/Makefile.objs +1 -0
@@ -24,6 +24,7 @@ common-obj-$(CONFIG_OMAP) += omap_synctimer.o common-obj-$(CONFIG_PXA2XX) += pxa2xx_timer.o common-obj-$(CONFIG_SH4) += sh_timer.o common-obj-$(CONFIG_RENESAS_TMR) += renesas_tmr.o +common-obj-$(CONFIG_RENESAS_CMT) += renesas_cmt.o common-obj-$(CONFIG_DIGIC) += digic-timer.o common-obj-$(CONFIG_MIPS_CPS) += mips_gictimer.o
Signature · 1 line
2.21.3
PATCH 6/12 hw/char: RX62N serial communication interface (SCI)
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
This module supported only non FIFO type.
Hardware manual.
https://www.renesas.com/us/en/doc/products/mpumcu/doc/rx_family/r01uh0033ej0140_rx62n.pdf
Message-Id: <[email protected]>
--- include/hw/char/renesas_sci.h | 51 +++++ hw/char/renesas_sci.c | 350 ++++++++++++++++++++++++++++++++++ hw/char/Kconfig | 3 + hw/char/Makefile.objs | 1 + 4 files changed, 405 insertions(+) create mode 100644 include/hw/char/renesas_sci.h create mode 100644 hw/char/renesas_sci.c
include/hw/char/renesas_sci.h new file +51 -0
@@ -0,0 +1,51 @@ +/* +* Renesas Serial Communication Interface +* +* Copyright (c) 2018 Yoshinori Sato +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef HW_CHAR_RENESAS_SCI_H +#define HW_CHAR_RENESAS_SCI_H + +#include "chardev/char-fe.h" +#include "hw/sysbus.h" + +#define TYPE_RENESAS_SCI "renesas-sci" +#define RSCI (obj) OBJECT_CHECK(RSCIState, (obj), TYPE_RENESAS_SCI) + +enum { +ERI =0 , +RXI =1 , +TXI =2 , +TEI =3 , +SCI_NR_IRQ =4 +}; + +typedef struct { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +MemoryRegion memory; +QEMUTimer timer; +CharBackend chr; +qemu_irq irq[SCI_NR_IRQ ]; + +uint8_t smr; +uint8_t brr; +uint8_t scr; +uint8_t tdr; +uint8_t ssr; +uint8_t rdr; +uint8_t scmr; +uint8_t semr; + +uint8_t read_ssr; +int64_t trtime; +int64_t rx_next; +uint64_t input_freq; +}RSCIState ; + +#endif
hw/char/renesas_sci.c new file +350 -0
350 lines not on this page · raw message
hw/char/Kconfig +3 -0
@@ -46,3 +46,6 @@ config SCLPCONSOLE config TERMINAL3270 bool + +config RENESAS_SCI + bool
hw/char/Makefile.objs +1 -0
@@ -20,6 +20,7 @@ common-obj-$(CONFIG_SH4) += sh_serial.o common-obj-$(CONFIG_DIGIC) += digic-uart.o common-obj-$(CONFIG_STM32F2XX_USART) += stm32f2xx_usart.o common-obj-$(CONFIG_RASPI) += bcm2835_aux.o +common-obj-$(CONFIG_RENESAS_SCI) += renesas_sci.o common-obj-$(CONFIG_CMSDK_APB_UART) += cmsdk-apb-uart.o common-obj-$(CONFIG_ETRAXFS) += etraxfs_ser.o
Signature · 1 line
2.21.3
PATCH 7/12 hw/rx: RX62N microcontroller (MCU)
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
rx62n - RX62N cpu.
[PMD: Use TYPE_RX62N_CPU, use #define for RX62N_NR_TMR/CMT/SCI,
renamed CPU -> MCU, device -> microcontroller]
Message-Id: <[email protected]>
--- include/hw/rx/rx62n.h | 75 ++++++++++++ hw/rx/rx62n.c | 264 ++++++++++++++++++++++++++++++++++++++++++ hw/Kconfig | 1 + hw/rx/Kconfig | 6 + hw/rx/Makefile.objs | 1 + 5 files changed, 347 insertions(+) create mode 100644 include/hw/rx/rx62n.h create mode 100644 hw/rx/rx62n.c create mode 100644 hw/rx/Kconfig create mode 100644 hw/rx/Makefile.objs
include/hw/rx/rx62n.h new file +75 -0
@@ -0,0 +1,75 @@ +/* +* RX62N MCU Object +* +* Datasheet: RX62N Group, RX621 Group User's Manual: Hardware +* (Rev.1.40 R01UH0033EJ0140) +* +* Copyright (c) 2019 Yoshinori Sato +* +* SPDX-License-Identifier: GPL-2.0-or-later +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2 or later, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef HW_RX_RX62N_MCU_H +#define HW_RX_RX62N_MCU_H + +#include "target/rx/cpu.h" +#include "hw/intc/rx_icu.h" +#include "hw/timer/renesas_tmr.h" +#include "hw/timer/renesas_cmt.h" +#include "hw/char/renesas_sci.h" +#include "qemu/units.h" + +#define TYPE_RX62N_MCU "rx62n-mcu" +#define RX62N_MCU (obj) OBJECT_CHECK(RX62NState, (obj), TYPE_RX62N_MCU) + +#define RX62N_NR_TMR 2 +#define RX62N_NR_CMT 2 +#define RX62N_NR_SCI 6 + +typedef struct RX62NState { +/*< private >*/ +DeviceState parent_obj; +/*< public >*/ + +RXCPU cpu; +RXICUState icu; +RTMRState tmr[RX62N_NR_TMR ]; +RCMTState cmt[RX62N_NR_CMT ]; +RSCIState sci[RX62N_NR_SCI ]; + +MemoryRegion *sysmem; +bool kernel; + +MemoryRegion iram; +MemoryRegion iomem1; +MemoryRegion d_flash; +MemoryRegion iomem2; +MemoryRegion iomem3; +MemoryRegion c_flash; +qemu_irq irq[NR_IRQS ]; +}RX62NState ; + +/* +* RX62N Internal Memory +* It is the value of R5F562N8. +* Please change the size for R5F562N7. +*/ +#define RX62N_IRAM_SIZE (96 * KiB) +#define RX62N_DFLASH_SIZE (32 * KiB) +#define RX62N_CFLASH_SIZE (512 * KiB) + +#define RX62N_PCLK (48 * 1000 * 1000) + +#endif
hw/rx/rx62n.c new file +264 -0
264 lines not on this page · raw message
hw/Kconfig +1 -0
@@ -55,6 +55,7 @@ source nios2/Kconfig source openrisc/Kconfig source ppc/Kconfig source riscv/Kconfig +source rx/Kconfig source s390x/Kconfig source sh4/Kconfig source sparc/Kconfig
hw/rx/Kconfig new file +6 -0
@@ -0,0 +1,6 @@ +config RX62N_MCU + bool + select RX_ICU + select RENESAS_TMR + select RENESAS_CMT + select RENESAS_SCI
hw/rx/Makefile.objs new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_RX62N_MCU) += rx62n.o
Signature · 1 line
2.21.3
PATCH 8/12 hw/rx: Honor -accel qtest
In reply to Philippe Mathieu-DaudéFrom: Richard Henderson <[email protected]>
Issue an error if no kernel, no bios, and not qtest'ing. Fixes make check-qtest-rx: test/qom-test.
Message-Id: <[email protected]>
--- hw/rx/rx62n.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
hw/rx/rx62n.c +8 -1
@@ -21,12 +21,14 @@#include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/rx/rx62n.h" #include "hw/loader.h" #include "hw/sysbus.h" #include "hw/qdev-properties.h" #include "sysemu/sysemu.h" +#include "sysemu/qtest.h" #include "cpu.h" /*
@@ -217,7 +219,12 @@ static void rx62n_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (s->sysmem,RX62N_CFLASH_BASE , &s->c_flash);if (!s->kernel) { -rom_add_file_fixed (bios_name,RX62N_CFLASH_BASE ,0 ); +if (bios_name) { +rom_add_file_fixed (bios_name,RX62N_CFLASH_BASE ,0 ); + }else if (!qtest_enabled ()) { +error_report ("No bios or kernel specified" ); +exit (1 ); + } }/* Initialize CPU */
Signature · 1 line
2.21.3
PATCH 9/12 hw/rx: Register R5F562N7 and R5F562N8 MCUs
In reply to Philippe Mathieu-DaudéMake the current TYPE_RX62N_MCU an abstract class, and generate TYPE_R5F562N7_MCU and TYPE_R5F562N8_MCU models.
--- include/hw/rx/rx62n.h | 17 +++++---- hw/rx/rx62n.c | 81 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 77 insertions(+), 21 deletions(-)
include/hw/rx/rx62n.h +8 -9
@@ -34,6 +34,9 @@#define TYPE_RX62N_MCU "rx62n-mcu"#define RX62N_MCU (obj) OBJECT_CHECK(RX62NState, (obj), TYPE_RX62N_MCU) +#define TYPE_R5F562N7_MCU "r5f562n7-mcu" +#define TYPE_R5F562N8_MCU "r5f562n8-mcu" +#define RX62N_NR_TMR 2#define RX62N_NR_CMT 2#define RX62N_NR_SCI 6
@@ -59,16 +62,12 @@ typedef struct RX62NState {MemoryRegion iomem3;MemoryRegion c_flash;qemu_irq irq[NR_IRQS ]; -} RX62NState; -/* -* RX62N Internal Memory -* It is the value of R5F562N8. -* Please change the size for R5F562N7. -*/ -#define RX62N_IRAM_SIZE (96 * KiB) -#define RX62N_DFLASH_SIZE (32 * KiB) -#define RX62N_CFLASH_SIZE (512 * KiB) +/* Input Clock (XTAL) frequency */ +uint32_t xtal_freq_hz; +/* Peripheral Module Clock frequency */ +uint32_t pclk_freq_hz; +} RX62NState;#define RX62N_PCLK (48 * 1000 * 1000)
hw/rx/rx62n.c +69 -12
130 lines not on this page · raw message
Signature · 1 line
2.21.3
PATCH 10/12 hw/rx: Add RX GDB simulator
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
Add the RX machine internally simulated in GDB.
[PMD: Use TYPE_RX62N_CPU, use #define for RX62N_NR_TMR/CMT/SCI,
renamed CPU -> MCU, device -> microcontroller]
Message-Id: <[email protected]>
--- default-configs/rx-softmmu.mak | 1 + include/hw/rx/rx62n.h | 4 + hw/rx/rx-gdbsim.c | 198 +++++++++++++++++++++++++++++++++ hw/rx/Kconfig | 4 + hw/rx/Makefile.objs | 1 + 5 files changed, 208 insertions(+) create mode 100644 hw/rx/rx-gdbsim.c
default-configs/rx-softmmu.mak +1 -0
@@ -1,2 +1,3 @@ # Default configuration for rx-softmmu +CONFIG_RX_GDBSIM=y
include/hw/rx/rx62n.h +4 -0
@@ -37,6 +37,10 @@#define TYPE_R5F562N7_MCU "r5f562n7-mcu"#define TYPE_R5F562N8_MCU "r5f562n8-mcu" +#define EXT_CS_BASE 0x01000000 +#define VECTOR_TABLE_BASE 0xffffff80 +#define RX62N_CFLASH_BASE 0xfff80000 +#define RX62N_NR_TMR 2#define RX62N_NR_CMT 2#define RX62N_NR_SCI 6
hw/rx/rx-gdbsim.c new file +198 -0
198 lines not on this page · raw message
hw/rx/Kconfig +4 -0
@@ -4,3 +4,7 @@ config RX62N_MCU select RENESAS_TMR select RENESAS_CMT select RENESAS_SCI + +config RX_GDBSIM + bool + select RX62N_MCU
hw/rx/Makefile.objs +1 -0
@@ -1 +1,2 @@ obj-$(CONFIG_RX62N_MCU) += rx62n.o +obj-$(CONFIG_RX_GDBSIM) += rx-gdbsim.o
Signature · 1 line
2.21.3
PATCH 11/12 BootLinuxConsoleTest: Test the RX GDB simulator
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
Add two tests for the rx-gdbsim machine, based on the recommended test setup from Yoshinori Sato:
https://lists.gnu.org/archive/html/qemu-devel/2019-05/msg03586.html
- U-Boot prompt
- Linux kernel with Sash shell
These are very quick tests:
$ avocado run -t arch:rx tests/acceptance/machine_rx_gdbsim.py JOB ID : 84a6ef01c0b87975ecbfcb31a920afd735753ace JOB LOG : /home/phil/avocado/job-results/job-2019-05-24T05.02-84a6ef0/job.log (1/2) tests/acceptance/machine_rx_gdbsim.py:RxVirtMachine.test_uboot: PASS (0.11 s) (2/2) tests/acceptance/machine_rx_gdbsim.py:RxVirtMachine.test_linux_sash: PASS (0.45 s) RESULTS : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
Tests can also be run with:
$ avocado --show=console run -t arch:rx tests/acceptance/machine_rx_gdbsim.py console: U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty (Feb 05 2019 - 21:56:06 +0900) console: Linux version 4.19.0+ (yo-satoh@yo-satoh-debian) (gcc version 9.0.0 20181105 (experimental) (GCC)) #137 Wed Feb 20 23:20:02 JST 2019 console: Built 1 zonelists, mobility grouping on. Total pages: 8128 ... console: SuperH (H)SCI(F) driver initialized console: 88240.serial: ttySC0 at MMIO 0x88240 (irq = 215, base_baud = 0) is a sci console: console [ttySC0] enabled console: 88248.serial: ttySC1 at MMIO 0x88248 (irq = 219, base_baud = 0) is a sci
Message-Id: <[email protected]>
--- tests/acceptance/machine_rx_gdbsim.py | 68 +++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 tests/acceptance/machine_rx_gdbsim.py
tests/acceptance/machine_rx_gdbsim.py new file +68 -0
@@ -0,0 +1,68 @@ +# Functional test that boots a Linux kernel and checks the console +# +# Copyright (c) 2018 Red Hat, Inc. +# +# Author: +# Cleber Rosa <[email protected]> +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +from avocado_qemu import Test +from avocado_qemu import exec_command_and_wait_for_pattern +from avocado_qemu import wait_for_console_pattern +from avocado.utils import archive + + +class RxGdbSimMachine(Test): + + timeout = 30 + KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' + + def test_uboot(self): + """ + U-Boot and checks that the console is operational. + + :avocado: tags=arch:rx + :avocado: tags=machine:gdbsim-r5f562n8 + :avocado: tags=endian:little + """ + uboot_url = ('https://acc.dl.osdn.jp/users/23/23888/u-boot.bin.gz') + uboot_hash = '9b78dbd43b40b2526848c0b1ce9de02c24f4dcdb' + uboot_path = self.fetch_asset(uboot_url, asset_hash=uboot_hash) + uboot_path = archive.uncompress(uboot_path, self.workdir) + + self.vm.set_console() + self.vm.add_args('-bios', uboot_path, + '-no-reboot') + self.vm.launch() + uboot_version = 'U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty' + wait_for_console_pattern(self, uboot_version) + gcc_version = 'rx-unknown-linux-gcc (GCC) 9.0.0 20181105 (experimental)' + # FIXME limit baudrate on chardev, else we type too fast + #exec_command_and_wait_for_pattern(self, 'version', gcc_version) + + def test_linux_sash(self): + """ + Boots a Linux kernel and checks that the console is operational. + + :avocado: tags=arch:rx + :avocado: tags=machine:gdbsim-r5f562n7 + :avocado: tags=endian:little + """ + dtb_url = ('https://acc.dl.osdn.jp/users/23/23887/rx-qemu.dtb') + dtb_hash = '7b4e4e2c71905da44e86ce47adee2210b026ac18' + dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash) + kernel_url = ('http://acc.dl.osdn.jp/users/23/23845/zImage') + kernel_hash = '39a81067f8d72faad90866ddfefa19165d68fc99' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + + self.vm.set_console() + kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'earlycon' + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-no-reboot') + self.vm.launch() + wait_for_console_pattern(self, 'Sash command shell (version 1.1.1)', + failure_message='Kernel panic - not syncing') + exec_command_and_wait_for_pattern(self, 'printenv', 'TERM=linux')
Signature · 1 line
2.21.3
PATCH 12/12 docs: Document the RX target
In reply to Philippe Mathieu-DaudéFrom: Yoshinori Sato <[email protected]>
Add rx-virt target specification document.
Message-Id: <[email protected]>
--- docs/system/target-rx.rst | 36 ++++++++++++++++++++++++++++++++++++ docs/system/targets.rst | 1 + 2 files changed, 37 insertions(+) create mode 100644 docs/system/target-rx.rst
docs/system/target-rx.rst new file +36 -0
@@ -0,0 +1,36 @@ +.. _RX-System-emulator: + +RX System emulator +-------------------- + +Use the executable ``qemu-system-rx`` to simulate RX target (GDB simulator). +This target emulated following devices. + +- R5F562N8 MCU + + - On-chip memory (ROM 512KB, RAM 96KB) + - Interrupt Control Unit (ICUa) + - 8Bit Timer x 1CH (TMR0,1) + - Compare Match Timer x 2CH (CMT0,1) + - Serial Communication Interface x 1CH (SCI0) + +- External memory 16MByte + +Example of ``qemu-system-rx`` usage for RX is shown below: + +Download ``<u-boot_image_file>`` from +https://osdn.net/users/ysato/pf/qemu/dl/u-boot.bin.gz + +Start emulation of rx-virt:: + qemu-system-rx -M gdbsim-r5f562n8 -bios <u-boot_image_file> + +Download ``kernel_image_file`` from +https://osdn.net/users/ysato/pf/qemu/dl/zImage + +Download ``device_tree_blob`` from +https://osdn.net/users/ysato/pf/qemu/dl/rx-virt.dtb + +Start emulation of rx-virt:: + qemu-system-rx -M gdbsim-r5f562n8 \ + -kernel <kernel_image_file> -dtb <device_tree_blob> \ + -append "earlycon"
docs/system/targets.rst +1 -0
@@ -18,3 +18,4 @@ Contents: target-m68k target-xtensa target-s390x + target-rx
Signature · 1 line
2.21.3