平台:Ubuntu 10.04 LTS
RT-Thread : 0.4.0
1.到這裡下載Compiler
http://www.codesourcery.com/sgpp/lite/arm/download.html
2.安裝SCons
$ sudo apt-get install scons
3.安裝 git-core
$ sudo apt-get install git-core
4.下載qemu-mini2440
$ git clone git://repo.or.cz/qemu/mini2440.git mini2440-qemu
5.修補qemu-mini2440
$ patch -d mini2440-qemu/ -p1 <mini2440.patch
patching file gdbstub.c
patching file hw/mini2440.c
patching file hw/s3c2410.c
patching file hw/s3c24xx_lcd.c
patching file hw/sd.c
mini2440.patch 如下
-----------------(以下開始)--------------------
diff -Nur mini2440/gdbstub.c mini2440_0308/gdbstub.c--- mini2440/gdbstub.c 2009-05-20 18:28:02 +0800
+++ mini2440_0308/gdbstub.c 2010-02-07 18:58:36 +0800
@@ -2345,7 +2345,7 @@
if (strstart(device, "tcp:", NULL)) {
/* enforce required TCP attributes */
snprintf(gdbstub_device_name, sizeof(gdbstub_device_name),
- "%s,nowait,nodelay,server", device);
+ "%s,nowait,nodelay,server,ipv4", device);
device = gdbstub_device_name;
}
#ifndef _WIN32
diff -Nur mini2440/hw/mini2440.c mini2440_0308/hw/mini2440.c
--- mini2440/hw/mini2440.c 2009-05-20 18:28:02 +0800
+++ mini2440_0308/hw/mini2440.c 2010-01-29 00:56:24 +0800
@@ -258,6 +258,9 @@
struct mini2440_board_s *s = (struct mini2440_board_s *) opaque;
uint32_t image_size;
+#if 1
+ s->cpu->env->regs[15] = S3C_RAM_BASE;
+#else
/*
* Normally we would load 4 KB of nand to SRAM and jump there, but
* it is not working perfectly as expected, so we cheat and load
@@ -298,6 +301,7 @@
mini2440_printf("loaded %s (size %x)\n", s->kernel, image_size);
}
}
+#endif
}
/* Typical touchscreen calibration values */
@@ -328,7 +332,7 @@
mini2440_printf("This platform requires an ARM920T core\n");
exit(2);
}
- s->cpu = s3c24xx_init(S3C_CPU_2440, 12000000 /* 12 mhz */, s->ram, S3C_SRAM_BASE_NANDBOOT, s->mmc);
+ s->cpu = s3c24xx_init(S3C_CPU_2440, 12000000 /* 12 mhz */, s->ram, S3C_SRAM_BASE_NORBOOT, s->mmc);
/* Setup peripherals */
mini2440_gpio_setup(s);
@@ -353,6 +357,11 @@
return s;
}
+static struct arm_boot_info mini2440_binfo = {
+ .loader_start = S3C_RAM_BASE,
+ .ram_size = 0x04000000,
+ .board_id = 0x050,
+};
static void mini2440_init(ram_addr_t ram_size,
const char *boot_device,
@@ -371,9 +380,16 @@
mini = mini2440_init_common(ram_size,
kernel_filename, cpu_model, sd);
- mini->nand = nand_init(NAND_MFR_SAMSUNG, 0x76);
+ mini->nand = nand_init(NAND_MFR_SAMSUNG, 0x76);
mini->cpu->nand->reg(mini->cpu->nand, mini->nand);
+ /* Load the kernel. */
+ if (kernel_filename) {
+ mini2440_binfo.kernel_filename = kernel_filename;
+ mini2440_binfo.kernel_cmdline = kernel_cmdline;
+ mini2440_binfo.initrd_filename = initrd_filename;
+ arm_load_kernel(mini->cpu->env, &mini2440_binfo);
+ }
mini2440_reset(mini);
}
diff -Nur mini2440/hw/s3c2410.c mini2440_0308/hw/s3c2410.c
--- mini2440/hw/s3c2410.c 2009-05-20 18:28:02 +0800
+++ mini2440_0308/hw/s3c2410.c 2010-01-29 23:33:11 +0800
@@ -1603,7 +1603,7 @@
static void s3c_adc_done(void *opaque)
{
struct s3c_adc_state_s *s = (struct s3c_adc_state_s *) opaque;
- s->xdata = s->input[s->in_idx] & 0x3ff;
+ //s->xdata = s->input[s->in_idx] & 0x3ff;
s->control |= 1 << 15;
qemu_irq_raise(s->irq);
}
@@ -1630,6 +1630,15 @@
qemu_mod_timer(s->tst, qemu_get_clock(vm_clock) +
(ticks_per_sec >> 5));
}
+ /* add by yi.qiu@2010.01.28 */
+ else
+ {
+ if (((s->ts & 3) == 3) && (s->ts & (1<<8)) && (s->enable))
+ qemu_irq_raise(s->tcirq);
+
+ qemu_mod_timer(s->tst, qemu_get_clock(vm_clock) +
+ (ticks_per_sec >> 5));
+ }
}
static void s3c_adc_event(void *opaque,
@@ -1637,8 +1646,9 @@
{
struct s3c_adc_state_s *s = (struct s3c_adc_state_s *) opaque;
s->down = !!buttons_state;
- s->x = x;
- s->y = y;
+ s->x = 32767 - y;
+ s->y = 32767 - x;
+
s3c_adc_tick(s);
}
@@ -1689,7 +1699,7 @@
break;
case S3C_ADCTSC:
- s->ts = value & 0xff;
+ s->ts = value & 0x1ff;
break;
case S3C_ADCDLY:
diff -Nur mini2440/hw/s3c24xx_lcd.c mini2440_0308/hw/s3c24xx_lcd.c
--- mini2440/hw/s3c24xx_lcd.c 2009-05-20 18:28:02 +0800
+++ mini2440_0308/hw/s3c24xx_lcd.c 2010-01-28 18:44:50 +0800
@@ -432,7 +432,7 @@
dirty[1] = cpu_physical_memory_get_dirty(x, VGA_DIRTY_FLAG);
dirty[0] |= dirty[1];
}
- if (dirty[0] || s->invalidate) {
+ // if (dirty[0] || s->invalidate) {
s->fn(s->palette, dest, src, s->width, s->dest_width);
maxy = y;
end = new_addr;
@@ -440,7 +440,7 @@
miny = y;
start = addr;
}
- }
+ // }
addr = new_addr;
dirty[0] = dirty[1];
src += src_width;
@@ -452,7 +452,9 @@
cpu_physical_memory_reset_dirty(start, end, VGA_DIRTY_FLAG);
s->srcpnd |= (1 << 1); /* INT_FrSyn */
s3c_lcd_update(s);
- dpy_update(s->ds, 0, miny, s->width, maxy);
+ /* fix qemu/2410 lcd bug */
+ dpy_update(s->ds, 0, 0, 240, 320);
+ // dpy_update(s->ds, 0, miny, s->width, maxy);
}
static void s3c_invalidate_display(void *opaque)
diff -Nur mini2440/hw/sd.c mini2440_0308/hw/sd.c
--- mini2440/hw/sd.c 2009-05-20 18:28:02 +0800
+++ mini2440_0308/hw/sd.c 2010-02-07 13:26:34 +0800
@@ -195,7 +195,7 @@
static void sd_set_ocr(SDState *sd)
{
/* All voltages OK, card power-up OK, Standard Capacity SD Memory Card */
- sd->ocr = 0x80ffff00;
+ sd->ocr = 0x80ff8000;
}
static void sd_set_scr(SDState *sd)
沒有留言:
張貼留言