Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dts: Add new DTS/binding parser #17660

Merged
merged 3 commits into from
Jul 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@
/scripts/elf_helper.py @andrewboie
/scripts/sanity_chk/expr_parser.py @nashif
/scripts/gen_app_partitions.py @andrewboie
/scripts/dts/ @ulfalizer @galak
/arch/x86/gen_gdt.py @andrewboie
/arch/x86/gen_idt.py @andrewboie
/scripts/gen_kobject_list.py @andrewboie
Expand Down
32 changes: 28 additions & 4 deletions cmake/dts.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,39 @@ if(SUPPORTS_DTS)
message(FATAL_ERROR "command failed with return code: ${ret}")
endif()

#
# Run gen_defines.py to create a .conf file and a header file
#

set(CMD_NEW_EXTRACT ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/dts/gen_defines.py
--dts ${BOARD}.dts.pre.tmp
--bindings-dir ${DTS_ROOT_BINDINGS}
--conf-out ${GENERATED_DTS_BOARD_CONF}
--header-out ${GENERATED_DTS_BOARD_UNFIXED_H}
)

execute_process(
COMMAND ${CMD_NEW_EXTRACT}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
RESULT_VARIABLE ret
)
if(NOT "${ret}" STREQUAL "0")
message(FATAL_ERROR "new extractor failed with return code: ${ret}")
endif()

#
# Run extract_dts_includes.py (the older DT/binding parser) to generate some
# legacy identifiers (via --deprecated-only). This will go away later.
#

set(CMD_EXTRACT_DTS_INCLUDES ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/dts/extract_dts_includes.py
--deprecated-only
--dts ${BOARD}.dts_compiled
--yaml ${DTS_ROOT_BINDINGS}
--keyvalue ${GENERATED_DTS_BOARD_CONF}
--include ${GENERATED_DTS_BOARD_UNFIXED_H}
--include ${GENERATED_DTS_BOARD_UNFIXED_H}.deprecated
--old-alias-names
)

# Run extract_dts_includes.py to create a .conf and a header file that can be
# included into the CMake namespace
execute_process(
COMMAND ${CMD_EXTRACT_DTS_INCLUDES}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
Expand All @@ -179,4 +202,5 @@ if(SUPPORTS_DTS)

else()
file(WRITE ${GENERATED_DTS_BOARD_UNFIXED_H} "/* WARNING. THIS FILE IS AUTO-GENERATED. DO NOT MODIFY! */")
file(WRITE ${GENERATED_DTS_BOARD_UNFIXED_H}.deprecated "/* WARNING. THIS FILE IS AUTO-GENERATED. DO NOT MODIFY! */")
endif(SUPPORTS_DTS)
2 changes: 2 additions & 0 deletions include/generated_dts_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

#include <generated_dts_board_unfixed.h>

#include <generated_dts_board_unfixed.h.deprecated>

/* The following definitions fixup the generated include */

#include <generated_dts_board_fixups.h>
Expand Down
6 changes: 6 additions & 0 deletions scripts/dts/devicetree.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
# SPDX-License-Identifier: Apache-2.0
#

# NOTE: This file is part of the old device tree scripts, which will be removed
# later. They are kept to generate some legacy #defines via the
# --deprecated-only flag.
#
# The new scripts are gen_defines.py, edtlib.py, and dtlib.py.

# vim: ai:ts=4:sw=4

import sys
Expand Down
Loading