Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V4 major revision proposal #1431

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ BraceWrapping:
BeforeElse: true
IndentBraces: false
# AfterExternBlock: true # available in v7
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
# BreakBeforeBinaryOperators: None
BreakBeforeBraces: Linux
BreakBeforeBraces: Custom
# BreakBeforeTernaryOperators: true
# BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: AfterColon
ColumnLimit: 120
# CommentPragmas: '^ IWYU pragma:'
# ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
# ConstructorInitializerIndentWidth: 4
# ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
Expand Down Expand Up @@ -75,10 +79,13 @@ PointerAlignment: Left
ReflowComments: false
SortIncludes: false
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Never
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
# SpaceBeforeCpp11BracedList: true # available in v7
# SpaceBeforeCtorInitializerColon: false # available in v7
# SpaceBeforeInheritanceColon: false # available in v7
SpacesInAngles: false
SpacesInContainerLiterals: false
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ nbproject
GTAGS
GRTAGS
GPATH
/.metadata/
2 changes: 1 addition & 1 deletion Sming/.cproject
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<option id="cdt.managedbuild.option.gnu.cross.prefix.1865912994" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix"/>
<option id="cdt.managedbuild.option.gnu.cross.path.1823876896" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.712625349" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
<builder id="cdt.managedbuild.builder.gnu.cross.2019070319" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>
<builder id="cdt.managedbuild.builder.gnu.cross.2019070319" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="unlimited" superClass="cdt.managedbuild.builder.gnu.cross"/>
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.1904387915" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
<option id="gnu.c.compiler.option.include.paths.378707889" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;../${ESP_HOME}&quot;"/>
Expand Down
2 changes: 1 addition & 1 deletion Sming/Libraries/ArduCAM/ArduCAMStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ bool ArduCAMStream::isFinished() {
}


