From patchwork Thu Jun 6 19:30:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Rolnik X-Patchwork-Id: 10980357 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 A0F5E92A for ; Thu, 6 Jun 2019 19:42:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E9B327CF3 for ; Thu, 6 Jun 2019 19:42:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8078E28A01; Thu, 6 Jun 2019 19:42:10 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.47]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EBAA627CF3 for ; Thu, 6 Jun 2019 19:42:09 +0000 (UTC) Received: from localhost ([::1]:57700 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hYyH3-0000Aq-3Y for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Jun 2019 15:42:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59392) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hYy6Z-00081z-6f for qemu-devel@nongnu.org; Thu, 06 Jun 2019 15:31:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYy6U-00024T-Oz for qemu-devel@nongnu.org; Thu, 06 Jun 2019 15:31:17 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:50849) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hYy6S-0000jg-2D for qemu-devel@nongnu.org; Thu, 06 Jun 2019 15:31:13 -0400 Received: by mail-wm1-x341.google.com with SMTP id f204so1078281wme.0 for ; Thu, 06 Jun 2019 12:30:35 -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=PrOPjyYV0TYQYTy+XWhC+bHrUQAqtXXJDRLIlMWJNZU=; b=OFTd23et7WfNLguZWk5G+pY5FGKWF2Y4wpioKgOAUB/gz9j5eQHEqRK+W0dpj1gnsl x04xOtOhwtUAK9ZSzgukh0/CzyVJl1XIQoDVQ4qv6Lz9niXymkVsVpsh7PNSFDz3cYH8 Z2I3lOg8SHYMhLW6+y7WdVpg+MiZ3vyuQSSjq4tZVWULPx9ymCwjzq+duYQMK6efryhw 6Cz+9noy29d1dRwMH0a4iOTIjw/2ax1DbLwhPc0YhmnMPs4SFji/qm8eaX+ELSXdU+Z9 5fv2A6pnsI+4C8GUxFpgHshRK+Uj7HE0LE5ogWuYqtyLirZdKehE5hyPBFdWv4Nt3FqW ILMA== 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=PrOPjyYV0TYQYTy+XWhC+bHrUQAqtXXJDRLIlMWJNZU=; b=T7l7E9wEZpvWju3qy1Uu25qYlQcvRQAOO8gbXnIHPFPRCuMSuX6t5eqhdEFXHRC0Rl Nsb+F+TxX9cX/R8h+3QJgLm6g6YAR+LlU/Db2eAxM4bH8KOuF+PGoH6EQ0HZtQ5ZEyXW urwVwORC6/P1Ieu2Ld43NDCatCqtQIZGxP7P/y1YFnFcJ6FyUTezRD1QjLpAB8fmXkBX CgF7qqiOZSooOtxK7XJeDHHBkiANTDftu2d3OuNsIsAbn1xHPuUREyxlW+7a92tLy8B9 Son1eQw6k+BC/7PdU9BdPNGWlBbVECCJ8zYz4FNo2gyyEYKG/NP+a9aAm0unTRrIbjmj 3lrQ== X-Gm-Message-State: APjAAAXAP4af0K3a4yPzJAyU1/WcXHclfN+iugPX7fSbRyAW0SO1Yqpf zESmsDMIjpNxN360FIT+OxvdeDYc4AKeng== X-Google-Smtp-Source: APXvYqyjGdvuaY84zaAOVtmc5V7wuX4NElkaDYaXEjnofvQJXRk3tvFbAxX1zXoVBGNxtuE51b9ofg== X-Received: by 2002:a1c:f311:: with SMTP id q17mr1054943wmq.2.1559849434152; Thu, 06 Jun 2019 12:30:34 -0700 (PDT) Received: from localhost.localdomain (bzq-79-183-55-157.red.bezeqint.net. [79.183.55.157]) by smtp.gmail.com with ESMTPSA id o126sm2942791wmo.31.2019.06.06.12.30.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Jun 2019 12:30:33 -0700 (PDT) From: Michael Rolnik To: qemu-devel@nongnu.org Date: Thu, 6 Jun 2019 22:30:12 +0300 Message-Id: <20190606193012.37715-8-mrolnik@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190606193012.37715-1-mrolnik@gmail.com> References: <20190606193012.37715-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 v21 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: Sarah Harris , Michael Rolnik , rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sarah Harris Signed-off-by: Michael Rolnik --- MAINTAINERS | 6 ++++++ arch_init.c | 2 ++ configure | 6 ++++++ 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, 62 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 a96829ea83..57fab2cfa9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -162,6 +162,12 @@ S: Maintained F: hw/arm/smmu* F: include/hw/arm/smmu* +AVR +M: Michael Rolnik +S: Odd Fixes +F: target/avr/ +F: hw/avr/ + CRIS M: Edgar E. Iglesias S: Maintained diff --git a/arch_init.c b/arch_init.c index f4f3f610c8..184cdca6dd 100644 --- a/arch_init.c +++ b/arch_init.c @@ -86,6 +86,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 b091b82cb3..6206a52eb9 100755 --- a/configure +++ b/configure @@ -7499,6 +7499,9 @@ case "$target_name" in target_compiler=$cross_cc_aarch64 eval "target_compiler_cflags=\$cross_cc_cflags_${target_name}" ;; + avr) + target_compiler=$cross_cc_avr + ;; cris) target_compiler=$cross_cc_cris ;; @@ -7776,6 +7779,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 9240ec32c2..a7d230ba66 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..53f5018b9c 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: since 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..1034d87525 --- /dev/null +++ b/target/avr/Makefile.objs @@ -0,0 +1,33 @@ +# +# QEMU AVR CPU +# +# Copyright (c) 2016 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 4c6d470798..361927bb76 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" }, { "x86_64", "qemu64,apic-id=0" }, { "i386", "qemu32,apic-id=0" }, { "alpha", "ev67" },