From 2ea5f005eed9bc374dadefb368eca22e18f32b99 Mon Sep 17 00:00:00 2001 From: Mariano Alvira Date: Sat, 11 Apr 2009 09:08:38 -0400 Subject: [PATCH] load memory with images directly. emulation runs correctly now. --- qemu/README.qemu.mc1322x | 7 ++++--- qemu/hw/mc1322x.c | 33 ++++++++++++++++----------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/qemu/README.qemu.mc1322x b/qemu/README.qemu.mc1322x index 1509d38cf..270575ac4 100644 --- a/qemu/README.qemu.mc1322x +++ b/qemu/README.qemu.mc1322x @@ -8,12 +8,13 @@ Build qemu Run with arm-softmmu/qemu-system-arm -S -M mc1322x -nographic \ - -pflash ~/mc1322x-tests/tests/blink-red.bin \ - -mtdblock ~/mcmc1322x-tests/doc/mc13224v.img + foo -which will load mc13224v.img at 0x00000000 and blink-red.bin at +which will load rom.img at 0x00000000 and ram.img at 0x00400000 --- execution will start at 0x00400000 (type c). +I'll be adding command line options for those images soon. + Debug with gdb: Build gdb for an arm target: diff --git a/qemu/hw/mc1322x.c b/qemu/hw/mc1322x.c index 1a49e3873..d7cf600fb 100644 --- a/qemu/hw/mc1322x.c +++ b/qemu/hw/mc1322x.c @@ -13,6 +13,8 @@ #include "flash.h" #include "block.h" +#include + static const int sector_len = 128 * 1024; /* Initialize a MC1322x (ARM7) */ @@ -20,6 +22,8 @@ struct mc1322x_state_s *mc1322x_init(void) { struct mc1322x_state_s *s; int index; + FILE *ram, *rom; + ram_addr_t ramoff, romoff; s = (struct mc1322x_state_s *) qemu_mallocz(sizeof(struct mc1322x_state_s)); @@ -31,29 +35,24 @@ struct mc1322x_state_s *mc1322x_init(void) register_savevm("cpu", 0, ARM_CPU_SAVE_VERSION, cpu_save, cpu_load, s->env); - /* SDRAM & Internal Memory Storage */ - /* should probably allocate memory for all the cpu registers... I think that is where the emulation might be bombing */ + /* should probably allocate memory for all the cpu registers also */ + + romoff = qemu_ram_alloc(MC1322X_ROMSIZE); cpu_register_physical_memory(MC1322X_ROMBASE, MC1322X_ROMSIZE, - qemu_ram_alloc(MC1322X_ROMSIZE) | IO_MEM_RAM); + romoff | IO_MEM_RAM); + ramoff = qemu_ram_alloc(MC1322X_RAMSIZE); cpu_register_physical_memory(MC1322X_RAMBASE, MC1322X_RAMSIZE, - qemu_ram_alloc(MC1322X_RAMSIZE) | IO_MEM_RAM); + ramoff | IO_MEM_RAM); - /* shouldn't load the images in this way */ - /* should make a commandline arg for this and just load the file to ram */ - /* directly. */ - /* this may be possible with snapshots or something...*/ + /* need to add a way to specify these images from the command line */ - index = drive_get_index(IF_MTD, 0, 0); - if(0env->regs[15] = 0x00400000;