Preprocess all binary SDK symbols to add an sdk_ prefix
* This fixes the problem of axTLS symbols hmac_md5/hmac_sha1 having same name as symbols in libwpa (which have incompatible signatures) * Also allows for easier identification and piece-by-piece removal of binary functions. * Some libc symbols are not renamed, list is in lib/symbols_norename.txt
This commit is contained in:
		
							parent
							
								
									05019cb0ee
								
							
						
					
					
						commit
						e743d03a78
					
				
					 19 changed files with 220 additions and 103 deletions
				
			
		|  | @ -99,7 +99,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE | |||
|     SET_STKREG( XT_STK_A0,      0                           );  /* to terminate GDB backtrace       */ | ||||
|     SET_STKREG( XT_STK_A1,      (uint32_t)sp + XT_STK_FRMSZ   );  /* physical top of stack frame      */ | ||||
|     SET_STKREG( XT_STK_A2,      pvParameters   );           /* parameters      */ | ||||
|     SET_STKREG( XT_STK_EXIT,    _xt_user_exit               );  /* user exception exit dispatcher   */ | ||||
|     SET_STKREG( XT_STK_EXIT,    sdk__xt_user_exit               );  /* user exception exit dispatcher   */ | ||||
| 
 | ||||
|     /* Set initial PS to int level 0, EXCM disabled ('rfe' will enable), user mode. */ | ||||
|     SET_STKREG( XT_STK_PS,      PS_UM | PS_EXCM     ); | ||||
|  | @ -139,19 +139,19 @@ void PendSV(enum SVC_ReqType req) | |||
|  * after a Blob SV requests a soft interrupt by calling | ||||
|  * PendSV(SVC_MACLayer). | ||||
|  */ | ||||
| extern portBASE_TYPE MacIsrSigPostDefHdl(void); | ||||
| extern portBASE_TYPE sdk_MacIsrSigPostDefHdl(void); | ||||
| 
 | ||||
| void SV_ISR(void) | ||||
| { | ||||
| 	portBASE_TYPE xHigherPriorityTaskWoken=pdFALSE ; | ||||
| 	if(pending_maclayer_sv) | ||||
| 	{ | ||||
| 		xHigherPriorityTaskWoken = MacIsrSigPostDefHdl(); | ||||
| 		xHigherPriorityTaskWoken = sdk_MacIsrSigPostDefHdl(); | ||||
| 		pending_maclayer_sv = 0; | ||||
| 	} | ||||
| 	if( xHigherPriorityTaskWoken || pending_soft_sv) | ||||
| 	{ | ||||
| 	    _xt_timer_int1(); | ||||
| 	    sdk__xt_timer_int1(); | ||||
| 	    pending_soft_sv = 0; | ||||
| 	} | ||||
| } | ||||
|  | @ -175,14 +175,14 @@ void xPortSysTickHandle (void) | |||
| portBASE_TYPE xPortStartScheduler( void ) | ||||
| { | ||||
|     _xt_isr_attach(ETS_SOFT_INUM, SV_ISR); | ||||
|     _xt_isr_unmask(1<<ETS_SOFT_INUM); | ||||
|     sdk__xt_isr_unmask(1<<ETS_SOFT_INUM); | ||||
| 
 | ||||
|     /* Initialize system tick timer interrupt and schedule the first tick. */ | ||||
|     _xt_tick_timer_init(); | ||||
|     sdk__xt_tick_timer_init(); | ||||
| 
 | ||||
|     vTaskSwitchContext(); | ||||
| 
 | ||||
|     _xt_int_exit(); | ||||
|     sdk__xt_int_exit(); | ||||
| 
 | ||||
|     /* Should not get here as the tasks are now running! */ | ||||
|     return pdTRUE; | ||||
|  | @ -254,7 +254,7 @@ uint16_t _xt_isr_handler(uint16_t i) | |||
| 	} | ||||
|     } | ||||
| 
 | ||||
|     _xt_clear_ints(1<<index); | ||||
|     sdk__xt_clear_ints(1<<index); | ||||
| 
 | ||||
|     isr[index](); | ||||
| 
 | ||||
|  |  | |||
|  | @ -183,18 +183,21 @@ not necessary for to use this port.  They are defined so the common demo files | |||
| #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) | ||||
| /*-----------------------------------------------------------*/ | ||||
| 
 | ||||
| /* ESPTODO: These parts of the FreeRTOS support are still in binary libraries */ | ||||
| #define vApplicationStackOverflowHook sdk_vApplicationStackOverflowHook | ||||
| 
 | ||||
