[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [PATCH v3 12/13] arm: Instantiate NRF51 Timers
From: |
Steffen Görtz |
Subject: |
Re: [Qemu-arm] [PATCH v3 12/13] arm: Instantiate NRF51 Timers |
Date: |
Fri, 2 Nov 2018 11:57:54 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 |
Hi Stefan,
>
> Indentation is off here. One way of formatting it:
>
> address_space_write(&s->as, i * NRF51_PAGE_SIZE,
> MEMTXATTRS_UNSPECIFIED, s->empty_page,
> NRF51_PAGE_SIZE);
Good catch.
>> +static void nrf51_nvm_reset(DeviceState *dev)
>> +{
>> + NRF51NVMState *s = NRF51_NVM(dev);
>> +
>> + memset(s->uicr_content, '\0', sizeof(s->uicr_content));
>> +}
>
> We will zero UICR. Does UICR come zero-initialized on a real micro:bit?
>
> I remember there was an issue with .hex files that set UICR values.
> Will nrf51_nvm_reset() overwrite values from .hex files when the generic
> loader devices is used (-device loader,file=test.hex)?
>
UICR comes 0xFF initialized ([1] 8.1) and yes we had a conflict with the
js-runtime.
I now moved the memset to init just before mapping the region:
memset(s->uicr_content, 0xFF, sizeof(s->uicr_content));
memory_region_init_io(&s->uicr, NULL, &uicr_ops, s, "nrf51_soc.uicr",
sizeof(s->uicr_content));
ysbus_init_mmio(sbd, &s->uicr);
That should do the trick.
A reset without loading of a new firmware blob will not change the (flash) user
memory any longer, which should match the real device.
Best,
Steffen
[1] http://infocenter.nordicsemi.com/pdf/nRF51_RM_v3.0.pdf