uint16_t ArduCAMStream::readMemoryBlock(char* data, int bufSize) {
size_t ArduCAMStream::readMemoryBlock(char* data, size_t bufSize) {
if(!dataReady()) {
return 0;
}
Expand Down
17 changes: 9 additions & 8 deletions Sming/Libraries/ArduCAM/ArduCAMStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@

#include "../../Services/HexDump/HexDump.h"


class ArduCAMStream: public ReadWriteStream {
class ArduCAMStream : public ReadWriteStream {
public:
ArduCAMStream(ArduCAM *cam);
ArduCAMStream(ArduCAM* cam);
virtual ~ArduCAMStream();

virtual StreamType getStreamType() { return eSST_User; }
virtual StreamType getStreamType() const
{
return eSST_User;
}

virtual uint16_t readMemoryBlock(char* data, int bufSize);
virtual size_t readMemoryBlock(char* data, size_t bufSize);
virtual bool seek(int len);
virtual bool isFinished();

Expand All @@ -34,7 +36,7 @@ class ArduCAMStream: public ReadWriteStream {
* @param size Quantity of chars to writen
* @retval size_t Quantity of chars written to stream
*/
virtual size_t write(const uint8_t *buffer, size_t size)
virtual size_t write(const uint8_t* buffer, size_t size)
{
return 0;
}
Expand All @@ -43,8 +45,7 @@ class ArduCAMStream: public ReadWriteStream {
int available();

private:

ArduCAM *myCAM;
ArduCAM* myCAM;
bool transfer = false;
bool sendHeader = false;
size_t len;
Expand Down
40 changes: 35 additions & 5 deletions Sming/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ COM_SPEED_SERIAL ?= $(COM_SPEED)
# By default `debugf` does not print file name and line number. If you want this enabled set the directive below to 1
DEBUG_PRINT_FILENAME_AND_LINE ?= 0

# Defaut debug verbose level is INFO, where DEBUG=3 INFO=2 WARNING=1 ERROR=0
# Default debug verbose level is INFO, where DEBUG=3 INFO=2 WARNING=1 ERROR=0
DEBUG_VERBOSE_LEVEL ?= 2

# Disable CommandExecutor functionality if not used and save some ROM and RAM
Expand Down Expand Up @@ -186,6 +186,7 @@ EXTRA_INCDIR += third-party/rboot third-party/rboot/appcode
THIRD_PARTY_DATA += third-party/spiffs/makefile
MODULES += third-party/spiffs/src
EXTRA_INCDIR += third-party/spiffs/src
CFLAGS += -DSPIFFS_OBJ_META_LEN=16

# => http-parser
THIRD_PARTY_DATA += third-party/http-parser/Makefile
Expand Down Expand Up @@ -250,6 +251,10 @@ ifeq ($(LWIP_EXTRA_FLAGS),1)
ifeq ($(ENABLE_ESPCONN), 1)
LIBLWIP = lwip_full
endif

ifeq ($(LWIP_MDNS_RESPONDER), 1)
EXTRA_CFLAGS_LWIP += -DLWIP_MDNS_RESPONDER=1
endif
CUSTOM_TARGETS += $(USER_LIBDIR)/lib$(LIBLWIP).a
endif

Expand All @@ -265,12 +270,35 @@ endif
MFORCE32 := $(shell $(CC) --help=target | grep mforce-l32)

# compiler flags using during compilation of source files. Add '-pg' for debugging
CFLAGS += -Wpointer-arith -Wundef -Werror -Wl,-EL -nostdlib -mlongcalls -mtext-section-literals -finline-functions -fdata-sections -ffunction-sections \
-D__ets__ -DICACHE_FLASH -DARDUINO=106 -DCOM_SPEED_SERIAL=$(COM_SPEED_SERIAL) -DENABLE_CMD_EXECUTOR=$(ENABLE_CMD_EXECUTOR) -DESP8266=1 -DSMING_INCLUDED=1
#
# Core plus ArduinoJson build with only these warnings disabled:
#
# comment
# strict-aliasing
# unused-function
# unused-variable
#
# Libraries require these ones disabled also
#
# reorder
# parentheses
# unused-but-set-variable
# maybe-uninitialized *
# return-type *
# sign-compare +
# array-bounds *
#
# * masks serious issues
# + frail code, likely to break
# -Wno-parentheses -Wno-unused-but-set-variable -Wno-maybe-uninitialized -Wno-return-type -Wno-sign-compare -Wno-array-bounds \
#
CFLAGS += -Wall -Wno-comment -Wno-strict-aliasing -Wno-unused-function -Wno-unused-variable \
-Wl,-EL -nostdlib -mlongcalls -mtext-section-literals -finline-functions -fdata-sections -ffunction-sections \
-D__ets__ -DICACHE_FLASH -DARDUINO=106 -DCOM_SPEED_SERIAL=$(COM_SPEED_SERIAL) -DENABLE_CMD_EXECUTOR=$(ENABLE_CMD_EXECUTOR) -DESP8266=1 -DSMING_INCLUDED=1
ifeq ($(SMING_RELEASE),1)
# See: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
# for full list of optimization options
CFLAGS += -Os -DSMING_RELEASE=1
CFLAGS += -Os -DSMING_RELEASE=1 -DLWIP_NOASSERT
else ifeq ($(ENABLE_GDB), 1)
CFLAGS += -Og -ggdb -DGDBSTUB_FREERTOS=0 -DENABLE_GDB=1
else
Expand All @@ -287,7 +315,7 @@ endif
#Append debug options
CFLAGS += -DCUST_FILE_BASE=$$* -DDEBUG_VERBOSE_LEVEL=$(DEBUG_VERBOSE_LEVEL) -DDEBUG_PRINT_FILENAME_AND_LINE=$(DEBUG_PRINT_FILENAME_AND_LINE)

CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions -std=c++11 -felide-constructors
CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions -std=c++11 -felide-constructors -Wno-reorder

# linker flags used to generate the main object file
LDFLAGS = -nostdlib -u call_user_start -Wl,-static -Wl,--gc-sections -Wl,-wrap,system_restart_local
Expand Down Expand Up @@ -449,6 +477,7 @@ $(FW_BASE):
$(Q) mkdir -p $@/upgrade

clean:
$(Q) rm -f $(USER_LIBDIR)/$(LIBSMING).a
$(Q) rm -f $(APP_AR)
$(Q) rm -f $(TARGET_OUT)
$(Q) rm -rf $(BUILD_DIR)
Expand Down Expand Up @@ -554,6 +583,7 @@ dist-clean: clean samples-clean third-party-clean libraries-clean tools-clean
done
$(Q) $(GIT) checkout $(USER_LIBDIR)



# Files that should follow our coding standards
CS_FILES=$(shell find SmingCore/ -name '*.cpp' -o -name '*.h' -o -name '*.c') \
Expand Down
11 changes: 7 additions & 4 deletions Sming/Makefile-project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ ifeq ($(ENABLE_WPS),1)
endif

# compiler flags using during compilation of source files
CFLAGS = -Wpointer-arith -Wundef -Werror -Wl,-EL -nostdlib -mlongcalls -mtext-section-literals -finline-functions -fdata-sections -ffunction-sections \
-D__ets__ -DICACHE_FLASH -DARDUINO=106 -DCOM_SPEED_SERIAL=$(COM_SPEED_SERIAL) $(USER_CFLAGS) -DENABLE_CMD_EXECUTOR=$(ENABLE_CMD_EXECUTOR) -DSMING_INCLUDED=1
CFLAGS = -Wall -Wno-comment -Wno-strict-aliasing -Wno-unused-function -Wno-unused-variable \
-Wl,-EL -nostdlib -mlongcalls -mtext-section-literals -finline-functions -fdata-sections -ffunction-sections \
-D__ets__ -DICACHE_FLASH -DARDUINO=106 -DCOM_SPEED_SERIAL=$(COM_SPEED_SERIAL) $(USER_CFLAGS) -DENABLE_CMD_EXECUTOR=$(ENABLE_CMD_EXECUTOR) -DESP8266=1 -DSMING_INCLUDED=1

# => SDK
ifneq (,$(findstring third-party/ESP8266_NONOS_SDK, $(SDK_BASE)))
CFLAGS += -DSDK_INTERNAL
Expand Down Expand Up @@ -311,6 +313,7 @@ endif
ifeq ($(DISABLE_SPIFFS), 1)
CFLAGS += -DDISABLE_SPIFFS=1
endif
CFLAGS += -DSPIFFS_OBJ_META_LEN=16

# linker flags used to generate the main object file
LDFLAGS = -nostdlib -u call_user_start -u custom_crash_callback -Wl,-static -Wl,--gc-sections -Wl,-Map=$(FW_BASE)/firmware.map -Wl,-wrap,system_restart_local
Expand Down Expand Up @@ -443,7 +446,7 @@ $(FW_BASE)/$(IMAGE_MAIN): $(APP_AR)
# Pass 1: Generate rom0 to be able to check its size
$(Q) $(LD) -L$(USER_LIBDIR) -L$(SDK_LIBDIR) -L$(LD_PATH) -T$(LD_SCRIPT) $(LDFLAGS) -Wl,--start-group $(LIBS) $(APP_AR) -Wl,--end-group -o $(TARGET_OUT).tmp

$(Q) $(STRIP) $(TARGET_OUT).tmp
# $(Q) $(STRIP) $(TARGET_OUT).tmp

$(Q) $(ESPTOOL2) $(ESPTOOL2_MAIN_ARGS) $(TARGET_OUT).tmp $@ $(ESPTOOL2_SECTS)

Expand All @@ -458,7 +461,7 @@ $(TARGET_OUT): $(FW_BASE)/$(IMAGE_MAIN) $(PROJECT_LD_PATH)/$(LD_SCRIPT)
# Pass 2: Generate roms with correct offsets
$(Q) $(LD) -L$(USER_LIBDIR) -L$(SDK_LIBDIR) -L$(PROJECT_LD_PATH) -L$(LD_PATH) -T$(LD_SCRIPT) $(LDFLAGS) -Wl,--start-group $(LIBS) $(APP_AR) -Wl,--end-group -o $@

$(Q) $(STRIP) $@
# $(Q) $(STRIP) $@

$(vecho) ""
$(vecho) "#Memory / Section info:"
Expand Down
25 changes: 20 additions & 5 deletions Sming/Makefile-rboot.mk
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,16 @@ endif

EXTRA_INCDIR += $(SMING_HOME)/include $(SMING_HOME)/ $(LWIP_INCDIR) $(SMING_HOME)/system/include \
$(SMING_HOME)/Wiring $(SMING_HOME)/Libraries \
$(SMING_HOME)/Libraries/Adafruit_GFX $(SMING_HOME)/Libraries/Adafruit_Sensor \
$(SMING_HOME)/SmingCore $(SMING_HOME)/Services/SpifFS $(SDK_BASE)/../include \
$(THIRD_PARTY_DIR)/rboot $(THIRD_PARTY_DIR)/rboot/appcode $(THIRD_PARTY_DIR)/spiffs/src

USER_LIBDIR = $(SMING_HOME)/compiler/lib/

# compiler flags using during compilation of source files
CFLAGS = -Wpointer-arith -Wundef -Werror -Wl,-EL -nostdlib -mlongcalls -mtext-section-literals -finline-functions -fdata-sections -ffunction-sections \
-D__ets__ -DICACHE_FLASH -DARDUINO=106 -DCOM_SPEED_SERIAL=$(COM_SPEED_SERIAL) $(USER_CFLAGS) -DENABLE_CMD_EXECUTOR=$(ENABLE_CMD_EXECUTOR) -DSMING_INCLUDED=1
CFLAGS = -Wall -Wno-comment -Wno-strict-aliasing -Wno-unused-function -Wno-unused-variable \
-Wl,-EL -nostdlib -mlongcalls -mtext-section-literals -finline-functions -fdata-sections -ffunction-sections \
-D__ets__ -DICACHE_FLASH -DARDUINO=106 -DCOM_SPEED_SERIAL=$(COM_SPEED_SERIAL) $(USER_CFLAGS) -DENABLE_CMD_EXECUTOR=$(ENABLE_CMD_EXECUTOR) -DESP8266=1 -DSMING_INCLUDED=1

# => SDK
ifneq (,$(findstring third-party/ESP8266_NONOS_SDK, $(SDK_BASE)))
CFLAGS += -DSDK_INTERNAL
Expand Down Expand Up @@ -350,6 +351,7 @@ endif
ifeq ($(DISABLE_SPIFFS), 1)
CFLAGS += -DDISABLE_SPIFFS=1
endif
CFLAGS += -DSPIFFS_OBJ_META_LEN=16

# linker flags used to generate the main object file
LDFLAGS = -nostdlib -u call_user_start -u Cache_Read_Enable_New -u spiffs_get_storage_config -u custom_crash_callback -Wl,-static -Wl,--gc-sections -Wl,-Map=$(basename $@).map -Wl,-wrap,system_restart_local
Expand Down Expand Up @@ -406,6 +408,7 @@ SDK_LDDIR = ld
SDK_INCDIR = include

# select which tools to use as compiler, librarian and linker
AS := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-gcc
CC := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-gcc
CXX := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-g++
AR := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-ar
Expand All @@ -421,6 +424,7 @@ SDK_INCDIR := $(addprefix -I$(SDK_BASE)/,$(SDK_INCDIR))

C_SRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.c))
CXX_SRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.cpp))
AS_SRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.s))

