mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 13:18:50 +08:00
fdt: add libfdt support
Signed-off-by: liaoao <liaoao@xiaomi.com>
This commit is contained in:
parent
b185f8d889
commit
74dddfe92b
6 changed files with 128 additions and 0 deletions
2
libs/libc/.gitignore
vendored
2
libs/libc/.gitignore
vendored
|
@ -1,2 +1,4 @@
|
|||
/exec_symtab.c
|
||||
/modlib_symtab.c
|
||||
/dtc
|
||||
/dtc.zip
|
||||
|
|
|
@ -32,3 +32,4 @@ source "libs/libc/symtab/Kconfig"
|
|||
source "libs/libc/stream/Kconfig"
|
||||
source "libs/libc/regex/Kconfig"
|
||||
source "libs/libc/gpsutils/Kconfig"
|
||||
source "libs/libc/fdt/Kconfig"
|
||||
|
|
|
@ -68,6 +68,7 @@ include uuid/Make.defs
|
|||
include wchar/Make.defs
|
||||
include wctype/Make.defs
|
||||
include wqueue/Make.defs
|
||||
include fdt/Make.defs
|
||||
|
||||
# Use double delim to fix windows native build and give an error:
|
||||
# makefile:132: *** target mode do not include“%”. stop.
|
||||
|
|
44
libs/libc/fdt/CMakeLists.txt
Normal file
44
libs/libc/fdt/CMakeLists.txt
Normal file
|
@ -0,0 +1,44 @@
|
|||
# ##############################################################################
|
||||
# libs/libc/fdt/CMakeLists.txt
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
|
||||
# license agreements. See the NOTICE file distributed with this work for
|
||||
# additional information regarding copyright ownership. The ASF licenses this
|
||||
# file to you under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
#
|
||||
# ##############################################################################
|
||||
if(CONFIG_LIBFDT)
|
||||
|
||||
set(VERSION CONFIG_LIBFDT_DTC_VERSION)
|
||||
|
||||
FetchContent_Declare(
|
||||
dtc URL https://github.com/dgibson/dtc/archive/v$(VERSION).zip)
|
||||
FetchContent_Populate(dtc)
|
||||
FetchContent_GetProperties(dtc)
|
||||
|
||||
set(SRCS
|
||||
fdt.c
|
||||
fdt_ro.c
|
||||
fdt_wip.c
|
||||
fdt_sw.c
|
||||
fdt_rw.c
|
||||
fdt_strerror.c
|
||||
fdt_empty_tree.c
|
||||
fdt_addresses.c
|
||||
fdt_overlay.c
|
||||
fdt_check.c)
|
||||
list(TRANSFORM SRCS PREPEND ${dtc_SOURCE_DIR}/libfdt/)
|
||||
target_sources(c PRIVATE ${SRCS})
|
||||
|
||||
target_include_directories(c PRIVATE ${dtc_SOURCE_DIR}/libfdt)
|
||||
endif()
|
20
libs/libc/fdt/Kconfig
Normal file
20
libs/libc/fdt/Kconfig
Normal file
|
@ -0,0 +1,20 @@
|
|||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
config LIBFDT
|
||||
bool "Flattened Device Tree Library"
|
||||
default n
|
||||
---help---
|
||||
Enable or disable Flattened Device Tree Library features.
|
||||
|
||||
if LIBFDT
|
||||
|
||||
config LIBFDT_DTC_VERSION
|
||||
string "LIBFDT DTC Version"
|
||||
default "1.7.0"
|
||||
---help---
|
||||
Version of DTC source code to download from github.
|
||||
|
||||
endif # LIBFDT
|
60
libs/libc/fdt/Make.defs
Normal file
60
libs/libc/fdt/Make.defs
Normal file
|
@ -0,0 +1,60 @@
|
|||
############################################################################
|
||||
# libs/libc/fdt/Make.defs
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
ifeq ($(CONFIG_LIBFDT),y)
|
||||
|
||||
VERSION=$(CONFIG_LIBFDT_DTC_VERSION)
|
||||
|
||||
# Download and unpack tarball if no git repo found
|
||||
ifeq ($(wildcard dtc/.git),)
|
||||
dtc:
|
||||
$(call DOWNLOAD,https://github.com/dgibson/dtc/archive,v$(VERSION).zip,dtc.zip)
|
||||
$(Q) unzip -o dtc.zip
|
||||
$(Q) mv dtc-$(VERSION) dtc
|
||||
else
|
||||
dtc:
|
||||
endif
|
||||
|
||||
context:: dtc
|
||||
|
||||
CSRCS += fdt.c
|
||||
CSRCS += fdt_ro.c
|
||||
CSRCS += fdt_wip.c
|
||||
CSRCS += fdt_sw.c
|
||||
CSRCS += fdt_rw.c
|
||||
CSRCS += fdt_strerror.c
|
||||
CSRCS += fdt_empty_tree.c
|
||||
CSRCS += fdt_addresses.c
|
||||
CSRCS += fdt_overlay.c
|
||||
CSRCS += fdt_check.c
|
||||
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)libs$(DELIM)libc$(DELIM)dtc$(DELIM)libfdt$(DELIM)
|
||||
|
||||
VPATH += dtc/libfdt
|
||||
SUBDIRS += dtc/libfdt
|
||||
DEPPATH += --dep-path dtc/libfdt
|
||||
|
||||
distclean::
|
||||
ifeq ($(wildcard dtc/.git),)
|
||||
$(call DELDIR, dtc)
|
||||
$(call DELFILE, dtc.zip)
|
||||
endif
|
||||
|
||||
endif
|
Loading…
Reference in a new issue