linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* DTC/dts modifications
@ 2006-04-29 16:00 Kumar Gala
  2006-05-01 19:33 ` Jon Loeliger
  0 siblings, 1 reply; 13+ messages in thread
From: Kumar Gala @ 2006-04-29 16:00 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: Jon Loeliger, linuxppc-dev@ozlabs.org list

All,

What evilness would it be to change the use of '#' in the .dts format  
to some other character like '$' or '%'.  The problem is the use of  
'#' prevents use from using cpp which would make some aspects of  
building up .dts for boards far more useful.

We can easily provide a one line script to convert people's .dts to  
the new format.

- kumar

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

* Re: DTC/dts modifications
  2006-04-29 16:00 DTC/dts modifications Kumar Gala
@ 2006-05-01 19:33 ` Jon Loeliger
  2006-05-01 19:39   ` Kumar Gala
  0 siblings, 1 reply; 13+ messages in thread
From: Jon Loeliger @ 2006-05-01 19:33 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Jon Loeliger, linuxppc-dev@ozlabs.org list

On Sat, 2006-04-29 at 11:00, Kumar Gala wrote:
> All,
> 
> What evilness would it be to change the use of '#' in the .dts format  
> to some other character like '$' or '%'.

Uh, use of '#' for what?  Current comment style is
either C or C++, ie, /* ... */ or //.

>   The problem is the use of  
> '#' prevents use from using cpp which would make some aspects of  
> building up .dts for boards far more useful.

I think to get CPP to be usable, it will need to handle
the # emitted line-location markers, "# <line> <file> <level>".

> We can easily provide a one line script to convert people's .dts to  
> the new format.

I don't think there is a conversion necessary yet.
Did I miss something here?

Thanks,
jdl

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

* Re: DTC/dts modifications
  2006-05-01 19:33 ` Jon Loeliger
@ 2006-05-01 19:39   ` Kumar Gala
  2006-05-01 19:45     ` Jon Loeliger
  2006-05-01 22:14     ` Paul Mackerras
  0 siblings, 2 replies; 13+ messages in thread
From: Kumar Gala @ 2006-05-01 19:39 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: Jon Loeliger, linuxppc-dev@ozlabs.org list


On May 1, 2006, at 2:33 PM, Jon Loeliger wrote:

> On Sat, 2006-04-29 at 11:00, Kumar Gala wrote:
>> All,
>>
>> What evilness would it be to change the use of '#' in the .dts format
>> to some other character like '$' or '%'.
>
> Uh, use of '#' for what?  Current comment style is
> either C or C++, ie, /* ... */ or //.

Comment aren't the issue.

>>   The problem is the use of
>> '#' prevents use from using cpp which would make some aspects of
>> building up .dts for boards far more useful.
>
> I think to get CPP to be usable, it will need to handle
> the # emitted line-location markers, "# <line> <file> <level>".

Don't follow you here.

>> We can easily provide a one line script to convert people's .dts to
>> the new format.
>
> I don't think there is a conversion necessary yet.
> Did I miss something here?

Try running a current .dts through cpp today.  You will get errors like:

oftree.dts:15:3: error: invalid preprocessing directive #address
oftree.dts:16:3: error: invalid preprocessing directive #size
oftree.dts:20:4: error: invalid preprocessing directive #cpus
oftree.dts:21:4: error: invalid preprocessing directive #address
oftree.dts:22:4: error: invalid preprocessing directive #size
oftree.dts:25:2: error: invalid preprocessing directive #foobar

Because of props like:

       #cpus = <1>;
       #address-cells = <1>;
       #size-cells = <0>;

If these used some other symbol instead of '#' cpp will be happy and  
we can use it to create macros for us.

- k

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

* Re: DTC/dts modifications
  2006-05-01 19:39   ` Kumar Gala
@ 2006-05-01 19:45     ` Jon Loeliger
  2006-05-01 19:52       ` Kumar Gala
  2006-05-01 22:14     ` Paul Mackerras
  1 sibling, 1 reply; 13+ messages in thread
From: Jon Loeliger @ 2006-05-01 19:45 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Jon Loeliger, linuxppc-dev@ozlabs.org list

On Mon, 2006-05-01 at 14:39, Kumar Gala wrote:

> 
> Comment aren't the issue.

Ah, ok.


> > I think to get CPP to be usable, it will need to handle
> > the # emitted line-location markers, "# <line> <file> <level>".
> 
> Don't follow you here.

The pre-processor emits crap like this:

# 1 "cmd_load.c"
# 1 "/proj/ppc/sysperf/sw/u/jdl/86xx/u-boot-86xx/common//"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "cmd_load.c"
# 27 "cmd_load.c"
# 1 "/proj/ppc/sysperf/sw/u/jdl/86xx/u-boot-86xx/include/common.h" 1
# 30 "/proj/ppc/sysperf/sw/u/jdl/86xx/u-boot-86xx/include/common.h"
typedef unsigned char uchar;
typedef volatile unsigned long vu_long;
typedef volatile unsigned short vu_short;
typedef volatile unsigned char vu_char;

> Try running a current .dts through cpp today.  You will get errors like:
> 
> oftree.dts:15:3: error: invalid preprocessing directive #address

> Because of props like:
> 
>        #cpus = <1>;
>        #address-cells = <1>;
>        #size-cells = <0>;
> 
> If these used some other symbol instead of '#' cpp will be happy and  
> we can use it to create macros for us.

Yeah, we're not going to be able to change those; they
are "By The Book".

Instead, we'll have to make the lexical analysis conscious
of something like a <newline> context sensitive token or so.
Or throw some flag to cpp to not emit location markers.

Or something.

jdl

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

* Re: DTC/dts modifications
  2006-05-01 19:45     ` Jon Loeliger
@ 2006-05-01 19:52       ` Kumar Gala
  2006-05-01 20:07         ` Kim Phillips
  2006-05-01 23:34         ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 13+ messages in thread
From: Kumar Gala @ 2006-05-01 19:52 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: Jon Loeliger, linuxppc-dev@ozlabs.org list

[snip]

>> Try running a current .dts through cpp today.  You will get errors  
>> like:
>>
>> oftree.dts:15:3: error: invalid preprocessing directive #address
>
>> Because of props like:
>>
>>        #cpus = <1>;
>>        #address-cells = <1>;
>>        #size-cells = <0>;
>>
>> If these used some other symbol instead of '#' cpp will be happy and
>> we can use it to create macros for us.
>
> Yeah, we're not going to be able to change those; they
> are "By The Book".

By what book?  It would seem to me that BNF for dtc is completely  
under our control and if we want to change it we can.  I understand  
that there is some correspondence to Open Firmware, but it seems that  
if its people are ok with the dts format changing that's a lot easier  
than implementing tons of support in dtc for features that cpp gives us.

[I'm also guessing no one's really got time to go and implement these  
features in dtc]

> Instead, we'll have to make the lexical analysis conscious
> of something like a <newline> context sensitive token or so.
> Or throw some flag to cpp to not emit location markers.

- kumar

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

* Re: DTC/dts modifications
  2006-05-01 19:52       ` Kumar Gala
@ 2006-05-01 20:07         ` Kim Phillips
  2006-05-01 20:28           ` Kumar Gala
  2006-05-01 23:34         ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 13+ messages in thread
From: Kim Phillips @ 2006-05-01 20:07 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, jdl

On Mon, 1 May 2006 14:52:23 -0500
Kumar Gala <galak@kernel.crashing.org> wrote:

> [snip]
> 
> >> Try running a current .dts through cpp today.  You will get errors  
> >> like:
> >>
> >> oftree.dts:15:3: error: invalid preprocessing directive #address
> >
> >> Because of props like:
> >>
> >>        #cpus = <1>;
> >>        #address-cells = <1>;
> >>        #size-cells = <0>;
> >>
> >> If these used some other symbol instead of '#' cpp will be happy and
> >> we can use it to create macros for us.
> >
> > Yeah, we're not going to be able to change those; they
> > are "By The Book".
> 
> By what book?  It would seem to me that BNF for dtc is completely  
> under our control and if we want to change it we can.  I understand  
> that there is some correspondence to Open Firmware, but it seems that  
> if its people are ok with the dts format changing that's a lot easier  
> than implementing tons of support in dtc for features that cpp gives us.
> 
> [I'm also guessing no one's really got time to go and implement these  
> features in dtc]
> 
cpp -x assembler-with-cpp seems to not produce the above errors, and still honours preprocessing directives like #define.  Don't know what else is messes with, and whether you want to add CPPFLAGS.

Kim

> > Instead, we'll have to make the lexical analysis conscious
> > of something like a <newline> context sensitive token or so.
> > Or throw some flag to cpp to not emit location markers.
> 
> - kumar

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

* Re: DTC/dts modifications
  2006-05-01 20:07         ` Kim Phillips
@ 2006-05-01 20:28           ` Kumar Gala
  2006-05-01 21:26             ` Segher Boessenkool
                               ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Kumar Gala @ 2006-05-01 20:28 UTC (permalink / raw)
  To: Kim Phillips; +Cc: linuxppc-dev, jdl


On May 1, 2006, at 3:07 PM, Kim Phillips wrote:

> On Mon, 1 May 2006 14:52:23 -0500
> Kumar Gala <galak@kernel.crashing.org> wrote:
>
>> [snip]
>>
>>>> Try running a current .dts through cpp today.  You will get errors
>>>> like:
>>>>
>>>> oftree.dts:15:3: error: invalid preprocessing directive #address
>>>
>>>> Because of props like:
>>>>
>>>>        #cpus = <1>;
>>>>        #address-cells = <1>;
>>>>        #size-cells = <0>;
>>>>
>>>> If these used some other symbol instead of '#' cpp will be happy  
>>>> and
>>>> we can use it to create macros for us.
>>>
>>> Yeah, we're not going to be able to change those; they
>>> are "By The Book".
>>
>> By what book?  It would seem to me that BNF for dtc is completely
>> under our control and if we want to change it we can.  I understand
>> that there is some correspondence to Open Firmware, but it seems that
>> if its people are ok with the dts format changing that's a lot easier
>> than implementing tons of support in dtc for features that cpp  
>> gives us.
>>
>> [I'm also guessing no one's really got time to go and implement these
>> features in dtc]
>>
> cpp -x assembler-with-cpp seems to not produce the above errors,  
> and still honours preprocessing directives like #define.  Don't  
> know what else is messes with, and whether you want to add CPPFLAGS.

Cool, here's an invocation that seems to work well.  Not sure what  
causes linux = 1 (thus I need the -U linux).  Also address the line  
information that is normally spit out.

cpp -U linux -P -x assembler-with-cpp foo.dts

With a 8349 dts I'm using I'm able to run it through cpp then dts and  
get the exact same dtb.

- kumar

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

* Re: DTC/dts modifications
  2006-05-01 20:28           ` Kumar Gala
@ 2006-05-01 21:26             ` Segher Boessenkool
  2006-05-01 22:00             ` Gabriel Paubert
  2006-05-01 22:59             ` Andreas Schwab
  2 siblings, 0 replies; 13+ messages in thread
From: Segher Boessenkool @ 2006-05-01 21:26 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, jdl

> Cool, here's an invocation that seems to work well.  Not sure what
> causes linux = 1 (thus I need the -U linux).  Also address the line
> information that is normally spit out.
>
> cpp -U linux -P -x assembler-with-cpp foo.dts

Try  -undef  instead.  You will *still* have some predefined
symbols, but at least all of those will have plenty of underscores.

It's still a really bad idea to run non-C code through the C
pre-processor; have you considered using m4 or similar instead?


Segher

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

* Re: DTC/dts modifications
  2006-05-01 20:28           ` Kumar Gala
  2006-05-01 21:26             ` Segher Boessenkool
@ 2006-05-01 22:00             ` Gabriel Paubert
  2006-05-01 22:59             ` Andreas Schwab
  2 siblings, 0 replies; 13+ messages in thread
From: Gabriel Paubert @ 2006-05-01 22:00 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, jdl

On Mon, May 01, 2006 at 03:28:34PM -0500, Kumar Gala wrote:
> 
> Cool, here's an invocation that seems to work well.  Not sure what  
> causes linux = 1 (thus I need the -U linux).  Also address the line  
> information that is normally spit out.
> 
> cpp -U linux -P -x assembler-with-cpp foo.dts

Try to add the -undef parameter:

