On Thu, 27 Feb 2020 at 15:08, Stephanos Ioannidis <r...@stephanos.io> wrote: > On 2/27/20 10:31 PM, Philippe Mathieu-Daudé wrote: > > I think Alistair and myself use the 'loader' device with Cortex-M boards > > and never hit this problem. > > I tried both `-kernel [ELF IMAGE]` and `-device loader,file=[ELF IMAGE]` > without any success; in both cases, without this patch, QEMU hard-faults > during start-up due to the unavailability of the vector table content at the > time of CPU reset.
You only run into this bug if: * you're using a Cortex-M CPU * and the board model has aliased memory regions so that the flash or memory you're loading the ELF file into appears at multiple addresses in the memory map * and the ELF file loads the data into the aliased address rather than the CPU's VTOR register reset value (which is 0 for CPUs without the Security Extension) * but it doesn't matter whether you use -kernel or -device loader So you can work around it by linking your images to be loaded at 0 rather than the higher address. It is definitely a bug that we don't correctly handle these ELF images. thanks -- PMM