Skip to content

Update IDF, fix SS definition, add custom partitions and debug level selection #174

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

Merged
merged 4 commits into from
Feb 6, 2017
Merged
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
66 changes: 66 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
menu.UploadSpeed=Upload Speed
menu.FlashFreq=Flash Frequency
menu.DebugLevel=Core Debug Level

##############################################################

esp32.name=ESP32 Dev Module

esp32.upload.tool=esptool
Expand Down Expand Up @@ -41,7 +43,62 @@ esp32.menu.UploadSpeed.460800.upload.speed=460800
esp32.menu.UploadSpeed.512000.windows=512000
esp32.menu.UploadSpeed.512000.upload.speed=512000

esp32.menu.DebugLevel.none=None
esp32.menu.DebugLevel.none.build.code_debug=0
esp32.menu.DebugLevel.error=Error
esp32.menu.DebugLevel.error.build.code_debug=1
esp32.menu.DebugLevel.warn=Warn
esp32.menu.DebugLevel.warn.build.code_debug=2
esp32.menu.DebugLevel.info=Info
esp32.menu.DebugLevel.info.build.code_debug=3
esp32.menu.DebugLevel.debug=Debug
esp32.menu.DebugLevel.debug.build.code_debug=4
esp32.menu.DebugLevel.verbose=Verbose
esp32.menu.DebugLevel.verbose.build.code_debug=5

##############################################################

esp32thing.name=SparkFun ESP32 Thing

esp32thing.upload.tool=esptool
esp32thing.upload.maximum_size=1044464
esp32thing.upload.maximum_data_size=294912
esp32thing.upload.wait_for_upload_port=true

esp32thing.serial.disableDTR=true
esp32thing.serial.disableRTS=true

esp32thing.build.mcu=esp32
esp32thing.build.core=esp32
esp32thing.build.variant=esp32thing
esp32thing.build.board=ESP32_THING

esp32thing.build.f_cpu=240000000L
esp32thing.build.flash_mode=dio
esp32thing.build.flash_size=4MB

esp32thing.menu.FlashFreq.80=80MHz
esp32thing.menu.FlashFreq.80.build.flash_freq=80m
esp32thing.menu.FlashFreq.40=40MHz
esp32thing.menu.FlashFreq.40.build.flash_freq=40m

esp32thing.menu.UploadSpeed.921600=921600
esp32thing.menu.UploadSpeed.921600.upload.speed=921600
esp32thing.menu.UploadSpeed.115200=115200
esp32thing.menu.UploadSpeed.115200.upload.speed=115200
esp32thing.menu.UploadSpeed.256000.windows=256000
esp32thing.menu.UploadSpeed.256000.upload.speed=256000
esp32thing.menu.UploadSpeed.230400.windows.upload.speed=256000
esp32thing.menu.UploadSpeed.230400=230400
esp32thing.menu.UploadSpeed.230400.upload.speed=230400
esp32thing.menu.UploadSpeed.460800.linux=460800
esp32thing.menu.UploadSpeed.460800.macosx=460800
esp32thing.menu.UploadSpeed.460800.upload.speed=460800
esp32thing.menu.UploadSpeed.512000.windows=512000
esp32thing.menu.UploadSpeed.512000.upload.speed=512000

##############################################################

esp320.name=Electronic SweetPeas - ESP320

esp320.upload.tool=esptool
Expand Down Expand Up @@ -82,6 +139,7 @@ esp320.menu.UploadSpeed.512000.windows=512000
esp320.menu.UploadSpeed.512000.upload.speed=512000

##############################################################

nano32.name=Nano32

nano32.upload.tool=esptool
Expand Down Expand Up @@ -122,6 +180,7 @@ nano32.menu.UploadSpeed.512000.windows=512000
nano32.menu.UploadSpeed.512000.upload.speed=512000

##############################################################

lolin32.name=WEMOS LoLin32

lolin32.upload.tool=esptool
Expand Down Expand Up @@ -162,6 +221,7 @@ lolin32.menu.UploadSpeed.512000.windows=512000
lolin32.menu.UploadSpeed.512000.upload.speed=512000

##############################################################

espea32.name=ESPea32

espea32.upload.tool=esptool
Expand Down Expand Up @@ -202,6 +262,7 @@ espea32.menu.UploadSpeed.512000.windows=512000
espea32.menu.UploadSpeed.512000.upload.speed=512000

##############################################################

quantum.name=Noduino Quantum

quantum.upload.tool=esptool
Expand Down Expand Up @@ -242,6 +303,7 @@ quantum.menu.UploadSpeed.512000.windows=512000
quantum.menu.UploadSpeed.512000.upload.speed=512000

##############################################################

node32s.name=Node32s