| /* XTensa interrupt management functions, used in port.c.
 | ||||
|    Implementations in blob libs */ | ||||
| void        _xt_int_exit (void); | ||||
| void        _xt_user_exit (void); | ||||
| void        _xt_tick_timer_init (void); | ||||
| void        _xt_isr_unmask (uint32_t unmask); | ||||
| void        _xt_isr_mask (uint32_t mask); | ||||
| uint32_t    _xt_read_ints (void); | ||||
| void        _xt_clear_ints(uint32_t mask); | ||||
|    Some (w/ sdk_ prefix) are implemented in blob libs */ | ||||
| void        sdk__xt_int_exit (void); | ||||
| void        sdk__xt_user_exit (void); | ||||
| void        sdk__xt_tick_timer_init (void); | ||||
| void        sdk__xt_isr_unmask (uint32_t unmask); | ||||
| void        sdk__xt_isr_mask (uint32_t mask); | ||||
| uint32_t    sdk__xt_read_ints (void); | ||||
| void        sdk__xt_clear_ints(uint32_t mask); | ||||
| typedef void (* _xt_isr)(void); | ||||
| void        _xt_isr_attach (uint8_t i, _xt_isr func); | ||||
| void	    _xt_timer_int1(void); | ||||
| void	    sdk__xt_timer_int1(void); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
|  |  | |||
							
								
								
									
										55
									
								
								common.mk
									
										
									
									
									
								
							
							
						
						
									
										55
									
								
								common.mk
									
										
									
									
									
								
							|  | @ -55,11 +55,16 @@ OBJCOPY = $(CROSS)objcopy | |||
| # of the root, with a 'component.mk' file.
 | ||||
| COMPONENTS     ?= FreeRTOS lwip | ||||
| 
 | ||||
| # libraries to link, mainly blobs provided by the esp-iot-rtos SDK
 | ||||
| LIBS		?= gcc main net80211 phy pp ssl wpa hal | ||||
| # binary esp-iot-rtos SDK libraries to link. These are pre-processed prior to linking.
 | ||||
| SDK_LIBS		?= main net80211 phy pp wpa | ||||
| 
 | ||||
| # open source libraries linked in
 | ||||
| LIBS ?= gcc hal | ||||
| 
 | ||||
| ENTRY_SYMBOL ?= sdk_call_user_start | ||||
| 
 | ||||
| CFLAGS		= -Wall -Werror -Wl,-EL -nostdlib -mlongcalls -mtext-section-literals -std=gnu99 | ||||
| LDFLAGS		= -nostdlib -Wl,--no-check-sections -Wl,-L$(ROOT)lib -u call_user_start -Wl,-static -Wl,-Map=build/${TARGET}.map | ||||
| LDFLAGS		= -nostdlib -Wl,--no-check-sections -Wl,-L$(BUILD_DIR)sdklib -Wl,-L$(ROOT)lib -u $(ENTRY_SYMBOL) -Wl,-static -Wl,-Map=build/${TARGET}.map | ||||
| 
 | ||||
| ifeq ($(FLAVOR),debug) | ||||
|     CFLAGS += -g -O0 | ||||
|  | @ -86,6 +91,7 @@ TARGET_DIR := $(dir $(firstword $(MAKEFILE_LIST))) | |||
| ROOT := $(dir $(lastword $(MAKEFILE_LIST))) | ||||
| 
 | ||||
| # derive various parts of compiler/linker arguments
 | ||||
| SDK_LIB_ARGS         = $(addprefix -l,$(SDK_LIBS)) | ||||
| LIB_ARGS             = $(addprefix -l,$(LIBS)) | ||||
| TARGET_OUT   = $(BUILD_DIR)$(TARGET).out | ||||
| LDFLAGS      += $(addprefix -T$(ROOT),$(LINKER_SCRIPTS)) | ||||
|  | @ -158,6 +164,37 @@ COMPONENT_ARS += $$($(1)_AR) | |||
| -include $$($(1)_OBJ_FILES:.o=.d) | ||||
| endef | ||||
| 
 | ||||
| 
 | ||||
| ## Linking rules for SDK libraries
 | ||||
| ## SDK libraries are preprocessed to:
 | ||||
| # - prefix all defined symbols with 'sdk_'
 | ||||
| # - weaken all global symbols so they can be overriden from the open SDK side
 | ||||
| 
 | ||||
| # SDK binary libraries are preprocessed into build/lib
 | ||||
| SDK_PROCESSED_LIBS = $(addsuffix .a,$(addprefix $(BUILD_DIR)sdklib/lib,$(SDK_LIBS))) | ||||
| 
 | ||||
| # Make rule for preprocessing each SDK library
 | ||||
| #
 | ||||
