fdttools: add fdt utility tools

Signed-off-by: liaoao <liaoao@xiaomi.com>
This commit is contained in:
liaoao 2023-08-03 20:13:13 +08:00 committed by Xiang Xiao
parent 9abb0a2592
commit 126faafb6e
4 changed files with 218 additions and 0 deletions

106
system/fdt/Kconfig Normal file
View File

@ -0,0 +1,106 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config SYSTEM_FDT
bool
default n
---help---
Enable support for fdt utility tools.
if LIBFDT
config SYSTEM_FDTDUMP
bool "system fdtdump command"
default n
select SYSTEM_FDT
---help---
Enable fdtdump cmd.
if SYSTEM_FDTDUMP
config SYSTEM_FDTDUMP_STACKSIZE
int "fdtdump stack size"
default DEFAULT_TASK_STACKSIZE
---help---
The size of stack allocated for the fdtdump task.
config SYSTEM_FDTDUMP_PRIORITY
int "fdtdump priority"
default 100
---help---
The priority of the fdtdump task.
endif # SYSTEM_FDTDUMP
config SYSTEM_FDTGET
bool "system fdtget command"
default n
select SYSTEM_FDT
---help---
Enable fdtget cmd.
if SYSTEM_FDTGET
config SYSTEM_FDTGET_STACKSIZE
int "fdtget stack size"
default DEFAULT_TASK_STACKSIZE
---help---
The size of stack allocated for the fdtget task.
config SYSTEM_FDTGET_PRIORITY
int "fdtget priority"
default 100
---help---
The priority of the fdtget task.
endif # SYSTEM_FDTGET
config SYSTEM_FDTPUT
bool "system fdtput command"
default n
select SYSTEM_FDT
---help---
Enable fdtput cmd.
if SYSTEM_FDTPUT
config SYSTEM_FDTPUT_STACKSIZE
int "fdtput stack size"
default DEFAULT_TASK_STACKSIZE
---help---
The size of stack allocated for the fdtput task.
config SYSTEM_FDTPUT_PRIORITY
int "fdtput priority"
default 100
---help---
The priority of the fdtput task.
endif # SYSTEM_FDTPUT
config SYSTEM_FDTOVERLAY
bool "system fdtoverlay command"
default n
select SYSTEM_FDT
---help---
Enable fdtoverlay cmd.
if SYSTEM_FDTOVERLAY
config SYSTEM_FDTOVERLAY_STACKSIZE
int "fdtoverlay stack size"
default DEFAULT_TASK_STACKSIZE
---help---
The size of stack allocated for the fdtoverlay task.
config SYSTEM_FDTOVERLAY_PRIORITY
int "fdtoverlay priority"
default 100
---help---
The priority of the fdtoverlay task.
endif # SYSTEM_FDTOVERLAY
endif # LIBFDT

23
system/fdt/Make.defs Normal file
View File

@ -0,0 +1,23 @@
############################################################################
# apps/system/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.
#
############################################################################
ifneq ($(CONFIG_SYSTEM_FDT),)
CONFIGURED_APPS += $(APPDIR)/system/fdt
endif

61
system/fdt/Makefile Normal file
View File

@ -0,0 +1,61 @@
############################################################################
# apps/system/fdt/Makefile
#
# 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.
#
############################################################################
include $(APPDIR)/Make.defs
# Utility Tools
CSRCS = util.c
ifeq ($(CONFIG_SYSTEM_FDTDUMP),y)
MAINSRC += fdtdump.c
PROGNAME += fdtdump
STACKSIZE += $(CONFIG_SYSTEM_FDTDUMP_STACKSIZE)
PRIORITY += $(CONFIG_SYSTEM_FDTDUMP_PRIORITY)
endif
ifeq ($(CONFIG_SYSTEM_FDTGET),y)
MAINSRC += fdtget.c
PROGNAME += fdtget
STACKSIZE += $(CONFIG_SYSTEM_FDTGET_STACKSIZE)
PRIORITY += $(CONFIG_SYSTEM_FDTGET_PRIORITY)
endif
ifeq ($(CONFIG_SYSTEM_FDTPUT),y)
MAINSRC += fdtput.c
PROGNAME += fdtput
STACKSIZE += $(CONFIG_SYSTEM_FDTPUT_STACKSIZE)
PRIORITY += $(CONFIG_SYSTEM_FDTPUT_PRIORITY)
endif
ifeq ($(CONFIG_SYSTEM_FDTOVERLAY),y)
MAINSRC += fdtoverlay.c
PROGNAME += fdtoverlay
STACKSIZE += $(CONFIG_SYSTEM_FDTOVERLAY_STACKSIZE)
PRIORITY += $(CONFIG_SYSTEM_FDTOVERLAY_PRIORITY)
endif
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/system/fdt/
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)/libs/libc/dtc/libfdt/
VPATH += $(TOPDIR)/libs/libc/dtc/
DEPPATH += --dep-path $(TOPDIR)/libs/libc/dtc/
include $(APPDIR)/Application.mk

28
system/fdt/version_gen.h Normal file
View File

@ -0,0 +1,28 @@
/****************************************************************************
* apps/system/fdt/version_gen.h
*
* 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.
*
****************************************************************************/
#ifndef __SYSTEM_FDT_VERSION_GEN_H
#define __SYSTEM_FDT_VERSION_GEN_H
/* DTC Version should be same as that in nuttx/libs/libc/dtc/ */
#define DTC_VERSION ("DTC "CONFIG_LIBFDT_DTC_VERSION)
#endif /* __SYSTEM_FDT_VERSION_GEN_H */