[U-Boot] [PATCH] ftsmc020: enhance for features and asm support.

Wolfgang Denk wd at denx.de
Thu Mar 31 08:48:28 CEST 2011


Dear Macpaul Lin,

In message <AANLkTikh-0JvLqGm2gk3F70cg3z8=LvT5GgrfQUTuxf0 at mail.gmail.com> you wrote:
> 
> I'm not sure if this way I use make-asm-offset is correct.
> 
> First I add the OFFSET marco of ftsmc020 into "lib/asm-offsets.c".
> The file "lib/asm-offsets.c" becomes

We should probably split architecture and/or board specific additions
like these into separate files in the respectice architecture / board
directories.  Eventually we add make targets for these, then; for now
it's probably sufficient to add some #include to lib/asm-offsets.c

Otherwise lib/asm-offsets.c will quickly become an unreadable mess.

Otherwise this looks OK with me.

> Then I ran make process, the result of make-asm-offset goes into
> "include/generated/generic-asm-offsets.h" as
...
> #define FTSMC020_BANK2_TPR (20) /* offsetof(struct ftsmc020, bank[2].tpr) *> /
> #define FTSMC020_BANK3_CR (24) /* offsetof(struct ftsmc020, bank[3].cr) */
> #define FTSMC020_BANK3_TPR (28) /* offsetof(struct ftsmc020, bank[3].tpr) *> /

Keep in mind that I dislike this manual unrolling of the nested
structs. It may work in your code, but it is ugly and doesn't scale.
Also, it does not allow any kind of looping over the entries which
might be needed here and there.  I strongly recommend to get rid of
these nested declarations.

> #define FTSMC020_PAD0 (32) /* offsetof(struct ftsmc020, pad[0]) */
> #define FTSMC020_PAD1 (36) /* offsetof(struct ftsmc020, pad[1]) */
> #define FTSMC020_PAD2 (40) /* offsetof(struct ftsmc020, pad[2]) */
> #define FTSMC020_PAD3 (44) /* offsetof(struct ftsmc020, pad[3]) */
> #define FTSMC020_PAD4 (48) /* offsetof(struct ftsmc020, pad[4]) */
> #define FTSMC020_PAD5 (52) /* offsetof(struct ftsmc020, pad[5]) */
> #define FTSMC020_PAD6 (56) /* offsetof(struct ftsmc020, pad[6]) */
> #define FTSMC020_PAD7 (60) /* offsetof(struct ftsmc020, pad[7]) */
> #define FTSMC020_SSR (64) /* offsetof(struct ftsmc020, ssr) */
>
> However, this looks weird. It doesn't look like the other automated
> generated code.

What exactly looks weird?  And what "other automated generated code"
do you mean?

> And, how does the offset address in decimal could be generated in hex?

I don't know of a way to do that - it's the cpp + assembler which
generates this code, and I am not aware of any ways to ask them for
specific formatting or number bases.

> Could I move the generated code into ftsmc020.h?

No - what for?  This is automatically generated code, that gets used
somewhere. No human eye is supposed to have to read it.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Each honest calling, each walk of life, has its own  elite,  its  own
aristocracy based on excellence of performance. - James Bryant Conant


More information about the U-Boot mailing list