qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-arm] [PATCH 1/2] arm: Add Nordic Semiconductor nRF51 SoC


From: Stefan Hajnoczi
Subject: Re: [Qemu-arm] [PATCH 1/2] arm: Add Nordic Semiconductor nRF51 SoC
Date: Tue, 8 May 2018 13:05:45 +0100
User-agent: Mutt/1.9.2 (2017-12-15)

On Thu, May 03, 2018 at 06:35:31PM +0930, Joel Stanley wrote:
> diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c
> new file mode 100644
> index 000000000000..a2e3d6f013f0
> --- /dev/null
> +++ b/hw/arm/nrf51_soc.c
> @@ -0,0 +1,101 @@
> +/*
> + * Nordic Semiconductor nRF51 SoC
> + *
> + * Copyright 2018 Joel Stanley <address@hidden>
> + *
> + * This code is licensed under the GPL version 2 or later.  See
> + * the COPYING file in the top-level directory.

Please include the link in the comment:

  The reference manual is available here:
  http://infocenter.nordicsemi.com/pdf/nRF51_RM_v3.0.pdf

> +static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
> +{
> +    NRF51State *s = NRF51_SOC(dev_soc);
> +    DeviceState *nvic;
> +    Error *err = NULL;
> +
> +    /* IO space */
> +    create_unimplemented_device("nrf51_soc.io", IOMEM_BASE, IOMEM_SIZE);
> +
> +    /* FICR */
> +    create_unimplemented_device("nrf51_soc.ficr", FICR_BASE, FICR_SIZE);
> +
> +    MemoryRegion *system_memory = get_system_memory();
> +    MemoryRegion *sram = g_new(MemoryRegion, 1);
> +    MemoryRegion *flash = g_new(MemoryRegion, 1);
> +
> +    memory_region_init_ram_nomigrate(flash, NULL, "nrf51.flash", FLASH_SIZE,
> +            &err);
> +    if (err) {
> +        error_propagate(errp, err);
> +        return;

Please free resources (e.g. sram and flash) in error code paths.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]