Re: [PATCH] Add support for Baltos systems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 31, 2016 at 06:46:57PM +0000, Trent Piepho wrote:
> On Fri, 2016-05-27 at 15:48 +0200, yegorslists@xxxxxxxxxxxxxx wrote:
> 
> > +
> > +/**
> > + * @brief The basic entry point for board initialization.
> > + *
> > + * This is called as part of machine init (after arch init).
> > + * This is again called with stack in SRAM, so not too many
> > + * constructs possible here.
> > + *
> > + * @return void
> > + */
> 
> Does anyone (Sascha?) know why this is noline?  Obviously it is being
> copied from the all the other boards that do this, and the only thing it
> can be doing is preventing this from being inlined into the entry
> function.  But why must this be prevented?

Only after calling relocate_to_current_adr() / setup_c() the C
environment is correctly initialized. Before that for example pointers
to global variables are not valid. The following does not work:

ENTRY_FUNCTION(start_am33xx_baltos_sram, bootinfo, r1, r2)
{
	void *fdt = __dtb_am335x_baltos_minimal_start;

	relocate_to_current_adr();
	setup_c();

	barebox_arm_entry(0x80000000, sdram_size, fdt);
}

Wenn entering start_am33xx_baltos_sram() we do not run at the address we
are linked at, so *fdt will have the offset between link address and
actual runtime address in it. Basically we must make sure that *fdt is
initialized *after* calling relocate_to_current_adr()/setup_c(). The same
might happen when create an extra function but let the compiler inline it:

static inline void cont(void)
{
	void *fdt = __dtb_am335x_baltos_minimal_start;

	barebox_arm_entry(0x80000000, sdram_size, fdt);
}

ENTRY_FUNCTION(start_am33xx_baltos_sram, bootinfo, r1, r2)
{
	relocate_to_current_adr();
	setup_c();

	cont();
}

This doesn't happen when we explicitly noinline cont().

The compiler simply doesn't know about the dirty tricks we play in
relocate_to_current_adr() and setup_c().

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux