From nobody Mon Feb 9 20:46:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153442953646264.24465103759906; Thu, 16 Aug 2018 07:25:36 -0700 (PDT) Received: from localhost ([::1]:56013 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqJDP-00024r-2X for importer@patchew.org; Thu, 16 Aug 2018 10:25:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqJ25-0006j5-QF for qemu-devel@nongnu.org; Thu, 16 Aug 2018 10:13:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqJ22-0004Xz-66 for qemu-devel@nongnu.org; Thu, 16 Aug 2018 10:13:49 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:39487) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fqJ21-0004XO-W9; Thu, 16 Aug 2018 10:13:46 -0400 Received: by mail-pf1-x442.google.com with SMTP id j8-v6so2089779pff.6; Thu, 16 Aug 2018 07:13:45 -0700 (PDT) Received: from aurora.jms.id.au ([45.124.203.18]) by smtp.gmail.com with ESMTPSA id x1-v6sm24117637pgr.59.2018.08.16.07.13.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Aug 2018 07:13:44 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Thu, 16 Aug 2018 23:43:37 +0930 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=BEuLX0ahye47Gf5X2qlGa21bUMaQV4A951E5uD+yS84=; b=PLnETtpgP3CvBROKNAQGtkO5druacSEEwl/lRcd3AERFhtVtRHQlLIZndnBMfAMWzG QhzOljl7a0lMzq17fgA5uHRZz+9miRIZXNfSWe3TPoOwceYpP0rGKg2Jjm0TPonoe7mx U6Zj2QT8sTrxC1kRJBwuzM+Qr+RtDPFQ7SXDMN7OPO4HPqS7ukxDoh0i8MOzhuV77Yqx +fhxjK71naxVUwywLsUROQ1U7sYJaR6t2Sb4IJlKVocOvmgbGcHxCWjwryMMw00iCHnT tA/vKd2jQwFOaJaAoMPgo1hyCwGRg/WJndJg7/QetyD+eTWonyVS82TbE6+VbKODbe7i u2iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=BEuLX0ahye47Gf5X2qlGa21bUMaQV4A951E5uD+yS84=; b=BmY+cf2BetvjA62wWNsTfZyjROKPKq93lWaICEuESbX+v+rjim22UrDNc1+C4Bkip9 LiI3KgeX3k4CFQCqID9LMg0I8U6ZRWnfkHIP2VORAmSsj/f4sCOb75WPKPiE9usHF6p5 zn4Siaq7px4Jq5k3uxg/BYHBYeIMf2w/4HiorR+3dQ0ZTYLuKQEHPrGWD70UYUrgw01i 9eeYGbNOymizxBybBKiqlCwHSu9gzpWs0BiSb4vuOquhDJyIuTjrai5pkX5KitKMIFhj QkxhtqQjTJq8Cfd0e201zgXMt2U9ddf0x/rhwgXyMPRqj5SnsSR9DjgUUrzqD9hO/QYg bxzA== X-Gm-Message-State: AOUpUlFcfOR2W6T0HXiJjjs+s0dRtMMM8SmKlxvn3+Z1f4obd9OthYIj N4GZ/PBbhcTml9YT9oUPTEc= X-Google-Smtp-Source: AA+uWPyQh7j9V1tRwQ6OxEvuEnhEJQKtuHH9AbQP3WnBegjtzr9FLP6IkVqYV6NSkowUZJcMGaPQPQ== X-Received: by 2002:a63:cf10:: with SMTP id j16-v6mr29232964pgg.238.1534428825117; Thu, 16 Aug 2018 07:13:45 -0700 (PDT) From: Joel Stanley To: Peter Maydell Date: Thu, 16 Aug 2018 23:43:03 +0930 Message-Id: <20180816141303.20518-4-joel@jms.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180816141303.20518-1-joel@jms.id.au> References: <20180816141303.20518-1-joel@jms.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PATCH v5 3/3] arm: Add BBC micro:bit machine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Hajnoczi , =?UTF-8?q?Steffen=20G=C3=B6rtz?= , qemu-devel@nongnu.org, qemu-arm@nongnu.org, Jim Mussared , Julia Suvorova Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This adds the base for a machine model of the BBC micro:bit: https://en.wikipedia.org/wiki/Micro_Bit This is a system with a nRF51 SoC containing the main processor, with various peripherals on board. Reviewed-by: Stefan Hajnoczi Signed-off-by: Joel Stanley --- v2: - Instead of setting kernel filename property, load the image directly - Add link to hardware overview website v3: - Rebase microbit on m0 changes - Remove hard-coded flash size and retrieve from the soc - Add Stefan's reviewed-by v5: - move back to armv7m calls, as v4 of Stefan's patch removed the m_profile changes --- hw/arm/Makefile.objs | 2 +- hw/arm/microbit.c | 54 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 hw/arm/microbit.c diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs index ae4e20373b9e..5f88062c666d 100644 --- a/hw/arm/Makefile.objs +++ b/hw/arm/Makefile.objs @@ -37,4 +37,4 @@ obj-$(CONFIG_IOTKIT) +=3D iotkit.o obj-$(CONFIG_FSL_IMX7) +=3D fsl-imx7.o mcimx7d-sabre.o obj-$(CONFIG_ARM_SMMUV3) +=3D smmu-common.o smmuv3.o obj-$(CONFIG_FSL_IMX6UL) +=3D fsl-imx6ul.o mcimx6ul-evk.o -obj-$(CONFIG_NRF51_SOC) +=3D nrf51_soc.o +obj-$(CONFIG_NRF51_SOC) +=3D nrf51_soc.o microbit.o diff --git a/hw/arm/microbit.c b/hw/arm/microbit.c new file mode 100644 index 000000000000..467cfbda2348 --- /dev/null +++ b/hw/arm/microbit.c @@ -0,0 +1,54 @@ +/* + * BBC micro:bit machine + * http://tech.microbit.org/hardware/ + * + * Copyright 2018 Joel Stanley + * + * This code is licensed under the GPL version 2 or later. See + * the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/boards.h" +#include "hw/arm/arm.h" +#include "exec/address-spaces.h" + +#include "hw/arm/nrf51_soc.h" + +typedef struct { + MachineState parent; + + NRF51State nrf51; +} MICROBITMachineState; + +#define TYPE_MICROBIT_MACHINE "microbit" + +#define MICROBIT_MACHINE(obj) \ + OBJECT_CHECK(MICROBITMachineState, obj, TYPE_MICROBIT_MACHINE) + +static void microbit_init(MachineState *machine) +{ + MICROBITMachineState *s =3D g_new(MICROBITMachineState, 1); + MemoryRegion *system_memory =3D get_system_memory(); + Object *soc; + + object_initialize(&s->nrf51, sizeof(s->nrf51), TYPE_NRF51_SOC); + soc =3D OBJECT(&s->nrf51); + object_property_add_child(OBJECT(machine), "nrf51", soc, &error_fatal); + object_property_set_link(soc, OBJECT(system_memory), + "memory", &error_abort); + + object_property_set_bool(soc, true, "realized", &error_abort); + + armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename, + NRF51_SOC(soc)->flash_size); +} + +static void microbit_machine_init(MachineClass *mc) +{ + mc->desc =3D "BBC micro:bit"; + mc->init =3D microbit_init; + mc->max_cpus =3D 1; +} +DEFINE_MACHINE("microbit", microbit_machine_init); --=20 2.17.1