Merge branch 'untested'
Conflicts: qemu/README.qemu.mc1322x qemu/hw/mc1322x.c qemu/hw/mc1322x.h
This commit is contained in:
commit
121c1bfc07
20 changed files with 1964 additions and 18 deletions
|
@ -7,11 +7,14 @@ Build qemu
|
|||
make
|
||||
|
||||
Run with
|
||||
arm-softmmu/qemu-system-arm -S -M mc1322x -nographic -pflash /home/malvira/mc1322x-tests/tests/blink-red.bin
|
||||
|
||||
which will load the bin at 0x00400000 and execution will start there (type c).
|
||||
arm-softmmu/qemu-system-arm -S -M mc1322x -nographic \
|
||||
foo
|
||||
|
||||
I plan to add a way to load a rom image as well...
|
||||
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:
|
||||
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
#include "sysemu.h"
|
||||
#include "boards.h"
|
||||
#include "flash.h"
|
||||
#include "block.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static const int sector_len = 128 * 1024;
|
||||
|
||||
|
@ -19,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));
|
||||
|
||||
|
@ -30,18 +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 */
|
||||
cpu_register_physical_memory(MC1322X_ROMBASE, MC1322X_ROMSIZE,
|
||||
qemu_ram_alloc(MC1322X_ROMSIZE) | IO_MEM_RAM);
|
||||
cpu_register_physical_memory(MC1322X_RAMBASE, MC1322X_RAMSIZE,
|
||||
qemu_ram_alloc(MC1322X_RAMSIZE) | IO_MEM_RAM);
|
||||
/* should probably allocate memory for all the cpu registers also */
|
||||
|
||||
index = drive_get_index(IF_PFLASH, 0, 0);
|
||||
if (!pflash_cfi01_register(0x00400000, qemu_ram_alloc(MC1322X_RAMBASE),
|
||||
drives_table[index].bdrv, sector_len, MC1322X_RAMBASE / sector_len,
|
||||
2, 0, 0, 0, 0)) {
|
||||
fprintf(stderr, "qemu: Error registering flash memory.\n");
|
||||
exit(1);
|
||||
romoff = qemu_ram_alloc(MC1322X_ROMSIZE);
|
||||
cpu_register_physical_memory(MC1322X_ROMBASE, MC1322X_ROMSIZE,
|
||||
romoff | IO_MEM_RAM);
|
||||
ramoff = qemu_ram_alloc(MC1322X_RAMSIZE);
|
||||
cpu_register_physical_memory(MC1322X_RAMBASE, MC1322X_RAMSIZE,
|
||||
ramoff | IO_MEM_RAM);
|
||||
|
||||
/* need to add a way to specify these images from the command line */
|
||||
|
||||
if(rom = fopen("rom.img", "r")) {
|
||||
fread(phys_ram_base,1,MC1322X_ROMSIZE,rom);
|
||||
}
|
||||
|
||||
if(ram = fopen("ram.img", "r")) {
|
||||
fprintf(stderr, "loading ram image\n");
|
||||
fread(phys_ram_base+ramoff,1,MC1322X_RAMSIZE,ram);
|
||||
}
|
||||
|
||||
s->env->regs[15] = 0x00400000;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#define MC1322X_ROMBASE 0x00000000
|
||||
#define MC1322X_ROMSIZE 0x00014000
|
||||
#define MC1322X_RAMBASE 0x04000000
|
||||
#define MC1322X_RAMBASE 0x00400000
|
||||
#define MC1322X_RAMSIZE 0x00020000
|
||||
|
||||
/* mc1322x.c */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue