> On 14 Jun 2015, at 15:43, Liviu Ionescu <i...@livius.net> wrote: > > in practical terms this means that realize() should be called right after > creation, immediately after setting the properties: > > DeviceState *mcu = qdev_create(NULL, TYPE_STM32F103RB); > { > qdev_prop_set_uint32(mcu, "hse-freq-hz", 8000000); /* 8.0 MHz */ > qdev_prop_set_uint32(mcu, "lse-freq-hz", 32768); /* 32 KHz */ > } > qdev_realize(mcu); > > which is ok as long as it is strictly adhered.
after adding aliases from the mcu to the internal rcc, I discovered that this is no longer true, if the object creation is done at realize(), the target object and the aliases do not exist before realize, so these settings are not possible. so, from my point of view, this topic is clear now, realize() is not the right place for construction and the only viable solution is to use explicit constructors. DeviceState *mcu = qdev_alloc(NULL, TYPE_STM32F103RB); { STM32F103RB_GET_CLASS(mcu)->construct(OBJECT(mcu), machine); /* Set the board specific oscillator frequencies. */ qdev_prop_set_uint32(mcu, "hse-freq-hz", 8000000); /* 8.0 MHz */ qdev_prop_set_uint32(mcu, "lse-freq-hz", 32768); /* 32 KHz */ } qdev_realize(mcu); one less issue to worry about. :-) regards, Liviu