Skip to content

Commit

Permalink
Merge pull request #263 from vanvught/development
Browse files Browse the repository at this point in the history
Merged with development branch
  • Loading branch information
vanvught authored May 19, 2023
2 parents e714c2b + 6646080 commit 1996b1c
Show file tree
Hide file tree
Showing 653 changed files with 11,299 additions and 15,740 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,7 @@ linux_e131/linux_e131
linux_osc/linux_osc
*/spiflash.bin
*.bin

lib-nextion
lib-node

9 changes: 6 additions & 3 deletions firmware-template-bcm/Rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ $(info [${LIB7DEP}])

COPS_COMMON=-DBARE_METAL -DNO_EMAC -DSD_WRITE_SUPPORT $(DEFINES)
COPS_COMMON+=$(INCDIRS) $(LIBINCDIRS) $(addprefix -I,$(EXTRA_INCLUDES))
COPS_COMMON+=-Wall -Werror -O2 -nostartfiles -nostdinc -nostdlib -ffreestanding -mhard-float -mfloat-abi=hard #-fstack-usage
COPS_COMMON+=-Wall -Werror -O2 -nostartfiles -nostdlib -ffreestanding -mhard-float -mfloat-abi=hard #-fstack-usage
#COPS_COMMON+=-ffunction-sections -fdata-sections

COPS=-mfpu=vfp -march=armv6zk -mtune=arm1176jzf-s -mcpu=arm1176jzf-s
COPS+=-DRPI1
Expand All @@ -67,6 +68,8 @@ COPS7=-mfpu=neon-vfpv4 -march=armv7-a -mtune=cortex-a7
COPS7+=-DRPI2
COPS7+=$(COPS_COMMON)

LDOPS=--gc-sections --print-gc-sections

# Why does gcc not automatically select the correct path based on -m options?
PLATFORM_LIBGCC:= -L $(shell dirname `$(CC) $(COPS) -print-libgcc-file-name`)/armv7-a/cortex-a7/hardfp/vfpv4
PLATFORM_LIBGCC+= -L $(shell dirname `$(CC) $(COPS) -print-libgcc-file-name`)
Expand All @@ -87,15 +90,15 @@ $(BUILD)$1/%.o: $(SOURCE)$1/%.c
$(CC) $(COPS) -c $$< -o $$@

$(BUILD)$1/%.o: $(SOURCE)$1/%.cpp
$(CPP) -pedantic -fno-exceptions -fno-unwind-tables -fno-rtti -fno-threadsafe-statics -std=c++11 -nostdinc++ $(COPS) -c $$< -o $$@
$(CPP) -pedantic -fno-exceptions -fno-unwind-tables -fno-rtti -fno-threadsafe-statics -std=c++11 $(COPS) -c $$< -o $$@
endef

define compile-objects7
$(BUILD7)$1/%.o: $(SOURCE)$1/%.c
$(CC) $(COPS7) -c $$< -o $$@

$(BUILD7)$1/%.o: $(SOURCE)$1/%.cpp
$(CPP) -pedantic -fno-exceptions -fno-unwind-tables -fno-rtti -std=c++11 -nostdinc++ $(COPS7) -c $$< -o $$@
$(CPP) -pedantic -fno-exceptions -fno-unwind-tables -fno-rtti -std=c++11 $(COPS7) -c $$< -o $$@
endef

THISDIR=$(CURDIR)
Expand Down
7 changes: 4 additions & 3 deletions firmware-template-bcm/lib/Rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ $(info $$DEFINES [${DEFINES}])
$(info $$MAKE_FLAGS [${MAKE_FLAGS}])

COPS_COMMON=-DBARE_METAL -DNO_EMAC -DSD_WRITE_SUPPORT $(DEFINES) $(MAKE_FLAGS) $(INCLUDES)
COPS_COMMON+=-Wall -Werror -O2 -nostartfiles -ffreestanding -nostdinc -nostdlib -mhard-float -mfloat-abi=hard -fno-exceptions -fno-unwind-tables -fprefetch-loop-arrays #-fstack-usage
COPS_COMMON+=-Wall -Werror -O2 -nostartfiles -ffreestanding -nostdlib -mhard-float -mfloat-abi=hard -fno-exceptions -fno-unwind-tables -fprefetch-loop-arrays #-fstack-usage
#COPS_COMMON+=-ffunction-sections -fdata-sections

COPS=-mfpu=vfp -march=armv6zk -mtune=arm1176jzf-s -mcpu=arm1176jzf-s
COPS+=-DRPI1
Expand Down Expand Up @@ -66,7 +67,7 @@ $(BUILD)$1/%.o: $1/%.c
$(CC) $(COPS) -c $$< -o $$@

$(BUILD)$1/%.o: $1/%.cpp
$(CPP) $(COPS) -pedantic -fno-exceptions -fno-unwind-tables -fno-rtti -fno-threadsafe-statics -std=c++11 -nostdinc++ -c $$< -o $$@
$(CPP) $(COPS) -pedantic -fno-exceptions -fno-unwind-tables -fno-rtti -fno-threadsafe-statics -std=c++11 -c $$< -o $$@

$(BUILD)$1/%.o: $1/%.S
$(CC) $(COPS) -D__ASSEMBLY__ -c $$< -o $$@
Expand All @@ -77,7 +78,7 @@ $(BUILD7)$1/%.o: $1/%.c
$(CC) $(COPS7) -c $$< -o $$@

$(BUILD7)$1/%.o: $1/%.cpp
$(CPP) $(COPS7) -pedantic -fno-exceptions -fno-unwind-tables -fno-rtti -fno-threadsafe-statics -std=c++11 -nostdinc++ -c $$< -o $$@
$(CPP) $(COPS7) -pedantic -fno-exceptions -fno-unwind-tables -fno-rtti -fno-threadsafe-statics -std=c++11 -c $$< -o $$@

$(BUILD7)$1/%.o: $1/%.S
$(CC) $(COPS7) -D__ASSEMBLY__ -c $$< -o $$@
Expand Down
4 changes: 2 additions & 2 deletions firmware-template-bcm/vectors.S
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* defined in arch/arm/include/asm/assembler.h
* Copyright (C) 1996-2000 Russell King
*/
/* Copyright (C) 2016-2018 by Arjan van Vught mailto:[email protected]
/* Copyright (C) 2016-2023 by Arjan van Vught mailto:[email protected]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -144,7 +144,7 @@ reset:
#endif

bl hardware_init
bl notmain
bl main
halt:
wfe
b halt
Expand Down
6 changes: 5 additions & 1 deletion firmware-template-h3/Rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,15 @@ ifneq ($(findstring _TIME_STAMP_YEAR_,$(DEFINES)), _TIME_STAMP_YEAR_)
endif

DEFINES+=-DENABLE_TFTP_SERVER -D__FPU_PRESENT=1
DEFINES+=-DCONFIG_MDNS_DOMAIN_REVERSE

ifneq ($(findstring CONFIG_STORE_USE_SPI,$(DEFINES)), CONFIG_STORE_USE_SPI)
DEFINES+=-DCONFIG_STORE_USE_SPI
endif

#DEFINES+=-DDEBUG_I2C
#DEFINES+=-DDEBUG_STACK

# The variable for the firmware include directories
INCDIRS+=../include $(wildcard ./include) $(wildcard ./*/include) ../firmware-template-h3/include
INCDIRS:=$(addprefix -I,$(INCDIRS))
Expand All @@ -79,7 +83,7 @@ $(info [${LIBDEP}])
COPS=-DBARE_METAL -DH3 -D$(PLATFORM) $(DEFINES)
COPS+=$(INCDIRS) $(LIBINCDIRS) $(addprefix -I,$(EXTRA_INCLUDES))
COPS+=-mfpu=neon-vfpv4 -mcpu=cortex-a7 -mfloat-abi=hard -mhard-float
COPS+=-nostartfiles -ffreestanding -nostdinc -nostdlib -fprefetch-loop-arrays
COPS+=-nostartfiles -ffreestanding -nostdlib -fprefetch-loop-arrays
COPS+=-O2 -Wall -Werror -Wpedantic -Wextra -Wunused -Wsign-conversion -Wconversion
COPS+=-Wduplicated-cond -Wlogical-op #-Wduplicated-branches
COPS+=-ffunction-sections -fdata-sections
Expand Down
3 changes: 2 additions & 1 deletion firmware-template-h3/lib/Rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SRCDIR+=src/debug

$(info [${SRCDIR}])

INCLUDES:=-I./include -I../include -I../lib-hal/include -I../lib-debug/include -I../lib-h3/include -I../lib-h3/include/firmware -I../lib-arm/include
INCLUDES:=-I./include -I../include -I../lib-hal/include -I../lib-debug/include -I../lib-h3/include -I../lib-arm/include
INCLUDES+=$(addprefix -I,$(EXTRA_INCLUDES))

DEFINES:=-D$(PLATFORM) $(addprefix -D,$(DISPLAYS)) $(addprefix -D,$(DEFINES))
Expand All @@ -35,6 +35,7 @@ ifneq ($(findstring _TIME_STAMP_YEAR_,$(DEFINES)), _TIME_STAMP_YEAR_)
endif

DEFINES+=-DENABLE_TFTP_SERVER -D__FPU_PRESENT=1
DEFINES+=-DCONFIG_MDNS_DOMAIN_REVERSE

ifneq ($(findstring CONFIG_STORE_USE_SPI,$(DEFINES)), CONFIG_STORE_USE_SPI)
DEFINES+=-DCONFIG_STORE_USE_SPI
Expand Down
2 changes: 2 additions & 0 deletions firmware-template-h3/memmap
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ __fiq_stack_top = .;
__irq_stack_top = .;

. = ALIGN(4);
PROVIDE( stack_low = .);
. = . + __svc_stack_size;
__svc_stack_top = .;
PROVIDE( _sp = __svc_stack_top );

. = ALIGN(4);
. = . + __sys_stack_size;
Expand Down
8 changes: 6 additions & 2 deletions firmware-template-h3/vectors.S
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @file vector.S
*
*/
/* Copyright (C) 2018-2020 by Arjan van Vught mailto:[email protected]
/* Copyright (C) 2018-2023 by Arjan van Vught mailto:[email protected]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -142,14 +142,18 @@ reset:
strlo r0, [r1], #4
blo 4b

#if defined (DEBUG_STACK)
bl stack_debug_init
#endif

bl vfp_init
bl mmu_enable
bl hardware_init
#if defined ( NO_EMAC )
bl emac_shutdown
#endif

bl notmain
bl main
halt:
wfe
b halt
Expand Down
36 changes: 27 additions & 9 deletions firmware-template-linux/Rules.mk
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,47 +28,63 @@ TTT=uuid
TMPVAR:=$(LIBS)
LIBS=$(filter-out $(TTT), $(TMPVAR))
LIBS+=debug
LDLIBS=

ifdef LINUX
ifneq (, $(shell which /opt/vc/bin/vcgencmd))
ifneq (, $(shell which vcgencmd))
BCM2835 = ./../lib-bcm2835_raspbian
ifneq "$(wildcard $(BCM2835) )" ""
LIBS+=bcm2835_raspbian
else
LIBS+=bcm2835
LDLIBS=-lbcm2835
endif
DEFINES+=RASPPI
endif
endif

$(info $$LDLIBS [${LDLIBS}])

DEFINES:=$(addprefix -D,$(DEFINES))
DEFINES+=-DDISABLE_TFTP -DENABLE_HTTPD -DDISABLE_RTC
DEFINES+=-DCONFIG_STORE_USE_FILE
DEFINES+=-DDISABLE_TFTP
DEFINES+=-DDISABLE_RTC
DEFINES+=-DENABLE_HTTPD
DEFINES+=-DCONFIG_STORE_USE_FILE
DEFINES+=-DCONFIG_MDNS_DOMAIN_REVERSE
DEFINES+=$(addprefix -I,$(EXTRA_INCLUDES))

# The variable for the firmware include directories
INCDIRS=$(wildcard ./lib) $(wildcard ./include) $(wildcard ./*/include) ../firmware-template-linux/include
INCDIRS:=$(addprefix -I,$(INCDIRS))
INCDIRS:=$(addprefix -I,$(INCDIRS)) -I../lib-display/include

# The variable for the libraries include directory
LIBINCDIRS=$(addprefix -I../lib-,$(LIBS))
LIBINCDIRS+=$(addprefix -I../lib-,$(DEFAULT_INCLUDES))
LIBINCDIRS=$(addprefix -I../lib-,$(DEFAULT_INCLUDES))
LIBINCDIRS+=$(addprefix -I../lib-,$(LIBS))
ifeq ($(findstring CONFIG_DISPLAY_USE_CUSTOM,$(DEFINES)),CONFIG_DISPLAY_USE_CUSTOM)
ifneq ($(CONFIG_DISPLAY_LIB),)
LIBINCDIRS+=$(addprefix -I../lib-,$(CONFIG_DISPLAY_LIB))
endif
endif
LIBINCDIRS:=$(addsuffix /include, $(LIBINCDIRS))

DEFINES+=$(INCDIRS) $(LIBINCDIRS)

$(info $$LIBS [${LIBS}])

# The variables for the ld -L flag
LIB=$(addprefix -L../lib-,$(LIBS))
LIB:=$(addsuffix /lib_linux, $(LIB))

# The variable for the ld -l flag
LDLIBS:=$(addprefix -l,$(LIBS))
LDLIBS+=$(addprefix -l,$(LIBS))
$(info $$LDLIBS [${LDLIBS}])

# The variables for the dependency check
LIBDEP=$(addprefix ../lib-,$(LIBS))

COPS=$(DEFINES) $(INCDIRS) $(LIBINCDIRS) $(addprefix -I,$(EXTRA_INCLUDES))
COPS=$(DEFINES)
COPS+=-g -Wall -Werror -Wextra -pedantic
COPS+=-Wunused #-Wsign-conversion #-Wconversion
COPS+=-fstack-protector-all

CCPOPS=-fno-rtti -fno-exceptions -fno-unwind-tables -Wnon-virtual-dtor

Expand All @@ -84,6 +100,8 @@ else
CCPOPS+=-std=c++11
endif

COPS+=-ffunction-sections -fdata-sections

SOURCE = ./

CURR_DIR:=$(notdir $(patsubst %/,%,$(CURDIR)))
Expand Down
22 changes: 17 additions & 5 deletions firmware-template-linux/lib/Rules.mk
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@ LIB_NAME :=$(patsubst lib-%,%,$(CURR_DIR))

DEFINES:=$(addprefix -D,$(DEFINES))
DEFINES+=-D_TIME_STAMP_YEAR_=$(shell date +"%Y") -D_TIME_STAMP_MONTH_=$(shell date +"%-m") -D_TIME_STAMP_DAY_=$(shell date +"%-d")
DEFINES+=-DDISABLE_TFTP -DENABLE_HTTPD -DDISABLE_RTC
DEFINES+=-DDISABLE_TFTP
DEFINES+=-DDISABLE_RTC
DEFINES+=-DENABLE_HTTPD
DEFINES+=-DCONFIG_STORE_USE_FILE
DEFINES+=-DCONFIG_MDNS_DOMAIN_REVERSE

INCLUDES:=-I./include -I../lib-hal/include -I../lib-debug/include
INCLUDES:=-I./include -I../lib-hal/include -I../lib-display/include -I../lib-debug/include
INCLUDES+=$(addprefix -I,$(EXTRA_INCLUDES))
ifeq ($(findstring CONFIG_DISPLAY_USE_CUSTOM,$(DEFINES)),CONFIG_DISPLAY_USE_CUSTOM)
ifneq ($(CONFIG_DISPLAY_LIB),)
INCLUDES+=-I../lib-$(CONFIG_DISPLAY_LIB)/include
endif
endif

detected_OS := $(shell uname 2>/dev/null || echo Unknown)
detected_OS := $(patsubst CYGWIN%,Cygwin,$(detected_OS))
Expand All @@ -27,7 +36,7 @@ ifeq ($(detected_OS),Darwin)
endif

ifeq ($(detected_OS),Linux)
ifneq (, $(shell which /opt/vc/bin/vcgencmd))
ifneq (, $(shell which vcgencmd))

BCM2835 = ./../lib-bcm2835_raspbian

Expand All @@ -42,12 +51,13 @@ ifeq ($(detected_OS),Linux)
endif

$(info $$DEFINES [${DEFINES}])
$(info $$INCLUDES [${INCLUDES}])
$(info $$MAKE_FLAGS [${MAKE_FLAGS}])

COPS=$(DEFINES) $(MAKE_FLAGS) $(INCLUDES)
COPS+=-g -Wall -Werror -Wextra -Wpedantic
COPS+=-Wunused -Wsign-conversion #-Wconversion
#COPS+=-fstack-usage
COPS+=-Wunused #-Wsign-conversion -Wconversion
COPS+=-fstack-protector-all

ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
else
Expand All @@ -63,6 +73,8 @@ else
CCPOPS+=-std=c++11
endif

COPS+=-ffunction-sections -fdata-sections

SRCDIR = src src/linux $(EXTRA_SRCDIR)

BUILD = build_linux/
Expand Down
15 changes: 12 additions & 3 deletions firmware-template/libs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,24 @@ ifeq ($(findstring NODE_NODE,$(DEFINES)),NODE_NODE)
endif

ifeq ($(findstring NODE_ARTNET,$(DEFINES)),NODE_ARTNET)
LIBS+=artnet4 artnet e131
DEFINES+=ARTNET_HAVE_FAILSAFE_RECORD
ifeq ($(findstring ARTNET_VERSION=3,$(DEFINES)),ARTNET_VERSION=3)
LIBS+=artnet
else
LIBS+=artnet4 artnet e131
DEFINES+=NODE_E131
ifeq ($(findstring ARTNET_HAVE_DMXIN,$(DEFINES)),ARTNET_HAVE_DMXIN)
LIBS+=dmxartnet
endif
endif
endif

ifeq ($(findstring NODE_E131,$(DEFINES)),NODE_E131)
ifneq ($(findstring e131,$(LIBS)),e131)
LIBS+=e131
endif
ifeq ($(findstring E131_HAVE_DMXIN,$(DEFINES)),E131_HAVE_DMXIN)
LIBS+=dmxe131
endif
endif

ifeq ($(findstring NODE_SHOWFILE,$(DEFINES)),NODE_SHOWFILE)
Expand Down Expand Up @@ -172,6 +178,8 @@ endif

ifneq ($(findstring CONFIG_DISPLAY_USE_CUSTOM,$(DEFINES)),CONFIG_DISPLAY_USE_CUSTOM)
LIBS+=display
else
LIBS+=$(CONFIG_DISPLAY_LIB)
endif

ifneq ($(findstring properties,$(LIBS)),properties)
Expand All @@ -180,4 +188,5 @@ endif

LIBS+=lightset device hal

$(info $$LIBS [${LIBS}])
$(info $$LIBS [${LIBS}])
$(info $$DEFINES [${DEFINES}])
Loading

0 comments on commit 1996b1c

Please sign in to comment.