On Tue, Oct 30, 2018 at 08:25:19PM -0400, Steffen Görtz wrote: > +static void io_write(void *opaque, hwaddr offset, uint64_t value, > + unsigned int size) > +{ > + NRF51NVMState *s = NRF51_NVM(opaque); > + > + switch (offset) { > + case NRF51_NVMC_CONFIG: > + s->config = value & NRF51_NVMC_CONFIG_MASK; > + break; > + case NRF51_NVMC_ERASEPCR0: > + case NRF51_NVMC_ERASEPCR1: > + value &= ~(NRF51_PAGE_SIZE - 1); > + if (value < (s->code_size * NRF51_PAGE_SIZE)) { > + address_space_write(&s->as, value, MEMTXATTRS_UNSPECIFIED, > + s->empty_page, NRF51_PAGE_SIZE); > + } > + break; > + case NRF51_NVMC_ERASEALL: > + if (value == NRF51_NVMC_ERASE) { > + for (uint32_t i = 0; i < s->code_size; i++) { > + address_space_write(&s->as, i * NRF51_PAGE_SIZE, > + MEMTXATTRS_UNSPECIFIED, s->empty_page, NRF51_PAGE_SIZE);
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); > +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)?
signature.asc
Description: PGP signature