qemu: fatal: RAM or ROM at 0x34000000?将编译好的 u-boot.bin 拷贝到 qemu/mini2440 的文件夹中去?

本文讲述了如何在QEMU环境中配置mini2440,包括设置Bootmode为NAND,加载默认u-boot并从NAND中获取,以及处理将u-boot.bin文件复制到qemu/mini2440文件夹以避免启动时的错误。
摘要由CSDN通过智能技术生成

mini2440_init: Boot mode: NAND
mini2440_init: NAND size/id 138412032 (128MB) defaulting to old 64MB
S3C: CLK=240 HCLK=240 PCLK=240 UCLK=57
QEMU: ee24c08_init
DM9000: INIT QEMU MAC : 52:54:00:12:34:56
QEMU mini2440_reset: loaded default u-boot from NAND
qemu: fatal: Trying to execute code outside RAM or ROM at 0x34000000

R00=00000000 R01=00000000 R02=00000000 R03=00000000
R04=00000000 R05=00000000 R06=00000000 R07=00000000
R08=00000000 R09=00000000 R10=00000000 R11=00000000
R12=00000000 R13=00000000 R14=00000000 R15=34000000
PSR=400001d3 -Z-- A svc32
Aborted (core dumped)
 

为什么将编译好的 u-boot.bin 拷贝到 qemu/mini2440 的文件夹中去? 

将编译好的 u-boot.bin 拷贝到 qemu/mini2440 的文件夹中去, 否则以后执行mini2440/mini2440_start.sh就会遇到一下错误

linux@linux:~/Buildroot/mini2440-HEAD-18b91f2/mini2440$ cp ../../flashtools/flashimg/u-boot.bin ./

原因:阅读这该死的源码,你就知道了!!!源码加载的是这里的 mini2440/u-boot.bin,没有这个,不crash你,crash 谁!

{
			image_size = load_image("mini2440/u-boot.bin", qemu_get_ram_ptr(0x03f80000));
			if (image_size < 0)
				image_size = load_image("u-boot.bin", qemu_get_ram_ptr(0x03f80000));
			if (image_size > 0) {
				if (image_size & (512 -1))	/* round size to a NAND block size */
					image_size = (image_size + 512) & ~(512-1);
				mini2440_printf("loaded override u-boot (size %x)\n", image_size);
				s->cpu->env->regs[15] = S3C_RAM_BASE | 0x03f80000;	/* start address, u-boot already relocated */
			}
		}

 

static void mini2440_reset(void *opaque)
{
    struct mini2440_board_s *s = (struct mini2440_board_s *) opaque;
    int32_t image_size;

    s->cpu->env->regs[15] = 0;

	if (s->boot_mode == BOOT_NAND) {
		/*
		 * 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
		 * it from nand directly relocated to 0x33f80000 and jump there
		 */
		if (mini2440_load_from_nand(s->nand, 0, S3C_RAM_BASE | 0x03f80000, 256*1024)> 0) {
			mini2440_printf("loaded default u-boot from NAND\n");
			s->cpu->env->regs[15] = S3C_RAM_BASE | 0x03f80000; /* start address, u-boot already relocated */
		}
#if 0 && defined(LATER)
		if (mini2440_load_from_nand(s->nand, 0, S3C_SRAM_BASE_NANDBOOT, S3C_SRAM_SIZE) > 0) {
			s->cpu->env->regs[15] = S3C_SRAM_BASE_NANDBOOT;	/* start address, u-boot relocating code */
			mini2440_printf("4KB SteppingStone loaded from NAND\n");
		}
#endif

		/*
		 * if a u--boot is available as a file, we always use it
		 */
		{
			image_size = load_image("mini2440/u-boot.bin", qemu_get_ram_ptr(0x03f80000));
			if (image_size < 0)
				image_size = load_image("u-boot.bin", qemu_get_ram_ptr(0x03f80000));
			if (image_size > 0) {
				if (image_size & (512 -1))	/* round size to a NAND block size */
					image_size = (image_size + 512) & ~(512-1);
				mini2440_printf("loaded override u-boot (size %x)\n", image_size);
				s->cpu->env->regs[15] = S3C_RAM_BASE | 0x03f80000;	/* start address, u-boot already relocated */
			}
		}
	}
	/*
	 * if a kernel was explicitly specified, we load it too
	 */
	if (s->kernel) {
	   	image_size = load_image(s->kernel, qemu_get_ram_ptr(0x02000000));
	   	if (image_size > 0) {
	   		if (image_size & (512 -1))	/* round size to a NAND block size */
	   			image_size = (image_size + 512) & ~(512-1);
	   		mini2440_printf("lee loaded %s (size %x)\n", s->kernel, image_size);
	    }
	}
	mini2440_printf("\n\n**welcome to uboot's world,start your Fuck codes**\n\n");
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值