| $(BUILD_DIR)sdklib/%.a: $(ROOT)lib/%.a $(BUILD_DIR)sdklib/allsymbols.rename | ||||
| 	$(vecho) "Pre-processing SDK library $< -> $@" | ||||
| 	$(Q) $(OBJCOPY) --redefine-syms $(word 2,$^) --weaken $< $@ | ||||
| 
 | ||||
| 
 | ||||
| # Generate a regex to match symbols we don't want to rename, by parsing
 | ||||
| # a list of symbol names
 | ||||
| $(BUILD_DIR)sdklib/norename.match: $(ROOT)lib/symbols_norename.txt | $(BUILD_DIR)sdklib | ||||
| 	grep -v "^#" $< | sed ':begin;$!N;s/\n/\\|/;tbegin' > $@ | ||||
| 
 | ||||
| # Generate list of symbols to rename from a single library. Uses grep & sed.
 | ||||
| $(BUILD_DIR)sdklib/%.rename: $(ROOT)lib/%.a $(BUILD_DIR)sdklib/norename.match | ||||
| 	$(vecho) "Building symbol list for $< -> $@" | ||||
| 	$(Q) $(NM) --defined $< | grep ' T ' | sed -r 's/(.+) T (.+)/\2 sdk_\2/' | grep -v `cat $(BUILD_DIR)sdklib/norename.match` > $@ | ||||
| 
 | ||||
| # Build master list of all SDK-defined symbols to rename
 | ||||
| $(BUILD_DIR)sdklib/allsymbols.rename: $(patsubst %.a,%.rename,$(SDK_PROCESSED_LIBS)) | ||||
| 	cat $^ > $@ | ||||
| 
 | ||||
| 
 | ||||
| ## Include components (this is where the actual compiler sections are generated)
 | ||||
| $(foreach component,$(COMPONENTS), $(eval include $(ROOT)/$(component)/component.mk)) | ||||
| 
 | ||||
|  | @ -167,16 +204,16 @@ target_ROOT=$(TARGET_DIR) | |||
| $(eval $(call component_compile_rules,target)) | ||||
| 
 | ||||
| # final linking step to produce .elf
 | ||||
| $(TARGET_OUT): $(COMPONENT_ARS) | ||||
| $(TARGET_OUT): $(COMPONENT_ARS) $(SDK_PROCESSED_LIBS) | ||||
| 	$(vecho) "LD $@" | ||||
| 	$(Q) $(LD) $(LD_SCRIPT) $(LDFLAGS) -Wl,--start-group $(LIB_ARGS) $(COMPONENT_ARS) -Wl,--end-group -o $@ | ||||
| 	$(Q) $(LD) $(LD_SCRIPT) $(LDFLAGS) -Wl,--start-group $(SDK_LIB_ARGS) $(LIB_ARGS) $(COMPONENT_ARS) -Wl,--end-group -o $@ | ||||
| 
 | ||||
| $(BUILD_DIR) $(FW_BASE): | ||||
| $(BUILD_DIR) $(FW_BASE) $(BUILD_DIR)sdklib: | ||||
| 	$(Q) mkdir -p $@ | ||||
| 
 | ||||
| $(FW_FILE_1) $(FW_FILE_2): $(TARGET_OUT) $(FW_BASE) | ||||
| 	$(vecho) "FW $@" | ||||
| 	$(ESPTOOL) elf2image $< -o $(FW_BASE) | ||||
| 	$(ESPTOOL) elf2image --entry-symbol $(ENTRY_SYMBOL) $< -o $(FW_BASE) | ||||
| 
 | ||||
| flash: $(FW_FILE_1) $(FW_FILE_2) | ||||
| 	$(ESPTOOL) -p $(ESPPORT) --baud $(ESPBAUD) write_flash $(FW_1) $(FW_FILE_1) $(FW_2) $(FW_FILE_2) | ||||
|  | @ -196,3 +233,7 @@ rebuild: | |||
| clean: | ||||
| 	$(Q) rm -rf $(BUILD_DIR) | ||||
| 	$(Q) rm -rf $(FW_BASE) | ||||
| 
 | ||||
| # prevent "intermediate" files from being deleted
 | ||||
| .SECONDARY: | ||||
| 
 | ||||
|  |  | |||
|  | @ -109,17 +109,17 @@ void http_get_task(void *pvParameters) | |||
| 
 | ||||
