Commit graph

62 commits

Author SHA1 Message Date
David Gibson
c4cb12e193 Alter grammar to allow multiple /dts-v1/ tags
This patch allows dtc to accept multiple /dts-v1/ tags (provided they're
all at the beginning of the input), rather than giving a syntax error.

This makes it more convenient to include one .dts file from another without
having to be careful that the /dts-v1/ tag is in exactly one of them.

We a couple of existing testcases to take advantage of this, which
simplifies them slightly.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-05-27 15:21:04 +10:00
David Gibson
b06e55c88b Prevent crash on modulo by zero
1937095 "Prevent crash on division by zero" fixed a crash when attempting
a division by zero using the / operator in a dts.  However, it missed the
precisely equivalent crash with the % (modulus) operator.  This patch fixes
the oversight.

Reported-by: Anton Blanchard <anton@samba.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-01-12 19:27:25 +11:00
David Gibson
1937095588 Prevent crash on division by zero
Currently, attempting to divide by zero in an integer expression in a dts
file will cause dtc to crash with a division by zero (SIGFPE).

This patch corrects this to properly detect this case and raise an error.

Reported-by: Anton Blanchard <anton@samba.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-01-03 22:27:32 +11:00
Nikhil Devshatwar
3346e065aa dtc: parser: Add label while overriding nodes
This patch changes the dtc grammar to allow following syntax

i2cexp: &i2c2 {
    ...
};

Current device tree compiler allows to define multiple labels when defining
the device node the first time. Typically device nodes are defined in
DTSI files. Now these nodes can be overwritten for updating some of the
properties. Typically, device nodes are overridden in DTS files.

When working with adapter boards, most of the time adapter board can fit to
multiple base boards. But depending on which base board it is connected to,
the devices on the adapter board would be children of different devices.

e.g. On dra7-evm.dts, i2c2 is exported for expansion connector whereas
on dra72-evm.dts, i2c5 is exported for expansion connector.
This causes a problem when writing a generic device tree file for
the adapter board. Because, you cannot know whether all the devices on
adapter board are present on i2c or i2c5.

The problem can be solved by adding a common label (e.g. i2cexp) in both
of the DTS files when overriding the device nodes for i2c2 or i2c5.
This way, generic adapter board file would override the i2cexp. And
depending on which base board you use the adapter board, all the devices
are automatically added for correct device nodes.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2015-02-23 12:29:36 +11:00
David Gibson
aba74ddba2 Remove references to unused DT_BASE token
Also remove the cbase bison union member that was only used for it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2014-02-15 19:47:23 +11:00
David Gibson
fa3f3f0ebd Clean up parser error messages
Generally edit parser error messages for brevity and clarity.  Replace
the print_error() function with a a new macro for brevity and clarity in
the source.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2014-01-04 10:04:20 +11:00
David Gibson
c854434dc2 Correct locations in parser error messaes
The print_error() function used in several places in the parser uses the
location information in yylloc to describe the location of the error.
This is not correct in most cases.  yylloc gives the location of the
lookahead token, whereas the error is generally associated with one of
the already parsed non-terminals.

This patch corrects this, adding a location parameter to print_error() and
supplying it with the appropriate bison @N symbols.

This probably breaks yacc compatiblity, but too bad - accurate error
messages are more important.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2014-01-04 10:04:20 +11:00
David Gibson
6a15eb2350 Die on failed /incbin/ seeks
Failing to open an input file, with /include/ or /incbin/ is treated as
immediately fatal inside srcfile_relative_open().  However, filing to
seek() to the requested offset in an /incbin/ is not.  This is a bit oddly
inconsistent, and leaves us with a strange case that's awkward to deal with
down the line.

So, get rid of it and have failed seeks on an /incbin/ be immediately
fatal.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2014-01-04 10:04:19 +11:00
David Gibson
cfc6523619 Move character literal processing to the lexer
To match the processing of integer literals, character literals are passed
as a string from lexer to parser then interpreted there.  This is just as
awkward as it was for integer literals, without the excuse that we used to
need the information about the dts version to process them correctly.

