From bdcd66c6f605e34736e46a85312f3bbb99b91113 Mon Sep 17 00:00:00 2001 From: liaoao Date: Thu, 3 Aug 2023 20:13:13 +0800 Subject: [PATCH] fdttools: add fdt utility tools Signed-off-by: liaoao --- system/fdt/Kconfig | 106 +++++++++++++++++++++++++++++++++++++++ system/fdt/Make.defs | 23 +++++++++ system/fdt/Makefile | 61 ++++++++++++++++++++++ system/fdt/version_gen.h | 28 +++++++++++ 4 files changed, 218 insertions(+) create mode 100644 system/fdt/Kconfig create mode 100644 system/fdt/Make.defs create mode 100644 system/fdt/Makefile create mode 100644 system/fdt/version_gen.h diff --git a/system/fdt/Kconfig b/system/fdt/Kconfig new file mode 100644 index 0000000000..6c81f5ba56 --- /dev/null +++ b/system/fdt/Kconfig @@ -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 diff --git a/system/fdt/Make.defs b/system/fdt/Make.defs new file mode 100644 index 0000000000..6958c01f9c --- /dev/null +++ b/system/fdt/Make.defs @@ -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 diff --git a/system/fdt/Makefile b/system/fdt/Makefile new file mode 100644 index 0000000000..38583caa86 --- /dev/null +++ b/system/fdt/Makefile @@ -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 diff --git a/system/fdt/version_gen.h b/system/fdt/version_gen.h new file mode 100644 index 0000000000..56fd9a32b3 --- /dev/null +++ b/system/fdt/version_gen.h @@ -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 */