`-undef'
     Do not predefine any system-specific or GCC-specific macros.  The
     standard predefined macros remain defined.

On this machine, the number of lines from:

cpp -dM -x assembler-with-cpp /dev/null

drops from 83 (among which linux, unix, PPC, and powerpc do not start
with underscores) to 5(!) when I add the -undef option. The only ones
left are:

#define __linux__ 1
#define __STDC_HOSTED__ 1
#define __unix__ 1
#define __gnu_linux__ 1
#define __ASSEMBLER__ 1

but at least they all have leading and trailing double underscores.

	Regards,
	Gabriel

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

* Re: DTC/dts modifications
  2006-05-01 19:39   ` Kumar Gala
  2006-05-01 19:45     ` Jon Loeliger
@ 2006-05-01 22:14     ` Paul Mackerras
  1 sibling, 0 replies; 13+ messages in thread
From: Paul Mackerras @ 2006-05-01 22:14 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev@ozlabs.org list, Jon Loeliger

Kumar Gala writes:

> Because of props like:
> 
>        #cpus = <1>;
>        #address-cells = <1>;
>        #size-cells = <0>;
> 
> If these used some other symbol instead of '#' cpp will be happy and  
> we can use it to create macros for us.

I think it will get really really confused if the dts says "$cpus = 1"
but that turns into a "#cpus" property.

There are other macro processors besides cpp, you know - why not look
at m4, for instance?

Paul.

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

* Re: DTC/dts modifications
  2006-05-01 20:28           ` Kumar Gala
  2006-05-01 21:26             ` Segher Boessenkool
  2006-05-01 22:00             ` Gabriel Paubert
@ 2006-05-01 22:59             ` Andreas Schwab
  2 siblings, 0 replies; 13+ messages in thread
From: Andreas Schwab @ 2006-05-01 22:59 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, jdl

Kumar Gala <galak@kernel.crashing.org> writes:

> Cool, here's an invocation that seems to work well.  Not sure what  
> causes linux = 1 (thus I need the -U linux).  Also address the line  
> information that is normally spit out.
>
> cpp -U linux -P -x assembler-with-cpp foo.dts

Try -undef, that removes all pre-defined macros.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: DTC/dts modifications
  2006-05-01 19:52       ` Kumar Gala
  2006-05-01 20:07         ` Kim Phillips
@ 2006-05-01 23:34         ` Benjamin Herrenschmidt
  2006-05-02  0:17           ` Segher Boessenkool
  1 sibling, 1 reply; 13+ messages in thread
From: Benjamin Herrenschmidt @ 2006-05-01 23:34 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev@ozlabs.org list, Jon Loeliger


> By what book?  It would seem to me that BNF for dtc is completely  
> under our control and if we want to change it we can.  I understand  
> that there is some correspondence to Open Firmware, but it seems that  
> if its people are ok with the dts format changing that's a lot easier  
> than implementing tons of support in dtc for features that cpp gives us.

What about just providing a way to escape them ? Something like \# would
do the trick

Ben

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

* Re: DTC/dts modifications
  2006-05-01 23:34         ` Benjamin Herrenschmidt
@ 2006-05-02  0:17           ` Segher Boessenkool
  0 siblings, 0 replies; 13+ messages in thread
From: Segher Boessenkool @ 2006-05-02  0:17 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev@ozlabs.org list, Jon Loeliger

>> By what book?  It would seem to me that BNF for dtc is completely
>> under our control and if we want to change it we can.  I understand
>> that there is some correspondence to Open Firmware, but it seems that
>> if its people are ok with the dts format changing that's a lot easier
>> than implementing tons of support in dtc for features that cpp  
>> gives us.
>
> What about just providing a way to escape them ? Something like \#  
> would
> do the trick

Nope, cpp won't eat that.


\#Segher

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

end of thread, other threads:[~2006-05-02  0:17 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-29 16:00 DTC/dts modifications Kumar Gala
2006-05-01 19:33 ` Jon Loeliger
2006-05-01 19:39   ` Kumar Gala
2006-05-01 19:45     ` Jon Loeliger
2006-05-01 19:52       ` Kumar Gala
2006-05-01 20:07         ` Kim Phillips
2006-05-01 20:28           ` Kumar Gala
2006-05-01 21:26             ` Segher Boessenkool
2006-05-01 22:00             ` Gabriel Paubert
2006-05-01 22:59             ` Andreas Schwab
2006-05-01 23:34         ` Benjamin Herrenschmidt
2006-05-02  0:17           ` Segher Boessenkool
2006-05-01 22:14     ` Paul Mackerras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).