[PATCH 03/12] Add pre-bootloader (pbl) image support
Sascha Hauer
s.hauer at pengutronix.de
Thu Aug 2 11:29:12 EDT 2012
On Mon, Jul 30, 2012 at 12:02:36PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> +
> + /* Setup the stack */
> + r = STACK_BASE + STACK_SIZE - 16;
> + __asm__ __volatile__("mov sp, %0" : : "r"(r));
> + /* clear bss */
> + memset(__bss_start, 0, __bss_stop - __bss_start);
> +
> + start_barebox();
> +}
> +#else
> void __naked __section(.text_entry) start(void)
> {
> barebox_arm_head();
> }
> +#endif
>
> /*
> * The actual reset vector. This code is position independent and usually
> @@ -73,6 +97,14 @@ void __naked __bare_init reset(void)
> board_init_lowlevel_return();
> }
>
> +#ifdef __PBL__
> +void barebox_pbl(uint32_t offset)
> +{
> +}
> +#else
> +void barebox_pbl(uint32_t offset) {}
> +#endif
> +
> /*
> * Board code can jump here by either returning from board_init_lowlevel
> * or by calling this function directly.
> @@ -105,8 +137,11 @@ void __naked __section(.text_ll_return) board_init_lowlevel_return(void)
> /* flush I-cache before jumping to the copied binary */
> __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 0" : : "r" (0));
>
> - /* call start_barebox with its absolute address */
> - r = (unsigned int)&start_barebox;
> - __asm__ __volatile__("mov pc, %0" : : "r"(r));
> + if (IS_ENABLED(CONFIG_PBL_IMAGE)) {
> + barebox_pbl(offset);
The pbl should be called at it's absolute address, not at it's relative
address. This makes sure that the pbl code is running in a completely
valid C environment.
I fixed that before applying
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 |
More information about the barebox
mailing list