Merge pull request #546 from hmueller01/fix-compile

Fix various compile errors ...
This commit is contained in:
martin-ger authored and GitHub committed 2025-02-05 20:22:37 +01:00
commit 2dcae7e489
5 files changed
+70 -16

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.{c,cpp}]
indent_style = space
indent_size = 4
max_line_length = 155
+2
View File
@@ -0,0 +1,2 @@
build/
.vscode/
+15 -9
View File
@@ -29,27 +29,28 @@ SDK_BASE ?= $(BUILD_AREA)/esp-open-sdk/sdk
# # esptool.py path and port
ESPTOOL ?= $(XTENSA_TOOLS_ROOT)/esptool.py
ESPPORT ?= /dev/ttyUSB0
ESPTOOLBAUD ?= 115200
ESPTOOLOPTS = -ff 40m -fm dio -fs 32m
#ESPTOOLBAUD ?= 115200
ESPTOOLBAUD ?= 460800 # will work with modern hardware
ESPTOOLOPTS = -ff 40m -fm dio -fs 4MB
# name for the target project
TARGET = app
# which modules (subdirectories) of the project to include in compiling
MODULES = driver user mqtt easygpio
#EXTRA_INCDIR = include $(BUILD_AREA)/esp-open-sdk/esp-open-lwip/include
EXTRA_INCDIR = include
EXTRA_INCDIR = include $(BUILD_AREA)/esp-open-sdk/esp-open-lwip/include
#EXTRA_INCDIR = include
#LIB_MODULES = mqtt
# libraries used in this project, mainly provided by the SDK
LIBS = c gcc hal pp phy net80211 lwip_open_napt wpa wpa2 main
LIBS = c gcc hal pp phy net80211 lwip_open_napt wpa wpa2 main crypto
# compiler flags using during compilation of source files
CFLAGS = -Os -g -O2 -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH -DLWIP_OPEN_SRC -DUSE_OPTIMIZE_PRINTF
# linker flags used to generate the main object file
LDFLAGS = -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static -L.
LDFLAGS = -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static -L. -L$(SDK_BASE)/ld
# linker script used for the above linkier step
#LD_SCRIPT = eagle.app.v6.ld
@@ -65,6 +66,7 @@ SDK_INCDIR = include include/json
# these are the names and options to generate them
FW_FILE_1_ADDR = 0x02000
FW_FILE_2_ADDR = 0x82000
FW_FILE_ESP_INIT_ADDR = 0x3FC000
# select which tools to use as compiler, librarian and linker
CC := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-gcc
@@ -96,6 +98,7 @@ MODULE_INCDIR := $(addsuffix /include,$(INCDIR))
FW_FILE_1 := $(addprefix $(FW_BASE)/,$(FW_FILE_1_ADDR).bin)
FW_FILE_2 := $(addprefix $(FW_BASE)/,$(FW_FILE_2_ADDR).bin)
FW_FILE_ESP_INIT := $(SDK_BASE)/bin/esp_init_data_default_v08_vdd33.bin
RBOOT_FILE := $(addprefix $(FW_BASE)/,0x00000.bin)
V ?= $(VERBOSE)
@@ -157,13 +160,16 @@ $(FW_BASE):
$(Q) mkdir -p $@
flash: $(FW_BASE)/sha1sums
$(ESPTOOL) --port $(ESPPORT) --baud $(ESPTOOLBAUD) write_flash $(ESPTOOLOPTS) 0x00000 $(RBOOT_FILE) $(FW_FILE_1_ADDR) $(FW_FILE_1)
$(ESPTOOL) --port $(ESPPORT) --baud $(ESPTOOLBAUD) write_flash $(ESPTOOLOPTS) 0x00000 $(RBOOT_FILE) $(FW_FILE_1_ADDR) $(FW_FILE_1) $(FW_FILE_2_ADDR) $(FW_FILE_2) $(FW_FILE_ESP_INIT_ADDR) $(FW_FILE_ESP_INIT)
flash0: $(FW_BASE)/sha1sums
$(ESPTOOL) --port $(ESPPORT) --baud $(ESPTOOLBAUD) write_flash $(ESPTOOLOPTS) $(FW_FILE_1_ADDR) $(FW_FILE_1)
flash1: $(FW_BASE)/sha1sums
$(ESPTOOL) --port $(ESPPORT) --baud $(ESPTOOLBAUD) write_flash $(ESPTOOLOPTS) 0x00000 $(RBOOT_FILE) $(FW_FILE_2_ADDR) $(FW_FILE_2)
$(ESPTOOL) --port $(ESPPORT) --baud $(ESPTOOLBAUD) write_flash $(ESPTOOLOPTS) $(FW_FILE_2_ADDR) $(FW_FILE_2)
flashboth: $(FW_BASE)/sha1sums
$(ESPTOOL) --port $(ESPPORT) --baud $(ESPTOOLBAUD) write_flash $(ESPTOOLOPTS) 0x00000 $(RBOOT_FILE) $(FW_FILE_1_ADDR) $(FW_FILE_1) $(FW_FILE_2_ADDR) $(FW_FILE_2)
$(ESPTOOL) --port $(ESPPORT) --baud $(ESPTOOLBAUD) write_flash $(ESPTOOLOPTS) $(FW_FILE_1_ADDR) $(FW_FILE_1) $(FW_FILE_2_ADDR) $(FW_FILE_2)
clean:
$(Q) rm -rf $(FW_BASE) $(BUILD_BASE)
+37 -4
View File
@@ -313,7 +313,7 @@ void user_rf_pre_init() {
/*
// user_pre_init is required from SDK v3.0.0 onwards
// It is used to register the parition map with the SDK, primarily to allow
// the app to use the SDK's OTA capability. We don't make use of that in
// the app to use the SDK's OTA capability. We don't make use of that in
// otb-iot and therefore the only info we provide is the mandatory stuff:
// - RF calibration data
// - Physical data
@@ -322,7 +322,7 @@ void user_rf_pre_init() {
void ICACHE_FLASH_ATTR user_pre_init(void)
{
bool rc = false;
static const partition_item_t part_table[] =
static const partition_item_t part_table[] =
{
{SYSTEM_PARTITION_RF_CAL,
0x3fb000,
@@ -362,7 +362,7 @@ void ICACHE_FLASH_ATTR user_pre_init(void)
break;
}
static const partition_item_t part_table[] =
static const partition_item_t part_table[] =
{
{SYSTEM_PARTITION_RF_CAL,
rf_cal_sec * 0x1000,
@@ -376,7 +376,7 @@ void ICACHE_FLASH_ATTR user_pre_init(void)
};
// This isn't an ideal approach but there's not much point moving on unless
// or until this has succeeded cos otherwise the SDK will just barf and
// or until this has succeeded cos otherwise the SDK will just barf and
// refuse to call user_init()
while (!rc)
{
@@ -388,3 +388,36 @@ void ICACHE_FLASH_ATTR user_pre_init(void)
return;
}
*/
uint32 ICACHE_FLASH_ATTR user_rf_cal_sector_set(void)
{
enum flash_size_map size_map = system_get_flash_size_map();
uint32 rf_cal_sec = 0;
switch (size_map) {
case FLASH_SIZE_4M_MAP_256_256:
rf_cal_sec = 128 - 5;
break;
case FLASH_SIZE_8M_MAP_512_512:
rf_cal_sec = 256 - 5;
break;
case FLASH_SIZE_16M_MAP_512_512:
case FLASH_SIZE_16M_MAP_1024_1024:
rf_cal_sec = 512 - 5;
break;
case FLASH_SIZE_32M_MAP_512_512:
case FLASH_SIZE_32M_MAP_1024_1024:
rf_cal_sec = 1024 - 5;
break;
case FLASH_SIZE_64M_MAP_1024_1024:
rf_cal_sec = 2048 - 5;
break;
case FLASH_SIZE_128M_MAP_1024_1024:
rf_cal_sec = 4096 - 5;
break;
default:
rf_cal_sec = 0;
break;
}
return rf_cal_sec;
}
+4 -3
View File
@@ -1,3 +1,4 @@
#include "stdint.h"
#include "c_types.h"
#include "mem.h"
#include "ets_sys.h"
@@ -306,7 +307,7 @@ void ICACHE_FLASH_ATTR user_do_ping(const char *name, ip_addr_t *ipaddr, void *a
os_sprintf(response, "DNS lookup failed for: %s\r\n", name);
to_console(response);
system_os_post(0, SIG_CONSOLE_TX, (ETSParam)currentconn);
return;
return;
}
ping_opt.count = 4; // try to ping how many times
@@ -3106,9 +3107,9 @@ void ICACHE_FLASH_ATTR console_handle_command(struct espconn *pespconn)
* Get GPIO pin 2 value:
* gpio 2 get
* Link GPIO input pin 5 to GPIO output pin 2 as a monostable normally open:
* gpio 5 trigger 2 monostable_NO
* gpio 5 trigger 2 monostable_NO
* Clear previous link:
* gpio 5 trigger none
* gpio 5 trigger none
*/
if (nTokens < 3)
{