Added buildtime wifi config ability

Added SDK_DBG parameter to turn off nonsense SDK debug output
pull/49/head
Benjamin Runnels 9 years ago
parent 587df27d78
commit 5068fa28cb
  1. 12
      Makefile
  2. 3
      esp-link/log.c
  3. 16
      esp-link/main.c
  4. 14
      include/espmissingincludes.h
  5. 8
      serial/serbridge.c
  6. 5
      serial/uart.c

@ -29,6 +29,10 @@ ESPTOOL ?= $(abspath ../esp-open-sdk/esptool/esptool.py)
ESPPORT ?= /dev/ttyUSB0 ESPPORT ?= /dev/ttyUSB0
ESPBAUD ?= 460800 ESPBAUD ?= 460800
# Build time Wifi Cfg
# STA_SSID ?=
# STA_PASS ?=
# --------------- chipset configuration --------------- # --------------- chipset configuration ---------------
# Pick your flash size: "512KB", "1MB", or "4MB" # Pick your flash size: "512KB", "1MB", or "4MB"
@ -244,6 +248,14 @@ Q := @
vecho := @echo vecho := @echo
endif endif
ifneq ($(strip $(STA_SSID)),)
CFLAGS += -DSTA_SSID="$(STA_SSID)"
endif
ifneq ($(strip $(STA_PASS)),)
CFLAGS += -DSTA_PASS="$(STA_PASS)"
endif
ifeq ("$(GZIP_COMPRESSION)","yes") ifeq ("$(GZIP_COMPRESSION)","yes")
CFLAGS += -DGZIP_COMPRESSION CFLAGS += -DGZIP_COMPRESSION
endif endif

@ -162,8 +162,9 @@ void ICACHE_FLASH_ATTR dumpMem(void *addr, int len) {
int off = 0; int off = 0;
while (off < len) { while (off < len) {
os_printf("%p ", a); os_printf("%p ", a);
for (int i=0; i<16 && off+i<len; i++) for (int i = 0; i < 16 && off + i < len; i++) {
os_printf(" %02x", a[i]); os_printf(" %02x", a[i]);
}
os_printf(" "); os_printf(" ");
for (int i=0; i<16 && off<len; i++,off++,a++) for (int i=0; i<16 && off<len; i++,off++,a++)
os_printf("%c", *a > 0x20 && *a < 0x3f ? *a : '.'); os_printf("%c", *a > 0x20 && *a < 0x3f ? *a : '.');

@ -79,7 +79,19 @@ static void ICACHE_FLASH_ATTR prHeapTimerCb(void *arg) {
} }
#endif #endif
# define VERS_STR_STR(V) #V
# define VERS_STR(V) VERS_STR_STR(V)
char* esp_link_version = VERS_STR(VERSION);
void user_rf_pre_init(void) { void user_rf_pre_init(void) {
system_set_os_print(DEBUG_SDK);
#if defined(STA_SSID) && defined(STA_PASS)
struct station_config stconf;
os_strncpy((char*)stconf.ssid, VERS_STR(STA_SSID), 32);
os_strncpy((char*)stconf.password, VERS_STR(STA_PASS), 64);
stconf.bssid_set = 0;
wifi_station_set_config_current(&stconf);
#endif
} }
// address of espfs binary blob // address of espfs binary blob
@ -93,10 +105,6 @@ static char *flash_maps[] = {
"2MB:1024/1024", "4MB:1024/1024" "2MB:1024/1024", "4MB:1024/1024"
}; };
# define VERS_STR_STR(V) #V
# define VERS_STR(V) VERS_STR_STR(V)
char* esp_link_version = VERS_STR(VERSION);
extern void app_init(void); extern void app_init(void);
extern void mqtt_client_init(void); extern void mqtt_client_init(void);

@ -36,10 +36,22 @@ void ets_timer_setfn(ETSTimer *t, ETSTimerFunc *fn, void *parg);
void ets_update_cpu_frequency(int freqmhz); void ets_update_cpu_frequency(int freqmhz);
int os_printf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); #ifdef SDK_DBG
#define DEBUG_SDK true
#else
#define DEBUG_SDK false
#endif
int os_snprintf(char *str, size_t size, const char *format, ...) __attribute__((format(printf, 3, 4))); int os_snprintf(char *str, size_t size, const char *format, ...) __attribute__((format(printf, 3, 4)));
int os_printf_plus(const char *format, ...) __attribute__((format(printf, 1, 2))); int os_printf_plus(const char *format, ...) __attribute__((format(printf, 1, 2)));
#undef os_printf
#define os_printf(format, ...) \
system_set_os_print(true); \
os_printf_plus(format, ## __VA_ARGS__); \
system_set_os_print(DEBUG_SDK); // int os_printf(const char *format, ...)
void pvPortFree(void *ptr); void pvPortFree(void *ptr);
void *pvPortMalloc(size_t xWantedSize); void *pvPortMalloc(size_t xWantedSize);
void *pvPortZalloc(size_t); void *pvPortZalloc(size_t);

@ -1,12 +1,6 @@
// Copyright 2015 by Thorsten von Eicken, see LICENSE.txt // Copyright 2015 by Thorsten von Eicken, see LICENSE.txt
#include "espmissingincludes.h" #include "esp8266.h"
#include "c_types.h"
#include "user_interface.h"
#include "espconn.h"
#include "mem.h"
#include "osapi.h"
#include "gpio.h"
#include "uart.h" #include "uart.h"
#include "crc16.h" #include "crc16.h"

@ -17,10 +17,7 @@
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* Heavily modified and enhanced by Thorsten von Eicken in 2015 * Heavily modified and enhanced by Thorsten von Eicken in 2015
*/ */
#include "espmissingincludes.h" #include "esp8266.h"
#include "ets_sys.h"
#include "osapi.h"
#include "user_interface.h"
#include "uart.h" #include "uart.h"
#ifdef UART_DBG #ifdef UART_DBG

Loading…
Cancel
Save