node32s.upload.tool=esptool
Expand Down Expand Up @@ -280,7 +342,9 @@ node32s.menu.UploadSpeed.460800.macosx=460800
node32s.menu.UploadSpeed.460800.upload.speed=460800
node32s.menu.UploadSpeed.512000.windows=512000
node32s.menu.UploadSpeed.512000.upload.speed=512000

##############################################################

hornbill32dev.name=Hornbill ESP32 Dev

hornbill32dev.upload.tool=esptool
Expand Down Expand Up @@ -318,7 +382,9 @@ hornbill32dev.menu.UploadSpeed.460800.macosx=460800
hornbill32dev.menu.UploadSpeed.460800.upload.speed=460800
hornbill32dev.menu.UploadSpeed.512000.windows=512000
hornbill32dev.menu.UploadSpeed.512000.upload.speed=512000

##############################################################

hornbill32minima.name=Hornbill ESP32 Minima

hornbill32minima.upload.tool=esptool
Expand Down
16 changes: 11 additions & 5 deletions cores/esp32/esp32-hal-log.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ extern "C"
#define CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL ARDUHAL_LOG_LEVEL_NONE
#endif

#ifndef CORE_DEBUG_LEVEL
#define ARDUHAL_LOG_LEVEL CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL
#else
#define ARDUHAL_LOG_LEVEL CORE_DEBUG_LEVEL
#endif

#ifndef CONFIG_ARDUHAL_LOG_COLORS
#define CONFIG_ARDUHAL_LOG_COLORS 0
#endif
Expand Down Expand Up @@ -71,31 +77,31 @@ int log_printf(const char *fmt, ...);
#define ARDUHAL_SHORT_LOG_FORMAT(letter, format) ARDUHAL_LOG_COLOR_ ## letter format ARDUHAL_LOG_RESET_COLOR "\r\n"
#define ARDUHAL_LOG_FORMAT(letter, format) ARDUHAL_LOG_COLOR_ ## letter "[" #letter "][%s:%u] %s(): " format ARDUHAL_LOG_RESET_COLOR "\r\n", pathToFileName(__FILE__), __LINE__, __FUNCTION__

#if CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE
#define log_v(format, ...) log_printf(ARDUHAL_LOG_FORMAT(V, format), ##__VA_ARGS__)
#else
#define log_v(format, ...)
#endif

#if CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
#define log_d(format, ...) log_printf(ARDUHAL_LOG_FORMAT(D, format), ##__VA_ARGS__)
#else
#define log_d(format, ...)
#endif

#if CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
#define log_i(format, ...) log_printf(ARDUHAL_LOG_FORMAT(I, format), ##__VA_ARGS__)
#else
#define log_i(format, ...)
#endif

#if CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL >= ARDUHAL_LOG_LEVEL_WARN
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_WARN
#define log_w(format, ...) log_printf(ARDUHAL_LOG_FORMAT(W, format), ##__VA_ARGS__)
#else
#define log_w(format, ...)
#endif

#if CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL >= ARDUHAL_LOG_LEVEL_ERROR
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_ERROR
#define log_e(format, ...) log_printf(ARDUHAL_LOG_FORMAT(E, format), ##__VA_ARGS__)
#else
#define log_e(format, ...)
Expand Down
2 changes: 1 addition & 1 deletion libraries/WiFi/src/WiFiGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void WiFiGenericClass::removeEvent(WiFiEventCb cbEvent, system_event_id_t event)
* callback for WiFi events
* @param arg
*/
#if CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
const char * system_event_names[] = { "WIFI_READY", "SCAN_DONE", "STA_START", "STA_STOP", "STA_CONNECTED", "STA_DISCONNECTED", "STA_AUTHMODE_CHANGE", "STA_GOT_IP", "STA_WPS_ER_SUCCESS", "STA_WPS_ER_FAILED", "STA_WPS_ER_TIMEOUT", "STA_WPS_ER_PIN", "AP_START", "AP_STOP", "AP_STACONNECTED", "AP_STADISCONNECTED", "AP_PROBEREQRECVED", "AP_STA_GOT_IP6", "ETH_START", "ETH_STOP", "ETH_CONNECTED", "ETH_DISCONNECTED", "ETH_GOT_IP", "MAX"};
const char * system_event_reasons[] = { "UNSPECIFIED", "AUTH_EXPIRE", "AUTH_LEAVE", "ASSOC_EXPIRE", "ASSOC_TOOMANY", "NOT_AUTHED", "NOT_ASSOCED", "ASSOC_LEAVE", "ASSOC_NOT_AUTHED", "DISASSOC_PWRCAP_BAD", "DISASSOC_SUPCHAN_BAD", "IE_INVALID", "MIC_FAILURE", "4WAY_HANDSHAKE_TIMEOUT", "GROUP_KEY_UPDATE_TIMEOUT", "IE_IN_4WAY_DIFFERS", "GROUP_CIPHER_INVALID", "PAIRWISE_CIPHER_INVALID", "AKMP_INVALID", "UNSUPP_RSN_IE_VERSION", "INVALID_RSN_IE_CAP", "802_1X_AUTH_FAILED", "CIPHER_SUITE_REJECTED", "BEACON_TIMEOUT", "NO_AP_FOUND", "AUTH_FAIL", "ASSOC_FAIL", "HANDSHAKE_TIMEOUT" };
#define reason2str(r) ((r>174)?system_event_reasons[r-174]:system_event_reasons[r-1])
Expand Down
14 changes: 9 additions & 5 deletions platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ runtime.tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp
tools.esptool.cmd="{runtime.platform.path}/tools/esptool"
tools.esptool.cmd.windows="{runtime.platform.path}/tools/esptool.exe"

tools.gen_esp32part.cmd=python "{runtime.platform.path}/tools/gen_esp32part.py"
tools.gen_esp32part.cmd.windows="{runtime.platform.path}/tools/gen_esp32part.exe"

compiler.warning_flags=-w
compiler.warning_flags.none=-w
compiler.warning_flags.default=
Expand All @@ -14,7 +17,7 @@ compiler.warning_flags.all=-Wall -Werror=all -Wextra

compiler.path={runtime.tools.xtensa-esp32-elf-gcc.path}/bin/
compiler.sdk.path={runtime.platform.path}/tools/sdk
compiler.cpreprocessor.flags=-DESP_PLATFORM -DMBEDTLS_CONFIG_FILE='"mbedtls/esp_config.h"' -DHAVE_CONFIG_H "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/bt" "-I{compiler.sdk.path}/include/driver" "-I{compiler.sdk.path}/include/esp32" "-I{compiler.sdk.path}/include/ethernet" "-I{compiler.sdk.path}/include/fatfs" "-I{compiler.sdk.path}/include/freertos" "-I{compiler.sdk.path}/include/log" "-I{compiler.sdk.path}/include/mdns" "-I{compiler.sdk.path}/include/vfs" "-I{compiler.sdk.path}/include/ulp" "-I{compiler.sdk.path}/include/newlib" "-I{compiler.sdk.path}/include/nvs_flash" "-I{compiler.sdk.path}/include/spi_flash" "-I{compiler.sdk.path}/include/sdmmc" "-I{compiler.sdk.path}/include/openssl" "-I{compiler.sdk.path}/include/app_update" "-I{compiler.sdk.path}/include/tcpip_adapter" "-I{compiler.sdk.path}/include/xtensa-debug-module" "-I{compiler.sdk.path}/include/newlib" "-I{compiler.sdk.path}/include/coap" "-I{compiler.sdk.path}/include/wpa_supplicant" "-I{compiler.sdk.path}/include/expat" "-I{compiler.sdk.path}/include/json" "-I{compiler.sdk.path}/include/mbedtls" "-I{compiler.sdk.path}/include/nghttp" "-I{compiler.sdk.path}/include/lwip"
compiler.cpreprocessor.flags=-DESP_PLATFORM -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DHAVE_CONFIG_H "-I{compiler.sdk.path}/include/config" "-I{compiler.sdk.path}/include/bluedroid" "-I{compiler.sdk.path}/include/bt" "-I{compiler.sdk.path}/include/driver" "-I{compiler.sdk.path}/include/esp32" "-I{compiler.sdk.path}/include/ethernet" "-I{compiler.sdk.path}/include/fatfs" "-I{compiler.sdk.path}/include/freertos" "-I{compiler.sdk.path}/include/log" "-I{compiler.sdk.path}/include/mdns" "-I{compiler.sdk.path}/include/mbedtls" "-I{compiler.sdk.path}/include/mbedtls_port" "-I{compiler.sdk.path}/include/vfs" "-I{compiler.sdk.path}/include/ulp" "-I{compiler.sdk.path}/include/newlib" "-I{compiler.sdk.path}/include/nvs_flash" "-I{compiler.sdk.path}/include/spi_flash" "-I{compiler.sdk.path}/include/sdmmc" "-I{compiler.sdk.path}/include/openssl" "-I{compiler.sdk.path}/include/app_update" "-I{compiler.sdk.path}/include/tcpip_adapter" "-I{compiler.sdk.path}/include/xtensa-debug-module" "-I{compiler.sdk.path}/include/newlib" "-I{compiler.sdk.path}/include/coap" "-I{compiler.sdk.path}/include/wpa_supplicant" "-I{compiler.sdk.path}/include/expat" "-I{compiler.sdk.path}/include/json" "-I{compiler.sdk.path}/include/nghttp" "-I{compiler.sdk.path}/include/lwip"

compiler.c.cmd=xtensa-esp32-elf-gcc
compiler.c.flags=-std=gnu99 -Os -g3 -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib -Wpointer-arith {compiler.warning_flags} -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-sign-compare -Wno-old-style-declaration -MMD -c
Expand All @@ -27,7 +30,7 @@ compiler.S.flags=-c -g3 -x assembler-with-cpp -MMD -mlongcalls

compiler.c.elf.cmd=xtensa-esp32-elf-gcc
compiler.c.elf.flags=-nostdlib "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" -T esp32_out.ld -T esp32.common.ld -T esp32.rom.ld -T esp32.peripherals.ld -u call_user_start_cpu0 -Wl,--gc-sections -Wl,-static -Wl,--undefined=uxTopUsedPriority
compiler.c.elf.libs=-lapp_update -lbootloader_support -lbt -lbtdm_app -lc -lc_nano -lcoap -lcoexist -lcore -lcxx -ldriver -lesp32 -lethernet -lexpat -lfatfs -lfreertos -lhal -ljson -llog -llwip -lm -lmbedtls -lmdns -lmicro-ecc -lnet80211 -lnewlib -lnghttp -lnvs_flash -lopenssl -lphy -lpp -lrtc -lsdmmc -lsmartconfig -lspi_flash -ltcpip_adapter -lulp -lvfs -lwpa -lwpa2 -lwpa_supplicant -lwps -lxtensa-debug-module -lgcc -lstdc++
compiler.c.elf.libs=-lgcc -lstdc++ -lapp_update -lbootloader_support -lbt -lbtdm_app -lc -lc_nano -lcoap -lcoexist -lcore -lcxx -ldriver -lesp32 -lethernet -lexpat -lfatfs -lfreertos -lhal -ljson -llog -llwip -lm -lmbedtls -lmdns -lmicro-ecc -lnet80211 -lnewlib -lnghttp -lnvs_flash -lopenssl -lphy -lpp -lrtc -lsdmmc -lsmartconfig -lspi_flash -ltcpip_adapter -lulp -lvfs -lwpa -lwpa2 -lwpa_supplicant -lwps -lxtensa-debug-module

compiler.as.cmd=xtensa-esp32-elf-as

Expand All @@ -37,7 +40,8 @@ compiler.ar.flags=cru
compiler.size.cmd=xtensa-esp32-elf-size

# This can be overriden in boards.txt
build.extra_flags=-DESP32
build.code_debug=0
build.extra_flags=-DESP32 -DCORE_DEBUG_LEVEL={build.code_debug}

# These can be overridden in platform.local.txt
compiler.c.extra_flags=
Expand All @@ -64,7 +68,7 @@ recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compil
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -Wl,--start-group {object_files} "{build.path}/arduino.ar" {compiler.c.elf.libs} -Wl,--end-group -Wl,-EL -o "{build.path}/{build.project_name}.elf"

## Create eeprom
recipe.objcopy.eep.pattern=
recipe.objcopy.eep.pattern={tools.gen_esp32part.cmd} -q "{runtime.platform.path}/tools/partitions/default.csv" "{build.path}/{build.project_name}.partitions.bin"

## Create hex
recipe.objcopy.hex.pattern={tools.esptool.cmd} --chip esp32 elf2image --flash_mode "{build.flash_mode}" --flash_freq "{build.flash_freq}" --flash_size "{build.flash_size}" -o "{build.path}/{build.project_name}.bin" "{build.path}/{build.project_name}.elf"
Expand All @@ -83,4 +87,4 @@ recipe.size.regex.data=^(?:\.dram0\.data|\.dram0\.bss)\s+([0-9]+).*
tools.esptool.upload.protocol=esp32
tools.esptool.upload.params.verbose=
tools.esptool.upload.params.quiet=
tools.esptool.upload.pattern={cmd} --chip esp32 --port "{serial.port}" --baud {upload.speed} write_flash -z --flash_freq {build.flash_freq} --flash_mode {build.flash_mode} --flash_size {build.flash_size} 0x1000 "{runtime.platform.path}/tools/sdk/bin/bootloader.bin" 0x8000 "{runtime.platform.path}/tools/sdk/bin/partitions_singleapp.bin" 0x10000 "{build.path}/{build.project_name}.bin"
tools.esptool.upload.pattern={cmd} --chip esp32 --port "{serial.port}" --baud {upload.speed} --before default_reset --after hard_reset write_flash -z --flash_freq {build.flash_freq} --flash_mode {build.flash_mode} --flash_size {build.flash_size} 0x1000 "{runtime.platform.path}/tools/sdk/bin/bootloader.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin" 0x10000 "{build.path}/{build.project_name}.bin"
Loading