| void user_init(void) | ||||
| { | ||||
|     uart_div_modify(0, UART_CLK_FREQ / 115200); | ||||
|     printf("SDK version:%s\n", system_get_sdk_version()); | ||||
|     sdk_uart_div_modify(0, UART_CLK_FREQ / 115200); | ||||
|     printf("SDK version:%s\n", sdk_system_get_sdk_version()); | ||||
| 
 | ||||
|     struct station_config config = { | ||||
|     struct sdk_station_config config = { | ||||
| 	.ssid = WIFI_SSID, | ||||
| 	.password = WIFI_PASS, | ||||
|     }; | ||||
| 
 | ||||
|     /* required to call wifi_set_opmode before station_set_config */ | ||||
|     wifi_set_opmode(STATION_MODE); | ||||
|     wifi_station_set_config(&config); | ||||
|     sdk_wifi_set_opmode(STATION_MODE); | ||||
|     sdk_wifi_station_set_config(&config); | ||||
| 
 | ||||
|     xTaskCreate(&http_get_task, (signed char *)"get_task", 256, NULL, 2, NULL); | ||||
| } | ||||
|  |  | |||
							
								
								
									
										33
									
								
								include/esp8266.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								include/esp8266.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,33 @@ | |||
| /* esp8266.h
 | ||||
|  * | ||||
|  * ESP-specific SoC-level addresses, macros, etc. | ||||
|  * Part of esp-open-rtos | ||||
|  * | ||||
|  * Copyright (C) 2105 Superhouse Automation Pty Ltd | ||||
|  * BSD Licensed as described in the file LICENSE | ||||
|  */ | ||||
| #include <stdint.h> | ||||
| 
 | ||||
| #ifndef _ESP8266_H | ||||
| #define _ESP8266_H | ||||
| 
 | ||||
| /* Use this macro to store constant values in IROM flash instead
 | ||||
|    of having them loaded into rodata (which resides in DRAM) | ||||
| 
 | ||||
|    Unlike the ESP8266 SDK you don't need an attribute like this for | ||||
|    standard functions. They're stored in flash by default. But | ||||
|    variables need them. | ||||
| 
 | ||||
|    Important to note: IROM flash can only be accessed via 32-bit word | ||||
|    aligned reads. It's up to the user of this attribute to ensure this. | ||||
| */ | ||||
| #define IROM __attribute__((section(".irom0"))) const | ||||
| 
 | ||||
| 
 | ||||
| /* Register addresses
 | ||||
| 
 | ||||
|    ESPTODO: break this out to its own header file and clean it up, add other regs, etc. | ||||
| */ | ||||
| static volatile __attribute__((unused)) uint32_t *ESP_REG_WDT = (uint32_t *)0x60000900; | ||||
| 
 | ||||
| #endif | ||||
|  | @ -18,9 +18,9 @@ | |||
| 
 | ||||
| #define IPSTR "%d.%d.%d.%d" | ||||
| 
 | ||||
| void os_delay_us(uint16_t us); | ||||
| void sdk_os_delay_us(uint16_t us); | ||||
| 
 | ||||
| void os_install_putc1(void (*p)(char c)); | ||||
| void os_putc(char c); | ||||
| void sdk_os_install_putc1(void (*p)(char c)); | ||||
| void sdk_os_putc(char c); | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| #ifndef __ESP_SOFTAP_H__ | ||||
| #define __ESP_SOFTAP_H__ | ||||
| 
 | ||||
| struct softap_config { | ||||
| struct sdk_softap_config { | ||||
|     uint8_t ssid[32]; | ||||
|     uint8_t password[64]; | ||||
|     uint8_t ssid_len; | ||||
|  | @ -17,7 +17,7 @@ struct softap_config { | |||
|     uint16_t beacon_interval; | ||||
| }; | ||||
| 
 | ||||
| bool wifi_softap_get_config(struct softap_config *config); | ||||
| bool wifi_softap_set_config(struct softap_config *config); | ||||
| bool sdk_wifi_softap_get_config(struct sdk_softap_config *config); | ||||
| bool sdk_wifi_softap_set_config(struct sdk_softap_config *config); | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| /*
 | ||||
|  *  Copyright (C) 2013 -2014  Espressif System | ||||
|  * | ||||
|  * | ||||
|  * Adapted from BSD licensed esp_iot_rtos_sdk v0.9.9 | ||||
|  */ | ||||
| 
 | ||||
| #ifndef __ESP_STA_H__ | ||||
|  | @ -8,27 +10,27 @@ | |||
| 
 | ||||
| #include "queue.h" | ||||
| 
 | ||||
| struct station_config { | ||||
| struct sdk_station_config { | ||||
|     uint8_t ssid[32]; | ||||
|     uint8_t password[64]; | ||||
|     uint8_t bssid_set; | ||||
|     uint8_t bssid[6]; | ||||
| }; | ||||
| 
 | ||||
| bool wifi_station_get_config(struct station_config *config); | ||||
| bool wifi_station_set_config(struct station_config *config); | ||||
| bool sdk_wifi_station_get_config(struct sdk_station_config *config); | ||||
| bool sdk_wifi_station_set_config(struct sdk_station_config *config); | ||||
| 
 | ||||
| bool wifi_station_connect(void); | ||||
| bool wifi_station_disconnect(void); | ||||
| bool sdk_wifi_station_connect(void); | ||||
| bool sdk_wifi_station_disconnect(void); | ||||
| 
 | ||||
| struct scan_config { | ||||
| struct sdk_scan_config { | ||||
|     uint8_t *ssid; | ||||
|     uint8_t *bssid; | ||||
|     uint8_t channel; | ||||
|     uint8_t show_hidden; | ||||
| }; | ||||
| 
 | ||||
| struct bss_info { | ||||
| struct sdk_bss_info { | ||||
|     STAILQ_ENTRY(bss_info)     next; | ||||
| 
 | ||||
|     uint8_t bssid[6]; | ||||
|  | @ -46,14 +48,14 @@ typedef enum { | |||
|     SCAN_PENDING, | ||||
|     SCAN_BUSY, | ||||
|     SCAN_CANCEL, | ||||
| } scan_status_t; | ||||
| } sdk_scan_status_t; | ||||
| 
 | ||||
| typedef void (* scan_done_cb_t)(void *arg, scan_status_t status); | ||||
| typedef void (* sdk_scan_done_cb_t)(void *arg, sdk_scan_status_t status); | ||||
| 
 | ||||
| bool wifi_station_scan(struct scan_config *config, scan_done_cb_t cb); | ||||
| bool sdk_wifi_station_scan(struct sdk_scan_config *config, sdk_scan_done_cb_t cb); | ||||
| 
 | ||||
| uint8_t wifi_station_get_auto_connect(void); | ||||
| bool wifi_station_set_auto_connect(uint8_t set); | ||||
| uint8_t sdk_wifi_station_get_auto_connect(void); | ||||
| bool sdk_wifi_station_set_auto_connect(uint8_t set); | ||||
| 
 | ||||
| enum { | ||||
|     STATION_IDLE = 0, | ||||
|  | @ -64,6 +66,6 @@ enum { | |||
|     STATION_GOT_IP | ||||
| }; | ||||
| 
 | ||||
| uint8_t wifi_station_get_connect_status(void); | ||||
| uint8_t sdk_wifi_station_get_connect_status(void); | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -6,14 +6,14 @@ | |||
| #ifndef __ESP_SYSTEM_H__ | ||||
| #define __ESP_SYSTEM_H__ | ||||
| 
 | ||||
| enum rst_reason { | ||||
| enum sdk_rst_reason { | ||||
| 	DEFAULT_RST	  = 0, | ||||
| 	WDT_RST	      = 1, | ||||
| 	EXCEPTION_RST = 2, | ||||
| 	SOFT_RST      = 3 | ||||
| }; | ||||
| 
 | ||||
| struct rst_info{ | ||||
| struct sdk_rst_info{ | ||||
| 	uint32_t reason; | ||||
| 	uint32_t exccause; | ||||
| 	uint32_t epc1; | ||||
|  | @ -24,26 +24,26 @@ struct rst_info{ | |||
| 	uint32_t rtn_addr; | ||||
| }; | ||||
| 
 | ||||
| struct rst_info* system_get_rst_info(void); | ||||
| struct rst_info* sdk_system_get_rst_info(void); | ||||
| 
 | ||||
| const char* system_get_sdk_version(void); | ||||
| const char* sdk_system_get_sdk_version(void); | ||||
| 
 | ||||
| void system_restore(void); | ||||
| void system_restart(void); | ||||
| void system_deep_sleep(uint32_t time_in_us); | ||||
| void sdk_system_restore(void); | ||||
| void sdk_system_restart(void); | ||||
| void sdk_system_deep_sleep(uint32_t time_in_us); | ||||
| 
 | ||||
| uint32_t system_get_time(void); | ||||
| uint32_t sdk_system_get_time(void); | ||||
| 
 | ||||
| void system_print_meminfo(void); | ||||
| uint32_t system_get_free_heap_size(void); | ||||
| uint32_t system_get_chip_id(void); | ||||
| void sdk_system_print_meminfo(void); | ||||
| uint32_t sdk_system_get_free_heap_size(void); | ||||
| uint32_t sdk_system_get_chip_id(void); | ||||
| 
 | ||||
| uint32_t system_rtc_clock_cali_proc(void); | ||||
| uint32_t system_get_rtc_time(void); | ||||
| uint32_t sdk_system_rtc_clock_cali_proc(void); | ||||
| uint32_t sdk_system_get_rtc_time(void); | ||||
| 
 | ||||
| bool system_rtc_mem_read(uint8_t src, void *dst, uint16_t n); | ||||
| bool system_rtc_mem_write(uint8_t dst, const void *src, uint16_t n); | ||||
| bool sdk_system_rtc_mem_read(uint8_t src, void *dst, uint16_t n); | ||||
| bool sdk_system_rtc_mem_write(uint8_t dst, const void *src, uint16_t n); | ||||
| 
 | ||||
| void system_uart_swap(void); | ||||
| void sdk_system_uart_swap(void); | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -7,16 +7,16 @@ | |||
| #define __ESP_TIMER_H__ | ||||
| 
 | ||||
| /* timer related */ | ||||
| typedef void os_timer_func_t(void *timer_arg); | ||||
| typedef void sdk_os_timer_func_t(void *timer_arg); | ||||
| 
 | ||||
| typedef struct _os_timer_t { | ||||
| 	struct _os_timer_t *timer_next; | ||||
|     void               *freerots_handle; | ||||
|     uint32_t             timer_expire; | ||||
|     uint32_t             timer_period; | ||||
|     os_timer_func_t    *timer_func; | ||||
|     sdk_os_timer_func_t    *timer_func; | ||||
|     bool               timer_repeat_flag; | ||||
|     void               *timer_arg; | ||||
| } os_timer_t; | ||||
| } sdk_os_timer_t; | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -1,6 +1,9 @@ | |||
| /*
 | ||||
|  *  Copyright (C) 2013 -2014  Espressif System | ||||
|  * | ||||
|  * Adapted from BSD licensed esp_iot_rtos_sdk v0.9.9 | ||||
|  * | ||||
|  * Functions declared in this header are defined in libmain.a | ||||
|  */ | ||||
| 
 | ||||
| #ifndef __ESP_WIFI_H__ | ||||
|  | @ -23,8 +26,8 @@ typedef enum _auth_mode { | |||
|     AUTH_MAX | ||||
| } AUTH_MODE; | ||||
| 
 | ||||
| uint8_t wifi_get_opmode(void); | ||||
| bool wifi_set_opmode(uint8_t opmode); | ||||
| uint8_t sdk_wifi_get_opmode(void); | ||||
| bool sdk_wifi_set_opmode(uint8_t opmode); | ||||
| 
 | ||||
| enum { | ||||
| 	STATION_IF = 0, | ||||
|  | @ -38,29 +41,29 @@ struct ip_info { | |||
|     struct ip_addr gw; | ||||
| }; | ||||
| 
 | ||||
| bool wifi_get_ip_info(uint8_t if_index, struct ip_info *info); | ||||
| bool wifi_set_ip_info(uint8_t if_index, struct ip_info *info); | ||||
| bool wifi_get_macaddr(uint8_t if_index, uint8_t *macaddr); | ||||
| bool wifi_set_macaddr(uint8_t if_index, uint8_t *macaddr); | ||||
| bool sdk_wifi_get_ip_info(uint8_t if_index, struct ip_info *info); | ||||
| bool sdk_wifi_set_ip_info(uint8_t if_index, struct ip_info *info); | ||||
| bool sdk_wifi_get_macaddr(uint8_t if_index, uint8_t *macaddr); | ||||
| bool sdk_wifi_set_macaddr(uint8_t if_index, uint8_t *macaddr); | ||||
| 
 | ||||
| uint8_t wifi_get_channel(void); | ||||
| bool wifi_set_channel(uint8_t channel); | ||||
| uint8_t sdk_wifi_get_channel(void); | ||||
| bool sdk_wifi_set_channel(uint8_t channel); | ||||
| 
 | ||||
| void wifi_status_led_install(uint8_t gpio_id, uint32_t gpio_name, uint8_t gpio_func); | ||||
| void sdk_wifi_status_led_install(uint8_t gpio_id, uint32_t gpio_name, uint8_t gpio_func); | ||||
| 
 | ||||
| void wifi_promiscuous_enable(uint8_t promiscuous); | ||||
| void sdk_wifi_promiscuous_enable(uint8_t promiscuous); | ||||
| 
 | ||||
| typedef void (* wifi_promiscuous_cb_t)(uint8_t *buf, uint16_t len); | ||||
| typedef void (* sdk_wifi_promiscuous_cb_t)(uint8_t *buf, uint16_t len); | ||||
| 
 | ||||
| void wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb); | ||||
| void sdk_wifi_set_promiscuous_rx_cb(sdk_wifi_promiscuous_cb_t cb); | ||||
| 
 | ||||
| enum phy_mode { | ||||
| enum sdk_phy_mode { | ||||
| 	PHY_MODE_11B	= 1, | ||||
| 	PHY_MODE_11G	= 2, | ||||
| 	PHY_MODE_11N    = 3 | ||||
| }; | ||||
| 
 | ||||
| enum phy_mode wifi_get_phy_mode(void); | ||||
| bool wifi_set_phy_mode(enum phy_mode mode); | ||||
| enum phy_mode sdk_wifi_get_phy_mode(void); | ||||
| bool sdk_wifi_set_phy_mode(enum sdk_phy_mode mode); | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -1,6 +1,11 @@ | |||
| /* This source file contains function prototypes for functions defined
 | ||||
| /* sdk_prototypes.h
 | ||||
| 
 | ||||
|    This source file contains function prototypes for functions defined | ||||
|    in the remaining "binary blob" ESP IoT RTOS SDK libraries. Sorted | ||||
|    by which library they appear in. | ||||
| 
 | ||||
|    Function names here have the 'sdk_' prefix that is put on all binary library functions | ||||
|    by the Open RTOS SDK. | ||||
| */ | ||||
| #ifndef SDK_PROTOTYPES_H | ||||
| #define SDK_PROTOTYPES_H | ||||
|  | @ -18,18 +23,28 @@ struct ip_addr; | |||
|    uart_no = 0 or 1 for which UART | ||||
|    new_divisor = Calculated in the form UART_CLK_FREQ / BAUD | ||||
|  */ | ||||
| void uart_div_modify(uint32_t uart_no, uint32_t new_divisor); | ||||
| void sdk_uart_div_modify(uint32_t uart_no, uint32_t new_divisor); | ||||
| 
 | ||||
| /* Read a single character from the UART.
 | ||||
|  */ | ||||
| char sdk_uart_rx_one_char(void); | ||||
| 
 | ||||
| /* Write a single character to the UART.
 | ||||
|  */ | ||||
| void sdk_os_putc(char c); | ||||
| 
 | ||||
| /* Called when an IP gets set on the "station" (client) interface.
 | ||||
|  */ | ||||
| void system_station_got_ip_set(struct ip_addr *ip_addr, struct ip_addr *sn_mask, struct ip_addr *gw_addr); | ||||
| void sdk_system_station_got_ip_set(struct ip_addr *ip_addr, struct ip_addr *sn_mask, struct ip_addr *gw_addr); | ||||
| 
 | ||||
| /* This is a no-op wrapper around ppRecycleRxPkt, which is defined in libpp.a
 | ||||
| 
 | ||||
|    It's called when a pbuf is freed, and allows pp to reuse the 'eb' pointer to ESP-specific | ||||
|    pbuf data. (See esp-lwip pbuf.h) | ||||
|  */ | ||||
| void system_pp_recycle_rx_pkt(void *eb); | ||||
| void sdk_system_pp_recycle_rx_pkt(void *eb); | ||||
| 
 | ||||
| const char* sdk_system_get_sdk_version(void); | ||||
| 
 | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -10,15 +10,15 @@ typedef enum { | |||
|     SPI_FLASH_RESULT_OK, | ||||
|     SPI_FLASH_RESULT_ERR, | ||||
|     SPI_FLASH_RESULT_TIMEOUT | ||||
| } SpiFlashOpResult; | ||||
| } sdk_SpiFlashOpResult; | ||||
| 
 | ||||
| #define SPI_FLASH_SEC_SIZE      4096 | ||||
| 
 | ||||
| uint32_t spi_flash_get_id(void); | ||||
| SpiFlashOpResult spi_flash_read_status(uint32_t *status); | ||||
| SpiFlashOpResult spi_flash_write_status(uint32_t status_value); | ||||
| SpiFlashOpResult spi_flash_erase_sector(uint16_t sec); | ||||
| SpiFlashOpResult spi_flash_write(uint32_t des_addr, uint32_t *src_addr, uint32_t size); | ||||
| SpiFlashOpResult spi_flash_read(uint32_t src_addr, uint32_t *des_addr, uint32_t size); | ||||
| uint32_t sdk_spi_flash_get_id(void); | ||||
| sdk_SpiFlashOpResult sdk_spi_flash_read_status(uint32_t *status); | ||||
| sdk_SpiFlashOpResult sdk_spi_flash_write_status(uint32_t status_value); | ||||
| sdk_SpiFlashOpResult sdk_spi_flash_erase_sector(uint16_t sec); | ||||
| sdk_SpiFlashOpResult sdk_spi_flash_write(uint32_t des_addr, uint32_t *src_addr, uint32_t size); | ||||
| sdk_SpiFlashOpResult sdk_spi_flash_read(uint32_t src_addr, uint32_t *des_addr, uint32_t size); | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -1,4 +1,8 @@ | |||
| /* This linker script generated from xt-genldscripts.tpp for LSP . */ | ||||
| /* This linker script generated from xt-genldscripts.tpp for LSP . | ||||
| 
 | ||||
|    Modified for esp open RTOS, this linker script is no longer the same as the esp_iot_rtos_sdk one. | ||||
| */ | ||||
| 
 | ||||
| /* Linker Script for ld -N */ | ||||
| MEMORY | ||||
| { | ||||
|  | @ -19,12 +23,12 @@ PHDRS | |||
| 
 | ||||
| 
 | ||||
| /*  Default entry point:  */ | ||||
| ENTRY(call_user_start) | ||||
| EXTERN(_DebugExceptionVector) | ||||
| EXTERN(_DoubleExceptionVector) | ||||
| EXTERN(_KernelExceptionVector) | ||||
| EXTERN(_NMIExceptionVector) | ||||
| EXTERN(_UserExceptionVector) | ||||
| ENTRY(sdk_call_user_start) | ||||
| EXTERN(sdk__DebugExceptionVector) | ||||
| EXTERN(sdk__DoubleExceptionVector) | ||||
| EXTERN(sdk__KernelExceptionVector) | ||||
| EXTERN(sdk__NMIExceptionVector) | ||||
| EXTERN(sdk__UserExceptionVector) | ||||
| PROVIDE(_memmap_vecbase_reset = 0x40000000); | ||||
| /* Various memory-map dependent cache attribute settings: */ | ||||
| _memmap_cacheattr_wb_base = 0x00000110; | ||||
|  |  | |||
							
								
								
									
										
											BIN
										
									
								
								lib/libhal.a
									
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								lib/libhal.a
									
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										6
									
								
								lib/symbols_norename.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								lib/symbols_norename.txt
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | |||
| # this is a stop-gap to avoid renaming some useful libc | ||||
| # symbols to sdk_xxx | ||||
| puts | ||||
| printf | ||||
| putchar | ||||
| atoi | ||||
|  | @ -47,7 +47,7 @@ | |||
| #include "netif/etharp.h" | ||||
| 
 | ||||
| /* declared in libnet80211.a */ | ||||
| int8_t ieee80211_output_pbuf(struct netif *ifp, struct pbuf* pb); | ||||
| int8_t sdk_ieee80211_output_pbuf(struct netif *ifp, struct pbuf* pb); | ||||
| 
 | ||||
| static err_t | ||||
| low_level_output(struct netif *netif, struct pbuf *p) | ||||
|  | @ -55,7 +55,7 @@ low_level_output(struct netif *netif, struct pbuf *p) | |||
|   struct pbuf *q; | ||||
| 
 | ||||
|   for(q = p; q != NULL; q = q->next) { | ||||
|       ieee80211_output_pbuf(netif, q); | ||||
|       sdk_ieee80211_output_pbuf(netif, q); | ||||
|   } | ||||
| 
 | ||||
|   LINK_STATS_INC(link.xmit); | ||||
|  |  | |||
|  | @ -35,6 +35,14 @@ | |||
| /* include ESP SDK prototypes as they're used in some LWIP routines */ | ||||
| #include "espressif/sdk_prototypes.h" | ||||
| 
 | ||||
| /* ESP8266 SDK Interface
 | ||||
| 
 | ||||
|    The lwip-esp stack is designed to be also compatible with other ESP8266 SDKs, | ||||
|    so we can't use our 'sdk_' prefixes there | ||||
| */ | ||||
| #define system_station_got_ip_set sdk_system_station_got_ip_set | ||||
| #define system_pp_recycle_rx_pkt sdk_system_pp_recycle_rx_pkt | ||||
| 
 | ||||
| /* Include some files for defining library routines */ | ||||
| #include <stdio.h> /* printf, fflush, FILE */ | ||||
| #include <stdlib.h> /* abort */ | ||||
|  |  | |||
|  | @ -37,6 +37,8 @@ | |||
| #include "queue.h" | ||||
| #include "semphr.h" | ||||
| 
 | ||||
| /* MBOX primitives */ | ||||
| 
 | ||||
| #define SYS_MBOX_NULL					( ( xQueueHandle ) NULL ) | ||||
| #define SYS_SEM_NULL					( ( xSemaphoreHandle ) NULL ) | ||||
| #define SYS_DEFAULT_THREAD_STACK_DEPTH	configMINIMAL_STACK_SIZE | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue