Merge pull request #1799 from proddy/dev

add Makefile back so sonar tests run again
This commit is contained in:
Proddy
2024-06-14 23:19:18 +02:00
committed by GitHub
8 changed files with 7818 additions and 44 deletions

158
Makefile Normal file
View File

@@ -0,0 +1,158 @@
#
# GNUMakefile for EMS-ESP
#
NUMJOBS=${NUMJOBS:-" -j2 "}
MAKEFLAGS+="j "
#----------------------------------------------------------------------
# Project Structure
#----------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing header files
# LIBRARIES is a list of directories containing libraries, this must be the top level containing include and lib
#----------------------------------------------------------------------
#TARGET := $(notdir $(CURDIR))
TARGET := emsesp
BUILD := build
SOURCES := src src/* lib_standalone lib/uuid-common/src lib/uuid-console/src lib/uuid-log/src src/devices lib/ArduinoJson/src lib/PButton lib/semver lib/espMqttClient/src lib/espMqttClient/src/*
INCLUDES := src lib_standalone lib/espMqttClient/src lib/espMqttClient/src/Transport lib/ArduinoJson/src lib/uuid-common/src lib/uuid-console/src lib/uuid-log/src lib/uuid-telnet/src lib/uuid-syslog/src lib/semver lib/* src/devices
LIBRARIES :=
CPPCHECK = cppcheck
# CHECKFLAGS = -q --force --std=c++17
CHECKFLAGS = -q --force --std=c++11
#----------------------------------------------------------------------
# Languages Standard
#----------------------------------------------------------------------
C_STANDARD := -std=c17
CXX_STANDARD := -std=gnu++14
# C_STANDARD := -std=c11
# CXX_STANDARD := -std=c++11
#----------------------------------------------------------------------
# Defined Symbols
#----------------------------------------------------------------------
DEFINES += -DARDUINOJSON_ENABLE -DARDUINOJSON_ENABLE_ARDUINO_STRING -DARDUINOJSON_USE_DOUBLE=0
DEFINES += -DEMSESP_DEBUG -DEMSESP_STANDALONE -DEMSESP_TEST -D__linux__ -DEMC_RX_BUFFER_SIZE=1500
DEFINES += $(ARGS)
DEFAULTS = -DEMSESP_DEFAULT_LOCALE=\"en\" -DEMSESP_DEFAULT_TX_MODE=8 -DEMSESP_DEFAULT_VERSION=\"3.7.0-dev\" -DEMSESP_DEFAULT_BOARD_PROFILE=\"S32\"
#----------------------------------------------------------------------
# Sources & Files
#----------------------------------------------------------------------
OUTPUT := $(CURDIR)/$(TARGET)
SYMBOLS := $(CURDIR)/$(BUILD)/$(TARGET).out
CSOURCES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.c))
CXXSOURCES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.cpp))
OBJS := $(patsubst %,$(BUILD)/%.o,$(basename $(CSOURCES)) $(basename $(CXXSOURCES)) )
DEPS := $(patsubst %,$(BUILD)/%.d,$(basename $(CSOURCES)) $(basename $(CXXSOURCES)) )
INCLUDE += $(addprefix -I,$(foreach dir,$(INCLUDES), $(wildcard $(dir))))
INCLUDE += $(addprefix -I,$(foreach dir,$(LIBRARIES),$(wildcard $(dir)/include)))
LDLIBS += $(addprefix -L,$(foreach dir,$(LIBRARIES),$(wildcard $(dir)/lib)))
#----------------------------------------------------------------------
# Compiler & Linker
#----------------------------------------------------------------------
CC := /usr/bin/gcc
CXX := /usr/bin/g++
#----------------------------------------------------------------------
# Compiler & Linker Flags
#----------------------------------------------------------------------
# CPPFLAGS C and C++ Compiler Flags
# CFLAGS C Compiler Flags
# CXXFLAGS C++ Compiler Flags
# LDFLAGS Linker Flags
#----------------------------------------------------------------------
CPPFLAGS += $(DEFINES) $(DEFAULTS) $(INCLUDE)
CPPFLAGS += -ggdb
CPPFLAGS += -g3
CPPFLAGS += -Os
CFLAGS += $(CPPFLAGS)
CFLAGS += -Wall -Wextra -Werror -Wswitch-enum -Wno-unused-parameter -Wno-inconsistent-missing-override -Wno-missing-braces -Wno-unused-lambda-capture -Wno-sign-compare
CXXFLAGS += $(CFLAGS) -MMD
#----------------------------------------------------------------------
# Compiler & Linker Commands
#----------------------------------------------------------------------
# LINK.o link object files to binary
# COMPILE.c compile C source files
# COMPILE.cpp compile C++ source files
#----------------------------------------------------------------------
ifeq ($(strip $(CXXSOURCES)),)
LD := $(CC)
else
LD := $(CXX)
endif
#DEPFLAGS += -MF $(BUILD)/$*.d
LINK.o = $(LD) $(LDFLAGS) $(LDLIBS) $^ -o $@
COMPILE.c = $(CC) $(C_STANDARD) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
COMPILE.cpp = $(CXX) $(CXX_STANDARD) $(CXXFLAGS) $(DEPFLAGS) -c $< -o $@
#----------------------------------------------------------------------
# Special Built-in Target
#----------------------------------------------------------------------
# .SUFFIXES disable built-in wildcard rules
# .INTERMEDIATE make will treat targets as intermediate files, and delete them
# .PRECIOUS make will not be deleted after it is no longer needed. Keep objects to speed up recompilation
# .PHONY make will run this targets unconditionally, regardless of whether a file with that name exists or what its last-modification time is
#----------------------------------------------------------------------
.SUFFIXES:
.INTERMEDIATE:
.PRECIOUS: $(OBJS) $(DEPS)
.PHONY: all clean help
#----------------------------------------------------------------------
# Targets
#----------------------------------------------------------------------
.PHONY: all
.SILENT: $(OUTPUT)
all: $(OUTPUT)
$(OUTPUT): $(OBJS)
@mkdir -p $(@D)
$(LINK.o)
$(SYMBOLS.out)
$(BUILD)/%.o: %.c
@mkdir -p $(@D)
$(COMPILE.c)
$(BUILD)/%.o: %.cpp
@mkdir -p $(@D)
$(COMPILE.cpp)
$(BUILD)/%.o: %.s
@mkdir -p $(@D)
$(COMPILE.s)
cppcheck: $(SOURCES)
$(CPPCHECK) $(CHECKFLAGS) $^
run: $(OUTPUT)
@$<
.PHONY: clean
clean:
@$(RM) -rf $(BUILD) $(OUTPUT)
help:
@echo available targets: all run clean
@echo $(OUTPUT)
-include $(DEPS)

View File

@@ -51,13 +51,13 @@
},
"devDependencies": {
"@babel/core": "^7.24.7",
"@eslint/js": "^9.4.0",
"@eslint/js": "^9.5.0",
"@preact/compat": "^17.1.2",
"@preact/preset-vite": "^2.8.2",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/babel__core": "^7",
"concurrently": "^8.2.2",
"eslint": "^9.4.0",
"eslint": "^9.5.0",
"eslint-config-prettier": "^9.1.0",
"preact": "^10.22.0",
"prettier": "^3.3.2",

View File

@@ -917,14 +917,14 @@ __metadata:
languageName: node
linkType: hard
"@eslint/config-array@npm:^0.15.1":
version: 0.15.1
resolution: "@eslint/config-array@npm:0.15.1"
"@eslint/config-array@npm:^0.16.0":
version: 0.16.0
resolution: "@eslint/config-array@npm:0.16.0"
dependencies:
"@eslint/object-schema": "npm:^2.1.3"
"@eslint/object-schema": "npm:^2.1.4"
debug: "npm:^4.3.1"
minimatch: "npm:^3.0.5"
checksum: 10c0/60947a188157f2f811cc2aedf3c2494fa10932178838f6a7c7e9a8bb106ab51b4b4e571f49ae63cdd3884002b78631e4395be25d4ae52470360fc7fb463303d2
checksum: 10c0/b9d04409151dc95ec6b5e04e1e185a808d58e18cfc7340adc1e9420a5ff15843a0a308fb2cd9a2b354652885c2bebbcd5515814e93e9c9133f423891b6e53c70
languageName: node
linkType: hard
@@ -945,17 +945,17 @@ __metadata:
languageName: node
linkType: hard
"@eslint/js@npm:9.4.0, @eslint/js@npm:^9.4.0":
version: 9.4.0
resolution: "@eslint/js@npm:9.4.0"
checksum: 10c0/7ffc508d3e9cd496cab7f08c5ba8f97851c8adaea3ebff8804b1c3b4662aa7aac7e9c3b597f7e47fdc29319a107bcf892865070a6b113c2e4d19f8fa1f99f569
"@eslint/js@npm:9.5.0, @eslint/js@npm:^9.5.0":
version: 9.5.0
resolution: "@eslint/js@npm:9.5.0"
checksum: 10c0/dacf51ec2d5b4c8d1315d21a0ff761235d9e39b2391cb945138c58dc512a6c18949c40b644235f5c4fdf5b637ef8f881214acc496dddf46b718529bf22af42ac
languageName: node
linkType: hard
"@eslint/object-schema@npm:^2.1.3":
version: 2.1.3
resolution: "@eslint/object-schema@npm:2.1.3"
checksum: 10c0/ee892d0112ee7ec86312dfb1fa718da76b2d446e3495b9ec1f3ef31382a335d31420b76f3def175b96f7c3517c88fc860fec049d62a81d444237a23881559403
"@eslint/object-schema@npm:^2.1.4":
version: 2.1.4
resolution: "@eslint/object-schema@npm:2.1.4"
checksum: 10c0/e9885532ea70e483fb007bf1275968b05bb15ebaa506d98560c41a41220d33d342e19023d5f2939fed6eb59676c1bda5c847c284b4b55fce521d282004da4dda
languageName: node
linkType: hard
@@ -1987,7 +1987,7 @@ __metadata:
"@babel/core": "npm:^7.24.7"
"@emotion/react": "npm:^11.11.4"
"@emotion/styled": "npm:^11.11.5"
"@eslint/js": "npm:^9.4.0"
"@eslint/js": "npm:^9.5.0"
"@mui/icons-material": "npm:^5.15.20"
"@mui/material": "npm:^5.15.20"
"@preact/compat": "npm:^17.1.2"
@@ -2003,7 +2003,7 @@ __metadata:
alova: "npm:^2.21.3"
async-validator: "npm:^4.2.5"
concurrently: "npm:^8.2.2"
eslint: "npm:^9.4.0"
eslint: "npm:^9.5.0"
eslint-config-prettier: "npm:^9.1.0"
history: "npm:^5.3.0"
jwt-decode: "npm:^4.0.0"
@@ -3490,15 +3490,15 @@ __metadata:
languageName: node
linkType: hard
"eslint@npm:^9.4.0":
version: 9.4.0
resolution: "eslint@npm:9.4.0"
"eslint@npm:^9.5.0":
version: 9.5.0
resolution: "eslint@npm:9.5.0"
dependencies:
"@eslint-community/eslint-utils": "npm:^4.2.0"
"@eslint-community/regexpp": "npm:^4.6.1"
"@eslint/config-array": "npm:^0.15.1"
"@eslint/config-array": "npm:^0.16.0"
"@eslint/eslintrc": "npm:^3.1.0"
"@eslint/js": "npm:9.4.0"
"@eslint/js": "npm:9.5.0"
"@humanwhocodes/module-importer": "npm:^1.0.1"
"@humanwhocodes/retry": "npm:^0.3.0"
"@nodelib/fs.walk": "npm:^1.2.8"
@@ -3510,7 +3510,7 @@ __metadata:
eslint-scope: "npm:^8.0.1"
eslint-visitor-keys: "npm:^4.0.0"
espree: "npm:^10.0.1"
esquery: "npm:^1.4.2"
esquery: "npm:^1.5.0"
esutils: "npm:^2.0.2"
fast-deep-equal: "npm:^3.1.3"
file-entry-cache: "npm:^8.0.0"
@@ -3530,7 +3530,7 @@ __metadata:
text-table: "npm:^0.2.0"
bin:
eslint: bin/eslint.js
checksum: 10c0/826c901812536451e1bdb151359098db3a01ee9ff41775d5e97553626d07f7319cb2a0fd54176ef8e2e057105874077426b5d408ee6e8cff06bb814651f4c004
checksum: 10c0/1c83d94ccfd6d97474aaaf463714eba7afa040639ad9191db430d34e9e2851ba14510651de69b52f26ee30611caf0fa4c66b3fb73bb71df6ab10cef5bb44bb32
languageName: node
linkType: hard
@@ -3545,7 +3545,7 @@ __metadata:
languageName: node
linkType: hard
"esquery@npm:^1.4.2":
"esquery@npm:^1.5.0":
version: 1.5.0
resolution: "esquery@npm:1.5.0"
dependencies:

7578
lib_standalone/ArduinoJson.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,54 @@
/*
* EMS-ESP - https://github.com/emsesp/EMS-ESP
* Copyright 2020-2024 Paul Derbyshire
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MODULELIBRARY_H
#define MODULELIBRARY_H
#include <Arduino.h>
#include <memory>
#include <vector>
#include <emsesp.h>
class ModuleLibrary {
public:
class Modules {
public:
Modules(const char * key, std::unique_ptr<Module> module)
: key(key)
, module(std::move(module)) {
}
const char * key;
std::unique_ptr<Module> module;
};
void start(emsesp::EMSESP * emsesp_main, bool test_mode = false) {};
void loop() {};
void list(JsonObject output) {};
bool enable(const char * key, const char * license, bool enable) {
return true;
};
static uuid::log::Logger logger_;
private:
std::vector<Modules> modules_;
};
#endif

View File

@@ -219,7 +219,6 @@ build_src_flags =
-Wall -Wextra -Werror
-Wno-unused-parameter -Wno-sign-compare
-I./lib_standalone
-I./lib/ArduinoJson/src
-I./lib/uuid-common/src
-I./lib/uuid-console/src
-I./lib/uuid-log/src
@@ -240,3 +239,4 @@ build_src_filter =
+<../lib/espMqttClient/src/Transport>
lib_compat_mode = off
lib_ldf_mode = off
lib_ignore = ArduinoJson

View File

@@ -1186,7 +1186,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
EMSESP::mqtt_.incoming("ems-esp/thermostat/mode/auto", "auto"); // invalid, not allowed
// check extended MQTT base
Mqtt::base("home/cellar/heating");
// Mqtt::base("home/cellar/heating");
EMSESP::mqtt_.incoming("home/cellar/heating/thermostat/mode"); // empty payload
// Web API TESTS

16
x2
View File

@@ -1,16 +0,0 @@
Processing lolin_s3 (extends: espressi32_base; board: lolin_s3; board_build.f_cpu: 240000000L; board_upload.flash_size: 16MB; board_build.partitions: esp32_partition_16M.csv; board_upload.use_1200bps_touch: false; board_upload.wait_for_upload_port: false; build_flags: -std=gnu++2a -Isrc -Wno-type-limits, -D FACTORY_WIFI_SSID=\"\", -D FACTORY_WIFI_PASSWORD=\"\", -D FACTORY_WIFI_HOSTNAME=\"ems-esp\", -D FACTORY_AP_PROVISION_MODE=AP_MODE_DISCONNECTED, -D FACTORY_AP_SSID=\"ems-esp\", -D FACTORY_AP_PASSWORD=\"ems-esp-neo\", -D FACTORY_AP_LOCAL_IP=\"192.168.4.1\", -D FACTORY_AP_GATEWAY_IP=\"192.168.4.1\", -D FACTORY_AP_SUBNET_MASK=\"255.255.255.0\", -D FACTORY_ADMIN_USERNAME=\"admin\", -D FACTORY_ADMIN_PASSWORD=\"admin\", -D FACTORY_GUEST_USERNAME=\"guest\", -D FACTORY_GUEST_PASSWORD=\"guest\", -D FACTORY_NTP_ENABLED=false, -D FACTORY_NTP_TIME_ZONE_LABEL=\"Europe/Amsterdam\", -D FACTORY_NTP_TIME_ZONE_FORMAT=\"CET-1CEST,M3.5.0,M10.5.0/3\", -D FACTORY_NTP_SERVER=\"time.google.com\", -D FACTORY_MQTT_ENABLED=false, -D FACTORY_MQTT_HOST=\"\", -D FACTORY_MQTT_PORT=1883, -D FACTORY_MQTT_USERNAME=\"\", -D FACTORY_MQTT_PASSWORD=\"\", -D FACTORY_MQTT_KEEP_ALIVE=60, -D FACTORY_MQTT_CLEAN_SESSION=false, -D FACTORY_MQTT_MAX_TOPIC_LENGTH=128, -D FACTORY_JWT_SECRET=\"ems-esp-neo\", -DEMSESP_TEST, -D ONEWIRE_CRC16=0, -D CONFIG_ETH_ENABLED, -D CONFIG_UART_ISR_IN_IRAM, -D CONFIG_ASYNC_TCP_STACK_SIZE=5120, -D CONFIG_ASYNC_TCP_QUEUE=32, -D CONFIG_ASYNC_TCP_TASK_PRIORITY=10, '-DEMSESP_DEFAULT_BOARD_PROFILE="S32S3"'; extra_scripts: scripts/rename_fw.py; platform: espressif32; framework: arduino; board_build.filesystem: littlefs; build_unflags: -std=gnu++11; monitor_speed: 115200; monitor_filters: direct; upload_speed: 921600; build_type: release; check_tool: cppcheck, clangtidy; check_severity: high, medium; check_flags: cppcheck: --std=c++11 -v, clangtidy: --checks=-*,clang-analyzer-*,performance-*; lib_ldf_mode: chain+; lib_deps: file://../modules/EMS-ESP-Modules, bblanchon/ArduinoJson@^7.0.4; upload_protocol: esptool; upload_port: /dev/ttyACM0; custom_emsesp_ip: 10.10.10.173; custom_username: admin; custom_password: admin)
--------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/lolin_s3.html
PLATFORM: Espressif 32 (2024.6.10) (https://github.com/tasmota/platform-espressif32/releases/download/2024.06.10/platform-espressif32.zip) > WEMOS LOLIN S3
HARDWARE: ESP32S3 240MHz, 320KB RAM, 16MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-builtin, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-arduinoespressif32 @ 3.0.1+sha.371d83e (https://github.com/tasmota/arduino-esp32/releases/download/3.0.1.240605/framework-arduinoespressif32.zip)
- tool-esptoolpy @ 4.7.3 (https://github.com/tasmota/esptool/releases/download/v4.7.3/esptool.zip)
- tool-mklittlefs @ 3.2.0
- tool-openocd-esp32 @ 2.1100.20220706 (11.0)
- tool-riscv32-esp-elf-gdb @ 12.1.0+20221002
- tool-xtensa-esp-elf-gdb @ 12.1.0+20221002
- toolchain-riscv32-esp @ 12.2.0+20230208
- toolchain-xtensa-esp32s3 @ 12.2.0+20230208
Build interrupted.