C_OBJ := $(patsubst %.c,$(BUILD_BASE)/%.o,$(C_SRC))
CXX_OBJ := $(patsubst %.cpp,$(BUILD_BASE)/%.o,$(CXX_SRC))
Expand Down Expand Up @@ -495,6 +499,9 @@ endif


define compile-objects
${BUILD_BASE}/$1/%.o: $1/%.s
$(vecho) "AS $$<"
$(Q) $(AS) $(INCDIR) $(MODULE_INCDIR) $(EXTRA_INCDIR) $(SDK_INCDIR) $(CFLAGS) -c $$< -o $$@
${BUILD_BASE}/$1/%.o: $1/%.c ${BUILD_BASE}/$1/%.c.d
$(vecho) "CC $$<"
$(Q) $(CC) $(INCDIR) $(MODULE_INCDIR) $(EXTRA_INCDIR) $(SDK_INCDIR) $(CFLAGS) -c $$< -o $$@
Expand Down Expand Up @@ -533,7 +540,7 @@ $(RBOOT_ROM_1): $(TARGET_OUT_1)
$(TARGET_OUT_0): $(APP_AR)
$(vecho) "LD $@"
$(Q) $(LD) -L$(USER_LIBDIR) -L$(SDK_LIBDIR) -L$(BUILD_BASE) -L$(SMING_HOME)/compiler/ld $(RBOOT_LD_0) $(LDFLAGS) -Wl,--start-group $(APP_AR) $(LIBS) -Wl,--end-group -o $@
$(Q) $(STRIP) $@
# $(Q) $(STRIP) $@

$(Q) $(MEMANALYZER) $@ > $(FW_MEMINFO_NEW)

Expand All @@ -547,7 +554,7 @@ $(TARGET_OUT_0): $(APP_AR)
$(TARGET_OUT_1): $(APP_AR)
$(vecho) "LD $@"
$(Q) $(LD) -L$(USER_LIBDIR) -L$(SDK_LIBDIR) -L$(BUILD_BASE) -L$(SMING_HOME)/compiler/ld $(RBOOT_LD_1) $(LDFLAGS) -Wl,--start-group $(APP_AR) $(LIBS) -Wl,--end-group -o $@
$(Q) $(STRIP) $@
# $(Q) $(STRIP) $@

# recreate it from 0, since you get into problems with same filenames
$(APP_AR): $(OBJ)
Expand Down Expand Up @@ -628,9 +635,17 @@ flashinit:
rebuild: clean all

clean:
#preserve meminfo file from /out/firmware to /out/
$(Q) if [ -f "$(FW_MEMINFO_NEW)" ]; then \
mv $(FW_MEMINFO_NEW) $(FW_MEMINFO_SAVED); \
fi
#remove build artifacts
$(Q) rm -f $(APP_AR)
$(Q) rm -f $(TARGET_OUT)
$(Q) rm -rf $(BUILD_DIR)
$(Q) rm -rf $(BUILD_BASE)
$(Q) rm -rf $(FW_BASE)


$(foreach mod,$(MODULES),$(eval $(call compile-objects,$(mod))))
$(foreach bdir,$(BUILD_DIR),$(eval include $(wildcard $(bdir)/*.c.d)))
Expand Down
9 changes: 6 additions & 3 deletions Sming/Makefile-windows.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
ESP_HOME ?= c:/Espressif

# Default COM port
COM_PORT ?= COM3
COM_PORT ?= COM4

# base directory of the ESP8266 SDK package, absolute
SDK_BASE ?= $(ESP_HOME)/ESP8266_SDK
#SDK_BASE ?= $(ESP_HOME)/ESP8266_SDK
SDK_BASE ?= $(SMING_HOME)/third-party/ESP8266_NONOS_SDK
SDK_TOOLS ?= $(ESP_HOME)/utils

# Other tools mappings
ESPTOOL ?= $(SDK_TOOLS)/ESP8266/esptool.exe
KILL_TERM ?= taskkill.exe -f -im Terminal.exe || exit 0
GET_FILESIZE ?= stat --printf="%s"
TERMINAL ?= $(SDK_TOOLS)/Terminal.exe $(COM_PORT) $(COM_SPEED_SERIAL) $(COM_OPTS)
MEMANALYZER ?= python $(SMING_HOME)/../tools/memanalyzer.py $(OBJDUMP).exe
MEMANALYZER ?= $(SDK_TOOLS)/ESP8266/memanalyzer $(OBJDUMP).exe

#CFLAGS += -DMEMLEAK_DEBUG=1
24 changes: 0 additions & 24 deletions Sming/Services/CommandProcessing/CommandDelegate.cpp

This file was deleted.

Loading