qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Cortex m3 initialisation
@ 2010-03-14 13:56 Benjamin Bagland
  2010-04-22  2:25 ` andrzej zaborowski
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Bagland @ 2010-03-14 13:56 UTC (permalink / raw)
  To: qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 742 bytes --]

Hi,

I'm having an issue while trying to use the lm3s811 board emulation with
qemu 0.12.3 or git. It works fine however with qemu-0.11.1.

The problem comes from hw/armv7m.c, around line 231, the initial PC and SP
are set by reading from physical memory, however the rom data is not copied
in physical memory until the reset later on in the initialisation (comes
from commit 45a50b1668822c23afc I think). Since the initial PC is invalid,
the cpu goes straight into UsageFault instead of going to the proper reset
routine.

I've made a small patch to read from rom instead of physical memory, that
fixes the issue with my test program but I'm not sure if it's the proper
thing to do, or even if it works with other arm boards.

Rgds,
Benjamin

[-- Attachment #1.2: Type: text/html, Size: 816 bytes --]

[-- Attachment #2: init.patch --]
[-- Type: application/octet-stream, Size: 573 bytes --]

diff --git a/hw/armv7m.c b/hw/armv7m.c
index 034323d..674a8b4 100644
--- a/hw/armv7m.c
+++ b/hw/armv7m.c
@@ -231,8 +231,10 @@ qemu_irq *armv7m_init(int flash_size, int sram_size,
        regular ROM image and perform the normal CPU reset sequence.
        Otherwise jump directly to the entry point.  */
     if (lowaddr == 0) {
-	env->regs[13] = ldl_phys(0);
-	pc = ldl_phys(4);
+        /* roms are not loaded in physical memory until reset */
+        uint32_t *rom = rom_ptr(0);
+        env->regs[13] = rom[0];
+        pc = rom[1];
     } else {
 	pc = entry;
     }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-22  2:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-14 13:56 [Qemu-devel] Cortex m3 initialisation Benjamin Bagland
2010-04-22  2:25 ` andrzej zaborowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).