Commit fe1ab6fe authored by Federico Vaga's avatar Federico Vaga

add kconfig support for firmware (and general building improvements)

parents f240f4ce 7546f7be
......@@ -2,3 +2,6 @@
*.bin
*.elf
*.d
build/
.config
.config.old
......@@ -3,11 +3,12 @@ DIRS := hello_world
DIRS += hello_world_framework
DIRS += alarm_clock
DIRS += data_generator
DIRS += fmc-svec-carrier/software
all clean modules install modules_install: $(DIRS)
all clean cleanall modules install modules_install: $(DIRS)
clean: TARGET = clean
cleanall: TARGET = cleanall
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
......@@ -16,5 +17,5 @@ $(DIRS):
$(MAKE) -C $@ $(TARGET)
.PHONY: all clean modules install modules_install
.PHONY: all clean cleanall modules install modules_install
.PHONY: $(DIRS)
......@@ -2,9 +2,10 @@
DIRS += firmware
all clean modules install modules_install: $(DIRS)
all clean cleanall modules install modules_install: $(DIRS)
clean: TARGET = clean
cleanall: TARGET = cleanall
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
......@@ -13,5 +14,5 @@ $(DIRS):
$(MAKE) -C $@ $(TARGET)
.PHONY: all clean modules install modules_install
.PHONY: all clean cleanall modules install modules_install
.PHONY: $(DIRS)
......@@ -2,15 +2,21 @@
DIRS := fw-01
all clean modules install modules_install: $(DIRS)
all clean cleanall modules install modules_install: $(DIRS)
clean: TARGET = clean
cleanall: TARGET = cleanall
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
$(DIRS):
DOT-CONFIGS = $(addsuffix /.config,$(DIRS))
$(DIRS): $(DOT-CONFIGS)
$(MAKE) -C $@ $(TARGET)
.PHONY: all clean modules install modules_install
$(DOT-CONFIGS):
$(MAKE) -C $(@D) defconfig
.PHONY: all clean cleanall modules install modules_install
.PHONY: $(DIRS)
mainmenu "alarm_clock demo configuration"
comment "Project specific configuration"
config FPGA_APPLICATION_ID
int "FPGA application ID"
default 0
help
Help text
config RT_APPLICATION_ID
int "RT application ID"
default 0
help
Help text
# include Mock Turtle's Kconfig
source "Kconfig.mt"
......@@ -4,15 +4,4 @@ OUTPUT = fw-ac
TRTL ?= ../../../../
TRTL_SW = $(TRTL)/software
EXTRA_CFLAGS += -DFPGA_APPLICATION_ID=0x0
EXTRA_CFLAGS += -DRT_APPLICATION_ID=0x0
MOCKTURTLE_LIBRARY_PRINT_ENABLE := 1
# Firmware Libray configuration
MOCKTURTLE_FRAMEWORK_ENABLE := 1
MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE := 1
MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE := 0
MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE := 1
MOCKTURTLE_FRAMEWORK_32BIT_ALIGN := 1
include $(TRTL_SW)/rt/Makefile
#
# Automatically generated file; DO NOT EDIT.
# alarm_clock demo configuration
#
#
# Project specific configuration
#
CONFIG_FPGA_APPLICATION_ID=0
CONFIG_RT_APPLICATION_ID=0
#
# Mock Turtle configuration
#
#
# Mock Turtle framework configuration
#
CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE=y
# CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE is not set
CONFIG_MOCKTURTLE_FRAMEWORK_32BIT_ALIGN=y
#
# Mock Turtle library configuration
#
CONFIG_MOCKTURTLE_LIBRARY_PRINT_ENABLE=y
# CONFIG_MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE is not set
# CONFIG_MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE is not set
......@@ -75,8 +75,8 @@ static struct rt_variable variables[] = {
static struct rt_application app = {
.name = "alarm-clk",
.version = {
.fpga_id = FPGA_APPLICATION_ID,
.rt_id = RT_APPLICATION_ID,
.fpga_id = CONFIG_FPGA_APPLICATION_ID,
.rt_id = CONFIG_RT_APPLICATION_ID,
.rt_version = RT_VERSION(0, 1),
.git_version = GIT_VERSION
},
......
......@@ -2,9 +2,10 @@
DIRS += firmware
all clean modules install modules_install: $(DIRS)
all clean cleanall modules install modules_install: $(DIRS)
clean: TARGET = clean
cleanall: TARGET = cleanall
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
......@@ -13,5 +14,5 @@ $(DIRS):
$(MAKE) -C $@ $(TARGET)
.PHONY: all clean modules install modules_install
.PHONY: all clean cleanall modules install modules_install
.PHONY: $(DIRS)
......@@ -2,15 +2,21 @@
DIRS := fw-01
all clean modules install modules_install: $(DIRS)
all clean cleanall modules install modules_install: $(DIRS)
clean: TARGET = clean
cleanall: TARGET = cleanall
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
$(DIRS):
DOT-CONFIGS = $(addsuffix /.config,$(DIRS))
$(DIRS): $(DOT-CONFIGS)
$(MAKE) -C $@ $(TARGET)
.PHONY: all clean modules install modules_install
$(DOT-CONFIGS):
$(MAKE) -C $(@D) defconfig
.PHONY: all clean cleanall modules install modules_install
.PHONY: $(DIRS)
mainmenu "data_generator demo configuration"
comment "Project specific configuration"
config FPGA_APPLICATION_ID
int "FPGA application ID"
default 0
help
Help text
config RT_APPLICATION_ID
int "RT application ID"
default 0
help
Help text
# include Mock Turtle's Kconfig
source "Kconfig.mt"
......@@ -4,17 +4,4 @@ OUTPUT = fw-dg
TRTL ?= ../../../../
TRTL_SW = $(TRTL)/software
EXTRA_CFLAGS += -DFPGA_APPLICATION_ID=0x0
EXTRA_CFLAGS += -DRT_APPLICATION_ID=0x0
MOCKTURTLE_LIBRARY_PRINT_ENABLE := 1
MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE := 1
MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE := 1
# Firmware Libray configuration
MOCKTURTLE_FRAMEWORK_ENABLE := 1
MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE := 1
MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE := 1
MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE := 1
MOCKTURTLE_FRAMEWORK_32BIT_ALIGN := 1
include $(TRTL_SW)/rt/Makefile
#
# Automatically generated file; DO NOT EDIT.
# data_generator demo configuration
#
#
# Project specific configuration
#
CONFIG_FPGA_APPLICATION_ID=0
CONFIG_RT_APPLICATION_ID=0
#
# Mock Turtle configuration
#
#
# Mock Turtle framework configuration
#
CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_32BIT_ALIGN=y
#
# Mock Turtle library configuration
#
CONFIG_MOCKTURTLE_LIBRARY_PRINT_ENABLE=y
CONFIG_MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE=y
CONFIG_MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE=y
......@@ -79,8 +79,8 @@ struct rt_buffer buffers[] = {
static struct rt_application app = {
.name = "data-gen",
.version = {
.fpga_id = FPGA_APPLICATION_ID,
.rt_id = RT_APPLICATION_ID,
.fpga_id = CONFIG_FPGA_APPLICATION_ID,
.rt_id = CONFIG_RT_APPLICATION_ID,
.rt_version = RT_VERSION(0, 1),
.git_version = GIT_VERSION
},
......
......@@ -4,9 +4,10 @@ DIRS += tools
DIRS += firmware
all clean modules install modules_install: $(DIRS)
all clean cleanall modules install modules_install: $(DIRS)
clean: TARGET = clean
cleanall: TARGET = cleanall
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
......@@ -15,5 +16,5 @@ $(DIRS):
$(MAKE) -C $@ $(TARGET)
.PHONY: all clean modules install modules_install
.PHONY: all clean cleanall modules install modules_install
.PHONY: $(DIRS)
\ No newline at end of file
......@@ -2,15 +2,21 @@
DIRS := fw-01 fw-02
all clean modules install modules_install: $(DIRS)
all clean cleanall modules install modules_install: $(DIRS)
clean: TARGET = clean
cleanall: TARGET = cleanall
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
$(DIRS):
DOT-CONFIGS = $(addsuffix /.config,$(DIRS))
$(DIRS): $(DOT-CONFIGS)
$(MAKE) -C $@ $(TARGET)
.PHONY: all clean modules install modules_install
$(DOT-CONFIGS):
$(MAKE) -C $(@D) defconfig
.PHONY: all clean cleanall modules install modules_install
.PHONY: $(DIRS)
mainmenu "fmc-svec-carrier fw-01 demo configuration"
comment "Project specific configuration"
# include Mock Turtle's Kconfig
source "Kconfig.mt"
include ../../../project.mk
OBJS = fw-svec.o
OBJS += ../common/fw-svec-smem-code.o
OBJS += common/fw-svec-smem-code.o
OBJDIR += common
OUTPUT = fw-svec-1
TRTL ?= ../../../../../
TRTL_SW = $(TRTL)/software
......@@ -11,15 +12,6 @@ EXTRA_CFLAGS += -I../common
EXTRA_CFLAGS += -DFPGA_APPLICATION_ID=APPLICATION_ID
EXTRA_CFLAGS += -DRT_APPLICATION_ID=$(RT_APPLICATION_ID_CPU1)
MOCKTURTLE_LIBRARY_PRINT_ENABLE := 1
MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE := 1
MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE := 1
# Firmware Libray configuration
MOCKTURTLE_FRAMEWORK_ENABLE := 0
MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE := 0
MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE := 0
MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE := 0
MOCKTURTLE_FRAMEWORK_32BIT_ALIGN := 0
vpath %.c ../
include $(TRTL_SW)/rt/Makefile
#
# Automatically generated file; DO NOT EDIT.
# fmc-svec-carrier fw-01 demo configuration
#
#
# Project specific configuration
#
#
# Mock Turtle configuration
#
#
# Mock Turtle framework configuration
#
# CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE is not set
#
# Mock Turtle library configuration
#
CONFIG_MOCKTURTLE_LIBRARY_PRINT_ENABLE=y
CONFIG_MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE=y
CONFIG_MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE=y
mainmenu "fmc-svec-carrier fw-02 demo configuration"
comment "Project specific configuration"
# include Mock Turtle's Kconfig
source "Kconfig.mt"
include ../../../project.mk
OBJS = fw-svec.o
OBJS += ../common/fw-svec-smem-code.o
OBJS += common/fw-svec-smem-code.o
OBJDIR += common
OUTPUT = fw-svec-2
TRTL ?= ../../../../../
TRTL_SW = $(TRTL)/software
......@@ -12,15 +13,6 @@ EXTRA_CFLAGS += -DFPGA_APPLICATION_ID=$(APPLICATION_ID)
EXTRA_CFLAGS += -DRT_APPLICATION_ID=$(RT_APPLICATION_ID_CPU2)
EXTRA_CFLAGS += -DLIBRT_DEBUG_VERBOSE -DLIBRT_DEBUG
MOCKTURTLE_LIBRARY_PRINT_ENABLE := 1
MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE := 1
MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE := 1
# Firmware Libray configuration
MOCKTURTLE_FRAMEWORK_ENABLE := 1
MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE := 1
MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE := 1
MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE := 1
MOCKTURTLE_FRAMEWORK_32BIT_ALIGN := 0
vpath %.c ../
include $(TRTL_SW)/rt/Makefile
#
# Automatically generated file; DO NOT EDIT.
# fmc-svec-carrier fw-02 demo configuration
#
#
# Project specific configuration
#
#
# Mock Turtle configuration
#
#
# Mock Turtle framework configuration
#
CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE=y
# CONFIG_MOCKTURTLE_FRAMEWORK_32BIT_ALIGN is not set
#
# Mock Turtle library configuration
#
CONFIG_MOCKTURTLE_LIBRARY_PRINT_ENABLE=y
CONFIG_MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE=y
CONFIG_MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE=y
libsvec.o: libsvec.c /acc/sys/L866/usr/include/stdlib.h \
/acc/sys/L866/usr/include/features.h \
/acc/sys/L866/usr/include/sys/cdefs.h \
/acc/sys/L866/usr/include/bits/wordsize.h \
/acc/sys/L866/usr/include/gnu/stubs.h \
/acc/sys/L866/usr/include/gnu/stubs-64.h \
/acc/sys/L866/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include/stddef.h \
/acc/sys/L866/usr/include/bits/waitflags.h \
/acc/sys/L866/usr/include/bits/waitstatus.h \
/acc/sys/L866/usr/include/endian.h \
/acc/sys/L866/usr/include/bits/endian.h \
/acc/sys/L866/usr/include/bits/byteswap.h \
/acc/sys/L866/usr/include/sys/types.h \
/acc/sys/L866/usr/include/bits/types.h \
/acc/sys/L866/usr/include/bits/typesizes.h \
/acc/sys/L866/usr/include/time.h /acc/sys/L866/usr/include/sys/select.h \
/acc/sys/L866/usr/include/bits/select.h \
/acc/sys/L866/usr/include/bits/sigset.h \
/acc/sys/L866/usr/include/bits/time.h \
/acc/sys/L866/usr/include/sys/sysmacros.h \
/acc/sys/L866/usr/include/bits/pthreadtypes.h \
/acc/sys/L866/usr/include/alloca.h /acc/sys/L866/usr/include/unistd.h \
/acc/sys/L866/usr/include/bits/posix_opt.h \
/acc/sys/L866/usr/include/bits/environments.h \
/acc/sys/L866/usr/include/bits/confname.h \
/acc/sys/L866/usr/include/getopt.h /acc/sys/L866/usr/include/errno.h \
/acc/sys/L866/usr/include/bits/errno.h \
/acc/sys/L866/usr/include/linux/errno.h \
/acc/sys/L866/usr/include/asm/errno.h \
/acc/sys/L866/usr/include/asm-generic/errno.h \
/acc/sys/L866/usr/include/asm-generic/errno-base.h \
../../../..//software/lib/libmockturtle.h \
/acc/sys/L866/usr/include/string.h /acc/sys/L866/usr/include/xlocale.h \
/acc/sys/L866/usr/include/bits/string.h \
/acc/sys/L866/usr/include/bits/string2.h \
/acc/sys/L866/usr/include/stdint.h \
/acc/sys/L866/usr/include/bits/wchar.h /acc/sys/L866/usr/include/stdio.h \
/acc/sys/L866/usr/include/libio.h /acc/sys/L866/usr/include/_G_config.h \
/acc/sys/L866/usr/include/wchar.h \
/acc/sys/L866/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include/stdarg.h \
/acc/sys/L866/usr/include/bits/stdio_lim.h \
/acc/sys/L866/usr/include/bits/sys_errlist.h \
/acc/sys/L866/usr/include/bits/stdio.h /acc/sys/L866/usr/include/poll.h \
/acc/sys/L866/usr/include/sys/poll.h \
/acc/sys/L866/usr/include/bits/poll.h \
../../../..//software/include/mockturtle-common.h \
../../../..//software/include/mockturtle.h libsvec-internal.h libsvec.h \
../include/svec-common.h
......@@ -35,6 +35,8 @@ $(LIB): $(LOBJ)
clean:
rm -f $(LIB) .depend *.o *~
cleanall: clean
.depend: Makefile $(wildcard *.c *.h)
$(CC) $(CFLAGS) -M $(LOBJ:.o=.c) -o $@
......
......@@ -28,7 +28,10 @@ install:
install -d $(DESTDIR)/bin
install -D $(PROGS) $(DESTDIR)/bin
mockturtle-svec: $(TRTL_SW)/lib/libmockturtle.a
$(TRTL_SW)/lib/libmockturtle.a:
$(MAKE) -C $(@D)
# TODO add rules to compile your programs
......@@ -39,4 +42,6 @@ modules_install:
clean:
rm -f $(PROGS) *.o *~
.PHONY: all, clean
cleanall: clean
.PHONY: all clean cleanall
-include Makefile.specific
DIRS := firmware
DIRS += firmware
all clean modules install modules_install: $(DIRS)
all clean cleanall modules install modules_install: $(DIRS)
clean: TARGET = clean
cleanall: TARGET = cleanall
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
......@@ -13,5 +14,5 @@ $(DIRS):
$(MAKE) -C $@ $(TARGET)
.PHONY: all clean modules install modules_install
.PHONY: all clean cleanall modules install modules_install
.PHONY: $(DIRS)
......@@ -2,15 +2,21 @@
DIRS := fw-01
all clean modules install modules_install: $(DIRS)
all clean cleanall modules install modules_install: $(DIRS)
clean: TARGET = clean
cleanall: TARGET = cleanall
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
$(DIRS):
DOT-CONFIGS = $(addsuffix /.config,$(DIRS))
$(DIRS): $(DOT-CONFIGS)
$(MAKE) -C $@ $(TARGET)
.PHONY: all clean modules install modules_install
$(DOT-CONFIGS):
$(MAKE) -C $(@D) defconfig
.PHONY: all clean cleanall modules install modules_install
.PHONY: $(DIRS)
mainmenu "hello_world demo configuration"
comment "Project specific configuration"
source "Kconfig.mt"
......@@ -4,16 +4,4 @@ OUTPUT = fw-hello
TRTL ?= ../../../../
TRTL_SW = $(TRTL)/software
EXTRA_CFLAGS += -DFPGA_APPLICATION_ID=0x0
EXTRA_CFLAGS += -DRT_APPLICATION_ID=0x0
MOCKTURTLE_LIBRARY_PRINT_ENABLE := 1
# Firmware Libray configuration
MOCKTURTLE_FRAMEWORK_ENABLE := 0
MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE := 0
MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE := 0
MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE := 0
MOCKTURTLE_FRAMEWORK_32BIT_ALIGN := 0
include $(TRTL_SW)/rt/Makefile
#
# Automatically generated file; DO NOT EDIT.
# hello_world demo configuration
#
#
# Project specific configuration
#
#
# Mock Turtle configuration
#
#
# Mock Turtle framework configuration
#
# CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE is not set
#
# Mock Turtle library configuration
#
CONFIG_MOCKTURTLE_LIBRARY_PRINT_ENABLE=y
# CONFIG_MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE is not set
# CONFIG_MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE is not set
......@@ -2,9 +2,10 @@
DIRS += firmware
all clean modules install modules_install: $(DIRS)
all clean cleanall modules install modules_install: $(DIRS)
clean: TARGET = clean
cleanall: TARGET = cleanall
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
......@@ -13,5 +14,5 @@ $(DIRS):
$(MAKE) -C $@ $(TARGET)
.PHONY: all clean modules install modules_install
.PHONY: all clean cleanall modules install modules_install
.PHONY: $(DIRS)
......@@ -2,15 +2,21 @@
DIRS := fw-01
all clean modules install modules_install: $(DIRS)
all clean cleanall modules install modules_install: $(DIRS)
clean: TARGET = clean
cleanall: TARGET = cleanall
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
$(DIRS):
DOT-CONFIGS = $(addsuffix /.config,$(DIRS))
$(DIRS): $(DOT-CONFIGS)
$(MAKE) -C $@ $(TARGET)
.PHONY: all clean modules install modules_install
$(DOT-CONFIGS):
$(MAKE) -C $(@D) defconfig
.PHONY: all clean cleanall modules install modules_install
.PHONY: $(DIRS)
mainmenu "hello_world_framework demo configuration"
comment "Project specific configuration"
config FPGA_APPLICATION_ID
int "FPGA application ID"
default 0
help
Help text
config RT_APPLICATION_ID
int "RT application ID"
default 0
help
Help text
# include Mock Turtle's Kconfig
source "Kconfig.mt"
......@@ -4,15 +4,4 @@ OUTPUT = fw-hellofrm
TRTL ?= ../../../../
TRTL_SW = $(TRTL)/software
EXTRA_CFLAGS += -DFPGA_APPLICATION_ID=0x0
EXTRA_CFLAGS += -DRT_APPLICATION_ID=0x0
MOCKTURTLE_LIBRARY_PRINT_ENABLE := 1
# Firmware Libray configuration
MOCKTURTLE_FRAMEWORK_ENABLE := 1
MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE := 0
MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE := 0
MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE := 0
MOCKTURTLE_FRAMEWORK_32BIT_ALIGN := 1
include $(TRTL_SW)/rt/Makefile
#
# Automatically generated file; DO NOT EDIT.
# hello_world_framework demo configuration
#
#
# Project specific configuration
#
CONFIG_FPGA_APPLICATION_ID=0
CONFIG_RT_APPLICATION_ID=0
#
# Mock Turtle configuration
#
#
# Mock Turtle framework configuration
#
CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE=y
# CONFIG_MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE is not set
# CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE is not set
# CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE is not set
CONFIG_MOCKTURTLE_FRAMEWORK_32BIT_ALIGN=y
#
# Mock Turtle library configuration
#
CONFIG_MOCKTURTLE_LIBRARY_PRINT_ENABLE=y
# CONFIG_MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE is not set
# CONFIG_MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE is not set
......@@ -25,8 +25,8 @@ static struct rt_mq mq[] = {
static struct rt_application app = {
.name = "hellofrm",
.version = {
.fpga_id = FPGA_APPLICATION_ID,
.rt_id = RT_APPLICATION_ID,
.fpga_id = CONFIG_FPGA_APPLICATION_ID,
.rt_id = CONFIG_RT_APPLICATION_ID,
.rt_version = RT_VERSION(0, 1),
.git_version = GIT_VERSION
},
......
-include Makefile.specific
DIRS := firmware
DIRS += firmware
all clean modules install modules_install: $(DIRS)
all clean cleanall modules install modules_install: $(DIRS)
clean: TARGET = clean
cleanall: TARGET = cleanall
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
......@@ -13,5 +14,5 @@ $(DIRS):
$(MAKE) -C $@ $(TARGET)
.PHONY: all clean modules install modules_install
.PHONY: all clean cleanall modules install modules_install
.PHONY: $(DIRS)
......@@ -3,15 +3,22 @@ DIRS := fw-01
DIRS += fw-02
DIRS += fw-03
all clean modules install modules_install: $(DIRS)
all clean cleanall modules install modules_install: $(DIRS)
clean: TARGET = clean
cleanall: TARGET = cleanall
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
$(DIRS):
DOT-CONFIGS = $(addsuffix /.config,$(DIRS))
$(DIRS): $(DOT-CONFIGS)
$(MAKE) -C $@ $(TARGET)
.PHONY: all clean modules install modules_install
$(DOT-CONFIGS):
$(MAKE) -C $(@D) defconfig
.PHONY: all clean cleanall modules install modules_install
.PHONY: $(DIRS)
mainmenu "Profiling 1 demo configuration"
comment "Project specific configuration"
source "Kconfig.mt"
......@@ -6,17 +6,4 @@ TRTL_SW = $(TRTL)/software
CFLAGS_OPT = -O0
EXTRA_CFLAGS += -DFPGA_APPLICATION_ID=0x0
EXTRA_CFLAGS += -DRT_APPLICATION_ID=0x0
MOCKTURTLE_LIBRARY_PRINT_ENABLE := 1
MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE := 1
# Firmware Libray configuration
MOCKTURTLE_FRAMEWORK_ENABLE := 0
MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE := 0
MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE := 0
MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE := 0
MOCKTURTLE_FRAMEWORK_32BIT_ALIGN := 0
include $(TRTL_SW)/rt/Makefile
#
# Automatically generated file; DO NOT EDIT.
# Profiling 1 demo configuration
#
#
# Project specific configuration
#
#
# Mock Turtle configuration
#
#
# Mock Turtle framework configuration
#
# CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE is not set
#
# Mock Turtle library configuration
#
CONFIG_MOCKTURTLE_LIBRARY_PRINT_ENABLE=y
CONFIG_MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE=y
# CONFIG_MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE is not set
mainmenu "alarm_clock demo configuration"
comment "Project specific configuration"
source "Kconfig.mt"
......@@ -6,17 +6,4 @@ TRTL_SW = $(TRTL)/software
CFLAGS_OPT = -O0
EXTRA_CFLAGS += -DFPGA_APPLICATION_ID=0x0
EXTRA_CFLAGS += -DRT_APPLICATION_ID=0x0
MOCKTURTLE_LIBRARY_PRINT_ENABLE := 1
MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE := 1
# Firmware Libray configuration
MOCKTURTLE_FRAMEWORK_ENABLE := 0
MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE := 0
MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE := 0
MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE := 0
MOCKTURTLE_FRAMEWORK_32BIT_ALIGN := 0
include $(TRTL_SW)/rt/Makefile
#
# Automatically generated file; DO NOT EDIT.
# alarm_clock demo configuration
#
#
# Project specific configuration
#
#
# Mock Turtle configuration
#
#
# Mock Turtle framework configuration
#
# CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE is not set
#
# Mock Turtle library configuration
#
CONFIG_MOCKTURTLE_LIBRARY_PRINT_ENABLE=y
CONFIG_MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE=y
# CONFIG_MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE is not set
mainmenu "alarm_clock demo configuration"
comment "Project specific configuration"
source "Kconfig.mt"
......@@ -6,17 +6,4 @@ TRTL_SW = $(TRTL)/software
CFLAGS_OPT = -O0
EXTRA_CFLAGS += -DFPGA_APPLICATION_ID=0x0
EXTRA_CFLAGS += -DRT_APPLICATION_ID=0x0
MOCKTURTLE_LIBRARY_PRINT_ENABLE := 1
MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE := 1
# Firmware Libray configuration
MOCKTURTLE_FRAMEWORK_ENABLE := 0
MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE := 0
MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE := 0
MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE := 0
MOCKTURTLE_FRAMEWORK_32BIT_ALIGN := 0
include $(TRTL_SW)/rt/Makefile
#
# Automatically generated file; DO NOT EDIT.
# alarm_clock demo configuration
#
#
# Project specific configuration
#
#
# Mock Turtle configuration
#
#
# Mock Turtle framework configuration
#
# CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE is not set
#
# Mock Turtle library configuration
#
CONFIG_MOCKTURTLE_LIBRARY_PRINT_ENABLE=y
CONFIG_MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE=y
# CONFIG_MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE is not set
......@@ -157,14 +157,7 @@ static inline struct trtl_proto_header *rt_proto_header_get(void *raw_msg)
static inline void rt_proto_header_set(void *raw_msg,
struct trtl_proto_header *header)
{
#if MOCKTURTLE_FRAMEWORK_32BIT_ALIGN
int i;
for (i = 0; i < sizeof(struct trtl_proto_header) / 4; ++i)
((uint32_t *)raw_msg)[i] = ((uint32_t *)header)[i];
#else
memcpy(raw_msg, header, sizeof(struct trtl_proto_header));
#endif
}
......
comment "Mock Turtle configuration"
comment "Mock Turtle framework configuration"
config MOCKTURTLE_FRAMEWORK_ENABLE
bool "Enable Mock Turtle framework"
default y
help
Help text
config MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE
bool "Enable debugging in Mock Turtle framework"
depends on MOCKTURTLE_FRAMEWORK_ENABLE
default y
help
Help text
config MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE
bool "Enable variable in Mock Turtle framework"
depends on MOCKTURTLE_FRAMEWORK_ENABLE
default y
help
Help text
config MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE
bool "Enable buffer in Mock Turtle framework"
depends on MOCKTURTLE_FRAMEWORK_ENABLE
default y
help
Help text
config MOCKTURTLE_FRAMEWORK_32BIT_ALIGN
bool "Enable 32bit align in Mock Turtle framework"
depends on MOCKTURTLE_FRAMEWORK_ENABLE
default y
help
Help text
comment "Mock Turtle library configuration"
config MOCKTURTLE_LIBRARY_PRINT_ENABLE
bool "Enable print in Mock Turtle library"
default y
help
Help text
config MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE
bool "Enable print debug in Mock Turtle library"
depends on MOCKTURTLE_LIBRARY_PRINT_ENABLE
default n
help
Help text
config MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE
bool "Enable print error in Mock Turtle library"
depends on MOCKTURTLE_LIBRARY_PRINT_ENABLE
default n
help
Help text
-include Makefile.specific
-include $(CURDIR)/.config
# and don't touch the rest unless you know what you're doing.
INSTALL_PREFIX ?= .
......@@ -9,6 +10,8 @@ TRTL_SW ?= $(TRTL)/software
TRTL_HDL ?= $(TRTL)/hdl/rtl
RT_GIT_VERSION = 0x$(shell git rev-parse --short=8 HEAD)
# header file generated from the .config
AUTOCONF = $(CURDIR)/$(BUILDDIR)/include/generated/autoconf.h
CROSS_COMPILE_TARGET ?= riscv32-elf-
# FIXME the mult/div is broken, for the time being remove it completely
......@@ -25,7 +28,6 @@ BUILDDIR := build
# auto dependency generation from
# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
DEPDIR := .d
$(shell mkdir -p $(BUILDDIR)/$(DEPDIR) >/dev/null)
DEPFLAGS = -MT $@ -MMD -MP -MF $(@D)/$(*F).Td
POSTCOMPILE = mv -f $(@D)/$(*F).Td $(@D)/$(DEPDIR)/$(*F).d && touch $@
......@@ -43,40 +45,17 @@ CFLAGS += $(CFLAGS_OPT)
CFLAGS += $(CFLAGS_DBG)
CFLAGS += -Wall -DWRNODE_RT -DARCH=urv
CFLAGS += -I.
CFLAGS += -I$(BUILDDIR)/include
CFLAGS += -I$(TRTL)/software/rt
CFLAGS += -I$(TRTL)/software/rt/lib
CFLAGS += -I$(TRTL)/software/rt/framework
CFLAGS += -I$(TRTL)/software/include
CFLAGS += -DGIT_VERSION=$(RT_GIT_VERSION)
ifeq ($(MOCKTURTLE_LIBRARY_PRINT_ENABLE), 1)
CFLAGS += -DLIB_PRINTF
ifeq ($(MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE), 1)
CFLAGS += -DLIB_PRINT_DEBUG
endif
ifeq ($(MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE), 1)
CFLAGS += -DLIB_PRINT_ERROR
endif
endif
ifeq ($(MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE), 1)
CFLAGS += -DMOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE
endif
ifeq ($(MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE), 1)
CFLAGS += -DMOCKTURTLE_FRAMEWORK_BUFFER_ENABLE
endif
ifeq ($(MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE), 1)
CFLAGS += -DMOCKTURTLE_FRAMEWORK_DEBUG_ENABLE
endif
ifeq ($(MOCKTURTLE_FRAMEWORK_32BIT_ALIGN), 1)
CFLAGS += -DMOCKTURTLE_FRAMEWORK_32BIT_ALIGN
endif
CFLAGS += $(EXTRA_CFLAGS)
OBJDIR := urv
OBJDIR += urv
OBJS += urv/irq.o
OBJS += urv/emulate.o
OBJS += urv/crt0.o
......@@ -86,21 +65,23 @@ OBJS += lib/vsprintf-xint.o
OBJS += lib/printf.o
OBJS += lib/mockturtle-rt-common.o
ifeq ($(MOCKTURTLE_FRAMEWORK_ENABLE), 1)
OBJDIR += framework
OBJS += framework/mockturtle-frm-core.o
OBJS += framework/mockturtle-frm-debug.o
OBJS += framework/mockturtle-frm-action.o
OBJS += framework/mockturtle-frm-mqueue.o
endif
OBJDIR-$(CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE) += framework
OBJS-$(CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE) += framework/mockturtle-frm-core.o
OBJS-$(CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE) += framework/mockturtle-frm-debug.o
OBJS-$(CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE) += framework/mockturtle-frm-action.o
OBJS-$(CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE) += framework/mockturtle-frm-mqueue.o
OBJDIR += $(OBJDIR-y)
OBJS += $(OBJS-y)
OBJS_BUILD = $(addprefix $(BUILDDIR)/, $(OBJS))
OBJDIR_BUILD = $(addprefix $(BUILDDIR)/, $(OBJDIR))
OBJDIR_BUILD += $(BUILDDIR)
MOCKTURTLE_LDSCRIPT ?= $(TRTL)/software/rt/urv/mockturtle.ld
.PHONY: all clean check-def
.PHONY: all clean cleanall check-def
all: $(OUTPUT).bin
......@@ -108,7 +89,7 @@ WBGEN_FILES = mt_cpu_csr.wb mt_cpu_lr.wb
WBGEN_HEADERS = mockturtle_cpu_csr.h mockturtle_cpu_lr.h
# .wb files should simply be there. This is used to check against the changes
$(addprefix $(TRTL_HDL)/cpu/,$(WBGEN_FILES)):
$(addprefix $(TRTL_HDL)/cpu/,$(WBGEN_FILES)): ;
# dependencies between .h and .wb files
$(TRTL_SW)/include/hw/mockturtle_cpu_csr.h: $(TRTL_HDL)/cpu/mt_cpu_csr.wb
......@@ -130,6 +111,8 @@ $(OBJDIR_BUILD):
mkdir -p $@
mkdir -p $@/$(DEPDIR)
# remove "|" to rebuild all objects on the .config change
$(OBJS_BUILD): | $(AUTOCONF)
$(OBJS_BUILD): | $(OBJDIR_BUILD)
$(OUTPUT).elf: $(addprefix $(TRTL_SW)/include/hw/,$(WBGEN_HEADERS)) $(MOCKTURTLE_LDSCRIPT) $(OBJS_BUILD) | check-def
......@@ -155,7 +138,35 @@ clean:
rm -f $(OUTPUT).bin $(OUTPUT).elf
rm -rf $(BUILDDIR)
clean-dot-config:
rm -f .config
cleanall: clean clean-dot-config
install:
@cp $(OUTPUT).bin $(INSTALL_PREFIX)
# inlude *.d files from the build directory
include $(wildcard $(patsubst %,%/.d/*.d,$(basename $(OBJDIR_BUILD))))
# following targets from Makefile.kconfig
# this one is used to generate autoconf.h file
$(AUTOCONF) silentoldconfig: .config | $(BUILDDIR)
export KCONFIG_CONFIG=$(CURDIR)/.config; \
$(MAKE) quiet=quiet_ KBUILD_KCONFIG=$(CURDIR)/Kconfig projtree=$(CURDIR)/$(BUILDDIR) -C $(TRTL)/software/rt -f Makefile.kconfig silentoldconfig
scripts_basic config:
$(MAKE) quiet=quiet_ KBUILD_KCONFIG=$(CURDIR)/Kconfig projtree=$(CURDIR) -C $(TRTL)/software/rt -f Makefile.kconfig $@
%config:
$(MAKE) quiet=quiet_ KBUILD_KCONFIG=$(CURDIR)/Kconfig projtree=$(CURDIR) -C $(TRTL)/software/rt -f Makefile.kconfig $@
defconfig:
$(MAKE) quiet=quiet_ KBUILD_KCONFIG=$(CURDIR)/Kconfig projtree=$(CURDIR) -C $(TRTL)/software/rt -f Makefile.kconfig mt_defconfig
.config: ;
# Explicit rule for .config
# needed since -include XXX triggers build for XXX
$(CURDIR)/.config: ;
VERSION = $(shell git describe --always --dirty)
export VERSION
# Do not:
# o use make's built-in rules and variables
# (this increases performance and avoids hard-to-debug behaviour);
# o print "Entering directory ...";
MAKEFLAGS += -rR --no-print-directory
# To put more focus on warnings, be less verbose as default
# Use 'make V=1' to see the full commands
ifdef V
ifeq ("$(origin V)", "command line")
KBUILD_VERBOSE = $(V)
endif
endif
ifndef KBUILD_VERBOSE
KBUILD_VERBOSE = 0
endif
# Cancel implicit rules on top Makefile
$(CURDIR)/Makefile Makefile: ;
# That's our default target when none is given on the command line
PHONY := _all
_all:
# SHELL used by kbuild
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \
else echo sh; fi ; fi)
# Make variables (CC, etc...)
HOSTCC = gcc
HOSTCXX = g++
HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
HOSTCXXFLAGS = -O2
export HOSTCC HOSTCXX HOSTCFLAGS HOSTCXXFLAGS
KBUILD_KCONFIG = $(CURDIR)/Kconfig
export KBUILD_KCONFIG
srctree ?= $(CURDIR)
objtree ?= $(CURDIR)
projtree ?= $(CURDIR)
src := $(srctree)
obj := $(objtree)
export srctree objtree projtree
YACC := bison
LEX := flex
export YACC LEX
# We need some generic definitions (do not try to remake the file).
$(srctree)/scripts/Kbuild.include: ;
include $(srctree)/scripts/Kbuild.include
# Basic helpers built in scripts/
PHONY += scripts_basic
scripts_basic:
$(Q)$(MAKE) $(build)=scripts/basic
config: scripts_basic FORCE
$(Q)mkdir -p include/linux include/config
$(Q)$(MAKE) $(build)=scripts/kconfig $@
%config: scripts_basic FORCE
$(Q)$(MAKE) $(build)=scripts/kconfig $@
clean:
@find . $(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
-o -name 'Module.markers' -o -name '.tmp_*.o.*' \) \
-type f -print | xargs rm -f -v
PHONY += FORCE
FORCE:
# Declare the contents of the .PHONY variable as phony. We keep that
# information in a variable so we can use it in if_changed and friends.
.PHONY: $(PHONY)
......@@ -14,6 +14,7 @@
#ifndef __TRTL_FW_FRM_H__
#define __TRTL_FW_FRM_H__
#include <generated/autoconf.h>
#include "mockturtle-rt.h"
#include "mockturtle-frm-action.h"
#include "mockturtle-frm-mqueue.h"
......
......@@ -48,13 +48,17 @@ int rt_version_getter(struct trtl_proto_header *hin, void *pin,
* it overwrite a data structure with the one contained in the input
* payload. If the message is syncrnous it will copy back the data structure.
*/
#ifdef MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE
int rt_buffer_setter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
unsigned int offset = 0, index, size;
uint32_t *din = pin;
if (!HAS_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE) {
rt_send_nack(hin, pin, hout, NULL);
return 0;
}
while (offset < hin->len) {
pr_debug("%s: offset %d/%d\n\r", __func__, offset, hin->len);
......@@ -83,21 +87,11 @@ int rt_buffer_setter(struct trtl_proto_header *hin, void *pin,
return 0;
}
#else
int rt_buffer_setter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
rt_send_nack(hin, pin, hout, NULL);
return 0;
}
#endif
/**
* This is an @ref action_t function type. Accorind the message request,
* it copies one of the declared data structure to the output payload.
*/
#ifdef MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE
int rt_buffer_getter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
......@@ -105,6 +99,11 @@ int rt_buffer_getter(struct trtl_proto_header *hin, void *pin,
uint32_t *din = pin;
uint32_t *dout = pout;
if (!HAS_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE) {
rt_send_nack(hin, pin, hout, NULL);
return 0;
}
hout->msg_id = TRTL_MSG_ID_BUF_GET_ANS;
while (offset < hin->len) {
......@@ -131,22 +130,12 @@ int rt_buffer_getter(struct trtl_proto_header *hin, void *pin,
return 0;
}
#else
int rt_buffer_getter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
rt_send_nack(hin, pin, hout, NULL);
return 0;
}
#endif
/**
* This is an @ref action_t function type. Accorind the message request,
* it writes a number of declared variables. If the message is synchronous
* it copies back the values in the output payload.
*/
#ifdef MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE
int rt_variable_setter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
......@@ -154,6 +143,12 @@ int rt_variable_setter(struct trtl_proto_header *hin, void *pin,
uint32_t *din = pin, *mem, val;
int i;
if (!HAS_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE) {
pr_debug("Variable set action not supported\n\r");
rt_send_nack(hin, pin, hout, NULL);
return 0;
}
/* we always have a pair of values */
if (hin->len % 2)
rt_send_nack(hin, pin, hout, pout);
......@@ -184,22 +179,11 @@ int rt_variable_setter(struct trtl_proto_header *hin, void *pin,
return 0;
}
#else
int rt_variable_setter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
pr_debug("Variable set action not supported\n\r");
rt_send_nack(hin, pin, hout, NULL);
return 0;
}
#endif
/**
* This is an @ref action_t function type. Accorind the message request,
* it copies a number of declared variables.
*/
#ifdef MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE
int rt_variable_getter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
......@@ -207,6 +191,12 @@ int rt_variable_getter(struct trtl_proto_header *hin, void *pin,
uint32_t *dout = pout, *din = pin, *mem, val;
int i;
if (!HAS_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE) {
pr_debug("Variable get action not supported\n\r");
rt_send_nack(hin, pin, hout, NULL);
return 0;
}
if (!hout || !pout)
return -1;
......@@ -237,17 +227,6 @@ int rt_variable_getter(struct trtl_proto_header *hin, void *pin,
return 0;
}
#else
int rt_variable_getter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
pr_debug("Variable get action not supported\n\r");
rt_send_nack(hin, pin, hout, NULL);
return 0;
}
#endif
/**
* List of standard actions
......
......@@ -18,7 +18,6 @@
* @param[in] n_values number of variadic arguments
* @return 0 on success. -1 on error
*/
#ifdef MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE
int rt_send_debug(int mq_in, int n_values, ...)
{
va_list ap;
......@@ -36,6 +35,10 @@ int rt_send_debug(int mq_in, int n_values, ...)
};
int i;
if (!HAS_MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE) {
return 0;
}
out_buf = rt_mq_claim_out(&hdr);
buf = (uint32_t *)rt_proto_payload_get(out_buf.data);
......@@ -49,22 +52,17 @@ int rt_send_debug(int mq_in, int n_values, ...)
return 0;
}
#else
int rt_send_debug(int mq_in, int n_values, ...)
{
return 0;
}
#endif
/**
* It prints on the serial interface the given message header
* @param[in] h message header to print
*/
#ifdef MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE
void rt_print_header(struct trtl_proto_header *h)
{
if (!HAS_MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE) {
return;
}
pr_debug(" app_id 0x%x | msg_id %d | slot_io 0x%x | seq %"PRIu32"d\n\r",
h->rt_app_id, h->msg_id, h->slot_io, h->seq);
delay(1000);
......@@ -72,32 +70,22 @@ void rt_print_header(struct trtl_proto_header *h)
h->len, h->flags, h->trans, h->time);
delay(1000);
}
#else
void rt_print_header(struct trtl_proto_header *h)
{
return;
}
#endif
/**
* It prints on the serial interface a buffer
* @param[in] d buffer data
* @param[in] count number of 32bit words to show
*/
#ifdef MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE
void rt_print_data(uint32_t *d, unsigned int count)
{
int i;
if (!HAS_MOCKTURTLE_FRAMEWORK_DEBUG_ENABLE) {
return;
}
for (i = 0; i < count; i++) {
pr_debug("%s: data[%d] = 0x%"PRIx32"\n\r", __func__, i , d[i]);
delay(1000);
}
}
#else
void rt_print_data(uint32_t *d, unsigned int count)
{
return ;
}
#endif
......@@ -18,6 +18,7 @@
#define __TRTL_RT_PP_PRINTF_H
#include <stdarg.h>
#include <generated/autoconf.h>
/**
* Print buffer size. This means that your printf string
......@@ -34,7 +35,7 @@
* @param[in] ... argument according to the string format
* @return number of printed characters
*/
#ifdef LIB_PRINTF
#if HAS_MOCKTURTLE_LIBRARY_PRINT_ENABLE == 1
extern int pp_printf(const char *fmt, ...)
__attribute__((format(printf,1,2)));
#else
......@@ -52,7 +53,7 @@ static inline int pp_printf(const char *fmt, ...)
* @param[in] ... argument according to the string format
* @return number of printed characters
*/
#ifdef LIB_PRINTF
#if HAS_MOCKTURTLE_LIBRARY_PRINT_ENABLE == 1
extern int pp_sprintf(char *s, const char *fmt, ...)
__attribute__((format(printf,2,3)));
#else
......@@ -70,7 +71,7 @@ static inline int pp_sprintf(char *s, const char *fmt, ...)
* @param[in] args list of arguments according to the string format
* @return number of printed characters
*/
#ifdef LIB_PRINTF
#if HAS_MOCKTURTLE_LIBRARY_PRINT_ENABLE
extern int pp_vprintf(const char *fmt, va_list args);
#else
static inline int pp_vprintf(const char *fmt, va_list args)
......@@ -87,7 +88,7 @@ static inline int pp_vprintf(const char *fmt, va_list args)
* @param[in] args list of arguments according to the string format
* @return number of printed characters
*/
#ifdef LIB_PRINTF
#if HAS_MOCKTURTLE_LIBRARY_PRINT_ENABLE == 1
extern int pp_vsprintf(char *buf, const char *, va_list args)
__attribute__ ((format (printf, 2, 0)));
#else
......@@ -102,16 +103,14 @@ static inline int pp_vsprintf(char *buf, const char *fmt, va_list args)
* It prints a string on the serial interface only when the support
* for error messages is enable.
*
* Standard Makefile -> MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE
*
* C Preprocessor ->LIB_PRINT_DEBUG
* Kconfig ->CONFIG_MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE
*
* Internally, it uses the puts() function.
* @param[in] fmt string format
* @param[in] ... argument according to the string format
* @return number of printed characters
*/
#if defined(LIB_PRINTF) && defined(LIB_PRINT_DEBUG)
#if (HAS_MOCKTURTLE_LIBRARY_PRINT_ENABLE == 1) && (HAS_MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE == 1)
extern int pr_debug(const char *fmt, ...)
__attribute__((format(printf,1,2)));
#else
......@@ -125,16 +124,14 @@ static inline int pr_debug(const char *fmt, ...)
* It prints a string on the serial interface only when the support
* for error messages is enable.
*
* Standard Makefile -> MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE
*
* C Preprocessor -> LIB_PRINT_ERROR
* Kconfig -> CONFIG_MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE
*
* Internally, it uses the puts() function.
* @param[in] fmt string format
* @param[in] ... argument according to the string format
* @return number of printed characters
*/
#if defined(LIB_PRINTF) && defined(LIB_PRINT_ERROR)
#if (HAS_MOCKTURTLE_LIBRARY_PRINT_ENABLE == 1) && (HAS_MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE == 1)
extern int pr_error(const char *fmt, ...)
__attribute__((format(printf,1,2)));
#else
......
......@@ -8,12 +8,13 @@
/**
* Include this code only if explicitly asked to
*/
#ifdef LIB_PRINTF
#include <stdarg.h>
#include <mockturtle-rt-common.h>
#include <mockturtle-rt-serial.h>
#if HAS_MOCKTURTLE_LIBRARY_PRINT_ENABLE == 1
static char print_buf[CONFIG_PRINT_BUFSIZE];
......@@ -50,7 +51,7 @@ int pp_printf(const char *fmt, ...)
return ret;
}
#ifdef LIB_PRINT_ERROR
#if HAS_MOCKTURTLE_LIBRARY_PRINT_ERROR_ENABLE == 1
int pr_error(const char *fmt, ...)
{
va_list args;
......@@ -66,7 +67,7 @@ int pr_error(const char *fmt, ...)
}
#endif
#ifdef LIB_PRINT_DEBUG
#if HAS_MOCKTURTLE_LIBRARY_PRINT_DEBUG_ENABLE == 1
int pr_debug(const char *fmt, ...)
{
va_list args;
......
......@@ -8,10 +8,12 @@
/**
* Include this code only if explicitly asked to
*/
#ifdef LIB_PRINTF
#include <stdarg.h>
#include <stdint.h>
#include <generated/autoconf.h>
#if HAS_MOCKTURTLE_LIBRARY_PRINT_ENABLE == 1
static const char hex[] = "0123456789abcdef";
......
This diff is collapsed.
#!/bin/sh
PARAM="-npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1"
RES=`indent --version`
if [ "$RES" = "" ]; then
exit 1
fi
V1=`echo $RES | cut -d' ' -f3 | cut -d'.' -f1`
V2=`echo $RES | cut -d' ' -f3 | cut -d'.' -f2`
V3=`echo $RES | cut -d' ' -f3 | cut -d'.' -f3`
if [ $V1 -gt 2 ]; then
PARAM="$PARAM -il0"
elif [ $V1 -eq 2 ]; then
if [ $V2 -gt 2 ]; then
PARAM="$PARAM -il0";
elif [ $V2 -eq 2 ]; then
if [ $V3 -ge 10 ]; then
PARAM="$PARAM -il0"
fi
fi
fi
indent $PARAM "$@"
subdir- += basic kconfig
This diff is collapsed.
# SPDX-License-Identifier: GPL-2.0
# ==========================================================================
# Building binaries on the host system
# Binaries are used during the compilation of the kernel, for example
# to preprocess a data file.
#
# Both C and C++ are supported, but preferred language is C for such utilities.
#
# Sample syntax (see Documentation/kbuild/makefiles.txt for reference)
# hostprogs-y := bin2hex
# Will compile bin2hex.c and create an executable named bin2hex
#
# hostprogs-y := lxdialog
# lxdialog-objs := checklist.o lxdialog.o
# Will compile lxdialog.c and checklist.c, and then link the executable
# lxdialog, based on checklist.o and lxdialog.o
#
# hostprogs-y := qconf
# qconf-cxxobjs := qconf.o
# qconf-objs := menu.o
# Will compile qconf as a C++ program, and menu as a C program.
# They are linked as C++ code to the executable qconf
__hostprogs := $(sort $(hostprogs-y) $(hostprogs-m))
host-cshlib := $(sort $(hostlibs-y) $(hostlibs-m))
host-cxxshlib := $(sort $(hostcxxlibs-y) $(hostcxxlibs-m))
# C code
# Executables compiled from a single .c file
host-csingle := $(foreach m,$(__hostprogs), \
$(if $($(m)-objs)$($(m)-cxxobjs),,$(m)))
# C executables linked based on several .o files
host-cmulti := $(foreach m,$(__hostprogs),\
$(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m))))
# Object (.o) files compiled from .c files
host-cobjs := $(sort $(foreach m,$(__hostprogs),$($(m)-objs)))
# C++ code
# C++ executables compiled from at least one .cc file
# and zero or more .c files
host-cxxmulti := $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m)))
# C++ Object (.o) files compiled from .cc files
host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs)))
# Object (.o) files used by the shared libaries
host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs))))
host-cxxshobjs := $(sort $(foreach m,$(host-cxxshlib),$($(m:.so=-objs))))
host-csingle := $(addprefix $(obj)/,$(host-csingle))
host-cmulti := $(addprefix $(obj)/,$(host-cmulti))
host-cobjs := $(addprefix $(obj)/,$(host-cobjs))
host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti))
host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs))
host-cshlib := $(addprefix $(obj)/,$(host-cshlib))
host-cxxshlib := $(addprefix $(obj)/,$(host-cxxshlib))
host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs))
host-cxxshobjs := $(addprefix $(obj)/,$(host-cxxshobjs))
#####
# Handle options to gcc. Support building with separate output directory
_hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
$(HOSTCFLAGS_$(basetarget).o)
_hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
$(HOSTCXXFLAGS_$(basetarget).o)
ifeq ($(KBUILD_SRC),)
__hostc_flags = $(_hostc_flags)
__hostcxx_flags = $(_hostcxx_flags)
else
__hostc_flags = -I$(obj) $(call flags,_hostc_flags)
__hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags)
endif
hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags)
hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags)
#####
# Compile programs on the host
# Create executable from a single .c file
# host-csingle -> Executable
quiet_cmd_host-csingle = HOSTCC $@
cmd_host-csingle = $(HOSTCC) $(hostc_flags) -o $@ $< \
$(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
$(host-csingle): $(obj)/%: $(src)/%.c FORCE
$(call if_changed_dep,host-csingle)
# Link an executable based on list of .o files, all plain c
# host-cmulti -> executable
quiet_cmd_host-cmulti = HOSTLD $@
cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \
$(addprefix $(obj)/,$($(@F)-objs)) \
$(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
$(host-cmulti): FORCE
$(call if_changed,host-cmulti)
$(call multi_depend, $(host-cmulti), , -objs)
# Create .o file from a single .c file
# host-cobjs -> .o
quiet_cmd_host-cobjs = HOSTCC $@
cmd_host-cobjs = $(HOSTCC) $(hostc_flags) -c -o $@ $<
$(host-cobjs): $(obj)/%.o: $(src)/%.c FORCE
$(call if_changed_dep,host-cobjs)
# Link an executable based on list of .o files, a mixture of .c and .cc
# host-cxxmulti -> executable
quiet_cmd_host-cxxmulti = HOSTLD $@
cmd_host-cxxmulti = $(HOSTCXX) $(HOSTLDFLAGS) -o $@ \
$(foreach o,objs cxxobjs,\
$(addprefix $(obj)/,$($(@F)-$(o)))) \
$(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
$(host-cxxmulti): FORCE
$(call if_changed,host-cxxmulti)
$(call multi_depend, $(host-cxxmulti), , -objs -cxxobjs)
# Create .o file from a single .cc (C++) file
quiet_cmd_host-cxxobjs = HOSTCXX $@
cmd_host-cxxobjs = $(HOSTCXX) $(hostcxx_flags) -c -o $@ $<
$(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE
$(call if_changed_dep,host-cxxobjs)
# Compile .c file, create position independent .o file
# host-cshobjs -> .o
quiet_cmd_host-cshobjs = HOSTCC -fPIC $@
cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $<
$(host-cshobjs): $(obj)/%.o: $(src)/%.c FORCE
$(call if_changed_dep,host-cshobjs)
# Compile .c file, create position independent .o file
# Note that plugin capable gcc versions can be either C or C++ based
# therefore plugin source files have to be compilable in both C and C++ mode.
# This is why a C++ compiler is invoked on a .c file.
# host-cxxshobjs -> .o
quiet_cmd_host-cxxshobjs = HOSTCXX -fPIC $@
cmd_host-cxxshobjs = $(HOSTCXX) $(hostcxx_flags) -fPIC -c -o $@ $<
$(host-cxxshobjs): $(obj)/%.o: $(src)/%.c FORCE
$(call if_changed_dep,host-cxxshobjs)
# Link a shared library, based on position independent .o files
# *.o -> .so shared library (host-cshlib)
quiet_cmd_host-cshlib = HOSTLLD -shared $@
cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \
$(addprefix $(obj)/,$($(@F:.so=-objs))) \
$(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
$(host-cshlib): FORCE
$(call if_changed,host-cshlib)
$(call multi_depend, $(host-cshlib), .so, -objs)
# Link a shared library, based on position independent .o files
# *.o -> .so shared library (host-cxxshlib)
quiet_cmd_host-cxxshlib = HOSTLLD -shared $@
cmd_host-cxxshlib = $(HOSTCXX) $(HOSTLDFLAGS) -shared -o $@ \
$(addprefix $(obj)/,$($(@F:.so=-objs))) \
$(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
$(host-cxxshlib): FORCE
$(call if_changed,host-cxxshlib)
$(call multi_depend, $(host-cxxshlib), .so, -objs)
targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\
$(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs) $(host-cxxshlib) $(host-cxxshobjs)
This diff is collapsed.
###
# Makefile.basic lists the most basic programs used during the build process.
# The programs listed herein are what are needed to do the basic stuff,
# such as fix file dependencies.
# This initial step is needed to avoid files to be recompiled
# when kernel configuration changes (which is what happens when
# .config is included by main Makefile.
# ---------------------------------------------------------------------------
# fixdep: Used to generate dependency information during build process
# docproc: Used in Documentation/DocBook
hostprogs-y := fixdep docproc hash
always := $(hostprogs-y)
# fixdep is needed to compile other host programs
$(addprefix $(obj)/,$(filter-out fixdep,$(always))): $(obj)/fixdep
This diff is collapsed.
/*
* "Optimize" a list of dependencies as spit out by gcc -MD
* for the kernel build
* ===========================================================================
*
* Author Kai Germaschewski
* Copyright 2002 by Kai Germaschewski <kai.germaschewski@gmx.de>
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*
* Introduction:
*
* gcc produces a very nice and correct list of dependencies which
* tells make when to remake a file.
*
* To use this list as-is however has the drawback that virtually
* every file in the kernel includes autoconf.h.
*
* If the user re-runs make *config, autoconf.h will be
* regenerated. make notices that and will rebuild every file which
* includes autoconf.h, i.e. basically all files. This is extremely
* annoying if the user just changed CONFIG_HIS_DRIVER from n to m.
*
* So we play the same trick that "mkdep" played before. We replace
* the dependency on autoconf.h by a dependency on every config
* option which is mentioned in any of the listed prequisites.
*
* kconfig populates a tree in include/config/ with an empty file
* for each config symbol and when the configuration is updated
* the files representing changed config options are touched
* which then let make pick up the changes and the files that use
* the config symbols are rebuilt.
*
* So if the user changes his CONFIG_HIS_DRIVER option, only the objects
* which depend on "include/linux/config/his/driver.h" will be rebuilt,
* so most likely only his driver ;-)
*
* The idea above dates, by the way, back to Michael E Chastain, AFAIK.
*
* So to get dependencies right, there are two issues:
* o if any of the files the compiler read changed, we need to rebuild
* o if the command line given to the compile the file changed, we
* better rebuild as well.
*
* The former is handled by using the -MD output, the later by saving
* the command line used to compile the old object and comparing it
* to the one we would now use.
*
* Again, also this idea is pretty old and has been discussed on
* kbuild-devel a long time ago. I don't have a sensibly working
* internet connection right now, so I rather don't mention names
* without double checking.
*
* This code here has been based partially based on mkdep.c, which
* says the following about its history:
*
* Copyright abandoned, Michael Chastain, <mailto:mec@shout.net>.
* This is a C version of syncdep.pl by Werner Almesberger.
*
*
* It is invoked as
*
* fixdep <depfile> <target> <cmdline>
*
* and will read the dependency file <depfile>
*
* The transformed dependency snipped is written to stdout.
*
* It first generates a line
*
* cmd_<target> = <cmdline>
*
* and then basically copies the .<target>.d file to stdout, in the
* process filtering out the dependency on autoconf.h and adding
* dependencies on include/config/my/option.h for every
* CONFIG_MY_OPTION encountered in any of the prequisites.
*
* It will also filter out all the dependencies on *.ver. We need
* to make sure that the generated version checksum are globally up
* to date before even starting the recursive build, so it's too late
* at this point anyway.
*
* The algorithm to grep for "CONFIG_..." is bit unusual, but should
* be fast ;-) We don't even try to really parse the header files, but
* merely grep, i.e. if CONFIG_FOO is mentioned in a comment, it will
* be picked up as well. It's not a problem with respect to
* correctness, since that can only give too many dependencies, thus
* we cannot miss a rebuild. Since people tend to not mention totally
* unrelated CONFIG_ options all over the place, it's not an
* efficiency problem either.
*
* (Note: it'd be easy to port over the complete mkdep state machine,
* but I don't think the added complexity is worth it)
*/
/*
* Note 2: if somebody writes HELLO_CONFIG_BOOM in a file, it will depend onto
* CONFIG_BOOM. This could seem a bug (not too hard to fix), but please do not
* fix it! Some UserModeLinux files (look at arch/um/) call CONFIG_BOOM as
* UML_CONFIG_BOOM, to avoid conflicts with /usr/include/linux/autoconf.h,
* through arch/um/include/uml-config.h; this fixdep "bug" makes sure that
* those files will have correct dependencies.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <ctype.h>
#include <arpa/inet.h>
#define INT_CONF ntohl(0x434f4e46)
#define INT_ONFI ntohl(0x4f4e4649)
#define INT_NFIG ntohl(0x4e464947)
#define INT_FIG_ ntohl(0x4649475f)
char *target;
char *depfile;
char *cmdline;
static void usage(void)
{
fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n");
exit(1);
}
/*
* Print out the commandline prefixed with cmd_<target filename> :=
*/
static void print_cmdline(void)
{
printf("cmd_%s := %s\n\n", target, cmdline);
}
char * str_config = NULL;
int size_config = 0;
int len_config = 0;
/*
* Grow the configuration string to a desired length.
* Usually the first growth is plenty.
*/
static void grow_config(int len)
{
while (len_config + len > size_config) {
if (size_config == 0)
size_config = 2048;
str_config = realloc(str_config, size_config *= 2);
if (str_config == NULL)
{ perror("fixdep:malloc"); exit(1); }
}
}
/*
* Lookup a value in the configuration string.
*/
static int is_defined_config(const char * name, int len)
{
const char * pconfig;
const char * plast = str_config + len_config - len;
for ( pconfig = str_config + 1; pconfig < plast; pconfig++ ) {
if (pconfig[ -1] == '\n'
&& pconfig[len] == '\n'
&& !memcmp(pconfig, name, len))
return 1;
}
return 0;
}
/*
* Add a new value to the configuration string.
*/
static void define_config(const char * name, int len)
{
grow_config(len + 1);
memcpy(str_config+len_config, name, len);
len_config += len;
str_config[len_config++] = '\n';
}
/*
* Clear the set of configuration strings.
*/
static void clear_config(void)
{
len_config = 0;
define_config("", 0);
}
/*
* Record the use of a CONFIG_* word.
*/
static void use_config(char *m, int slen)
{
char s[PATH_MAX];
char *p;
if (is_defined_config(m, slen))
return;
define_config(m, slen);
memcpy(s, m, slen); s[slen] = 0;
for (p = s; p < s + slen; p++) {
if (*p == '_')
*p = '/';
else
*p = tolower((int)*p);
}
printf(" $(wildcard include/config/%s.h) \\\n", s);
}
static void parse_config_file(char *map, size_t len)
{
int *end = (int *) (map + len);
/* start at +1, so that p can never be < map */
int *m = (int *) map + 1;
char *p, *q;
for (; m < end; m++) {
if (*m == INT_CONF) { p = (char *) m ; goto conf; }
if (*m == INT_ONFI) { p = (char *) m-1; goto conf; }
if (*m == INT_NFIG) { p = (char *) m-2; goto conf; }
if (*m == INT_FIG_) { p = (char *) m-3; goto conf; }
continue;
conf:
if (p > map + len - 7)
continue;
if (memcmp(p, "CONFIG_", 7))
continue;
for (q = p + 7; q < map + len; q++) {
if (!(isalnum(*q) || *q == '_'))
goto found;
}
continue;
found:
if (!memcmp(q - 7, "_MODULE", 7))
q -= 7;
if( (q-p-7) < 0 )
continue;
use_config(p+7, q-p-7);
}
}
/* test is s ends in sub */
static int strrcmp(char *s, char *sub)
{
int slen = strlen(s);
int sublen = strlen(sub);
if (sublen > slen)
return 1;
return memcmp(s + slen - sublen, sub, sublen);
}
static void do_config_file(char *filename)
{
struct stat st;
int fd;
void *map;
fd = open(filename, O_RDONLY);
if (fd < 0) {
fprintf(stderr, "fixdep: ");
perror(filename);
exit(2);
}
fstat(fd, &st);
if (st.st_size == 0) {
close(fd);
return;
}
map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if ((long) map == -1) {
perror("fixdep: mmap");
close(fd);
return;
}
parse_config_file(map, st.st_size);
munmap(map, st.st_size);
close(fd);
}
static void parse_dep_file(void *map, size_t len)
{
char *m = map;
char *end = m + len;
char *p;
char s[PATH_MAX];
p = strchr(m, ':');
if (!p) {
fprintf(stderr, "fixdep: parse error\n");
exit(1);
}
memcpy(s, m, p-m); s[p-m] = 0;
printf("deps_%s := \\\n", target);
m = p+1;
clear_config();
while (m < end) {
while (m < end && (*m == ' ' || *m == '\\' || *m == '\n'))
m++;
p = m;
while (p < end && *p != ' ') p++;
if (p == end) {
do p--; while (!isalnum(*p));
p++;
}
memcpy(s, m, p-m); s[p-m] = 0;
if (strrcmp(s, "include/generated/autoconf.h") &&
strrcmp(s, "arch/um/include/uml-config.h") &&
strrcmp(s, ".ver")) {
printf(" %s \\\n", s);
do_config_file(s);
}
m = p + 1;
}
printf("\n%s: $(deps_%s)\n\n", target, target);
printf("$(deps_%s):\n", target);
}
static void print_deps(void)
{
struct stat st;
int fd;
void *map;
fd = open(depfile, O_RDONLY);
if (fd < 0) {
fprintf(stderr, "fixdep: ");
perror(depfile);
exit(2);
}
fstat(fd, &st);
if (st.st_size == 0) {
fprintf(stderr,"fixdep: %s is empty\n",depfile);
close(fd);
return;
}
map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if ((long) map == -1) {
perror("fixdep: mmap");
close(fd);
return;
}
parse_dep_file(map, st.st_size);
munmap(map, st.st_size);
close(fd);
}
static void traps(void)
{
static char test[] __attribute__((aligned(sizeof(int)))) = "CONF";
int *p = (int *)test;
if (*p != INT_CONF) {
fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianess? %#x\n",
*p);
exit(2);
}
}
int main(int argc, char *argv[])
{
traps();
if (argc != 4)
usage();
depfile = argv[1];
target = argv[2];
cmdline = argv[3];
print_cmdline();
print_deps();
return 0;
}
/*
* Copyright (C) 2008 Red Hat, Inc., Jason Baron <jbaron@redhat.com>
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define DYNAMIC_DEBUG_HASH_BITS 6
static const char *program;
static void usage(void)
{
printf("Usage: %s <djb2|r5> <modname>\n", program);
exit(1);
}
/* djb2 hashing algorithm by Dan Bernstein. From:
* http://www.cse.yorku.ca/~oz/hash.html
*/
static unsigned int djb2_hash(char *str)
{
unsigned long hash = 5381;
int c;
c = *str;
while (c) {
hash = ((hash << 5) + hash) + c;
c = *++str;
}
return (unsigned int)(hash & ((1 << DYNAMIC_DEBUG_HASH_BITS) - 1));
}
static unsigned int r5_hash(char *str)
{
unsigned long hash = 0;
int c;
c = *str;
while (c) {
hash = (hash + (c << 4) + (c >> 4)) * 11;
c = *++str;
}
return (unsigned int)(hash & ((1 << DYNAMIC_DEBUG_HASH_BITS) - 1));
}
int main(int argc, char *argv[])
{
program = argv[0];
if (argc != 3)
usage();
if (!strcmp(argv[1], "djb2"))
printf("%d\n", djb2_hash(argv[2]));
else if (!strcmp(argv[1], "r5"))
printf("%d\n", r5_hash(argv[2]));
else
usage();
exit(0);
}
This diff is collapsed.
#
# Generated files
#
*.lex.c
*.tab.c
*.tab.h
*.moc
gconf.glade.h
*.pot
*.mo
#
# configuration programs
#
conf
mconf
nconf
qconf
gconf
kxgettext
This diff is collapsed.
scripts/kconfig/lxdialog/checklist.c
scripts/kconfig/lxdialog/inputbox.c
scripts/kconfig/lxdialog/menubox.c
scripts/kconfig/lxdialog/textbox.c
scripts/kconfig/lxdialog/util.c
scripts/kconfig/lxdialog/yesno.c
scripts/kconfig/mconf.c
scripts/kconfig/conf.c
scripts/kconfig/confdata.c
scripts/kconfig/gconf.c
scripts/kconfig/gconf.glade.h
scripts/kconfig/qconf.cc
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Needed for systems without gettext
$* -x c -o /dev/null - > /dev/null 2>&1 << EOF
#include <libintl.h>
int main()
{
gettext("");
return 0;
}
EOF
if [ ! "$?" -eq "0" ]; then
echo -DKBUILD_NO_NLS;
fi
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/
#ifndef EXPR_H
#define EXPR_H
#ifdef __cplusplus
extern "C" {
#endif
#include <assert.h>
#include <stdio.h>
#include "list.h"
#ifndef __cplusplus
#include <stdbool.h>
#endif
struct file {
struct file *next;
struct file *parent;
const char *name;
int lineno;
};
typedef enum tristate {
no, mod, yes
} tristate;
enum expr_type {
E_NONE, E_OR, E_AND, E_NOT,
E_EQUAL, E_UNEQUAL, E_LTH, E_LEQ, E_GTH, E_GEQ,
E_LIST, E_SYMBOL, E_RANGE
};
union expr_data {
struct expr *expr;
struct symbol *sym;
};
struct expr {
enum expr_type type;
union expr_data left, right;
};
#define EXPR_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2))
#define EXPR_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2))
#define EXPR_NOT(dep) (2-(dep))
#define expr_list_for_each_sym(l, e, s) \
for (e = (l); e && (s = e->right.sym); e = e->left.expr)
struct expr_value {
struct expr *expr;
tristate tri;
};
struct symbol_value {
void *val;
tristate tri;
};
enum symbol_type {
S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER
};
/* enum values are used as index to symbol.def[] */
enum {
S_DEF_USER, /* main user value */
S_DEF_AUTO, /* values read from auto.conf */
S_DEF_DEF3, /* Reserved for UI usage */
S_DEF_DEF4, /* Reserved for UI usage */
S_DEF_COUNT
};
/*
* Represents a configuration symbol.
*
* Choices are represented as a special kind of symbol and have the
* SYMBOL_CHOICE bit set in 'flags'.
*/
struct symbol {
/* The next symbol in the same bucket in the symbol hash table */
struct symbol *next;
/* The name of the symbol, e.g. "FOO" for 'config FOO' */
char *name;
/* S_BOOLEAN, S_TRISTATE, ... */
enum symbol_type type;
/*
* The calculated value of the symbol. The SYMBOL_VALID bit is set in
* 'flags' when this is up to date. Note that this value might differ
* from the user value set in e.g. a .config file, due to visibility.
*/
struct symbol_value curr;
/*
* Values for the symbol provided from outside. def[S_DEF_USER] holds
* the .config value.
*/
struct symbol_value def[S_DEF_COUNT];
/*
* An upper bound on the tristate value the user can set for the symbol
* if it is a boolean or tristate. Calculated from prompt dependencies,
* which also inherit dependencies from enclosing menus, choices, and
* ifs. If 'n', the user value will be ignored.
*
* Symbols lacking prompts always have visibility 'n'.
*/
tristate visible;
/* SYMBOL_* flags */
int flags;
/* List of properties. See prop_type. */
struct property *prop;
/* Dependencies from enclosing menus, choices, and ifs */
struct expr_value dir_dep;
/* Reverse dependencies through being selected by other symbols */
struct expr_value rev_dep;
/*
* "Weak" reverse dependencies through being implied by other symbols
*/
struct expr_value implied;
};
#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER)
#define SYMBOL_CONST 0x0001 /* symbol is const */
#define SYMBOL_CHECK 0x0008 /* used during dependency checking */
#define SYMBOL_CHOICE 0x0010 /* start of a choice block (null name) */
#define SYMBOL_CHOICEVAL 0x0020 /* used as a value in a choice block */
#define SYMBOL_VALID 0x0080 /* set when symbol.curr is calculated */
#define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */
#define SYMBOL_WRITE 0x0200 /* write symbol to file (KCONFIG_CONFIG) */
#define SYMBOL_CHANGED 0x0400 /* ? */
#define SYMBOL_AUTO 0x1000 /* value from environment variable */
#define SYMBOL_CHECKED 0x2000 /* used during dependency checking */
#define SYMBOL_WARNED 0x8000 /* warning has been issued */
/* Set when symbol.def[] is used */
#define SYMBOL_DEF 0x10000 /* First bit of SYMBOL_DEF */
#define SYMBOL_DEF_USER 0x10000 /* symbol.def[S_DEF_USER] is valid */
#define SYMBOL_DEF_AUTO 0x20000 /* symbol.def[S_DEF_AUTO] is valid */
#define SYMBOL_DEF3 0x40000 /* symbol.def[S_DEF_3] is valid */
#define SYMBOL_DEF4 0x80000 /* symbol.def[S_DEF_4] is valid */
/* choice values need to be set before calculating this symbol value */
#define SYMBOL_NEED_SET_CHOICE_VALUES 0x100000
/* Set symbol to y if allnoconfig; used for symbols that hide others */
#define SYMBOL_ALLNOCONFIG_Y 0x200000
#define SYMBOL_MAXLENGTH 256
#define SYMBOL_HASHSIZE 9973
/* A property represent the config options that can be associated
* with a config "symbol".
* Sample:
* config FOO
* default y
* prompt "foo prompt"
* select BAR
* config BAZ
* int "BAZ Value"
* range 1..255
*/
enum prop_type {
P_UNKNOWN,
P_PROMPT, /* prompt "foo prompt" or "BAZ Value" */
P_COMMENT, /* text associated with a comment */
P_MENU, /* prompt associated with a menu or menuconfig symbol */
P_DEFAULT, /* default y */
P_CHOICE, /* choice value */
P_SELECT, /* select BAR */
P_IMPLY, /* imply BAR */
P_RANGE, /* range 7..100 (for a symbol) */
P_ENV, /* value from environment variable */
P_SYMBOL, /* where a symbol is defined */
};
struct property {
struct property *next; /* next property - null if last */
struct symbol *sym; /* the symbol for which the property is associated */
enum prop_type type; /* type of property */
const char *text; /* the prompt value - P_PROMPT, P_MENU, P_COMMENT */
struct expr_value visible;
struct expr *expr; /* the optional conditional part of the property */
struct menu *menu; /* the menu the property are associated with
* valid for: P_SELECT, P_RANGE, P_CHOICE,
* P_PROMPT, P_DEFAULT, P_MENU, P_COMMENT */
struct file *file; /* what file was this property defined */
int lineno; /* what lineno was this property defined */
};
#define for_all_properties(sym, st, tok) \
for (st = sym->prop; st; st = st->next) \
if (st->type == (tok))
#define for_all_defaults(sym, st) for_all_properties(sym, st, P_DEFAULT)
#define for_all_choices(sym, st) for_all_properties(sym, st, P_CHOICE)
#define for_all_prompts(sym, st) \
for (st = sym->prop; st; st = st->next) \
if (st->text)
/*
* Represents a node in the menu tree, as seen in e.g. menuconfig (though used
* for all front ends). Each symbol, menu, etc. defined in the Kconfig files
* gets a node. A symbol defined in multiple locations gets one node at each
* location.
*/
struct menu {
/* The next menu node at the same level */
struct menu *next;
/* The parent menu node, corresponding to e.g. a menu or choice */
struct menu *parent;
/* The first child menu node, for e.g. menus and choices */
struct menu *list;
/*
* The symbol associated with the menu node. Choices are implemented as
* a special kind of symbol. NULL for menus, comments, and ifs.
*/
struct symbol *sym;
/*
* The prompt associated with the node. This holds the prompt for a
* symbol as well as the text for a menu or comment, along with the
* type (P_PROMPT, P_MENU, etc.)
*/
struct property *prompt;
/*
* 'visible if' dependencies. If more than one is given, they will be
* ANDed together.
*/
struct expr *visibility;
/*
* Ordinary dependencies from e.g. 'depends on' and 'if', ANDed
* together
*/
struct expr *dep;
/* MENU_* flags */
unsigned int flags;
/* Any help text associated with the node */
char *help;
/* The location where the menu node appears in the Kconfig files */
struct file *file;
int lineno;
/* For use by front ends that need to store auxiliary data */
void *data;
};
/*
* Set on a menu node when the corresponding symbol changes state in some way.
* Can be checked by front ends.
*/
#define MENU_CHANGED 0x0001
#define MENU_ROOT 0x0002
struct jump_key {
struct list_head entries;
size_t offset;
struct menu *target;
int index;
};
#define JUMP_NB 9
extern struct file *file_list;
extern struct file *current_file;
struct file *lookup_file(const char *name);
extern struct symbol symbol_yes, symbol_no, symbol_mod;
extern struct symbol *modules_sym;
extern struct symbol *sym_defconfig_list;
extern int cdebug;
struct expr *expr_alloc_symbol(struct symbol *sym);
struct expr *expr_alloc_one(enum expr_type type, struct expr *ce);
struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2);
struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2);
struct expr *expr_alloc_and(struct expr *e1, struct expr *e2);
struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
struct expr *expr_copy(const struct expr *org);
void expr_free(struct expr *e);
void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
tristate expr_calc_value(struct expr *e);
struct expr *expr_trans_bool(struct expr *e);
struct expr *expr_eliminate_dups(struct expr *e);
struct expr *expr_transform(struct expr *e);
int expr_contains_symbol(struct expr *dep, struct symbol *sym);
bool expr_depends_symbol(struct expr *dep, struct symbol *sym);
struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2);
void expr_fprint(struct expr *e, FILE *out);
struct gstr; /* forward */
void expr_gstr_print(struct expr *e, struct gstr *gs);
void expr_gstr_print_revdep(struct expr *e, struct gstr *gs);
static inline int expr_is_yes(struct expr *e)
{
return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes);
}
static inline int expr_is_no(struct expr *e)
{
return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no);
}
#ifdef __cplusplus
}
#endif
#endif /* EXPR_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
static struct kconf_id kconf_id_array[] = {
{ "mainmenu", T_MAINMENU, TF_COMMAND },
{ "menu", T_MENU, TF_COMMAND },
{ "endmenu", T_ENDMENU, TF_COMMAND },
{ "source", T_SOURCE, TF_COMMAND },
{ "choice", T_CHOICE, TF_COMMAND },
{ "endchoice", T_ENDCHOICE, TF_COMMAND },
{ "comment", T_COMMENT, TF_COMMAND },
{ "config", T_CONFIG, TF_COMMAND },
{ "menuconfig", T_MENUCONFIG, TF_COMMAND },
{ "help", T_HELP, TF_COMMAND },
{ "---help---", T_HELP, TF_COMMAND },
{ "if", T_IF, TF_COMMAND|TF_PARAM },
{ "endif", T_ENDIF, TF_COMMAND },
{ "depends", T_DEPENDS, TF_COMMAND },
{ "optional", T_OPTIONAL, TF_COMMAND },
{ "default", T_DEFAULT, TF_COMMAND, S_UNKNOWN },
{ "prompt", T_PROMPT, TF_COMMAND },
{ "tristate", T_TYPE, TF_COMMAND, S_TRISTATE },
{ "def_tristate", T_DEFAULT, TF_COMMAND, S_TRISTATE },
{ "bool", T_TYPE, TF_COMMAND, S_BOOLEAN },
{ "def_bool", T_DEFAULT, TF_COMMAND, S_BOOLEAN },
{ "int", T_TYPE, TF_COMMAND, S_INT },
{ "hex", T_TYPE, TF_COMMAND, S_HEX },
{ "string", T_TYPE, TF_COMMAND, S_STRING },
{ "select", T_SELECT, TF_COMMAND },
{ "imply", T_IMPLY, TF_COMMAND },
{ "range", T_RANGE, TF_COMMAND },
{ "visible", T_VISIBLE, TF_COMMAND },
{ "option", T_OPTION, TF_COMMAND },
{ "on", T_ON, TF_PARAM },
{ "modules", T_OPT_MODULES, TF_OPTION },
{ "defconfig_list", T_OPT_DEFCONFIG_LIST, TF_OPTION },
{ "env", T_OPT_ENV, TF_OPTION },
{ "allnoconfig_y", T_OPT_ALLNOCONFIG_Y, TF_OPTION },
};
#define KCONF_ID_ARRAY_SIZE (sizeof(kconf_id_array)/sizeof(struct kconf_id))
static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len)
{
int i;
for (i = 0; i < KCONF_ID_ARRAY_SIZE; i++) {
struct kconf_id *id = kconf_id_array+i;
int l = strlen(id->name);
if (len == l && !memcmp(str, id->name, len))
return id;
}
return NULL;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 */
#include <stdarg.h>
/* confdata.c */
void conf_parse(const char *name);
int conf_read(const char *name);
int conf_read_simple(const char *name, int);
int conf_write_defconfig(const char *name);
int conf_write(const char *name);
int conf_write_autoconf(void);
bool conf_get_changed(void);
void conf_set_changed_callback(void (*fn)(void));
void conf_set_message_callback(void (*fn)(const char *fmt, va_list ap));
/* menu.c */
extern struct menu rootmenu;
bool menu_is_empty(struct menu *menu);
bool menu_is_visible(struct menu *menu);
bool menu_has_prompt(struct menu *menu);
const char * menu_get_prompt(struct menu *menu);
struct menu * menu_get_root_menu(struct menu *menu);
struct menu * menu_get_parent_menu(struct menu *menu);
bool menu_has_help(struct menu *menu);
const char * menu_get_help(struct menu *menu);
struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head);
void menu_get_ext_help(struct menu *menu, struct gstr *help);
/* symbol.c */
extern struct symbol * symbol_hash[SYMBOL_HASHSIZE];
struct symbol * sym_lookup(const char *name, int flags);
struct symbol * sym_find(const char *name);
char *sym_expand_string_value(const char *in);
const char * sym_escape_string_value(const char *in);
struct symbol ** sym_re_search(const char *pattern);
const char * sym_type_name(enum symbol_type type);
void sym_calc_value(struct symbol *sym);
enum symbol_type sym_get_type(struct symbol *sym);
bool sym_tristate_within_range(struct symbol *sym,tristate tri);
bool sym_set_tristate_value(struct symbol *sym,tristate tri);
tristate sym_toggle_tristate_value(struct symbol *sym);
bool sym_string_valid(struct symbol *sym, const char *newval);
bool sym_string_within_range(struct symbol *sym, const char *str);
bool sym_set_string_value(struct symbol *sym, const char *newval);
bool sym_is_changable(struct symbol *sym);
struct property * sym_get_choice_prop(struct symbol *sym);
const char * sym_get_string_value(struct symbol *sym);
const char * prop_get_type_name(enum prop_type type);
/* expr.c */
void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken);
This is NOT the official version of dialog. This version has been
significantly modified from the original. It is for use by the Linux
kernel configuration script. Please do not bother Savio Lam with
questions about this program.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment