From patchwork Fri Jul 12 05:37:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Rolnik X-Patchwork-Id: 11041503 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3FC4D912 for ; Fri, 12 Jul 2019 05:38:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30281288E5 for ; Fri, 12 Jul 2019 05:38:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 245EB28BAD; Fri, 12 Jul 2019 05:38:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CEAF128B87 for ; Fri, 12 Jul 2019 05:38:34 +0000 (UTC) Received: from localhost ([::1]:46716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hloGP-0001ql-Uf for patchwork-qemu-devel@patchwork.kernel.org; Fri, 12 Jul 2019 01:38:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35107) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hloFM-0005i9-Gt for qemu-devel@nongnu.org; Fri, 12 Jul 2019 01:37:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hloFI-0007kh-PP for qemu-devel@nongnu.org; Fri, 12 Jul 2019 01:37:26 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:52045) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hloFI-0007jr-AP for qemu-devel@nongnu.org; Fri, 12 Jul 2019 01:37:24 -0400 Received: by mail-wm1-x341.google.com with SMTP id 207so7652737wma.1 for ; Thu, 11 Jul 2019 22:37:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UIhsGy04dsjgJibOFfGaAvr1JXdhmdGtxDKJUOCNxfs=; b=NTcKNFZAaWy/7q/z4Iq6KhDxH0It94g0Q2Q82/l2VF+0S7pAAFGb0spyWdj1KNWU/e WcaLqoxr674JDsvIuxAcpHSOLhnvzkRtQBHn2AwNjm8K6LiZTDVx+8ytewFRUJ10cloR OpJxGwkDZm0b1Sssatm5ZpVeP3B9aQ5t3xv8fIL3seskza3YqdC83W5fZ2xxKzw0w6Q5 tl0qmldEUiqI2hRzjXFxEz/Jn17heZP7zkLyFJRwuqJaQoNZbJAbR3UyY/txQ1j134Fr ooYQBblxR0mmj95nT8sn+dgmCqnrTJEhtlcqvpOFiNbAXh8F5rt/RS+GZgaMJvn1CPVL U5qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UIhsGy04dsjgJibOFfGaAvr1JXdhmdGtxDKJUOCNxfs=; b=TO+ytwsifdc/fcgV66zp8Yo28aZHB1vF0HFGe4Jy4mWG5HDEhxxZ7z2yqwG+Trl6yL VEVvIb7mx/buDht0eo35GjSNKISUbo0ZmMOEzUwbPakJ3Ncd2OO8UGzCS2BuY0xUyDG9 0uG0IfrB7G/KSRb0qi3WLq64Vs211B0+SY0vHOFYgNWiLkvJsTYRmxjFc0cCMPWmq1sK KS9EAj3vetvXcisyUs0DjVqfsOwFu8dG6peto2yIR+vblY457mFwiaTCVX4MO+W+9lAz 9R0BWWW1MmmttY/wGmHP+/s6ChUXtGzW4m6j2kte57LwTlJij5uBg4ZkgMUeLs5Zghqj hkCA== X-Gm-Message-State: APjAAAVe3CUhAJiKf8OWpqKs9LNEdc1li/8dc23ccQw9z4wUtfaVKNgU YDMPgvY+YxsvVV10/qqn4tGraPI6HYA= X-Google-Smtp-Source: APXvYqwRy98hNmuDVRpASlV9lrKSM5JeoOttCgbYjrfCHXYvCs47ct+dn5KGS8aQUfnPYXy1Ws4AGw== X-Received: by 2002:a1c:6c14:: with SMTP id h20mr2036459wmc.168.1562909842658; Thu, 11 Jul 2019 22:37:22 -0700 (PDT) Received: from 8c859074c0ff.ant.amazon.com.com (bzq-109-66-61-47.red.bezeqint.net. [109.66.61.47]) by smtp.gmail.com with ESMTPSA id y6sm7824009wmd.16.2019.07.11.22.37.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Jul 2019 22:37:22 -0700 (PDT) From: Michael Rolnik To: qemu-devel@nongnu.org Date: Fri, 12 Jul 2019 08:37:04 +0300 Message-Id: <20190712053704.21228-8-mrolnik@gmail.com> X-Mailer: git-send-email 2.17.2 (Apple Git-113) In-Reply-To: <20190712053704.21228-1-mrolnik@gmail.com> References: <20190712053704.21228-1-mrolnik@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PATCH v26 7/7] target/avr: Register AVR support with the rest of QEMU, the build system, and the MAINTAINERS file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imammedo@redhat.com, Michael Rolnik , richard.henderson@linaro.org, philmd@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Michael Rolnik --- MAINTAINERS | 6 ++++++ arch_init.c | 2 ++ configure | 7 +++++++ default-configs/avr-softmmu.mak | 5 +++++ include/disas/dis-asm.h | 6 ++++++ include/sysemu/arch_init.h | 1 + qapi/common.json | 3 ++- target/avr/Makefile.objs | 33 +++++++++++++++++++++++++++++++++ tests/machine-none-test.c | 1 + 9 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 default-configs/avr-softmmu.mak create mode 100644 target/avr/Makefile.objs diff --git a/MAINTAINERS b/MAINTAINERS index cc9636b43a..934ad5739b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -163,6 +163,12 @@ S: Maintained F: hw/arm/smmu* F: include/hw/arm/smmu* +AVR TCG CPUs +M: Michael Rolnik +S: Maintained +F: target/avr/ +F: hw/avr/ + CRIS TCG CPUs M: Edgar E. Iglesias S: Maintained diff --git a/arch_init.c b/arch_init.c index 74b0708634..413ad7acfd 100644 --- a/arch_init.c +++ b/arch_init.c @@ -85,6 +85,8 @@ int graphic_depth = 32; #define QEMU_ARCH QEMU_ARCH_UNICORE32 #elif defined(TARGET_XTENSA) #define QEMU_ARCH QEMU_ARCH_XTENSA +#elif defined(TARGET_AVR) +#define QEMU_ARCH QEMU_ARCH_AVR #endif const uint32_t arch_type = QEMU_ARCH; diff --git a/configure b/configure index 4983c8b533..ab8ebba100 100755 --- a/configure +++ b/configure @@ -7503,6 +7503,10 @@ case "$target_name" in target_compiler=$cross_cc_aarch64 eval "target_compiler_cflags=\$cross_cc_cflags_${target_name}" ;; + avr) + gdb_xml_files="avr-cpu.xml" + target_compiler=$cross_cc_avr + ;; cris) target_compiler=$cross_cc_cris ;; @@ -7780,6 +7784,9 @@ for i in $ARCH $TARGET_BASE_ARCH ; do disas_config "ARM_A64" fi ;; + avr) + disas_config "AVR" + ;; cris) disas_config "CRIS" ;; diff --git a/default-configs/avr-softmmu.mak b/default-configs/avr-softmmu.mak new file mode 100644 index 0000000000..d1e1c28118 --- /dev/null +++ b/default-configs/avr-softmmu.mak @@ -0,0 +1,5 @@ +# Default configuration for avr-softmmu + +# Boards: +# +CONFIG_AVR_SAMPLE=y diff --git a/include/disas/dis-asm.h b/include/disas/dis-asm.h index e9c7dd8eb4..8bedce17ac 100644 --- a/include/disas/dis-asm.h +++ b/include/disas/dis-asm.h @@ -211,6 +211,12 @@ enum bfd_architecture #define bfd_mach_m32r 0 /* backwards compatibility */ bfd_arch_mn10200, /* Matsushita MN10200 */ bfd_arch_mn10300, /* Matsushita MN10300 */ + bfd_arch_avr, /* Atmel AVR microcontrollers. */ +#define bfd_mach_avr1 1 +#define bfd_mach_avr2 2 +#define bfd_mach_avr3 3 +#define bfd_mach_avr4 4 +#define bfd_mach_avr5 5 bfd_arch_cris, /* Axis CRIS */ #define bfd_mach_cris_v0_v10 255 #define bfd_mach_cris_v32 32 diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h index 10cbafe970..aff57bfe61 100644 --- a/include/sysemu/arch_init.h +++ b/include/sysemu/arch_init.h @@ -25,6 +25,7 @@ enum { QEMU_ARCH_NIOS2 = (1 << 17), QEMU_ARCH_HPPA = (1 << 18), QEMU_ARCH_RISCV = (1 << 19), + QEMU_ARCH_AVR = (1 << 20), }; extern const uint32_t arch_type; diff --git a/qapi/common.json b/qapi/common.json index 99d313ef3b..6866c3e81d 100644 --- a/qapi/common.json +++ b/qapi/common.json @@ -183,11 +183,12 @@ # is true even for "qemu-system-x86_64". # # ppcemb: dropped in 3.1 +# avr: added in 4.1 # # Since: 3.0 ## { 'enum' : 'SysEmuTarget', - 'data' : [ 'aarch64', 'alpha', 'arm', 'cris', 'hppa', 'i386', 'lm32', + 'data' : [ 'aarch64', 'alpha', 'arm', 'avr', 'cris', 'hppa', 'i386', 'lm32', 'm68k', 'microblaze', 'microblazeel', 'mips', 'mips64', 'mips64el', 'mipsel', 'moxie', 'nios2', 'or1k', 'ppc', 'ppc64', 'riscv32', 'riscv64', 's390x', 'sh4', diff --git a/target/avr/Makefile.objs b/target/avr/Makefile.objs new file mode 100644 index 0000000000..2976affd95 --- /dev/null +++ b/target/avr/Makefile.objs @@ -0,0 +1,33 @@ +# +# QEMU AVR CPU +# +# Copyright (c) 2019 Michael Rolnik +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see +# +# + +DECODETREE = $(SRC_PATH)/scripts/decodetree.py +decode-y = $(SRC_PATH)/target/avr/insn.decode + +target/avr/decode_insn.inc.c: $(decode-y) $(DECODETREE) + $(call quiet-command, \ + $(PYTHON) $(DECODETREE) -o $@ --decode decode_insn --insnwidth 16 $<, \ + "GEN", $(TARGET_DIR)$@) + +target/avr/translate.o: target/avr/decode_insn.inc.c + +obj-y += translate.o cpu.o helper.o +obj-y += gdbstub.o +obj-$(CONFIG_SOFTMMU) += machine.o diff --git a/tests/machine-none-test.c b/tests/machine-none-test.c index 5953d31755..3e5c74e73e 100644 --- a/tests/machine-none-test.c +++ b/tests/machine-none-test.c @@ -27,6 +27,7 @@ static struct arch2cpu cpus_map[] = { /* tested targets list */ { "arm", "cortex-a15" }, { "aarch64", "cortex-a57" }, + { "avr", "avr6-avr-cpu" }, { "x86_64", "qemu64,apic-id=0" }, { "i386", "qemu32,apic-id=0" }, { "alpha", "ev67" },