您尚未登录。

楼主 # 2023-05-26 22:51:15

Ary_Ye
会员
注册时间: 2022-03-24
已发帖子: 11
积分: 6

mqr_t113使用xboot在SPINAND无法启动

用xfel在ram里面运行程序是没有问题的,也能检测到spinand

[    0.161625]Found spi nand flash 'GD5F1GQ4xAYIG' with 128.000MB
[    0.167369]Found partition:
[    0.170153]  0x0000000000000000 ~ 0x0000000007ffffff 128.000MB - blk-spinand.                                                                                                                                                                                                                                 0
[    0.177361]  0x0000000000000000 ~ 0x00000000005fffff 6.000MB   - blk-spinand.                                                                                                                                                                                                                                 0.xboot
[    0.185462]  0x0000000000600000 ~ 0x00000000007fffff 2.000MB   - blk-spinand.                                                                                                                                                                                                                                 0.reserve
[    0.193348]  0x0000000000800000 ~ 0x0000000007ffffff 120.000MB - blk-spinand.                                                                                                                                                                                                                               0.private

参考https://whycan.com/t_7323.html中xboot大佬在39楼以后的内容,了解到f133使用的是2kB一个page,
所以我使用sudo xfel spinand splwrite 2048 1048576 output/xboot.bin这条命令,烧写以后已经退出了FEL,但是没有启动LOG。
在sys-copyself.c里面的get_boot_device默认是return BOOT_DEVICE_SPINOR;改成return BOOT_DEVICE_SPINAND;
在sys_copyself的一部分改成

	else if(d == BOOT_DEVICE_SPINAND)
	{
		struct zdesc_t * z = (struct zdesc_t *)__heap_start;
		void * mem = (void *)__image_start;
		void * tmp = (void *)z + sizeof(struct zdesc_t);
		uint32_t size = __image_end - __image_start;
		#if 0
		sys_mmu_init();
		sys_spinand_init();
		sys_spinand_read(1048576 + 65536, z, sizeof(struct zdesc_t));
		sys_spinand_exit();
		if((z->magic[0] == 'Z') && (z->magic[1] == 'B') && (z->magic[2] == 'L') && (z->magic[3] == '!'))
		{
			//if(sys_verify((char *)z->pubkey, (char *)z->sha256, (char *)z->signature))
			{
				uint32_t csize = (z->csize[0] << 24) | (z->csize[1] << 16) | (z->csize[2] << 8) | (z->csize[3] << 0);
				uint32_t dsize = (z->dsize[0] << 24) | (z->dsize[1] << 16) | (z->dsize[2] << 8) | (z->dsize[3] << 0);
				sys_spinand_init();
				sys_spinand_read(1048576 + 65536 + sizeof(struct zdesc_t), tmp, csize);
				sys_spinand_exit();
				//if(sys_hash((char *)(&z->majoy), (sizeof(struct zdesc_t) - 100) + csize, (char *)z->sha256))
				{
					sys_decompress(tmp, csize, mem, dsize);
				}
			}
		}
		else
		#endif
		{
			sys_spinand_init();
			sys_spinand_read(1048576, mem, size);
			sys_spinand_exit();
		}
	}

但是没能启动成功,求大佬支支招。

最近编辑记录 Ary_Ye (2023-05-26 23:02:39)

离线

楼主 #1 2023-05-26 23:04:03

Ary_Ye
会员
注册时间: 2022-03-24
已发帖子: 11
积分: 6

Re: mqr_t113使用xboot在SPINAND无法启动

我在F1C200S上按上面的方法也能启动,但在T113上就没能启动,好奇怪啊。

离线

楼主 #4 2023-05-27 16:35:13

Ary_Ye
会员
注册时间: 2022-03-24
已发帖子: 11
积分: 6

Re: mqr_t113使用xboot在SPINAND无法启动

@xboot
大佬好,我这边是已经修改了get_boot_device()里面的启动介质,改成了BOOT_DEVICE_SPINAND,但还是没能启动
这是编译的结果

copy from `../output/xboot' [elf32-littlearm] to `../output/xboot.bin' [binary]
Make header information for brom booting
The bootloader head has been fixed, spl size is 32768 bytes.
Ecdsa256 public key:
        03cfd18e4a4b40d6529448aa2df8bbb677128258b8fbfc5b9e492fbbba4e84832f
Ecdsa256 private key:
        dc57b8a9e0e2b7f8b4c929bd8db2844e53f01f171bbcdf6e628908dbf2b2e6a9