So, move character literal processing back to the lexer as well, cleaning
things up.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2014-01-04 10:03:55 +11:00
David Gibson
b82b977614 Move integer literal processing back to the lexer
At the moment integer literals are passed from the lexer to the parser as
a string, where it's evaluated into an integer by eval_literal().  That
strange approach happened because we needed to know whether we were
processing dts-v0 or dts-v1 - only known at the parser level - to know
how to interpret the literal properly.

dts-v0 support has been gone for some time now, and the base and bits
parameters to eval_literal() are essentially useless.

So, clean things up by moving the literal interpretation back to the lexer.
This also introduces a new lexical_error() function to report malformed
literals and set the treesource_error flag so that they'll cause a parse
failure at the top level.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2014-01-03 20:00:01 +11:00
David Gibson
0e2d399225 Make srcpos_{v,}error() more widely useful
Allow them to take a prefix argument giving the general type of error,
which will be useful in future.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2014-01-01 23:27:31 +11:00
David Gibson
17625371ee Use stdbool more widely
We already use the C99 bool type from stdbool.h in a few places.  However
there are many other places we represent boolean values as plain ints.
This patch changes that.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2013-10-28 21:06:53 +11:00
Stephen Warren
45013d8619 dtc: Add ability to delete nodes and properties
dtc currently allows the contents of properties to be changed, and the
contents of nodes to be added to. There are situations where removing
properties or nodes may be useful. This change implements the following
syntax to do that:

    / {
        /delete-property/ propname;
        /delete-node/ nodename;
    };

or:

    /delete-node/ &noderef;

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
2012-09-06 07:51:43 -05:00
Stephen Warren
5f0c3b2d62 dtc: Basic integer expressions
Written by David Gibson <david@gibson.dropbear.id.au>. Additions by me:
* Ported to ToT dtc.
* Renamed cell to integer throughout.
* Implemented value range checks.
* Allow U/L/UL/LL/ULL suffix on literals.
* Enabled the commented test.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
2012-04-09 08:42:05 -05:00
Anton Staaf
033089f290 dtc: Add support for variable sized elements
Elements of size 8, 16, 32, and 64 bits are supported.  The new
/bits/ syntax was selected so as to not pollute the reserved
keyword space with uint8/uint16/... type names.

With this patch the following property assignment:

    property = /bits/ 16 <0x1234 0x5678 0x0 0xffff>;

is equivalent to:

    property = <0x12345678 0x0000ffff>;

It is now also possible to directly specify a 64 bit literal in a
cell list, also known as an array using:

    property = /bits/ 64 <0xdeadbeef00000000>;

It is an error to attempt to store a literal into an element that is
too small to hold the literal, and the compiler will generate an
error when it detects this.  For instance:

    property = /bits/ 8 <256>;

Will fail to compile.  It is also an error to attempt to place a
reference in a non 32-bit element.

The documentation has been changed to reflect that the cell list
is now an array of elements that can be of sizes other than the
default 32-bit cell size.

The sized_cells test tests the creation and access of 8, 16, 32,
and 64-bit sized elements.  It also tests that the creation of two
properties, one with 16 bit elements and one with 32 bit elements
result in the same property contents.

Signed-off-by: Anton Staaf <robotboy@chromium.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
2011-10-11 12:58:30 -05:00
Anton Staaf
a4ea2fa951 dtc: Support character literals in cell lists
With this patch the following property assignment:

    property = <0x12345678 'a' '\r' 100>;

is equivalent to:

    property = <0x12345678 0x00000061 0x0000000D 0x00000064>

Signed-off-by: Anton Staaf <robotboy@chromium.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
2011-09-22 09:24:31 -05:00
John Bonesio
73ae43ea44 Allow nodes to be referenced by path at the top level.
When nodes are modified by merging device trees, nodes to be updated/merged can
be specified by a label. Specifying nodes by full path (instead of label)
doesn't quite work. This patch fixes that.

Signed-off-by: John Bonesio <bones@secretlab.ca>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
2010-11-13 14:44:06 -06:00
John Bonesio
c0fa2e6d4e Create new and use new print_error that uses printf style formatting.
yyerror is meant to be called by the parser internal code, and it's interface
is limited. Instead create and call a new error message routine that allows
formatted strings to be used.

yyerror uses the new routine so error formatting remains consistent.

Signed-of-by: John Bonesio <bones@secretlab.ca>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-10-20 22:36:53 -06:00
David Gibson
8773e12fa9 Add merging of labelled subnodes. This patch allows the following
syntax:

/ {
	child {
		label: subchild {
		};
	};
};

&label {
	prop = "value";
};

which will result in the following tree:

/ {
	child {
		label: subchild {
			prop = "value";
		};
	};
};

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-09-21 10:15:51 -05:00
Grant Likely
83da1b2a4e Allow device tree to be modified by additonal device tree sections
This patch allows the following construct:

/ {
	property-a = "old";
	property-b = "does not change";
};

/ {
	property-a = "changed";
	property-c = "new";
	node-a {
	};
};

Where the later device tree overrides the properties found in the
earlier tree.  This is useful for laying down a template device tree
in an include file and modifying it for a specific board without having
to clone the entire tree.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-02-25 11:46:01 -06:00
David Gibson
05898c67c1 dtc: Allow multiple labels on nodes and properties
At present, both the grammar and our internal data structures mean
that there can be only one label on a node or property.  This is a
fairly arbitrary constraint, given that any number of value labels can
appear at the same point, and that in C you can have any number of
labels on the same statement.

This is pretty much a non-issue now, but it may become important with
some of the extensions that Grant and I have in mind.  It's not that
hard to change, so this patch does so, allowing an arbitrary number of
labels on any given node or property.  As usual a testcase is added
too.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
2010-02-24 08:48:51 -06:00
David Gibson
15ad6d862e dtc: Automatically pick a sensible boot_cpuid_phys
Currently, when in -Idts -Odtb or -Ifs -Odtb modes, dtc always
defaults to using 0 as the value for the boot_cpuid_phys header field.
That's correct quite often, but there are some systems where there is
no CPU with hardware ID of 0, or where we don't want to use the CPU
with hardware ID 0 at all (e.g. for AMP-style partitioning).  The only
way to override this default currently, is with the -b command line
option.

This patch improves dtc to instead base the default boot_cpuid_phys
value on the reg property of the first listed subnode of /cpus.  This
means that dtc will get boot_cpuid_phys correct by default in a
greater proportion of cases (since the boot cpu is usually listed
first, and this way at least the boot_cpuid_phys default will match
some existing cpu node).  If the node doesn't exist or has an invalid
'reg' property (missing or not 4 bytes in length), then
boot_cpuid_phys is set to 0.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2010-02-19 08:36:23 -06:00
Lukasz Wojcik
5c8d2e2b57 Modification of lexer and parser, improving dtc portability.
This mod allows successful build of dtc using both bison/flex and yacc/lex.

Signed-off-by: Lukasz Wojcik <zbr@semihalf.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
2010-02-08 09:29:52 -06:00
David Gibson
d68cb36b0b dtc: Simpler interface to source file management
This patch cleans up our handling of input files, particularly dts
source files, but also (to an extent) other input files such as those
used by /incbin/ and those used in -I dtb and -I fs modes.

We eliminate the current clunky mechanism which combines search paths
(which we don't actually use at present) with the open relative to
current source file behaviour, which we do.

Instead there's a single srcfile_relative_open() entry point for
callers which opens a new input file relative to the current source
file (which the srcpos code tracks internally).  It doesn't currently
do search paths, but we can add that later without messing with the
callers, by drawing the search path from a global (which makes sense
anyway, rather than shuffling it around the rest of the processing
code).

That suffices for non-dts input files.  For the actual dts files,
srcfile_push() and srcfile_pop() wrappers open the file while also
keeping track of it as the current source file for future opens.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2010-01-14 07:52:25 -06:00
David Gibson
350c9cce9e Use yylloc instead of yyloc
yylloc is the correct way to get token positioning information.
yyloc is a bison internal variable that only works by accident.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2009-11-11 21:36:30 -06:00
Jon Loeliger
4e1a0a0129 Remove support for the legacy DTS source file format.
Now that all in-kernel-tree DTS files are properly /dts-v1/,
remove direct support for the older, un-numbered DTS
source file format.

Convert existing tests to /dts-v1/ and remove support
for the conversion tests themselves.

For now, though, the conversion tool still exists.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
2008-10-03 16:09:34 -05:00
Jon Loeliger
e5c8e1dcd7 Enhance source position implementation.
Implemented some print and copy routines.
Made empty srcpos objects that will be used later.
Protected .h file from multiple #include's.
Added srcpos_error() and srcpos_warn().

Signed-off-by: Jon Loeliger <jdl@freescale.com>
2008-10-03 15:38:08 -05:00
David Gibson
53359016ca dtc: Use stdint.h types throughout dtc
Currently, dtc defines Linux-like names for various fixed-size integer
types.  There's no good reason to do this; even Linux itself doesn't
use these names for externally visible things any more.  This patch
replaces these with the C99 standardized type names from stdint.h.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-07-14 12:07:19 -05:00
David Gibson
e37ec7d588 dtc: Add support for binary includes.
On Wed, Jun 04, 2008 at 09:26:23AM -0500, Jon Loeliger wrote:
> David Gibson wrote:
>
>> But as I said that can be dealt with in the future without breaking
>> compatibility.  Objection withdrawn.
>>
>
> And on that note, I officially implore Scott to
> re-submit his binary include patch!

Scott's original patch does still have some implementation details I
didn't like.  So in the interests of saving time, I've addressed some
of those, added a testcase, and and now resubmitting my revised
version of Scott's patch.

dtc: Add support for binary includes.

A property's data can be populated with a file's contents
as follows:

node {
	prop = /incbin/("path/to/data");
};

A subset of a file can be included by passing start and size parameters.
For example, to include bytes 8 through 23:

node {
	prop = /incbin/("path/to/data", 8, 16);
};

As with /include/, non-absolute paths are looked for in the directory
of the source file that includes them.

Implementation revised, and a testcase added by David Gibson

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Scott Wood <scottwood@freescale.com>
2008-06-19 10:01:14 -05:00
David Gibson
548767f42e dtc: Rework handling of boot_cpuid_phys
Currently, dtc will put the nonsense value 0xfeedbeef into the
boot_cpuid_phys field of an output blob, unless explicitly given
another value with the -b command line option.  As well as being a
totally unuseful default value, this also means that dtc won't
properly preserve the boot_cpuid_phys field in -I dtb -O dtb mode.

This patch reworks things to improve the boot_cpuid handling.  The new
semantics are that the output's boot_cpuid_phys value is:
	the value given on the command line if -b is used
otherwise
	the value from the input, if in -I dtb mode
otherwise
	0

Implementation-wise we do the following:
	- boot_cpuid_phys is added to struct boot_info, so that
structure now contains all of the blob's semantic information.
	- dt_to_blob() and dt_to_asm() output the cpuid given in
boot_info
	- dt_from_blob() fills in boot_info based on the input blob
	- The other dt_from_*() functions just record 0, but we can
change this easily if e.g. we invent a way of specifying the boot cpu
in the source format.
	- main() overrides the cpuid in the boot_info between input
and output if -b is given

We add some testcases to check this new behaviour.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-05-19 14:12:15 -05:00
David Gibson
6b8e05626a dtc: Make eval_literal() static
eval_literal() is used only in the parser, so make it a static
function.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-03-23 08:00:33 -05:00
Scott Wood
3c3ecaacda Remove \n from yyerror() call.
The \n is provided by yyerror().

Signed-off-by: Scott Wood <scottwood@freescale.com>
2008-01-07 09:20:29 -06:00
Scott Wood
ad4f54ae2b Return a non-zero exit code if an error occurs during dts parsing.
Previously, only failure to parse caused the reading of the tree to fail;
semantic errors that called yyerror() but not YYERROR only emitted a message,
without signalling make to stop the build.

Signed-off-by: Scott Wood <scottwood@freescale.com>
2008-01-04 08:21:54 -06:00
Scott Wood
910efac4b4 Look for include files in the directory of the including file.
Looking in the diretory dtc is invoked from is not very useful behavior.

As part of the code reorganization to implement this, I removed the
uniquifying of name storage -- it seemed a rather dubious optimization
given likely usage, and some aspects of it would have been mildly awkward
to integrate with the new code.

Signed-off-by: Scott Wood <scottwood@freescale.com>
2008-01-04 08:20:10 -06:00
Scott Wood
f77fe6a20e Add yyerrorf() for formatted error messages.
Signed-off-by: Scott Wood <scottwood@freescale.com>
2008-01-04 08:04:15 -06:00
David Gibson
efbbef8e4f dtc: Implement path references
This patch extends dtc syntax to allow references (&label, or
&{/full/path}) directly within property definitions, rather than
inside a cell list.  Such references are expanded to the full path of
the referenced node, as a string, instead of to a phandle as
references within cell lists are evaluated.

A testcase is also included.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-12-05 08:28:44 -06:00
David Gibson
c048102f5b dtc: Generate useful error message for properties after subnodes
On several occasions, I've accidentally put properties after subnodes
in a dts file.  I've then spent ages thinking that the resulting
syntax error was because of something else.

This patch arranges for this specific syntax error to generate a more
specific and useful error message.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-12-05 08:27:46 -06:00
David Gibson
dc941774e2 dtc: Merge refs and labels into single "markers" list (v2)
Currently, every 'data' object, used to represent property values, has
two lists of fixup structures - one for labels and one for references.
Sometimes we want to look at them separately, but other times we need
to consider both types of fixup.

I'm planning to implement string references, where a full path rather
than a phandle is substituted into a property value.  Adding yet
another list of fixups for that would start to get silly.  So, this
patch merges the "refs" and "labels" lists into a single list of
"markers", each of which has a type field indicating if it represents
a label or a phandle reference.  String references or any other new
type of in-data marker will then just need a new type value - merging
data blocks and other common manipulations will just work.

While I was at it I made some cleanups to the handling of fixups which
simplify things further.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-11-26 16:00:19 -06:00
David Gibson
9138db565a dtc: Switch dtc to C-style literals
dtc: Switch dtc to C-style literals

This patch introduces a new version of dts file, distinguished from
older files by starting with the special token /dts-v1/.  dts files in
the new version take C-style literals instead of the old bare hex or
OF-style base notation.  In addition, the "range" for of memreserve entries
(/memreserve/ f0000-fffff) is no longer recognized in the new format.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-11-08 11:14:07 -06:00
David Gibson
9ed27a2aac dtc: Simplify lexing/parsing of literals vs. node/property names
The current scheme of having CELLDATA and MEMRESERVE states to
recognize hex literals instead of node or property names is
arse-backwards.  The patch switches things around so that literals are
lexed in normal states, and property/node names are only recognized in
the special PROPNODENAME state, which is only entered after a { or a
;, and is left as soon as we scan a property/node name or a keyword.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-11-08 11:14:07 -06:00
David Gibson
f7497dc6be dtc: Don't force alignment of cell list data
At present, defining a property as, say:
	foo = [abcd], <ffffffff>;

Will cause dtc to insert 2 bytes of zeros between the abcd and the
ffffffff, to align the cell form data.

Doing so seemed like a good idea at the time, but I don't believe
there are any users who actually rely on this behaviour.  Segher
claims that OF has some defined bindings which include properties an
unaligned subsection of which is interpreted as 32-bit ints (i.e. like
cell data).

Worse, this alignment will cause nothing but pain when we add
expression support to dtc (when celldata is included in a larger
bytestring expession, we won't know the size of the preceding chunk of
the expression until it's evaluated, so we would have to carry
alignment fixup information right through the expression evaluation
process).

Therefore, this patch kills off this alignment behaviour.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-11-05 08:42:10 -06:00
Jon Loeliger
7b3fb789d2 DTC: Remove the need for the GLR Parser.
Previously, there were a few shift/reduce and reduce/reduce
errors in the grammar that were being handled by the not-so-popular
GLR Parser technique.

Flip a right-recursive stack-abusing rule into a left-recursive
stack-friendly rule and clear up three messes in one shot: No more
conflicts, no need for the GLR parser, and friendlier stackness.
Compensate by reversing the property list on the node.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-10-25 11:13:29 -05:00
Jon Loeliger
7dfba39a23 DTC: Remove an unneeded %token definition.
Signed-off-by: Jon Loeliger <jdl@freescale.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
2007-10-23 09:37:09 -05:00
Jon Loeliger
5641289a46 DTC: Minor grammar rule shuffle.
I like to see the basis cases established early in
the rule sets, so place  "empty" reduction first.
Purely cosmetic.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
2007-10-23 09:35:36 -05:00
Jon Loeliger
30807ca1ce Reformat grammar rules to not mix language syntax and yacc syntax.
Use consistent indenting on all rule actions.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
2007-10-22 11:40:51 -05:00
David Gibson
63dc9c7113 dtc: Whitespace cleanup
This large patch removes all trailing whitespace from dtc (including
libfdt, the testsuite and documentation).  It also removes a handful
of redundant blank lines (at the end of functions, or when there are
two blank lines together for no particular reason).

As well as anything else, this means that quilt won't whinge when I go
to convert the whole of libfdt into a patch to apply to the kernel.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-09-18 09:43:26 -05:00
Milton Miller
6a99b13132 dtc: implement labels on property data
Extend the parser grammer to allow labels before or after any
property data (string, cell list, or byte list), and any
byte or cell within the property data.

Store the labels using the same linked list structure as node
references, but using a parallel list.

When writing assembly output emit global labels as offsets from
the start of the definition of the data.

Note that the alignment for a cell list is done as part of the
opening < delimiter, not the = or , before it.  To label a cell
after a string or byte list put the label inside the cell list.

For example,
	prop = zero: [ aa bb ], two: < four: 1234 > eight: ;
will produce labels with offsets 0, 2, 4, and 8 bytes from
the beginning of the data for property prop.

Signed-off-by: Milton Miller <miltonm@bga.com>
2007-07-07 10:13:31 -05:00
Milton Miller
d429033851 dtc: implement labels on memory reserve slots
Allow a label to be placed on a memory reserve entry.
Change the parser to recognize and store them.  Emit
them when writing assembly output.

Signed-off-by: Milton Miller <miltonm@bga.com>
2007-07-07 10:09:31 -05:00
Milton Miller
85ab5cc6ec dtc: complain about unparsed digits in cell lists
Check that strtoul() parsed the complete string.

As with the number overflow case, write a non-fatal error
message to stdout.

Signed-off-by: Milton Miller <miltonm@bga.com>
2007-07-07 10:07:44 -05:00
Milton Miller
6d7b222430 dtc: move declaration of yyerror
yyerror() is used by both dtc-parser.y and dtc-lexer.l, so move
the declaration to srcpos.h.

Signed-off-by: Milton Miller <miltonm@bga.com>
2007-07-07 10:07:27 -05:00