kconfig: load edt from edt.pickle

This saves time and avoids the need to pass additional state around in
the environment to recreate the edt exactly.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2020-07-01 12:17:02 -07:00 committed by Kumar Gala
commit 269f350487
2 changed files with 7 additions and 12 deletions

View file

@ -49,6 +49,7 @@ set(ENV{DTS_POST_CPP} ${DTS_POST_CPP})
set(ENV{DTS_ROOT_BINDINGS} "${DTS_ROOT_BINDINGS}")
set(ENV{TOOLCHAIN_KCONFIG_DIR} "${TOOLCHAIN_KCONFIG_DIR}")
set(ENV{EXTRA_DTC_FLAGS} ${EXTRA_DTC_FLAGS})
set(ENV{EDT_PICKLE} ${EDT_PICKLE})
# Allow out-of-tree users to add their own Kconfig python frontend
# targets by appending targets to the CMake list

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: Apache-2.0
import os
import pickle
import sys
ZEPHYR_BASE = os.environ.get("ZEPHYR_BASE")
@ -17,19 +18,12 @@ import edtlib
doc_mode = os.environ.get('KCONFIG_DOC_MODE') == "1"
if not doc_mode:
DTS_POST_CPP = os.environ["DTS_POST_CPP"]
BINDINGS_DIRS = os.environ.get("DTS_ROOT_BINDINGS")
DTC_FLAGS = os.environ.get("EXTRA_DTC_FLAGS")
EDT_PICKLE = os.environ.get("EDT_PICKLE")
if DTC_FLAGS is not None and "-Wno-simple_bus_reg" in DTC_FLAGS:
edt_warn_flag = False
else:
edt_warn_flag = True
# if a board port doesn't use DTS than these might not be set
if os.path.isfile(DTS_POST_CPP) and BINDINGS_DIRS is not None:
edt = edtlib.EDT(DTS_POST_CPP, BINDINGS_DIRS.split("?"),
warn_reg_unit_address_mismatch=edt_warn_flag)
# The "if" handles a missing dts.
if EDT_PICKLE is not None and os.path.isfile(EDT_PICKLE):
with open(EDT_PICKLE, 'rb') as f:
edt = pickle.load(f)
else:
edt = None