-
Notifications
You must be signed in to change notification settings - Fork 7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dtlib: implement copy.deepcopy() for DT
The standard library copy module allows you to implement shallow and deep copies of objects. See its documentation for more details on these terms. Implementing copy.deepcopy() support for DT objects will allow us to "clone" devicetree objects in other classes. This in turn will enable new features, such as native system devicetree support, within the python-devicetree. It is also a pure feature extension which can't harm anything and is therefore safe to merge now, even if system devicetree is never adopted in Zephyr. Note that we are making use of the move from OrderedDict to regular dict to make this implementation more convenient. See https://github.com/devicetree-org/lopper/ for more information on system devicetree. We want to add system devicetree support to dtlib because it seems to be a useful way to model modern, heterogeneous SoCs than traditional devicetree, which can really only model a single CPU "cluster" within such an SoC. In order to create 'regular' devicetrees from a system devicetree, we will want a programming interface that does the following: 1. parse the system devicetree 2. receive the desired transformations on it 3. perform the desired transformations to make a 'regular' devicetree Step 3 can be done as a destructive modification on an object-oriented representation of a system devicetree, and that's the approach we will take in python-devicetree. It will therefore be convenient to have an efficient deepcopy implementation to be able to preserve the original system devicetree and the derived regular devicetree in memory in the same python process. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
- Loading branch information
1 parent
b1daf2a
commit ac9033a
Showing
2 changed files
with
219 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters