-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scripts: extract_dts_includes.py: generate 'compatible' CONFIG flags
Generate CONFIG_DT_COMPAT flags using available nodes 'compatible' property. Store them in a bogus node_address key of defs dict so duplicates could be removed. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com> Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# | ||
# Copyright (c) 2018 Bobby Noelte | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
from extract.globals import * | ||
from extract.directive import DTDirective | ||
|
||
## | ||
# @brief Manage compatible directives. | ||
# | ||
# Handles: | ||
# - compatible | ||
# | ||
class DTCompatible(DTDirective): | ||
|
||
def __init__(self): | ||
pass | ||
|
||
## | ||
# @brief Extract compatible | ||
# | ||
# @param node_address Address of node owning the | ||
# compatible definition. | ||
# @param yaml YAML definition for the owning node. | ||
# @param prop compatible property name | ||
# @param names (unused) | ||
# @param def_label Define label string of node owning the | ||
# compatible definition. | ||
# | ||
def extract(self, node_address, yaml, prop, names, def_label): | ||
|
||
# compatible definition | ||
compatible = reduced[node_address]['props'][prop] | ||
if not isinstance(compatible, list): | ||
compatible = [compatible, ] | ||
|
||
for i, comp in enumerate(compatible): | ||
# Generate #define's | ||
compat_label = convert_string_to_label(str(comp)) | ||
compat_defs = 'CONFIG_DT_COMPAT_' + compat_label | ||
load_defs = { | ||
compat_defs: "", | ||
} | ||
insert_defs(node_address, load_defs, {}) | ||
|
||
## | ||
# @brief Management information for compatible. | ||
compatible = DTCompatible() |
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