1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00
freebsd/usr.bin/dtc/HACKING
David Chisnall af0dd31fc4 Import new (BSDL) device tree compiler. Now built by default, so that it can't
be used on the host system (and not installed on the device, if required).  The
GPL'd one is still available if there are any devices that need it (make
universe passes with it, including kernels that use fdt, but there may be some
out-of-tree ones).  WITH_GPL_DTC can be used to select the old one, for now.

Probably won't be MFC'd, but we'll remove the GPL'd version in head after the
new one has had a lot more testing and ship it in 10.0.
2013-01-22 17:49:51 +00:00

66 lines
2.5 KiB
Plaintext

$FreeBSD$
Notes for people hacking on dtc
===============================
This file contains some notes for people wishing to hack on dtc.
Upstreaming
-----------
This code is developed in the FreeBSD svn repository:
https://svn.freebsd.org/base/head/usr.bin/dtc
If you got the source from anywhere else and wish to make changes, please
ensure that you are working against the latest version, or you may end up
fixing bugs that are already fixed upstream. Although the license makes no
requirement that you share any improvements that you make, patches are very
welcome.
C++11
-----
This project currently aims to compile with g++ 4.2.1 and so doesn't make any
use of C++11 features. It would be a good idea to relax this restriction once
clang is the default compiler for ARM, MIPS and PowerPC.
This code makes use of a lot of iterator loops, which would be cleaner using
the new syntax in C++11. It also explicitly deletes a lot of objects held in
collections in destructors that have these collections as their members. This
could be simplified by using `shared_ptr`.
The code does make use of `static_assert()`, but uses a macro in utility.hh to
remove these if they are not supported. The FreeBSD standard headers also
define a compatibility macro the implements static asserts in terms of an array
with 1 element on success and -1 elements on failure.
Adding New Checks
-----------------
Currently, the biggest weakness of this version of the tool is that it lacks
most of the semantic checkers that can be implemented by simply reading the
ePAPR spec. The `checker` class provides a simple superclass for implementing
these quite easily. There are also helper methods on `device_tree` for finding
specific nodes, for checks that require some understanding of the structure of
the tree.
We should probably add a parent pointer to the `node` class for easily walking
up the tree.
Adding Direct C Output
----------------------
The FreeBSD build system currently uses dtc to generate a blob and then
converts this to C source code. A new `output_writer` subclass could easily
generate the C directly.
Parser Improvements
-------------------
There are a few FIXME lines in the parser for some corner cases that are not
currently used by FreeBSD. These are mainly related to labels in the middle of
values. These can be fixed by creating a new `property_value` with the
specified label, starting at the location of the label. Don't forget to remove
the associated comments from the BUGS section of the man page if you fix this.