all warnings as errors
This commit is contained in:
parent
ada748edbb
commit
5ba461adf6
1
.gitmodules
vendored
1
.gitmodules
vendored
@ -8,6 +8,7 @@
|
||||
[submodule "cube/libmbus"]
|
||||
path = cube/libmbus
|
||||
url = ../libmbus
|
||||
branch = WolfgangsOwnBranch
|
||||
[submodule "cube/pubsub"]
|
||||
path = cube/pubsub
|
||||
url = ../Pubsubclient
|
||||
|
@ -135,9 +135,9 @@ C_INCLUDES = \
|
||||
|
||||
|
||||
# compile gcc flags
|
||||
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
|
||||
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -Werror -fdata-sections -ffunction-sections
|
||||
|
||||
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
|
||||
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -Werror -fdata-sections -ffunction-sections
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -g -gdwarf-2
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
char *unit;
|
||||
const char *name;
|
||||
const char *unit;
|
||||
int8_t exponent;
|
||||
bool found;
|
||||
} parsedVIB_t;
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
|
||||
void mqttCommInit();
|
||||
void mqttPublish(char *topic, char *message);
|
||||
void mqttPublishf(char *topic, char *messageFormat, ...);
|
||||
void mqttPublish(const char *topic, char *message);
|
||||
void mqttPublishf(const char *topic, char *messageFormat, ...);
|
||||
|
||||
|
||||
|
||||
|
@ -55,11 +55,11 @@ bool globalStatsCmd(uint8_t argc, char **args) {
|
||||
char buf[256];
|
||||
sprintf(buf, \
|
||||
"Global statistics\n\r" \
|
||||
" Requests: %d\n\r" \
|
||||
" Errors: %d\n\r",
|
||||
" Requests: %ld\n\r" \
|
||||
" Errors: %ld\n\r",
|
||||
stats->requestCnt, stats->errorCnt
|
||||
);
|
||||
send(CMD_SOCK, buf, strlen(buf));
|
||||
send(CMD_SOCK, (uint8_t*)buf, strlen(buf));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ const static cmd_t COMMANDS[] = {
|
||||
// returns 1 to toggle to config mode
|
||||
// returns 2 to toggle back to default mode
|
||||
int8_t cmdExecuteCommand(uint8_t *cmdLine, bool resetConfigMode) {
|
||||
const static uint8_t HELP_MSG[] = \
|
||||
const static char HELP_MSG[] = \
|
||||
"Usage\n\r" \
|
||||
"\n\r" \
|
||||
"help ................................. Show this help page\n\r" \
|
||||
@ -141,10 +141,10 @@ int8_t cmdExecuteCommand(uint8_t *cmdLine, bool resetConfigMode) {
|
||||
"enable ............................... Enable configuration mode\n\r" \
|
||||
"disable .............................. Disable configuration mode\n\r" \
|
||||
;
|
||||
const static uint8_t GOODBYE_MSG[] = "Good bye\n\r";
|
||||
const static uint8_t OK_MSG[] = "OK\n\r";
|
||||
const static uint8_t FAILED_MSG[] = "Failed\n\r";
|
||||
const static uint8_t REQUIRES_CONFIG_MODE_MGS[] = "Not executed, requires config mode\n\r";
|
||||
const static char GOODBYE_MSG[] = "Good bye\n\r";
|
||||
const static char OK_MSG[] = "OK\n\r";
|
||||
const static char FAILED_MSG[] = "Failed\n\r";
|
||||
const static char REQUIRES_CONFIG_MODE_MGS[] = "Not executed, requires config mode\n\r";
|
||||
uint8_t *messageToSend = NULL;
|
||||
|
||||
static bool configMode = false;
|
||||
@ -158,7 +158,7 @@ int8_t cmdExecuteCommand(uint8_t *cmdLine, bool resetConfigMode) {
|
||||
#define MAX_NUM_OF_ARGS 8
|
||||
char *args[MAX_NUM_OF_TASKS];
|
||||
uint8_t argc = 0;
|
||||
char *inCmdLine = cmdLine;
|
||||
char *inCmdLine = (char*)cmdLine;
|
||||
do {
|
||||
args[argc++] = strtok(inCmdLine, " ");
|
||||
inCmdLine = NULL;
|
||||
@ -172,17 +172,17 @@ int8_t cmdExecuteCommand(uint8_t *cmdLine, bool resetConfigMode) {
|
||||
coloredMsg(LOG_YELLOW, false, "ch cec cmd is %s, number of arguments %d", cmd, argc);
|
||||
|
||||
if (0 == strcmp(cmd, "quit")) {
|
||||
messageToSend = GOODBYE_MSG;
|
||||
messageToSend = (uint8_t*)GOODBYE_MSG;
|
||||
retCode = -1;
|
||||
} else if (0 == strcmp(cmd, "help")) {
|
||||
send(CMD_SOCK, HELP_MSG, strlen(HELP_MSG));
|
||||
send(CMD_SOCK, (uint8_t*)HELP_MSG, strlen(HELP_MSG));
|
||||
uint8_t cmdIdx = 0;
|
||||
while (true) {
|
||||
cmd_t command = COMMANDS[cmdIdx];
|
||||
if (0 == strcmp("END_OF_CMDS", command.name)) {
|
||||
break;
|
||||
}
|
||||
send(CMD_SOCK, command.help, strlen(command.help));
|
||||
send(CMD_SOCK, (uint8_t*)command.help, strlen(command.help));
|
||||
cmdIdx++;
|
||||
}
|
||||
messageToSend = NULL;
|
||||
@ -203,9 +203,9 @@ int8_t cmdExecuteCommand(uint8_t *cmdLine, bool resetConfigMode) {
|
||||
}
|
||||
if (0 == strcmp(cmd, command.name)) {
|
||||
if (command.requiredConfigMode && !configMode) {
|
||||
messageToSend = REQUIRES_CONFIG_MODE_MGS;
|
||||
messageToSend = (uint8_t*)REQUIRES_CONFIG_MODE_MGS;
|
||||
} else {
|
||||
messageToSend = command.cmdFunc(argc, args) ? OK_MSG : FAILED_MSG;
|
||||
messageToSend = command.cmdFunc(argc, args) ? (uint8_t*)OK_MSG : (uint8_t*)FAILED_MSG;
|
||||
}
|
||||
}
|
||||
cmdIdx++;
|
||||
@ -213,7 +213,7 @@ int8_t cmdExecuteCommand(uint8_t *cmdLine, bool resetConfigMode) {
|
||||
}
|
||||
|
||||
if (messageToSend) {
|
||||
send(CMD_SOCK, messageToSend, strlen(messageToSend));
|
||||
send(CMD_SOCK, messageToSend, strlen((char*)messageToSend));
|
||||
}
|
||||
|
||||
return retCode;
|
||||
@ -225,14 +225,14 @@ void cmdHandlerEngine(void *handle) {
|
||||
static chState_t state = CH_INIT;
|
||||
static bool resetConfigMode = false;
|
||||
|
||||
static uint8_t banner[] = \
|
||||
static char banner[] = \
|
||||
"MBGW3\n\r" \
|
||||
"Type help for usage help\n\r" \
|
||||
"or quit to close the connection.\n\r";
|
||||
|
||||
static uint8_t *prompt;
|
||||
static uint8_t defaultPrompt[] = "MBGW3 # ";
|
||||
static uint8_t elevatedPrompt[] = "MBGW3 (admin) > ";
|
||||
static char *prompt;
|
||||
static char defaultPrompt[] = "MBGW3 # ";
|
||||
static char elevatedPrompt[] = "MBGW3 (admin) > ";
|
||||
|
||||
|
||||
int8_t res = 0;
|
||||
@ -292,7 +292,7 @@ void cmdHandlerEngine(void *handle) {
|
||||
coloredMsg(LOG_YELLOW, true, "ch che sockState is 0x%02x when trying to send banner", sockState);
|
||||
state = CH_DISCONNECT;
|
||||
} else {
|
||||
resultSend = send(CMD_SOCK, banner, strlen(banner));
|
||||
resultSend = send(CMD_SOCK, (uint8_t*)banner, strlen(banner));
|
||||
coloredMsg(LOG_YELLOW, false, "ch che sent banner, send returns 0x%02x", resultSend);
|
||||
prompt = defaultPrompt;
|
||||
resetConfigMode = true;
|
||||
@ -307,7 +307,7 @@ void cmdHandlerEngine(void *handle) {
|
||||
coloredMsg(LOG_YELLOW, true, "ch che sockState is 0x%02x when trying to send promt", sockState);
|
||||
state = CH_DISCONNECT;
|
||||
} else {
|
||||
resultSend = send(CMD_SOCK, prompt, strlen(prompt));
|
||||
resultSend = send(CMD_SOCK, (uint8_t*)prompt, strlen(prompt));
|
||||
coloredMsg(LOG_YELLOW, false, "ch che sent prompt %s, send returns 0x%02x", prompt, resultSend);
|
||||
state = CH_RECEIVE;
|
||||
}
|
||||
@ -326,13 +326,13 @@ void cmdHandlerEngine(void *handle) {
|
||||
resultRecv = recv(CMD_SOCK, receiveBuffer, sizeof(receiveBuffer));
|
||||
coloredMsg(LOG_YELLOW, false, "ch che recv returns 0x%02x", resultRecv);
|
||||
if (resultRecv > 0) {
|
||||
if ((receiveBuffer[strlen(receiveBuffer) - 1] == 0x0a) ||
|
||||
(receiveBuffer[strlen(receiveBuffer) - 1] == 0x0d)) {
|
||||
receiveBuffer[strlen(receiveBuffer) - 1] = 0;
|
||||
if ((receiveBuffer[strlen((char*)receiveBuffer) - 1] == 0x0a) ||
|
||||
(receiveBuffer[strlen((char*)receiveBuffer) - 1] == 0x0d)) {
|
||||
receiveBuffer[strlen((char*)receiveBuffer) - 1] = 0;
|
||||
}
|
||||
if ((receiveBuffer[strlen(receiveBuffer) - 1] == 0x0a) ||
|
||||
(receiveBuffer[strlen(receiveBuffer) - 1] == 0x0d)) {
|
||||
receiveBuffer[strlen(receiveBuffer) - 1] = 0;
|
||||
if ((receiveBuffer[strlen((char*)receiveBuffer) - 1] == 0x0a) ||
|
||||
(receiveBuffer[strlen((char*)receiveBuffer) - 1] == 0x0d)) {
|
||||
receiveBuffer[strlen((char*)receiveBuffer) - 1] = 0;
|
||||
}
|
||||
coloredMsg(LOG_YELLOW, false, "ch che received: %s", receiveBuffer);
|
||||
int8_t resCEC = cmdExecuteCommand(receiveBuffer, resetConfigMode);
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
|
||||
extern const uint8_t SYSLOG_SOCK;
|
||||
const uint8_t syslogAddr[] = { 172, 16, 11, 15 };
|
||||
uint8_t syslogAddr[] = { 172, 16, 11, 15 };
|
||||
|
||||
uint8_t singleOctetTXBuffer;
|
||||
|
||||
@ -88,9 +88,9 @@ static int innerLogMsg(const char *pre, const char *post, bool syslogToo, const
|
||||
const static char SYSLOG_HEADER[] = "<133>1 ";
|
||||
#define MAX_PREFIX_SIZE 20
|
||||
int res = -1;
|
||||
int offset = 0;
|
||||
char msgBuffer[MSGBUFFER_SIZE+MAX_PREFIX_SIZE];
|
||||
char *bufferStart;
|
||||
|
||||
memset(msgBuffer, 0, MSGBUFFER_SIZE+MAX_PREFIX_SIZE);
|
||||
|
||||
uint16_t syslogHeaderSize = strlen(SYSLOG_HEADER);
|
||||
@ -126,7 +126,7 @@ static int innerLogMsg(const char *pre, const char *post, bool syslogToo, const
|
||||
|
||||
#ifdef LOGGER_OUTPUT_BY_INTERRUPT
|
||||
debugTxCpltCallback(NULL);
|
||||
#endif LOGGER_OUTPUT_BY_INTERRUPT
|
||||
#endif //LOGGER_OUTPUT_BY_INTERRUPT
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -164,6 +164,9 @@ int coloredMsg(const t_logColor color, bool syslogToo, const char *format, ...)
|
||||
case LOG_YELLOW:
|
||||
pre = YELLOW;
|
||||
break;
|
||||
case LOG_NORMAL:
|
||||
pre = NULL;
|
||||
break;
|
||||
}
|
||||
va_list vl;
|
||||
va_start(vl, format);
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include <mbus/mbus-protocol.h>
|
||||
|
||||
|
||||
static const char MBUS_TOPIC[] = "IoT/MBGW3/Measurement";
|
||||
|
||||
static const uint8_t MBUS_QUERY_CMD = 0x5b;
|
||||
@ -175,7 +174,7 @@ static void parseAndPrintFrame(t_mbusCommHandle *localMbusCommHandle) {
|
||||
}
|
||||
mbus_data_record *record;
|
||||
int i;
|
||||
char *keys[MBUSDEVICE_NUM_OF_CONSIDEREDFIELDS];
|
||||
const char *keys[MBUSDEVICE_NUM_OF_CONSIDEREDFIELDS];
|
||||
float values[MBUSDEVICE_NUM_OF_CONSIDEREDFIELDS];
|
||||
uint8_t numOfConsideredFields = 0;
|
||||
for (record = data_var->record, i = 0;
|
||||
@ -689,4 +688,3 @@ void mbusCommInit() {
|
||||
coloredMsg(LOG_GREEN, true, "mbc mci initializing Meterbus communication");
|
||||
schAdd(mbusCommScheduler, NULL, 0, 1000);
|
||||
}
|
||||
|
||||
|
@ -53,9 +53,9 @@ static void mqttStatusPublisher(void *handle) {
|
||||
coloredMsg(LOG_GREEN, false, "mqsp: publishing status");
|
||||
t_mbusCommStats *mbusCommStats = mbusCommGetStats();
|
||||
char buf[64];
|
||||
snprintf(buf, 128, "{\"uptime\":\"%ld\", \"tasks\":\"%d\", \"requests\":\"%d\", \"errors\":\"%d\"}",
|
||||
snprintf(buf, 128, "{\"uptime\":\"%ld\", \"tasks\":\"%d\", \"requests\":\"%ld\", \"errors\":\"%ld\"}",
|
||||
HAL_GetTick()/1000, schTaskCnt(), mbusCommStats->requestCnt, mbusCommStats->errorCnt);
|
||||
bool res = publish(&mqttClient, StatusTopic, (const char*)buf, strlen(buf), false);
|
||||
bool res = publish(&mqttClient, StatusTopic, (const uint8_t*)buf, strlen(buf), false);
|
||||
coloredMsg(LOG_GREEN, false, "mqch, publish returned %d", res);
|
||||
|
||||
}
|
||||
@ -90,7 +90,7 @@ void mqttCommHandler(void *handle) {
|
||||
|
||||
case 2:
|
||||
coloredMsg(LOG_GREEN, false, "mqch, publish start-up");
|
||||
res = publish(&mqttClient, StartupTopic, (const char*)message, strlen(message), false);
|
||||
res = publish(&mqttClient, StartupTopic, (const uint8_t*)message, strlen((char*)message), false);
|
||||
coloredMsg(LOG_GREEN, false, "mqch, publish returned %d", res);
|
||||
schAdd(mqttStatusPublisher, NULL, 0, 60000);
|
||||
coloredMsg(LOG_GREEN, false, "mqch, status publisher scheduled");
|
||||
@ -132,10 +132,10 @@ void mqttCommInit() {
|
||||
schAdd(mqttCommHandler, NULL, 0, 100);
|
||||
}
|
||||
|
||||
void mqttPublish(char *topic, char *message) {
|
||||
void mqttPublish(const char *topic, char *message) {
|
||||
bool res = false;
|
||||
if (isNetworkAvailable()) {
|
||||
res = publish(&mqttClient, topic, message, strlen(message), false);
|
||||
res = publish(&mqttClient, topic, (const uint8_t*)message, strlen(message), false);
|
||||
}
|
||||
if (res) {
|
||||
coloredMsg(LOG_GREEN, false, "mqp: %s -> %s successfully published", message, topic);
|
||||
@ -144,7 +144,7 @@ void mqttPublish(char *topic, char *message) {
|
||||
}
|
||||
}
|
||||
|
||||
void mqttPublishf(char *topic, char *messageFormat, ...) {
|
||||
void mqttPublishf(const char *topic, char *messageFormat, ...) {
|
||||
va_list vl;
|
||||
va_start(vl, messageFormat);
|
||||
char buf[2048];
|
||||
@ -156,3 +156,5 @@ void mqttPublishf(char *topic, char *messageFormat, ...) {
|
||||
coloredMsg(LOG_RED, true, "mqc mpf buffer overflow, truncated message not published");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit e1f4dbdd52fe8a67e0665a0f3f5368ede1c59d83
|
||||
Subproject commit d063561b274d62011b5f54df89c7451c939b355e
|
@ -1 +1 @@
|
||||
Subproject commit 44647d686f41aa14446ed9e59bd6dd7b64b3541f
|
||||
Subproject commit 1ac129a02743d20b8d185fb41b7ee7b1ea85d412
|
@ -73,6 +73,7 @@ cp $MAKEFILE $MAKEFILE_BAK
|
||||
echo "# $PROCESSED" > $MAKEFILE
|
||||
cat $MAKEFILE_BAK | \
|
||||
sed -e 's/\(-specs=nano.specs\)/\1 -u _printf_float/' | \
|
||||
sed -e 's/\(-Wall\)/\1 -Werror/' | \
|
||||
sed -e 's%\(# list of ASM program objects\)%OBJECTS += $(addprefix $(BUILD_DIR)/,w5500.a pubsubc.a)\n\1%' | \
|
||||
sed -e 's,\($(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)\),$(BUILD_DIR)/w5500.a:\n\t(cd ioLibrary_Driver \&\& $(MAKE) \&\& cp w5500.a ../$(BUILD_DIR) \&\& cd ..)\n\n\1,' | \
|
||||
sed -e 's,\($(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)\),$(BUILD_DIR)/pubsubc.a:\n\t(cd pubsubc \&\& $(MAKE) \&\& cp pubsubc.a ../$(BUILD_DIR) \&\& cd ..)\n\n\1,' | \
|
||||
|
Loading…
x
Reference in New Issue
Block a user