[U-Boot] printf("%d") breaks u-boot 2015.01+

Pavel Machek
2015-04-06T18:14:44Z

On Mon 2015-04-06 16:59:55, Marek Vasut wrote:
> On Monday, April 06, 2015 at 04:40:09 PM, Pavel Machek wrote:
> > Hi!
> >
> > In u-boot 2015.04-rc, as soon as execution hits printf("%d"), it
> > hangs. (Usually, that's after "DRAM: " message).
>
> printf("%d") expects an argument, so could it be that it touches
> random piece of memory and thus hangs?

It had an argument, sorry for confusion. I was actually doing this:
the test with %s works, the one with %d kills it.

I suspect too small stack...?

Pavel

int dram_init(void)
{
printf("dram init: print size\n");
- // printf("printf test: %x\n", 0x12345678);
- // printf("dram_init... %x\n", PHYS_SDRAM_1_SIZE);
- gd->ram_size = PHYS_SDRAM_1_SIZE /2; //get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE);
+ printf("printf test: %x\n", 0x12345678);
+ printf("dram_init... %x\n", PHYS_SDRAM_1_SIZE);
+ gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1,
PHYS_SDRAM_1_SIZE);
printf("dram init: ram size set\n");
return 0;
}
@@ -108,6 +108,9 @@ int cpu_mmc_init(bd_t *bis)
int print_cpuinfo(void)
{
puts("CPU: Altera SoCFPGA Platform\n");
+ printf("printf test string: %s\n", "ahoj");
+ printf("printf test: %d\n", 1234567);
+ printf("printf test: %x\n", 0x12345678);
return 0;
}

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html