All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] ARMv7 Execution Flow
@ 2016-06-03 18:55 James Pollard
  2016-06-06  3:48 ` Lokesh Vutla
  0 siblings, 1 reply; 4+ messages in thread
From: James Pollard @ 2016-06-03 18:55 UTC (permalink / raw)
  To: u-boot

Hi,

I'm a new U-Boot user. I'm trying to follow the flow of execution for the
ARMv7 architecture, and have found myself running into confusion.

At the end of arch/arm/cpu/armv7/start.S, lowlevel_init is called. This is
defined (for the ARMv7 architecture in arch/arm/cpu/armv7/low_level_init.S
(not sure if there's a reason for the discrepancy in the use of
underscores?), and at the end of this file, s_init is called.

As far as I can tell, s_init is only defined for some of the ARMv7 CPUs:
the bcm281xx folder doesn't contain any files that define this function. In
the case of the am33xx CPU it's defined in board.c, but this function seems
to return without calling board_init_f.

My questions are:

   1.  In the case of the bcm281xx, what happens? s_init doesn't seem to be
   defined for this CPU.
   2.  In the case of the am33xx, where is board_init_f called? As far as I
   can tell, s_init should return to lowlevel_init without having
   called board_init_f , which then returns back to start.S, terminating
   the execution prematurely.

I presume my analysis of the assembly must be highly incorrect?

Sorry if this is the wrong place for such a question.

Yours,

James Pollard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] ARMv7 Execution Flow
  2016-06-03 18:55 [U-Boot] ARMv7 Execution Flow James Pollard
@ 2016-06-06  3:48 ` Lokesh Vutla
  2016-06-06 13:38   ` James Chargin
  0 siblings, 1 reply; 4+ messages in thread
From: Lokesh Vutla @ 2016-06-06  3:48 UTC (permalink / raw)
  To: u-boot

Hi James,

On Saturday 04 June 2016 12:25 AM, James Pollard wrote:
> Hi,
> 
> I'm a new U-Boot user. I'm trying to follow the flow of execution for the
> ARMv7 architecture, and have found myself running into confusion.
> 
> At the end of arch/arm/cpu/armv7/start.S, lowlevel_init is called. This is
> defined (for the ARMv7 architecture in arch/arm/cpu/armv7/low_level_init.S
> (not sure if there's a reason for the discrepancy in the use of
> underscores?), and at the end of this file, s_init is called.

So, s_init is called by cpu_init_crit and after that _main will be
called. Below is the code flow for u-boot(Skipped all the #ifdefs).

- reset
	- save_boot_params
	- cpu_init_cp15:
		- Invalidate caches and apply erratas:
	- cpu_init_crit:
		- lowlevel_init
			- s_init
	- _main (arch/arm/lib/crt0.S)
		- Setup C runtime environment
		- board_init_f
		- relocate code if !SPL
		- board_init_r

> 
> As far as I can tell, s_init is only defined for some of the ARMv7 CPUs:
> the bcm281xx folder doesn't contain any files that define this function. In
> the case of the am33xx CPU it's defined in board.c, but this function seems
> to return without calling board_init_f.

s_init is not necessary to be called for all the boards. board_init_f
should take care of system init. As per the above code flow board_init_f
will be called for every board.

> 
> My questions are:
> 
>    1.  In the case of the bcm281xx, what happens? s_init doesn't seem to be
>    defined for this CPU.

Yes, board_init_f will take care of the initialization.

>    2.  In the case of the am33xx, where is board_init_f called? As far as I
>    can tell, s_init should return to lowlevel_init without having
>    called board_init_f , which then returns back to start.S, terminating
>    the execution prematurely.

This has been answered above.

> 
> I presume my analysis of the assembly must be highly incorrect?
> 
> Sorry if this is the wrong place for such a question.


Yes, this is the right place to ask :)

Thanks and regards,
Lokesh

> 
> Yours,
> 
> James Pollard
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] ARMv7 Execution Flow
  2016-06-06  3:48 ` Lokesh Vutla
@ 2016-06-06 13:38   ` James Chargin
  2016-06-06 23:58     ` Simon Glass
  0 siblings, 1 reply; 4+ messages in thread
From: James Chargin @ 2016-06-06 13:38 UTC (permalink / raw)
  To: u-boot

Hi James,

On 06/05/2016 08:48 PM, Lokesh Vutla wrote:
> Hi James,
>
> On Saturday 04 June 2016 12:25 AM, James Pollard wrote:
>> Hi,
>>
>> I'm a new U-Boot user. I'm trying to follow the flow of execution for the
>> ARMv7 architecture, and have found myself running into confusion.
>>
>> ...

I've found, in my similar explorations for other architectures, that the 
link map can provide clues to where a particular function is linked from.

In this case, based on the reply from Lokesh, I'd imagine the link map 
would show no definition. Also, perhaps there is an objdump option to 
display this info.

I've noticed however, since the change to Kbuild, the names of all files 
contributing to the final link are "build-in.o" which decreases the 
usefulness of the link map for this purpose.

Jim
-- 
Jim Chargin
AJA Video Systems                       jimc at aja.com
(530) 271-3334                          http://www.aja.com

>
> Thanks and regards,
> Lokesh
>
>>
>> Yours,
>>
>> James Pollard
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
>>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] ARMv7 Execution Flow
  2016-06-06 13:38   ` James Chargin
@ 2016-06-06 23:58     ` Simon Glass
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2016-06-06 23:58 UTC (permalink / raw)
  To: u-boot

Hi James,

On 6 June 2016 at 07:38, James Chargin <jimccrown@gmail.com> wrote:
> Hi James,
>
> On 06/05/2016 08:48 PM, Lokesh Vutla wrote:
>>
>> Hi James,
>>
>> On Saturday 04 June 2016 12:25 AM, James Pollard wrote:
>>>
>>> Hi,
>>>
>>> I'm a new U-Boot user. I'm trying to follow the flow of execution for the
>>> ARMv7 architecture, and have found myself running into confusion.
>>>
>>> ...
>
>
> I've found, in my similar explorations for other architectures, that the
> link map can provide clues to where a particular function is linked from.
>
> In this case, based on the reply from Lokesh, I'd imagine the link map would
> show no definition. Also, perhaps there is an objdump option to display this
> info.
>
> I've noticed however, since the change to Kbuild, the names of all files
> contributing to the final link are "build-in.o" which decreases the
> usefulness of the link map for this purpose.

You can also take a look at the README under 'Board Initialisation
Flow:'. Unfortunately not all boards use this new flow, but it should
at least provide you with the intent. This is indeed an area that
takes some time to understand.

Regards,
Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-06 23:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-03 18:55 [U-Boot] ARMv7 Execution Flow James Pollard
2016-06-06  3:48 ` Lokesh Vutla
2016-06-06 13:38   ` James Chargin
2016-06-06 23:58     ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.