Compressed 4595712 bytes into 2987194 bytes ==> 64.999591%

这个是我在sys-copyself.c里面的自拷贝程序

void test()
{
	sys_uart_putc('B');
	sys_uart_putc('o');
	sys_uart_putc('o');
	sys_uart_putc('t');
	sys_uart_putc(' ');
	sys_uart_putc('t');
	sys_uart_putc('o');
	sys_uart_putc(' ');
	sys_uart_putc('F');
	sys_uart_putc('E');
	sys_uart_putc('L');
	sys_uart_putc(' ');
	sys_uart_putc('m');
	sys_uart_putc('o');
	sys_uart_putc('d');
	sys_uart_putc('e');
	sys_uart_putc('\r');
	sys_uart_putc('\n');
}

void sys_copyself(void)
{
	int d = get_boot_device();
	test();
	if(d == BOOT_DEVICE_SPINOR)
	{
		struct zdesc_t * z = (struct zdesc_t *)__heap_start;
		void * mem = (void *)__image_start;
		void * tmp = (void *)z + sizeof(struct zdesc_t);
		uint32_t size = __image_end - __image_start;

		sys_mmu_init();
		sys_spinor_init();
		sys_spinor_read(65536, z, sizeof(struct zdesc_t));
		sys_spinor_exit();
		if((z->magic[0] == 'Z') && (z->magic[1] == 'B') && (z->magic[2] == 'L') && (z->magic[3] == '!'))
		{
			//if(sys_verify((char *)z->pubkey, (char *)z->sha256, (char *)z->signature))
			{
				uint32_t csize = (z->csize[0] << 24) | (z->csize[1] << 16) | (z->csize[2] << 8) | (z->csize[3] << 0);
				uint32_t dsize = (z->dsize[0] << 24) | (z->dsize[1] << 16) | (z->dsize[2] << 8) | (z->dsize[3] << 0);
				sys_spinor_init();
				sys_spinor_read(65536 + sizeof(struct zdesc_t), tmp, csize);
				sys_spinor_exit();
				//if(sys_hash((char *)(&z->majoy), (sizeof(struct zdesc_t) - 100) + csize, (char *)z->sha256))
				{
					sys_decompress(tmp, csize, mem, dsize);
				}
			}
		}
		else
		{
			sys_spinor_init();
			sys_spinor_read(0, mem, size);
			sys_spinor_exit();
		}
	}
	else if(d == BOOT_DEVICE_SPINAND)
	{
		struct zdesc_t * z = (struct zdesc_t *)__heap_start;
		void * mem = (void *)__image_start;
		void * tmp = (void *)z + sizeof(struct zdesc_t);
		uint32_t size = __image_end - __image_start;
		#if 0
		sys_mmu_init();
		sys_spinand_init();
		sys_spinand_read(1048576 + 65536, z, sizeof(struct zdesc_t));
		sys_spinand_exit();
		if((z->magic[0] == 'Z') && (z->magic[1] == 'B') && (z->magic[2] == 'L') && (z->magic[3] == '!'))
		{
			//if(sys_verify((char *)z->pubkey, (char *)z->sha256, (char *)z->signature))
			{
				uint32_t csize = (z->csize[0] << 24) | (z->csize[1] << 16) | (z->csize[2] << 8) | (z->csize[3] << 0);
				uint32_t dsize = (z->dsize[0] << 24) | (z->dsize[1] << 16) | (z->dsize[2] << 8) | (z->dsize[3] << 0);
				sys_spinand_init();
				sys_spinand_read(1048576 + 65536 + sizeof(struct zdesc_t), tmp, csize);
				sys_spinand_exit();
				//if(sys_hash((char *)(&z->majoy), (sizeof(struct zdesc_t) - 100) + csize, (char *)z->sha256))
				{
					sys_decompress(tmp, csize, mem, dsize);
				}
			}
		}
		else
		#endif
		{
			sys_spinand_init();
			sys_spinand_read(1048576, mem, size);
			sys_spinand_exit();
		}
	}
	else if(d == BOOT_DEVICE_SDCARD)
	{
	}
}

我在开头加上了一个test打印程序,但是没看到有信息打印,uart使用的是0,我看了下寄存器和sys_uart_putc()的地址是一样的

离线

楼主 #7 2023-05-27 17:54:53

Ary_Ye
会员
注册时间: 2022-03-24
已发帖子: 11
积分: 6

Re: mqr_t113使用xboot在SPINAND无法启动

OKOK

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn