public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Graeme Russ <graeme.russ@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] initcall revisited - A new idea to discuss
Date: Tue, 03 Jan 2012 21:37:24 +1100	[thread overview]
Message-ID: <4F02DA64.60502@gmail.com> (raw)
In-Reply-To: <20120102144904.A3F1082272@gemini.denx.de>

Hi Wolfgang,

On 03/01/12 01:49, Wolfgang Denk wrote:
> Dear Graeme Russ,
> 
> In message <4F019ABB.9010201@gmail.com> you wrote:
>>
>> Which got me to thinking, what if we had an initcall macro which included
>> the dependency information. Imagine this rough example:
> ...
>> INITCALL(display_banner, "banner", "dram,board_early")
>>
>> Which says that the display_banner() function, when completed fulfils the
>> 'banner' dependency, and requires both the 'dram' and 'board_early'
>> dependencies to be fulfilled in order to run
> 
> Sounds great!

OK, I think I can do this...

#define INIT_FUNC(fn, stage, reqs, prereqs, postreqs) \
	static const char *__initfunc_ ## fn __used \
	__attribute__((__section__(".initfuncs"))) = \
	#stage ":" #fn ":" #reqs ":" #prereqs ":" #postreqs

'postreq' are requisite functions that the given function must be run
before (USB init priot to console if using a USB serial dongle for example)

Then:

INIT_FUNC(cpu_init_f, f, "fred", "blah", "foo");

Generates the string:
f:cpu_init_f:"fred":"blah":"foo"

and we can parse each of the elf archives to obtain a list of string
pointers from the .initfuncs, extract the strings and process them to
generate the init arrays

and add:

	/DISCARD/ : { *(.initfuncs*) }

to the linker script to throw away the strings

It's a tad ugly under the hood, but the output will be very clean

Does this sound like a plan?

Regards,

Graeme

  reply	other threads:[~2012-01-03 10:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-02 11:53 [U-Boot] initcall revisited - A new idea to discuss Graeme Russ
2012-01-02 14:49 ` Wolfgang Denk
2012-01-03 10:37   ` Graeme Russ [this message]
2012-01-03 14:44     ` Wolfgang Denk
2012-01-03 21:53       ` Graeme Russ
2012-01-05 22:18       ` Graeme Russ
2012-01-06  4:30         ` Simon Glass
2012-01-06  4:59           ` Graeme Russ
2012-01-06  5:41             ` Hebbar, Gururaja
2012-01-06  6:35               ` Wolfgang Denk
     [not found]                 ` <1BAFE6F6C881BF42822005164F1491C305D08F@DBDE01.ent.ti.com>
2012-01-07 22:39                   ` Simon Glass
2012-01-08 11:59                     ` Graeme Russ
2012-01-06  6:30             ` Wolfgang Denk
2012-01-03 16:04     ` Simon Glass
2012-01-03 22:36       ` Wolfgang Denk
2012-01-03 22:43         ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F02DA64.60502@gmail.com \
    --to=graeme.russ@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox