From 1eb0e589978d0a551b4282c2851ba2b233cd75ba Mon Sep 17 00:00:00 2001 From: Alex Stewart Date: Tue, 25 Aug 2015 09:31:02 -0700 Subject: [PATCH 01/11] Use fixed symbol rename list To keep things from changing out from under us as we slowly replace bits of the SDK libs, changing Makefiles to not auto-generate the list of symbols to rename, but always use the same list every time. --- common.mk | 22 +- lib/allsymbols.rename | 839 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 842 insertions(+), 19 deletions(-) create mode 100644 lib/allsymbols.rename diff --git a/common.mk b/common.mk index 323d13d..e05e78e 100644 --- a/common.mk +++ b/common.mk @@ -280,25 +280,9 @@ $(BUILD_DIR)sdklib/%_stage1.a: $(ROOT)lib/%.a $(BUILD_DIR)sdklib/%.remove | $(BU $(Q) cat $< > $@ $(Q) $(AR) d $@ @$(word 2,$^) -# Generate a regex to match symbols we don't want to rename, listed in -# symbols_norename.txt -$(BUILD_DIR)sdklib/norename.match: $(ROOT)lib/symbols_norename.txt | $(BUILD_DIR)sdklib - cat $< | grep -v "^#" | sed ':begin;$!N;s/\n/\\|/;tbegin' > $@ - -# Stage 2: Build a list of defined symbols per library, renamed with sdk_ prefix -$(BUILD_DIR)sdklib/%.rename: $(BUILD_DIR)sdklib/%_stage1.a $(BUILD_DIR)sdklib/norename.match - @echo "SDK processing stage 2: Building symbol list for $< -> $@" - $(Q) $(OBJDUMP) -t $< | grep ' g ' \ - | sed -r 's/^.+ ([^ ]+)$$/\1 sdk_\1/' \ - | grep -v `cat $(BUILD_DIR)sdklib/norename.match` > $@ - -# Build a master list of all SDK-defined symbols to rename across all libraries -$(BUILD_DIR)sdklib/allsymbols.rename: $(patsubst %.a,%.rename,$(SDK_PROCESSED_LIBS)) - cat $^ > $@ - -# Stage 3: Redefine all SDK symbols as sdk_, weaken all symbols. -$(BUILD_DIR)sdklib/%.a: $(BUILD_DIR)sdklib/%_stage1.a $(BUILD_DIR)sdklib/allsymbols.rename - @echo "SDK processing stage 3: Renaming symbols in SDK library $< -> $@" +# Stage 2: Redefine all SDK symbols as sdk_, weaken all symbols. +$(BUILD_DIR)sdklib/%.a: $(BUILD_DIR)sdklib/%_stage1.a $(ROOT)lib/allsymbols.rename + @echo "SDK processing stage 2: Renaming symbols in SDK library $< -> $@" $(Q) $(OBJCOPY) --redefine-syms $(word 2,$^) --weaken $< $@ # include "dummy component" for the 'program' object files, defined in the Makefile diff --git a/lib/allsymbols.rename b/lib/allsymbols.rename new file mode 100644 index 0000000..2f455f0 --- /dev/null +++ b/lib/allsymbols.rename @@ -0,0 +1,839 @@ +aes_decrypt_deinit sdk_aes_decrypt_deinit +aes_decrypt_init sdk_aes_decrypt_init +aes_decrypt sdk_aes_decrypt +aes_encrypt_deinit sdk_aes_encrypt_deinit +aes_encrypt_init sdk_aes_encrypt_init +aes_encrypt sdk_aes_encrypt +aes_unwrap sdk_aes_unwrap +aes_wrap sdk_aes_wrap +ant_switch_init sdk_ant_switch_init +auth_type sdk_auth_type +bb_init sdk_bb_init +bbpll_cal_flag sdk_bbpll_cal_flag +bbpll_cal sdk_bbpll_cal +cal_rf_ana_gain sdk_cal_rf_ana_gain +cannel_scan_connect_state sdk_cannel_scan_connect_state +ccmp sdk_ccmp +change_bbpll160 sdk_change_bbpll160 +change_bbpll160_sleep sdk_change_bbpll160_sleep +check_data_flag sdk_check_data_flag +check_data_func sdk_check_data_func +check_result sdk_check_result +chip_60_set_channel sdk_chip_60_set_channel +chip6_phy_init_ctrl sdk_chip6_phy_init_ctrl +chip6_sleep_params sdk_chip6_sleep_params +chip_v6_get_sense sdk_chip_v6_get_sense +chip_v6_initialize_bb sdk_chip_v6_initialize_bb +chip_v6_rf_init sdk_chip_v6_rf_init +chip_v6_rxmax_ext_ana sdk_chip_v6_rxmax_ext_ana +chip_v6_rxmax_ext_dig sdk_chip_v6_rxmax_ext_dig +chip_v6_rxmax_ext sdk_chip_v6_rxmax_ext +chip_v6_set_chanfreq sdk_chip_v6_set_chanfreq +chip_v6_set_chan_misc sdk_chip_v6_set_chan_misc +chip_v6_set_chan_offset sdk_chip_v6_set_chan_offset +chip_v6_set_chan_rx_cmp sdk_chip_v6_set_chan_rx_cmp +chip_v6_set_chan sdk_chip_v6_set_chan +chip_v6_set_chan_wakeup sdk_chip_v6_set_chan_wakeup +chip_v6_set_sense sdk_chip_v6_set_sense +chip_v6_unset_chanfreq sdk_chip_v6_unset_chanfreq +chip_version sdk_chip_version +chm_acquire_lock sdk_chm_acquire_lock +chm_cancel_op sdk_chm_cancel_op +chm_check_same_channel sdk_chm_check_same_channel +chm_end_op sdk_chm_end_op +chm_freq2index sdk_chm_freq2index +chm_get_current_channel sdk_chm_get_current_channel +chm_init sdk_chm_init +chm_release_lock sdk_chm_release_lock +chm_return_home_channel sdk_chm_return_home_channel +chm_set_current_channel sdk_chm_set_current_channel +chm_start_op sdk_chm_start_op +clockgate_watchdog sdk_clockgate_watchdog +cnx_add_rc sdk_cnx_add_rc +cnx_attach sdk_cnx_attach +cnx_bss_alloc sdk_cnx_bss_alloc +cnx_connect_timeout sdk_cnx_connect_timeout +cnx_node_alloc sdk_cnx_node_alloc +cnx_node_join sdk_cnx_node_join +cnx_node_leave sdk_cnx_node_leave +cnx_node_remove sdk_cnx_node_remove +cnx_node_search sdk_cnx_node_search +cnx_rc_search sdk_cnx_rc_search +cnx_rc_update_age sdk_cnx_rc_update_age +cnx_rc_update_rssi sdk_cnx_rc_update_rssi +cnx_rc_update_state_metric sdk_cnx_rc_update_state_metric +cnx_remove_rc sdk_cnx_remove_rc +cnx_sta_associated sdk_cnx_sta_associated +cnx_sta_connect_cmd sdk_cnx_sta_connect_cmd +cnx_sta_connect_led_timer_cb sdk_cnx_sta_connect_led_timer_cb +cnx_sta_leave sdk_cnx_sta_leave +cnx_start_handoff_cb sdk_cnx_start_handoff_cb +cnx_sta_scan_cmd sdk_cnx_sta_scan_cmd +cnx_update_bss_more sdk_cnx_update_bss_more +cnx_update_bss sdk_cnx_update_bss +correct_rf_ana_gain sdk_correct_rf_ana_gain +cpu_overclock sdk_cpu_overclock +data_collect sdk_data_collect +dbg_stop_hw_wdt sdk_dbg_stop_hw_wdt +dbg_stop_sw_wdt sdk_dbg_stop_sw_wdt +dcoindex2txbbgain sdk_dcoindex2txbbgain +debug_timerfn sdk_debug_timerfn +debug_timer sdk_debug_timer +deep_sleep_en sdk_deep_sleep_en +dhcp_bind_check sdk_dhcp_bind_check +dhcpc_flag sdk_dhcpc_flag +do_noisefloor_lsleep_v50 sdk_do_noisefloor_lsleep_v50 +do_noisefloor sdk_do_noisefloor +do_pwctrl_flag sdk_do_pwctrl_flag +dpd_db2linear sdk_dpd_db2linear +dpd_index sdk_dpd_index +dpd_init sdk_dpd_init +dpd_mem_write sdk_dpd_mem_write +dpd_scale_set sdk_dpd_scale_set +eagle_auth_done sdk_eagle_auth_done +eapol_txcb sdk_eapol_txcb +eloop_cancel_timeout sdk_eloop_cancel_timeout +eloop_register_timeout sdk_eloop_register_timeout +esf_buf_alloc sdk_esf_buf_alloc +esf_buf_recycle sdk_esf_buf_recycle +esf_buf_setup sdk_esf_buf_setup +esf_rx_buf_alloc sdk_esf_rx_buf_alloc +ets_delay_us sdk_ets_delay_us +ets_timer_arm_ms_us sdk_ets_timer_arm_ms_us +ets_timer_arm sdk_ets_timer_arm +ets_timer_arm_us sdk_ets_timer_arm_us +ets_timer_disarm sdk_ets_timer_disarm +ets_timer_done sdk_ets_timer_done +ets_timer_handler_isr sdk_ets_timer_handler_isr +ets_timer_init sdk_ets_timer_init +ets_timer_setfn sdk_ets_timer_setfn +ets_update_cpu_frequency sdk_ets_update_cpu_frequency +flashchip sdk_flashchip +g_cnx_probe_rc_list_cb sdk_g_cnx_probe_rc_list_cb +gen_rx_gain_table sdk_gen_rx_gain_table +GetAccess sdk_GetAccess +get_check_flag sdk_get_check_flag +get_chip_version sdk_get_chip_version +get_fcc_1m2m_pwr_offset sdk_get_fcc_1m2m_pwr_offset +get_noisefloor_sat sdk_get_noisefloor_sat +get_pwctrl_correct sdk_get_pwctrl_correct +get_rf_gain_qdb sdk_get_rf_gain_qdb +get_sar_dout sdk_get_sar_dout +get_target_power_offset sdk_get_target_power_offset +g_ic sdk_g_ic +g_phyFuns_instance sdk_g_phyFuns_instance +g_phyFuns sdk_g_phyFuns +gpio_output_set sdk_gpio_output_set +gScanStruct sdk_gScanStruct +hardware_reject sdk_hardware_reject +hex2byte sdk_hex2byte +hexstr2bin sdk_hexstr2bin +hmac_md5 sdk_hmac_md5 +hmac_md5_vector sdk_hmac_md5_vector +hmac_sha1 sdk_hmac_sha1 +hmac_sha1_vector sdk_hmac_sha1_vector +hostapd_config_defaults_bss sdk_hostapd_config_defaults_bss +hostapd_config_defaults sdk_hostapd_config_defaults +hostapd_get_psk sdk_hostapd_get_psk +hostapd_mac_comp_empty sdk_hostapd_mac_comp_empty +hostapd_mac_comp sdk_hostapd_mac_comp +hostapd_maclist_found sdk_hostapd_maclist_found +hostapd_rate_found sdk_hostapd_rate_found +hostapd_setup_wpa_psk sdk_hostapd_setup_wpa_psk +hostapd_wep_key_cmp sdk_hostapd_wep_key_cmp +hostap_handle_timer sdk_hostap_handle_timer +hostap_input sdk_hostap_input +ic_bss_info_update sdk_ic_bss_info_update +ic_disable_interface sdk_ic_disable_interface +ic_enable_interface sdk_ic_enable_interface +ic_get_addr sdk_ic_get_addr +ic_get_gtk_alg sdk_ic_get_gtk_alg +ic_get_ptk_alg sdk_ic_get_ptk_alg +ic_interface_enabled sdk_ic_interface_enabled +ic_interface_is_p2p sdk_ic_interface_is_p2p +ic_is_pure_sta sdk_ic_is_pure_sta +ic_remove_key sdk_ic_remove_key +ic_set_gtk_alg sdk_ic_set_gtk_alg +ic_set_key sdk_ic_set_key +ic_set_opmode sdk_ic_set_opmode +ic_set_ptk_alg sdk_ic_set_ptk_alg +ic_set_sta sdk_ic_set_sta +ic_set_vif sdk_ic_set_vif +ieee80211_addbasicrates sdk_ieee80211_addbasicrates +ieee80211_add_htcap sdk_ieee80211_add_htcap +ieee80211_add_htcap_vendor sdk_ieee80211_add_htcap_vendor +ieee80211_add_htinfo sdk_ieee80211_add_htinfo +ieee80211_add_htinfo_vendor sdk_ieee80211_add_htinfo_vendor +ieee80211_add_rates sdk_ieee80211_add_rates +ieee80211_addr_bcast sdk_ieee80211_addr_bcast +ieee80211_add_xrates sdk_ieee80211_add_xrates +ieee80211_alloc_challenge sdk_ieee80211_alloc_challenge +ieee80211_alloc_proberesp sdk_ieee80211_alloc_proberesp +ieee80211_beacon_alloc sdk_ieee80211_beacon_alloc +ieee80211_chan2ieee sdk_ieee80211_chan2ieee +ieee80211_compute_duration sdk_ieee80211_compute_duration +ieee80211_crypto_attach sdk_ieee80211_crypto_attach +ieee80211_crypto_available sdk_ieee80211_crypto_available +ieee80211_crypto_decap sdk_ieee80211_crypto_decap +ieee80211_crypto_encap sdk_ieee80211_crypto_encap +ieee80211_crypto_setkey sdk_ieee80211_crypto_setkey +ieee80211_decap sdk_ieee80211_decap +ieee80211_deliver_data sdk_ieee80211_deliver_data +ieee80211_dot11Rate_rix sdk_ieee80211_dot11Rate_rix +ieee80211_find_channel_byieee sdk_ieee80211_find_channel_byieee +ieee80211_find_channel sdk_ieee80211_find_channel +ieee80211_get_11g_ratetable sdk_ieee80211_get_11g_ratetable +ieee80211_getcapinfo sdk_ieee80211_getcapinfo +ieee80211_getmgtframe sdk_ieee80211_getmgtframe +ieee80211_get_ratetable sdk_ieee80211_get_ratetable +ieee80211_hostap_attach sdk_ieee80211_hostap_attach +ieee80211_ht_attach sdk_ieee80211_ht_attach +ieee80211_ht_node_cleanup sdk_ieee80211_ht_node_cleanup +ieee80211_ht_node_init sdk_ieee80211_ht_node_init +ieee80211_ht_updateparams sdk_ieee80211_ht_updateparams +ieee80211_ieee2mhz sdk_ieee80211_ieee2mhz +ieee80211_ifattach sdk_ieee80211_ifattach +ieee80211_iserp_rateset sdk_ieee80211_iserp_rateset +ieee80211_mgmt_output sdk_ieee80211_mgmt_output +ieee80211_mhz2ieee sdk_ieee80211_mhz2ieee +ieee80211_mlme_connect_bss sdk_ieee80211_mlme_connect_bss +ieee80211_node_pwrsave sdk_ieee80211_node_pwrsave +ieee80211_opcap sdk_ieee80211_opcap +ieee80211_output_pbuf sdk_ieee80211_output_pbuf +ieee80211_parse_action sdk_ieee80211_parse_action +ieee80211_parse_beacon sdk_ieee80211_parse_beacon +ieee80211_parse_htcap sdk_ieee80211_parse_htcap +ieee80211_parse_rsn sdk_ieee80211_parse_rsn +ieee80211_parse_wmeparams sdk_ieee80211_parse_wmeparams +ieee80211_parse_wpa sdk_ieee80211_parse_wpa +ieee80211_phy_init sdk_ieee80211_phy_init +ieee80211_phy_type_get sdk_ieee80211_phy_type_get +ieee80211_proto_attach sdk_ieee80211_proto_attach +ieee80211_psq_cleanup sdk_ieee80211_psq_cleanup +ieee80211_psq_init sdk_ieee80211_psq_init +ieee80211_pwrsave sdk_ieee80211_pwrsave +ieee80211_recv_action_register sdk_ieee80211_recv_action_register +ieee80211_recv_action sdk_ieee80211_recv_action +ieee80211_recv_action_unregister sdk_ieee80211_recv_action_unregister +ieee80211_scan_attach sdk_ieee80211_scan_attach +ieee80211_send_action_register sdk_ieee80211_send_action_register +ieee80211_send_action sdk_ieee80211_send_action +ieee80211_send_action_unregister sdk_ieee80211_send_action_unregister +ieee80211_send_mgmt sdk_ieee80211_send_mgmt +ieee80211_send_nulldata sdk_ieee80211_send_nulldata +ieee80211_send_probereq sdk_ieee80211_send_probereq +ieee80211_send_proberesp sdk_ieee80211_send_proberesp +ieee80211_send_setup sdk_ieee80211_send_setup +ieee80211_setbasicrates sdk_ieee80211_setbasicrates +ieee80211_set_shortslottime sdk_ieee80211_set_shortslottime +ieee80211_set_tim sdk_ieee80211_set_tim +ieee80211_setup_basic_htrates sdk_ieee80211_setup_basic_htrates +ieee80211_setup_htrates sdk_ieee80211_setup_htrates +ieee80211_setup_rateset sdk_ieee80211_setup_rateset +ieee80211_setup_rates sdk_ieee80211_setup_rates +ieee80211_setup_ratetable sdk_ieee80211_setup_ratetable +ieee80211_sta_new_state sdk_ieee80211_sta_new_state +ieee80211_tx_mgt_cb sdk_ieee80211_tx_mgt_cb +ieee80211_wme_initparams sdk_ieee80211_wme_initparams +ieee80211_wme_updateparams sdk_ieee80211_wme_updateparams +ieee802_1x_receive sdk_ieee802_1x_receive +if_ctrl sdk_if_ctrl +inc_byte_array sdk_inc_byte_array +info sdk_info +init_cal_dcoffset sdk_init_cal_dcoffset +interface_mask sdk_interface_mask +lmacConfMib sdk_lmacConfMib +lmacDiscardAgedMSDU sdk_lmacDiscardAgedMSDU +lmacInitAc sdk_lmacInitAc +lmacInit sdk_lmacInit +lmacIsActive sdk_lmacIsActive +lmacIsIdle sdk_lmacIsIdle +lmacMSDUAged sdk_lmacMSDUAged +lmacProcessAckTimeout sdk_lmacProcessAckTimeout +lmacProcessCollision sdk_lmacProcessCollision +lmacProcessCollisions sdk_lmacProcessCollisions +lmacProcessCtsTimeout sdk_lmacProcessCtsTimeout +lmacProcessRtsStart sdk_lmacProcessRtsStart +lmacProcessTxError sdk_lmacProcessTxError +lmacProcessTxRtsError sdk_lmacProcessTxRtsError +lmacProcessTXStartData sdk_lmacProcessTXStartData +lmacProcessTxSuccess sdk_lmacProcessTxSuccess +lmacRecycleMPDU sdk_lmacRecycleMPDU +lmacRxDone sdk_lmacRxDone +lmacSetAcParam sdk_lmacSetAcParam +lmacTxFrame sdk_lmacTxFrame +loop_pwctrl_correct_atten_high_power sdk_loop_pwctrl_correct_atten_high_power +loop_pwctrl_pwdet_error_accum_high_power sdk_loop_pwctrl_pwdet_error_accum_high_power +low_power_set sdk_low_power_set +MacIsrSigPostDefHdl sdk_MacIsrSigPostDefHdl +MD5Final sdk_MD5Final +MD5Init sdk_MD5Init +MD5Update sdk_MD5Update +md5_vector sdk_md5_vector +meas_tone_pwr_db sdk_meas_tone_pwr_db +NMIIrqIsOn sdk_NMIIrqIsOn +noise_array sdk_noise_array +noise_check_loop sdk_noise_check_loop +noise_init sdk_noise_init +NoiseTimerInterval sdk_NoiseTimerInterval +operation_test sdk_operation_test +os_delay_us sdk_os_delay_us +os_get_cpu_frequency sdk_os_get_cpu_frequency +os_get_time sdk_os_get_time +os_install_putc1 sdk_os_install_putc1 +os_putc sdk_os_putc +os_timer_arm sdk_os_timer_arm +os_timer_disarm sdk_os_timer_disarm +os_timer_setfn sdk_os_timer_setfn +os_update_cpu_frequency sdk_os_update_cpu_frequency +pbkdf2_sha1 sdk_pbkdf2_sha1 +pbus_set_rxbbgain sdk_pbus_set_rxbbgain +pend_flag_noise_check sdk_pend_flag_noise_check +pend_flag_periodic_cal sdk_pend_flag_periodic_cal +PendFreeBcnEb sdk_PendFreeBcnEb +periodic_cal_dc_num sdk_periodic_cal_dc_num +periodic_cal_flag sdk_periodic_cal_flag +periodic_cal_sat sdk_periodic_cal_sat +periodic_cal sdk_periodic_cal +periodic_cal_top sdk_periodic_cal_top +phy_bb_rx_cfg sdk_phy_bb_rx_cfg +phy_change_channel sdk_phy_change_channel +phy_delete_channel sdk_phy_delete_channel +phy_dig_spur_prot sdk_phy_dig_spur_prot +phy_dig_spur_set sdk_phy_dig_spur_set +phy_disable_agc sdk_phy_disable_agc +phy_enable_agc sdk_phy_enable_agc +phy_freq_offset sdk_phy_freq_offset +phy_get_mactime sdk_phy_get_mactime +phy_get_romfuncs sdk_phy_get_romfuncs +phy_gpio_cfg sdk_phy_gpio_cfg +phy_initialize_bb sdk_phy_initialize_bb +phy_init sdk_phy_init +phy_pbus_soc_cfg sdk_phy_pbus_soc_cfg +phy_set_sense sdk_phy_set_sense +pm_allow_tx sdk_pm_allow_tx +pm_assoc_parse sdk_pm_assoc_parse +pm_attach sdk_pm_attach +pm_check_mac_idle sdk_pm_check_mac_idle +pm_enable_gpio_wakeup sdk_pm_enable_gpio_wakeup +pm_force_scan_unlock sdk_pm_force_scan_unlock +pm_get_idle_wait_time sdk_pm_get_idle_wait_time +pm_get_sleep_type sdk_pm_get_sleep_type +pm_goto_sleep sdk_pm_goto_sleep +pm_idle_sleep sdk_pm_idle_sleep +pm_is_open sdk_pm_is_open +pm_is_waked sdk_pm_is_waked +pm_onBcnRx sdk_pm_onBcnRx +pm_open_rf sdk_pm_open_rf +pm_open sdk_pm_open +pm_post sdk_pm_post +pm_prepare_to_sleep sdk_pm_prepare_to_sleep +pm_reset_idle_sleep sdk_pm_reset_idle_sleep +pm_rf_is_closed sdk_pm_rf_is_closed +pm_rtc2usec sdk_pm_rtc2usec +pm_rtc_clock_cali_proc sdk_pm_rtc_clock_cali_proc +pm_rtc_clock_cali sdk_pm_rtc_clock_cali +pm_scan_lock sdk_pm_scan_lock +pm_scan_unlocked sdk_pm_scan_unlocked +pm_sdio_nidle sdk_pm_sdio_nidle +pm_send_nullfunc sdk_pm_send_nullfunc +pm_set_addr sdk_pm_set_addr +pm_set_pll_xtal_wait_time sdk_pm_set_pll_xtal_wait_time +pm_set_sleep_btco sdk_pm_set_sleep_btco +pm_set_sleep_cycles sdk_pm_set_sleep_cycles +pm_set_sleep_mode sdk_pm_set_sleep_mode +pm_set_sleep_time sdk_pm_set_sleep_time +pm_set_sleep_type_from_upper sdk_pm_set_sleep_type_from_upper +pm_set_wakeup_btco sdk_pm_set_wakeup_btco +pm_set_wakeup_mac sdk_pm_set_wakeup_mac +pm_shutdown sdk_pm_shutdown +pm_sleep_for sdk_pm_sleep_for +pm_sleep_opt_bb_off sdk_pm_sleep_opt_bb_off +pm_sleep_opt_bb_on sdk_pm_sleep_opt_bb_on +pm_sleep_opt sdk_pm_sleep_opt +pm_sleep_set_mac sdk_pm_sleep_set_mac +pm_suspend sdk_pm_suspend +pm_try_scan_unlock sdk_pm_try_scan_unlock +pm_unmask_bt sdk_pm_unmask_bt +pm_usec2rtc sdk_pm_usec2rtc +pm_wait4wakeup sdk_pm_wait4wakeup +pm_wakeup_init sdk_pm_wakeup_init +pm_wakeup_opt sdk_pm_wakeup_opt +pp_attach sdk_pp_attach +ppCalFrameTimes sdk_ppCalFrameTimes +ppCalTxop sdk_ppCalTxop +ppCheckTxIdle sdk_ppCheckTxIdle +ppDequeueTxQ sdk_ppDequeueTxQ +pp_disable_idle_timer sdk_pp_disable_idle_timer +pp_disable_noise_timer sdk_pp_disable_noise_timer +ppDiscardMPDU sdk_ppDiscardMPDU +pp_enable_idle_timer sdk_pp_enable_idle_timer +pp_enable_noise_timer sdk_pp_enable_noise_timer +ppEnqueueRxq sdk_ppEnqueueRxq +ppEnqueueTxDone sdk_ppEnqueueTxDone +ppFetchTxQFirstAvail sdk_ppFetchTxQFirstAvail +ppGetTxQFirstAvail_Locked sdk_ppGetTxQFirstAvail_Locked +ppInstallKey sdk_ppInstallKey +pp_michael_mic_failure sdk_pp_michael_mic_failure +pp_noise_test sdk_pp_noise_test +ppPeocessRxPktHdr sdk_ppPeocessRxPktHdr +pp_post sdk_pp_post +ppProcessTxQ sdk_ppProcessTxQ +ppProcessWaitQ sdk_ppProcessWaitQ +ppRecordBarRRC sdk_ppRecordBarRRC +ppRecycleRxPkt sdk_ppRecycleRxPkt +ppRegisterTxCallback sdk_ppRegisterTxCallback +ppRollBackTxQ sdk_ppRollBackTxQ +pp_soft_wdt_feed sdk_pp_soft_wdt_feed +pp_soft_wdt_init sdk_pp_soft_wdt_init +ppTask sdk_ppTask +pp_try_enable_idle_timer sdk_pp_try_enable_idle_timer +ppTxPkt sdk_ppTxPkt +ppTxqUpdateBitmap sdk_ppTxqUpdateBitmap +PPWdtReset sdk_PPWdtReset +promiscuous_cb sdk_promiscuous_cb +_putc1 sdk__putc1 +pwctrl_debug sdk_pwctrl_debug +ram_cal_tos_v60 sdk_ram_cal_tos_v60 +ram_chip_v6_rx_init sdk_ram_chip_v6_rx_init +ram_get_bb_atten sdk_ram_get_bb_atten +ram_get_corr_power sdk_ram_get_corr_power +ram_get_fm_sar_dout sdk_ram_get_fm_sar_dout +ram_get_noisefloor sdk_ram_get_noisefloor +ram_pbus_debugmode sdk_ram_pbus_debugmode +ram_pbus_set_rxgain sdk_ram_pbus_set_rxgain +ram_pbus_xpd_tx_on sdk_ram_pbus_xpd_tx_on +ram_restart_cal sdk_ram_restart_cal +ram_rfcal_pwrctrl sdk_ram_rfcal_pwrctrl +ram_rfcal_rxiq sdk_ram_rfcal_rxiq +ram_rfcal_txcap sdk_ram_rfcal_txcap +ram_rfcal_txiq sdk_ram_rfcal_txiq +ram_rfpll_set_freq sdk_ram_rfpll_set_freq +ram_rxiq_cover_mg_mp sdk_ram_rxiq_cover_mg_mp +ram_rxiq_get_mis sdk_ram_rxiq_get_mis +ram_set_channel_freq sdk_ram_set_channel_freq +ram_set_noise_floor sdk_ram_set_noise_floor +ram_set_txbb_atten sdk_ram_set_txbb_atten +ram_start_noisefloor sdk_ram_start_noisefloor +ram_tx_mac_disable sdk_ram_tx_mac_disable +ram_tx_mac_enable sdk_ram_tx_mac_enable +rc4_skip sdk_rc4_skip +rcAttach sdk_rcAttach +rc_cal sdk_rc_cal +rc_disable_trc_by_interface sdk_rc_disable_trc_by_interface +rc_disable_trc sdk_rc_disable_trc +rc_enable_trc sdk_rc_enable_trc +RC_GetAckRate sdk_RC_GetAckRate +RC_GetAckTime sdk_RC_GetAckTime +RC_GetBlockAckTime sdk_RC_GetBlockAckTime +RC_GetCtsTime sdk_RC_GetCtsTime +rc_get_mask sdk_rc_get_mask +rcGetRate sdk_rcGetRate +RC_GetRtsRate sdk_RC_GetRtsRate +rcGetSched sdk_rcGetSched +rc_get_sta_trc sdk_rc_get_sta_trc +rc_get_trc_by_index sdk_rc_get_trc_by_index +rc_get_trc sdk_rc_get_trc +rcGetTrc sdk_rcGetTrc +rc_only_sta_trc sdk_rc_only_sta_trc +rcons sdk_rcons +rcReachRetryLimit sdk_rcReachRetryLimit +RC_SetBasicRate sdk_RC_SetBasicRate +rcUpdateDataRxDone sdk_rcUpdateDataRxDone +rcUpdatePhyMode sdk_rcUpdatePhyMode +rcUpdateRxDone sdk_rcUpdateRxDone +rcUpdateTxDone sdk_rcUpdateTxDone +read_hw_noisefloor sdk_read_hw_noisefloor +read_sar_dout sdk_read_sar_dout +readvdd33 sdk_readvdd33 +register_chipv6_phy_init_param sdk_register_chipv6_phy_init_param +register_chipv6_phy sdk_register_chipv6_phy +register_phy_ops sdk_register_phy_ops +reset_noise_timer sdk_reset_noise_timer +RFChannelSel sdk_RFChannelSel +rf_init sdk_rf_init +rijndaelEncrypt sdk_rijndaelEncrypt +rijndaelKeySetupDec sdk_rijndaelKeySetupDec +rijndaelKeySetupEnc sdk_rijndaelKeySetupEnc +rom_abs_temp sdk_rom_abs_temp +rom_ana_inf_gating_en sdk_rom_ana_inf_gating_en +rom_cal_tos_v50 sdk_rom_cal_tos_v50 +rom_chip_50_set_channel sdk_rom_chip_50_set_channel +rom_chip_v5_disable_cca sdk_rom_chip_v5_disable_cca +rom_chip_v5_enable_cca sdk_rom_chip_v5_enable_cca +rom_chip_v5_rx_init sdk_rom_chip_v5_rx_init +rom_chip_v5_sense_backoff sdk_rom_chip_v5_sense_backoff +rom_chip_v5_tx_init sdk_rom_chip_v5_tx_init +rom_dc_iq_est sdk_rom_dc_iq_est +rom_en_pwdet sdk_rom_en_pwdet +rom_get_bb_atten sdk_rom_get_bb_atten +rom_get_corr_power sdk_rom_get_corr_power +rom_get_fm_sar_dout sdk_rom_get_fm_sar_dout +rom_get_noisefloor sdk_rom_get_noisefloor +rom_get_power_db sdk_rom_get_power_db +rom_i2c_readReg_Mask sdk_rom_i2c_readReg_Mask +rom_i2c_readReg sdk_rom_i2c_readReg +rom_i2c_writeReg_Mask sdk_rom_i2c_writeReg_Mask +rom_i2c_writeReg sdk_rom_i2c_writeReg +rom_iq_est_disable sdk_rom_iq_est_disable +rom_iq_est_enable sdk_rom_iq_est_enable +rom_linear_to_db sdk_rom_linear_to_db +rom_mhz2ieee sdk_rom_mhz2ieee +rom_pbus_dco___SA2 sdk_rom_pbus_dco___SA2 +rom_pbus_debugmode sdk_rom_pbus_debugmode +rom_pbus_enter_debugmode sdk_rom_pbus_enter_debugmode +rom_pbus_exit_debugmode sdk_rom_pbus_exit_debugmode +rom_pbus_force_test sdk_rom_pbus_force_test +rom_pbus_rd sdk_rom_pbus_rd +rom_pbus_set_rxgain sdk_rom_pbus_set_rxgain +rom_pbus_set_txgain sdk_rom_pbus_set_txgain +rom_pbus_workmode sdk_rom_pbus_workmode +rom_pbus_xpd_rx_off sdk_rom_pbus_xpd_rx_off +rom_pbus_xpd_rx_on sdk_rom_pbus_xpd_rx_on +rom_pbus_xpd_tx_off sdk_rom_pbus_xpd_tx_off +rom_pbus_xpd_tx_on__low_gain sdk_rom_pbus_xpd_tx_on__low_gain +rom_pbus_xpd_tx_on sdk_rom_pbus_xpd_tx_on +rom_phy_reset_req sdk_rom_phy_reset_req +rom_restart_cal sdk_rom_restart_cal +rom_rfcal_pwrctrl sdk_rom_rfcal_pwrctrl +rom_rfcal_rxiq sdk_rom_rfcal_rxiq +rom_rfcal_rxiq_set_reg sdk_rom_rfcal_rxiq_set_reg +rom_rfcal_txcap sdk_rom_rfcal_txcap +rom_rfcal_txiq_cover sdk_rom_rfcal_txiq_cover +rom_rfcal_txiq sdk_rom_rfcal_txiq +rom_rfcal_txiq_set_reg sdk_rom_rfcal_txiq_set_reg +rom_rfpll_reset sdk_rom_rfpll_reset +rom_rfpll_set_freq sdk_rom_rfpll_set_freq +rom_rxiq_cover_mg_mp sdk_rom_rxiq_cover_mg_mp +rom_rxiq_get_mis sdk_rom_rxiq_get_mis +rom_sar_init sdk_rom_sar_init +rom_set_ana_inf_tx_scale sdk_rom_set_ana_inf_tx_scale +rom_set_channel_freq sdk_rom_set_channel_freq +rom_set_loopback_gain sdk_rom_set_loopback_gain +rom_set_noise_floor sdk_rom_set_noise_floor +rom_set_rxclk_en sdk_rom_set_rxclk_en +rom_set_txbb_atten sdk_rom_set_txbb_atten +rom_set_txclk_en sdk_rom_set_txclk_en +rom_set_txiq_cal sdk_rom_set_txiq_cal +rom_start_noisefloor sdk_rom_start_noisefloor +rom_start_tx_tone sdk_rom_start_tx_tone +rom_stop_tx_tone sdk_rom_stop_tx_tone +rom_tx_mac_disable sdk_rom_tx_mac_disable +rom_tx_mac_enable sdk_rom_tx_mac_enable +rom_txtone_linear_pwr sdk_rom_txtone_linear_pwr +rom_write_rfpll_sdm sdk_rom_write_rfpll_sdm +rsn_cipher_put_suites sdk_rsn_cipher_put_suites +rsn_pmkid sdk_rsn_pmkid +rst_if sdk_rst_if +rtc_get_reset_reason sdk_rtc_get_reset_reason +rtc_mem_backup sdk_rtc_mem_backup +rtc_mem_recovery sdk_rtc_mem_recovery +rxdc_init_flag sdk_rxdc_init_flag +rx_gain_swp sdk_rx_gain_swp +rxiq_compute_num sdk_rxiq_compute_num +rxiq_cover_fail_num sdk_rxiq_cover_fail_num +RxNodeNum sdk_RxNodeNum +scan_add_bssid sdk_scan_add_bssid +scan_add_probe_ssid sdk_scan_add_probe_ssid +scan_cancel sdk_scan_cancel +scan_check_hidden sdk_scan_check_hidden +scan_clear_channles sdk_scan_clear_channles +scan_connect_state sdk_scan_connect_state +scan_get_type sdk_scan_get_type +scan_hidden_ssid sdk_scan_hidden_ssid +scannum sdk_scannum +scan_parse_beacon sdk_scan_parse_beacon +scan_pm_channel_op_cb sdk_scan_pm_channel_op_cb +scan_profile_check sdk_scan_profile_check +scan_remove_bssid sdk_scan_remove_bssid +scan_remove_probe_ssid sdk_scan_remove_probe_ssid +scan_set_desChan sdk_scan_set_desChan +scan_start sdk_scan_start +SDIO_slp_reject sdk_SDIO_slp_reject +sdt_on_noise_start sdk_sdt_on_noise_start +set_cal_rxdc sdk_set_cal_rxdc +set_crystal_uart sdk_set_crystal_uart +set_rfanagain_dc_reg sdk_set_rfanagain_dc_reg +set_rf_freq_offset sdk_set_rf_freq_offset +set_rx_gain_cal_iq sdk_set_rx_gain_cal_iq +set_rx_gain_testchip_50 sdk_set_rx_gain_testchip_50 +set_txcap_reg sdk_set_txcap_reg +set_txdc_pbus sdk_set_txdc_pbus +SHA1Final sdk_SHA1Final +SHA1Init sdk_SHA1Init +sha1_prf sdk_sha1_prf +SHA1Transform sdk_SHA1Transform +SHA1Update sdk_SHA1Update +sha1_vector sdk_sha1_vector +sleep_opt_8266 sdk_sleep_opt_8266 +sleep_opt_bb_on_8266 sdk_sleep_opt_bb_on_8266 +sleep_reset_analog_rtcreg_8266 sdk_sleep_reset_analog_rtcreg_8266 +sleep_start_wait_time sdk_sleep_start_wait_time +slop_test sdk_slop_test +slop_wdt_feed sdk_slop_wdt_feed +software_slp_reject sdk_software_slp_reject +SPIEraseSector sdk_SPIEraseSector +spi_flash_erase_sector sdk_spi_flash_erase_sector +spi_flash_get_id sdk_spi_flash_get_id +spi_flash_read sdk_spi_flash_read +spi_flash_read_status sdk_spi_flash_read_status +spi_flash_write sdk_spi_flash_write +spi_flash_write_status sdk_spi_flash_write_status +SPIReadModeCnfig sdk_SPIReadModeCnfig +SPIRead sdk_SPIRead +SPIWrite sdk_SPIWrite +sta_con_timer sdk_sta_con_timer +sta_input sdk_sta_input +start_dig_rx sdk_start_dig_rx +sta_status_set sdk_sta_status_set +stop_dig_rx sdk_stop_dig_rx +sw_scan_mode sdk_sw_scan_mode +system_adc_read sdk_system_adc_read +system_deep_sleep sdk_system_deep_sleep +system_get_boot_mode sdk_system_get_boot_mode +system_get_boot_version sdk_system_get_boot_version +system_get_checksum sdk_system_get_checksum +system_get_chip_id sdk_system_get_chip_id +system_get_cpu_freq sdk_system_get_cpu_freq +system_get_free_heap_size sdk_system_get_free_heap_size +system_get_rst_info sdk_system_get_rst_info +system_get_rtc_time sdk_system_get_rtc_time +system_get_sdk_version sdk_system_get_sdk_version +system_get_test_result sdk_system_get_test_result +system_get_time sdk_system_get_time +system_get_userbin_addr sdk_system_get_userbin_addr +system_overclock sdk_system_overclock +system_pp_recycle_rx_pkt sdk_system_pp_recycle_rx_pkt +system_print_meminfo sdk_system_print_meminfo +system_relative_time sdk_system_relative_time +system_restart_enhance sdk_system_restart_enhance +system_restart_in_nmi sdk_system_restart_in_nmi +system_restart sdk_system_restart +system_restoreclock sdk_system_restoreclock +system_restore sdk_system_restore +system_rtc_clock_cali_proc sdk_system_rtc_clock_cali_proc +system_rtc_mem_read sdk_system_rtc_mem_read +system_rtc_mem_write sdk_system_rtc_mem_write +system_station_got_ip_set sdk_system_station_got_ip_set +system_uart_swap sdk_system_uart_swap +system_update_cpu_freq sdk_system_update_cpu_freq +system_upgrade_flag_check sdk_system_upgrade_flag_check +system_upgrade_flag_set sdk_system_upgrade_flag_set +system_upgrade_reboot sdk_system_upgrade_reboot +system_upgrade_userbin_check sdk_system_upgrade_userbin_check +system_upgrade_userbin_set sdk_system_upgrade_userbin_set +target_power_add_backoff sdk_target_power_add_backoff +target_power_backoff sdk_target_power_backoff +Td0 sdk_Td0 +Td4s_rom sdk_Td4s_rom +Te0 sdk_Te0 +test_rffreq_txcap sdk_test_rffreq_txcap +test_tout sdk_test_tout +tkip sdk_tkip +TmpSTAAPCloseAP sdk_TmpSTAAPCloseAP +trc_NeedRTS sdk_trc_NeedRTS +trc_onDisconnect sdk_trc_onDisconnect +trc_onScanDone sdk_trc_onScanDone +trc_onScanStart sdk_trc_onScanStart +tsen_meas sdk_tsen_meas +tx_atten_set_interp sdk_tx_atten_set_interp +txbbgain2dcoindex sdk_txbbgain2dcoindex +txbk_dpdby_flag sdk_txbk_dpdby_flag +tx_cap_init sdk_tx_cap_init +tx_cont_cfg sdk_tx_cont_cfg +tx_cont_dis sdk_tx_cont_dis +tx_cont_en sdk_tx_cont_en +Tx_Copy2Queue sdk_Tx_Copy2Queue +txiq_cover sdk_txiq_cover +txiq_get_mis_pwr sdk_txiq_get_mis_pwr +TxNodeNum sdk_TxNodeNum +tx_pwctrl_atten_init_en sdk_tx_pwctrl_atten_init_en +tx_pwctrl_atten_init sdk_tx_pwctrl_atten_init +tx_pwctrl_background sdk_tx_pwctrl_background +tx_pwctrl_bg_init sdk_tx_pwctrl_bg_init +tx_pwctrl_cal sdk_tx_pwctrl_cal +tx_pwctrl_init_cal sdk_tx_pwctrl_init_cal +tx_pwctrl_init sdk_tx_pwctrl_init +tx_pwctrl_pk_num sdk_tx_pwctrl_pk_num +tx_pwctrl_set_chan_flag sdk_tx_pwctrl_set_chan_flag +tx_pwr_backoff sdk_tx_pwr_backoff +txpwr_offset sdk_txpwr_offset +tx_rf_ana_gain sdk_tx_rf_ana_gain +uart_buff_switch sdk_uart_buff_switch +uart_div_modify sdk_uart_div_modify +Uart_Init sdk_Uart_Init +uart_rx_one_char sdk_uart_rx_one_char +uart_tx_flush sdk_uart_tx_flush +uart_wait_idle sdk_uart_wait_idle +user_fatal_exception_handler sdk_user_fatal_exception_handler +user_init_flag sdk_user_init_flag +user_init_task sdk_user_init_task +user_start sdk_user_start +vApplicationIdleHook sdk_vApplicationIdleHook +vApplicationStackOverflowHook sdk_vApplicationStackOverflowHook +vApplicationTickHook sdk_vApplicationTickHook +vPortYield sdk_vPortYield +wait_rfpll_cal_end sdk_wait_rfpll_cal_end +wDev_AppendRxAmpduLensBlocks sdk_wDev_AppendRxAmpduLensBlocks +wDev_AppendRxBlocks sdk_wDev_AppendRxBlocks +wDev_ClearBssid sdk_wDev_ClearBssid +wDev_ClearTxqCollisions sdk_wDev_ClearTxqCollisions +wDev_ClearWaitingQueue sdk_wDev_ClearWaitingQueue +wDev_Crypto_Conf sdk_wDev_Crypto_Conf +wDev_Crypto_Disable sdk_wDev_Crypto_Disable +wDevCtrl sdk_wDevCtrl +wDev_Disable_Beacon_Tsf sdk_wDev_Disable_Beacon_Tsf +wDevDisableRx sdk_wDevDisableRx +wDev_DisableTransmit sdk_wDev_DisableTransmit +wDev_Enable_Beacon_Tsf sdk_wDev_Enable_Beacon_Tsf +wDevEnableRx sdk_wDevEnableRx +wDev_EnableTransmit sdk_wDev_EnableTransmit +wdev_exit_sniffer sdk_wdev_exit_sniffer +wDevForceAck6M sdk_wDevForceAck6M +wDev_GetBAInfo sdk_wDev_GetBAInfo +wDev_Get_Next_TBTT sdk_wDev_Get_Next_TBTT +wDev_GetTxqCollisions sdk_wDev_GetTxqCollisions +wdev_go_sniffer sdk_wdev_go_sniffer +wDev_Initialize sdk_wDev_Initialize +wDev_Insert_KeyEntry sdk_wDev_Insert_KeyEntry +wDev_MacTim1Arm sdk_wDev_MacTim1Arm +wDev_MacTim1SetFunc sdk_wDev_MacTim1SetFunc +wDev_MacTimArm sdk_wDev_MacTimArm +wDev_MacTimSetFunc sdk_wDev_MacTimSetFunc +wDev_Option_Init sdk_wDev_Option_Init +wDev_ProcessCollision sdk_wDev_ProcessCollision +wDev_ProcessFiq sdk_wDev_ProcessFiq +wDev_remove_KeyEntry sdk_wDev_remove_KeyEntry +wDev_Reset_TBTT sdk_wDev_Reset_TBTT +wDev_Set_Beacon_Int sdk_wDev_Set_Beacon_Int +wDev_SetBssid sdk_wDev_SetBssid +wDev_SetFrameAckType sdk_wDev_SetFrameAckType +wDev_SetMacAddress sdk_wDev_SetMacAddress +wDev_SetRxPolicy sdk_wDev_SetRxPolicy +wDev_SetWaitingQueue sdk_wDev_SetWaitingQueue +WdevTimOffSet sdk_WdevTimOffSet +wd_reset_cnt sdk_wd_reset_cnt +wdt_init sdk_wdt_init +wep sdk_wep +wifi_get_channel sdk_wifi_get_channel +wifi_get_ip_info sdk_wifi_get_ip_info +wifi_get_macaddr sdk_wifi_get_macaddr +wifi_get_opmode_default sdk_wifi_get_opmode_default +wifi_get_opmode sdk_wifi_get_opmode +wifi_get_phy_mode sdk_wifi_get_phy_mode +wifi_get_sleep_type sdk_wifi_get_sleep_type +wifi_mode_set sdk_wifi_mode_set +wifi_param_save_protect sdk_wifi_param_save_protect +wifi_promiscuous_enable sdk_wifi_promiscuous_enable +wifi_promiscuous_set_mac sdk_wifi_promiscuous_set_mac +wifi_set_channel sdk_wifi_set_channel +wifi_set_ip_info sdk_wifi_set_ip_info +wifi_set_macaddr sdk_wifi_set_macaddr +wifi_set_opmode_current sdk_wifi_set_opmode_current +wifi_set_opmode_local sdk_wifi_set_opmode_local +wifi_set_opmode sdk_wifi_set_opmode +wifi_set_phy_mode sdk_wifi_set_phy_mode +wifi_set_promiscuous_rx_cb sdk_wifi_set_promiscuous_rx_cb +wifi_set_sleep_type sdk_wifi_set_sleep_type +wifi_softap_cacl_mac sdk_wifi_softap_cacl_mac +wifi_softap_deauth sdk_wifi_softap_deauth +wifi_softap_free_station_info sdk_wifi_softap_free_station_info +wifi_softap_get_config_default sdk_wifi_softap_get_config_default +wifi_softap_get_config sdk_wifi_softap_get_config +wifi_softap_get_station_info sdk_wifi_softap_get_station_info +wifi_softap_set_config_current sdk_wifi_softap_set_config_current +wifi_softap_set_config sdk_wifi_softap_set_config +wifi_softap_set_default_ssid sdk_wifi_softap_set_default_ssid +wifi_softap_set_station_info sdk_wifi_softap_set_station_info +wifi_softap_start sdk_wifi_softap_start +wifi_softap_stop sdk_wifi_softap_stop +wifi_station_ap_change sdk_wifi_station_ap_change +wifi_station_ap_check sdk_wifi_station_ap_check +wifi_station_ap_number_set sdk_wifi_station_ap_number_set +wifi_station_connect sdk_wifi_station_connect +wifi_station_dhcpc_start sdk_wifi_station_dhcpc_start +wifi_station_dhcpc_status sdk_wifi_station_dhcpc_status +wifi_station_dhcpc_stop sdk_wifi_station_dhcpc_stop +wifi_station_disconnect sdk_wifi_station_disconnect +wifi_station_get_ap_info sdk_wifi_station_get_ap_info +wifi_station_get_auto_connect sdk_wifi_station_get_auto_connect +wifi_station_get_config_default sdk_wifi_station_get_config_default +wifi_station_get_config sdk_wifi_station_get_config +wifi_station_get_connect_status sdk_wifi_station_get_connect_status +wifi_station_get_current_ap_id sdk_wifi_station_get_current_ap_id +wifi_station_scan sdk_wifi_station_scan +wifi_station_set_auto_connect sdk_wifi_station_set_auto_connect +wifi_station_set_config_current sdk_wifi_station_set_config_current +wifi_station_set_config sdk_wifi_station_set_config +wifi_station_start sdk_wifi_station_start +wifi_station_stop sdk_wifi_station_stop +wifi_status_led_install sdk_wifi_status_led_install +wpa_add_kde sdk_wpa_add_kde +wpa_attach sdk_wpa_attach +wpa_auth_for_each_sta sdk_wpa_auth_for_each_sta +wpa_auth_gen_wpa_ie sdk_wpa_auth_gen_wpa_ie +wpa_auth_sm_event sdk_wpa_auth_sm_event +wpa_auth_sta_associated sdk_wpa_auth_sta_associated +wpa_auth_sta_deinit sdk_wpa_auth_sta_deinit +wpa_auth_sta_init sdk_wpa_auth_sta_init +wpa_auth_sta_no_wpa sdk_wpa_auth_sta_no_wpa +wpa_auth_uses_mfp sdk_wpa_auth_uses_mfp +wpabuf_alloc_copy sdk_wpabuf_alloc_copy +wpabuf_alloc_ext_data sdk_wpabuf_alloc_ext_data +wpabuf_alloc sdk_wpabuf_alloc +wpabuf_concat sdk_wpabuf_concat +wpabuf_dup sdk_wpabuf_dup +wpabuf_free sdk_wpabuf_free +wpabuf_put sdk_wpabuf_put +wpabuf_resize sdk_wpabuf_resize +wpabuf_zeropad sdk_wpabuf_zeropad +wpa_cipher_key_len sdk_wpa_cipher_key_len +wpa_cipher_put_suites sdk_wpa_cipher_put_suites +wpa_cipher_to_alg sdk_wpa_cipher_to_alg +wpa_cipher_to_suite sdk_wpa_cipher_to_suite +wpa_compare_rsn_ie sdk_wpa_compare_rsn_ie +wpa_config_assoc_ie sdk_wpa_config_assoc_ie +wpa_config_bss sdk_wpa_config_bss +wpa_config_parse_string sdk_wpa_config_parse_string +wpa_config_profile sdk_wpa_config_profile +wpa_eapol_key_mic sdk_wpa_eapol_key_mic +wpa_gen_wpa_ie sdk_wpa_gen_wpa_ie +wpa_get_ntp_timestamp sdk_wpa_get_ntp_timestamp +wpa_init sdk_wpa_init +wpa_neg_complete sdk_wpa_neg_complete +wpa_parse_kde_ies sdk_wpa_parse_kde_ies +wpa_parse_wpa_ie_rsn sdk_wpa_parse_wpa_ie_rsn +wpa_parse_wpa_ie sdk_wpa_parse_wpa_ie +wpa_parse_wpa_ie_wpa sdk_wpa_parse_wpa_ie_wpa +wpa_pmk_to_ptk sdk_wpa_pmk_to_ptk +wpa_receive sdk_wpa_receive +wpa_register sdk_wpa_register +wpa_remove_ptk sdk_wpa_remove_ptk +__wpa_send_eapol sdk___wpa_send_eapol +wpa_set_bss sdk_wpa_set_bss +wpa_set_pmk sdk_wpa_set_pmk +wpa_set_profile sdk_wpa_set_profile +wpa_sm_alloc_eapol sdk_wpa_sm_alloc_eapol +wpa_sm_deauthenticate sdk_wpa_sm_deauthenticate +wpa_sm_disassociate sdk_wpa_sm_disassociate +wpa_sm_get_beacon_ie sdk_wpa_sm_get_beacon_ie +wpa_sm_mlme_setprotection sdk_wpa_sm_mlme_setprotection +wpa_sm_rx_eapol sdk_wpa_sm_rx_eapol +wpa_sm_set_state sdk_wpa_sm_set_state +wpa_supplicant_parse_ies sdk_wpa_supplicant_parse_ies +wpa_validate_wpa_ie sdk_wpa_validate_wpa_ie +wpa_write_rsn_ie sdk_wpa_write_rsn_ie +xieee80211Queue sdk_xieee80211Queue +_xt_clear_ints sdk__xt_clear_ints +_xt_context_restore sdk__xt_context_restore +_xt_context_save sdk__xt_context_save +_xt_int_enter sdk__xt_int_enter +_xt_int_exit sdk__xt_int_exit +_xt_isr_mask sdk__xt_isr_mask +_xt_isr_unmask sdk__xt_isr_unmask +_xt_read_ints sdk__xt_read_ints +_xt_tick_timer_init sdk__xt_tick_timer_init +_xt_timer_int1 sdk__xt_timer_int1 +_xt_timer_int sdk__xt_timer_int +xUserTaskHandle sdk_xUserTaskHandle +xWatchDogTaskHandle sdk_xWatchDogTaskHandle From ec8c3c134ab0121e7d02c07d810d873343b90cfd Mon Sep 17 00:00:00 2001 From: Alex Stewart Date: Tue, 25 Aug 2015 09:34:37 -0700 Subject: [PATCH 02/11] Replace libmain:app_main.o with core/app_main.c --- core/app_main.c | 501 +++++++++++++++++++++++++++++++++++ core/include/esp/wdev_regs.h | 30 +++ core/include/esp/wdt_regs.h | 11 + core/include/os_version.h | 6 + core/include/sdk_internal.h | 235 ++++++++++++++++ core/include/xtensa_ops.h | 21 ++ lib/libmain.remove | 1 + 7 files changed, 805 insertions(+) create mode 100644 core/app_main.c create mode 100644 core/include/esp/wdev_regs.h create mode 100644 core/include/os_version.h create mode 100644 core/include/sdk_internal.h create mode 100644 core/include/xtensa_ops.h diff --git a/core/app_main.c b/core/app_main.c new file mode 100644 index 0000000..86d1cb3 --- /dev/null +++ b/core/app_main.c @@ -0,0 +1,501 @@ +/* Implementation of libmain/app_main.o from the Espressif SDK. + * + * This contains most of the startup code for the SDK/OS, some event handlers, + * etc. + * + * Part of esp-open-rtos + * Copyright (C) 2015 Superhouse Automation Pty Ltd + * BSD Licensed as described in the file LICENSE + */ + +#include +#include +#include +#include + +#include "common_macros.h" +#include "xtensa_ops.h" +#include "esp/rom.h" +#include "esp/iomux_regs.h" +#include "esp/uart_regs.h" +#include "esp/spi_regs.h" +#include "esp/dport_regs.h" +#include "esp/wdev_regs.h" +#include "os_version.h" + +#include "espressif/esp_system.h" +#include "sdk_internal.h" + +/* This is not declared in any header file (but arguably should be) */ + +void user_init(void); + +#define UART_DIVISOR 1068 // 74906 bps (yeah, I don't understand it either) +#define BOOT_INFO_SIZE 28 +//TODO: phy_info should probably be a struct (no idea about its organization, though) +#define PHY_INFO_SIZE 128 + +// These are the offsets of these values within the RTCMEM regions. It appears +// that the ROM saves them to RTCMEM before calling us, and we pull them out of +// there to display them in startup messages (not sure why it works that way). +#define RTCMEM_BACKUP_PHY_VER 31 +#define RTCMEM_SYSTEM_PP_VER 62 + +#define halt() while (1) {} + +extern uint32_t *_bss_start; +extern uint32_t *_bss_end; + +// .Ldata003 -- .irom.text+0x0 +static const uint8_t IROM default_phy_info[PHY_INFO_SIZE] = { + 0x05, 0x00, 0x04, 0x02, 0x05, 0x05, 0x05, 0x02, + 0x05, 0x00, 0x04, 0x05, 0x05, 0x04, 0x05, 0x05, + 0x04, 0xfe, 0xfd, 0xff, 0xf0, 0xf0, 0xf0, 0xe0, + 0xe0, 0xe0, 0xe1, 0x0a, 0xff, 0xff, 0xf8, 0x00, + 0xf8, 0xf8, 0x52, 0x4e, 0x4a, 0x44, 0x40, 0x38, + 0x00, 0x00, 0x01, 0x01, 0x02, 0x03, 0x04, 0x05, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe1, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x93, 0x43, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +// user_init_flag -- .bss+0x0 +uint8_t sdk_user_init_flag; + +// info -- .bss+0x4 +struct sdk_info_st sdk_info; + +// xUserTaskHandle -- .bss+0x28 +xTaskHandle sdk_xUserTaskHandle; + +// xWatchDogTaskHandle -- .bss+0x2c +xTaskHandle sdk_xWatchDogTaskHandle; + +/* Static function prototypes */ + +static void IRAM get_otp_mac_address(uint8_t *buf); +static void IRAM set_spi0_divisor(uint32_t divisor); +static void IRAM default_putc(uint8_t c); +static void IRAM default_putc1(uint8_t c); +static void zero_bss(void); +static void init_networking(uint8_t *phy_info, uint8_t *mac_addr); +static void init_g_ic(void); +static void dump_excinfo(void); +static void user_start_phase2(void); +static void dump_flash_data(uint32_t start_addr, uint32_t length); +static void dump_flash_config_sectors(uint32_t start_addr); + +// .Lfunc001 -- .text+0x14 +static void IRAM get_otp_mac_address(uint8_t *buf) { + uint32_t otp_flags; + uint32_t otp_id0, otp_id1; + uint32_t otp_vendor_id; + + otp_flags = DPORT.OTP_CHIPID; + otp_id1 = DPORT.OTP_MAC1; + otp_id0 = DPORT.OTP_MAC0; + if (!(otp_flags & 0x8000)) { + //FIXME: do we really need this check? + printf("Firmware ONLY supports ESP8266!!!\n"); + halt(); + } + if (otp_id0 == 0 && otp_id1 == 0) { + printf("empty otp\n"); + halt(); + } + if (otp_flags & 0x1000) { + // If bit 12 is set, it indicates that the vendor portion of the MAC + // address is stored in DPORT.OTP_MAC2. + otp_vendor_id = DPORT.OTP_MAC2; + buf[0] = otp_vendor_id >> 16; + buf[1] = otp_vendor_id >> 8; + buf[2] = otp_vendor_id; + } else { + // If bit 12 is clear, there's no MAC vendor in DPORT.OTP_MAC2, so + // default to the Espressif MAC vendor prefix instead. + buf[1] = 0xfe; + buf[0] = 0x18; + buf[2] = 0x34; + } + buf[3] = otp_id1 >> 8; + buf[4] = otp_id1; + buf[5] = otp_id0 >> 24; +} + +// .Lfunc002 -- .text+0xa0 +static void IRAM set_spi0_divisor(uint32_t divisor) { + int cycle_len, half_cycle_len, clkdiv; + + if (divisor < 2) { + clkdiv = 0; + SPI(0).CTRL0 |= SPI_CTRL0_CLOCK_EQU_SYS_CLOCK; + IOMUX.CONF |= IOMUX_CONF_SPI0_CLOCK_EQU_SYS_CLOCK; + } else { + cycle_len = divisor - 1; + half_cycle_len = (divisor / 2) - 1; + clkdiv = VAL2FIELD(SPI_CTRL0_CLOCK_NUM, cycle_len) + | VAL2FIELD(SPI_CTRL0_CLOCK_HIGH, half_cycle_len) + | VAL2FIELD(SPI_CTRL0_CLOCK_LOW, cycle_len); + SPI(0).CTRL0 &= ~SPI_CTRL0_CLOCK_EQU_SYS_CLOCK; + IOMUX.CONF &= ~IOMUX_CONF_SPI0_CLOCK_EQU_SYS_CLOCK; + } + SPI(0).CTRL0 = SET_FIELD(SPI(0).CTRL0, SPI_CTRL0_CLOCK, clkdiv); +} + +// .text+0x148 +void sdk_user_fatal_exception_handler(void) { + if (!sdk_NMIIrqIsOn) { + vPortEnterCritical(); + do { + DPORT.DPORT0 &= 0xffffffe0; + } while (DPORT.DPORT0 & 0x00000001); + } + Cache_Read_Disable(); + Cache_Read_Enable(0, 0, 1); + dump_excinfo(); + while (FIELD2VAL(UART_STATUS_TXFIFO_COUNT, UART(0).STATUS)) {} + while (FIELD2VAL(UART_STATUS_TXFIFO_COUNT, UART(1).STATUS)) {} + sdk_system_restart_in_nmi(); + halt(); +} + +// .Lfunc003 -- .text+0x1d0 +static void IRAM default_putc(uint8_t c) { + while (FIELD2VAL(UART_STATUS_TXFIFO_COUNT, UART(0).STATUS) > 125) {} + UART(0).FIFO = c; +} + +// .Lfunc004 -- .text+0x1f4 +static void IRAM default_putc1(uint8_t c) { + if (c == '\n') { + default_putc('\r'); + } else if (c == '\r') { + return; + } + default_putc(c); +} + +// .text+0x258 +void IRAM sdk_user_start(void) { + uint32_t buf32[sizeof(struct sdk_g_ic_saved_st) / 4]; + uint8_t *buf8 = (uint8_t *)buf32; + uint32_t flash_speed_divisor; + uint32_t flash_sectors; + uint32_t flash_size; + int boot_slot; + uint32_t cksum_magic; + uint32_t cksum_len; + uint32_t cksum_value; + uint32_t ic_flash_addr; + + SPI(0).USER0 |= SPI_USER0_CS_SETUP; + sdk_SPIRead(0, buf32, 4); + + switch (buf8[3] & 0x0f) { + case 0xf: // 80 MHz + flash_speed_divisor = 1; + break; + case 0x0: // 40 MHz + flash_speed_divisor = 2; + break; + case 0x1: // 26 MHz + flash_speed_divisor = 3; + break; + case 0x2: // 20 MHz + flash_speed_divisor = 4; + break; + default: // Invalid -- Assume 40 MHz + flash_speed_divisor = 2; + } + switch (buf8[3] >> 4) { + case 0x0: // 4 Mbit (512 KByte) + flash_sectors = 128; + break; + case 0x1: // 2 Mbit (256 Kbyte) + flash_sectors = 64; + break; + case 0x2: // 8 Mbit (1 Mbyte) + flash_sectors = 256; + break; + case 0x3: // 16 Mbit (2 Mbyte) + flash_sectors = 512; + break; + case 0x4: // 32 Mbit (4 Mbyte) + flash_sectors = 1024; + break; + default: // Invalid -- Assume 4 Mbit (512 KByte) + flash_sectors = 128; + } + //FIXME: we should probably calculate flash_sectors by starting with flash_size and dividing by sdk_flashchip.sector_size instead of vice-versa. + flash_size = flash_sectors * 4096; + sdk_flashchip.chip_size = flash_size; + set_spi0_divisor(flash_speed_divisor); + sdk_SPIRead(flash_size - 256, buf32, BOOT_INFO_SIZE); + boot_slot = buf8[0]; + cksum_magic = buf32[1]; + cksum_len = buf32[3 + boot_slot]; + cksum_value = buf32[5 + boot_slot]; + ic_flash_addr = (flash_sectors - 2 + boot_slot) * sdk_flashchip.sector_size; + sdk_SPIRead(ic_flash_addr, buf32, sizeof(struct sdk_g_ic_saved_st)); + Cache_Read_Enable(0, 0, 1); + zero_bss(); + sdk_os_install_putc1(default_putc1); + if (cksum_magic == 0xffffffff) { + // No checksum required + } else if ((cksum_magic == 0x55aa55aa) && + (sdk_system_get_checksum(buf8, cksum_len) == cksum_value)) { + // Checksum OK + } else { + // Bad checksum or bad cksum_magic value + dump_flash_config_sectors(flash_sectors - 4); + //FIXME: should we halt here? (original SDK code doesn't) + } + memcpy(&sdk_g_ic.s, buf32, sizeof(struct sdk_g_ic_saved_st)); + + user_start_phase2(); +} + +// .text+0x3a8 +void vApplicationStackOverflowHook(xTaskHandle task, char *task_name) { + printf("\"%s\"(stack_size = %lu) overflow the heap_size.\n", task_name, uxTaskGetStackHighWaterMark(task)); +} + +// .text+0x3d8 +void vApplicationIdleHook(void) { + printf("idle %lu\n", WDEV.SYS_TIME); +} + +// .text+0x404 +void vApplicationTickHook(void) { + printf("tick %lu\n", WDEV.SYS_TIME); +} + +// .Lfunc005 -- .irom0.text+0x8 +static void zero_bss(void) { + uint32_t *addr; + + for (addr = _bss_start; addr < _bss_end; addr++) { + *addr = 0; + } +} + +// .Lfunc006 -- .irom0.text+0x70 +static void init_networking(uint8_t *phy_info, uint8_t *mac_addr) { + if (sdk_register_chipv6_phy(phy_info)) { + printf("FATAL: sdk_register_chipv6_phy failed"); + halt(); + } + sdk_uart_div_modify(0, UART_DIVISOR); + sdk_uart_div_modify(1, UART_DIVISOR); + sdk_phy_disable_agc(); + sdk_ieee80211_phy_init(sdk_g_ic.s.phy_mode); + sdk_lmacInit(); + sdk_wDev_Initialize(); + sdk_pp_attach(); + sdk_ieee80211_ifattach(sdk_g_ic, mac_addr); + _xt_isr_mask(1); + DPORT.DPORT0 = SET_FIELD(DPORT.DPORT0, DPORT_DPORT0_FIELD0, 1); + sdk_pm_attach(); + sdk_phy_enable_agc(); + sdk_cnx_attach(sdk_g_ic); + sdk_wDevEnableRx(); +} + +// .Lfunc007 -- .irom0.text+0x148 +static void init_g_ic(void) { + if (sdk_g_ic.s.wifi_mode == 0xff) { + sdk_g_ic.s.wifi_mode = 2; + } + sdk_wifi_softap_set_default_ssid(); + if (sdk_g_ic.s._unknown30d < 1 || sdk_g_ic.s._unknown30d > 14) { + sdk_g_ic.s._unknown30d = 1; + } + if (sdk_g_ic.s._unknown544 < 100 || sdk_g_ic.s._unknown544 > 60000) { + sdk_g_ic.s._unknown544 = 100; + } + if (sdk_g_ic.s._unknown30e == 1 || sdk_g_ic.s._unknown30e > 4) { + sdk_g_ic.s._unknown30e = 0; + } + bzero(sdk_g_ic.s._unknown2ac, sizeof(sdk_g_ic.s._unknown2ac)); + if (sdk_g_ic.s._unknown30f > 1) { + sdk_g_ic.s._unknown30f = 0; + } + if (sdk_g_ic.s._unknown310 > 4) { + sdk_g_ic.s._unknown310 = 4; + } + if (sdk_g_ic.s._unknown1e4._unknown1e4 == 0xffffffff) { + bzero(&sdk_g_ic.s._unknown1e4, sizeof(sdk_g_ic.s._unknown1e4)); + bzero(&sdk_g_ic.s._unknown20f, sizeof(sdk_g_ic.s._unknown20f)); + } + sdk_g_ic.s.wifi_led_enable = 0; + if (sdk_g_ic.s._unknown281 > 1) { + sdk_g_ic.s._unknown281 = 0; + } + if (sdk_g_ic.s.ap_number > 5) { + sdk_g_ic.s.ap_number = 1; + } + if (sdk_g_ic.s.phy_mode < 1 || sdk_g_ic.s.phy_mode > 3) { + sdk_g_ic.s.phy_mode = PHY_MODE_11N; + } +} + +// .Lfunc008 -- .irom0.text+0x2a0 +static void dump_excinfo(void) { + uint32_t exccause, epc1, epc2, epc3, excvaddr, depc, excsave1; + uint32_t excinfo[8]; + + RSR(exccause, exccause); + printf("Fatal exception (%d): \n", (int)exccause); + RSR(epc1, epc1); + RSR(epc2, epc2); + RSR(epc3, epc3); + RSR(excvaddr, excvaddr); + RSR(depc, depc); + RSR(excsave1, excsave1); + printf("%s=0x%08lx\n", "epc1", epc1); + printf("%s=0x%08lx\n", "epc2", epc2); + printf("%s=0x%08lx\n", "epc3", epc3); + printf("%s=0x%08lx\n", "excvaddr", excvaddr); + printf("%s=0x%08lx\n", "depc", depc); + printf("%s=0x%08lx\n", "excsave1", excsave1); + sdk_system_rtc_mem_read(0, excinfo, 32); // Why? + excinfo[0] = 2; + excinfo[1] = exccause; + excinfo[2] = epc1; + excinfo[3] = epc2; + excinfo[4] = epc3; + excinfo[5] = excvaddr; + excinfo[6] = depc; + excinfo[7] = excsave1; + sdk_system_rtc_mem_write(0, excinfo, 32); +} + +// .irom0.text+0x368 +int sdk_uart_rx_one_char(char *buf) { + if (FIELD2VAL(UART_STATUS_RXFIFO_COUNT, UART(0).STATUS)) { + *buf = UART(0).FIFO; + return 0; + } + return 1; +} + +// .irom0.text+0x398 +void sdk_wdt_init(void) { + WDT.CTRL &= ~WDT_CTRL_ENABLE; + DPORT.INT_ENABLE |= DPORT_INT_ENABLE_WDT; + WDT.REG1 = 0x0000000b; + WDT.REG2 = 0x0000000c; + WDT.CTRL |= WDT_CTRL_FLAG3 | WDT_CTRL_FLAG4 | WDT_CTRL_FLAG5; + WDT.CTRL = SET_FIELD(WDT.CTRL, WDT_CTRL_FIELD0, 0); + WDT.CTRL |= WDT_CTRL_ENABLE; + sdk_pp_soft_wdt_init(); +} + +// .irom0.text+0x474 +void sdk_user_init_task(void *params) { + int phy_ver, pp_ver; + + sdk_ets_timer_init(); + printf("\nESP-Open-SDK ver: %s compiled @ %s %s\n", OS_VERSION_STR, __DATE__, __TIME__); + phy_ver = RTCMEM_BACKUP[RTCMEM_BACKUP_PHY_VER] >> 16; + printf("phy ver: %d, ", phy_ver); + pp_ver = RTCMEM_SYSTEM[RTCMEM_SYSTEM_PP_VER]; + printf("pp ver: %d.%d\n\n", (pp_ver >> 8) & 0xff, pp_ver & 0xff); + user_init(); + sdk_user_init_flag = 1; + sdk_wifi_mode_set(sdk_g_ic.s.wifi_mode); + if (sdk_g_ic.s.wifi_mode == 1) { + sdk_wifi_station_start(); + netif_set_default(sdk_g_ic.v.station_netif_info->netif); + } + if (sdk_g_ic.s.wifi_mode == 2) { + sdk_wifi_softap_start(); + netif_set_default(sdk_g_ic.v.softap_netif_info->netif); + } + if (sdk_g_ic.s.wifi_mode == 3) { + sdk_wifi_station_start(); + sdk_wifi_softap_start(); + netif_set_default(sdk_g_ic.v.softap_netif_info->netif); + } + if (sdk_wifi_station_get_auto_connect()) { + sdk_wifi_station_connect(); + } + vTaskDelete(NULL); +} + +// .Lfunc009 -- .irom0.text+0x5b4 +static void user_start_phase2(void) { + uint8_t *buf; + uint8_t *phy_info; + + sdk_system_rtc_mem_read(0, &sdk_rst_if, sizeof(sdk_rst_if)); + if (sdk_rst_if.version > 3) { + // Bad version number. Probably garbage. + bzero(&sdk_rst_if, sizeof(sdk_rst_if)); + } + buf = malloc(sizeof(sdk_rst_if)); + bzero(buf, sizeof(sdk_rst_if)); + sdk_system_rtc_mem_write(0, buf, sizeof(sdk_rst_if)); + free(buf); + sdk_sleep_reset_analog_rtcreg_8266(); + get_otp_mac_address(sdk_info.sta_mac_addr); + sdk_wifi_softap_cacl_mac(sdk_info.softap_mac_addr, sdk_info.sta_mac_addr); + sdk_info._unknown0 = 0x0104a8c0; + sdk_info._unknown1 = 0x00ffffff; + sdk_info._unknown2 = 0x0104a8c0; + init_g_ic(); + phy_info = malloc(PHY_INFO_SIZE); + sdk_spi_flash_read(sdk_flashchip.chip_size - sdk_flashchip.sector_size * 4, (uint32_t *)phy_info, PHY_INFO_SIZE); + + // Wait for UARTs to finish sending anything in their queues. + while (FIELD2VAL(UART_STATUS_TXFIFO_COUNT, UART(0).STATUS) > 0) {} + while (FIELD2VAL(UART_STATUS_TXFIFO_COUNT, UART(1).STATUS) > 0) {} + + if (phy_info[0] != 5) { + // Bad version byte. Discard what we read and use default values + // instead. + memcpy(phy_info, default_phy_info, PHY_INFO_SIZE); + } + init_networking(phy_info, sdk_info.sta_mac_addr); + free(phy_info); + tcpip_init(NULL, NULL); + sdk_wdt_init(); + xTaskCreate(sdk_user_init_task, (signed char *)"uiT", 1024, 0, 14, sdk_xUserTaskHandle); +} + +// .Lfunc010 -- .irom0.text+0x710 +static void dump_flash_data(uint32_t start_addr, uint32_t length) { + uint8_t *buf; + int bufsize, i; + + bufsize = (length + 3) & 0xfffc; + buf = malloc(bufsize); + sdk_spi_flash_read(start_addr, (uint32_t *)buf, bufsize); + for (i = 0; i < length; ) { + printf("%02x ", buf[i]); + if ((i & 0x1f) == 0) { + printf("\n"); + } + } + printf("\n"); + free(buf); +} + +// .Lfunc011 -- .irom0.text+0x790 +static void dump_flash_config_sectors(uint32_t start_addr) { + printf("system param error\n"); + // The original code used start_addr+1, start_addr+2, etc. This is + // obviously wrong as start_addr is clearly a byte address, not a sector + // address. + dump_flash_data(start_addr + sdk_flashchip.sector_size, sizeof(struct sdk_g_ic_saved_st)); + dump_flash_data(start_addr + sdk_flashchip.sector_size * 2, sizeof(struct sdk_g_ic_saved_st)); + dump_flash_data(start_addr + sdk_flashchip.sector_size * 3, BOOT_INFO_SIZE); +} + diff --git a/core/include/esp/wdev_regs.h b/core/include/esp/wdev_regs.h new file mode 100644 index 0000000..74788ca --- /dev/null +++ b/core/include/esp/wdev_regs.h @@ -0,0 +1,30 @@ +/* esp/wdev_regs.h + * + * ESP8266 register definitions for the "wdev" region (0x3FF2xxx) + * + * Not compatible with ESP SDK register access code. + */ + +#ifndef _ESP_WDEV_REGS_H +#define _ESP_WDEV_REGS_H + +#include "esp/types.h" +#include "common_macros.h" + +#define WDEV_BASE 0x3FF20000 +#define WDEV (*(struct WDEV_REGS *)(WDEV_BASE)) + +/* Note: This memory region is not currently well understood. Pretty much all + * of the definitions here are from reverse-engineering the Espressif SDK code, + * many are just educated guesses, and almost certainly some are misleading or + * wrong. If you can improve on any of this, please contribute! + */ + +struct WDEV_REGS { + uint32_t volatile _unknown[768]; // 0x0000 - 0x0bfc + uint32_t volatile SYS_TIME; // 0x0c00 +} __attribute__ (( packed )); + +_Static_assert(sizeof(struct WDEV_REGS) == 0xc04, "WDEV_REGS is the wrong size"); + +#endif /* _ESP_WDEV_REGS_H */ diff --git a/core/include/esp/wdt_regs.h b/core/include/esp/wdt_regs.h index eb51f57..66bf1d0 100644 --- a/core/include/esp/wdt_regs.h +++ b/core/include/esp/wdt_regs.h @@ -31,6 +31,17 @@ struct WDT_REGS { _Static_assert(sizeof(struct WDT_REGS) == 0x18, "WDT_REGS is the wrong size"); +/* Details for CTRL register */ + +/* Note: these are currently just guesses based on interpretation of the startup code */ + +#define WDT_CTRL_ENABLE BIT(0) +#define WDT_CTRL_FIELD0_M 0x00000003 +#define WDT_CTRL_FIELD0_S 1 +#define WDT_CTRL_FLAG3 BIT(3) +#define WDT_CTRL_FLAG4 BIT(4) +#define WDT_CTRL_FLAG5 BIT(5) + /* Writing WDT_FEED_MAGIC to WDT.FEED register "feeds the dog" and holds off * triggering for another cycle (unconfirmed) */ #define WDT_FEED_MAGIC 0x73 diff --git a/core/include/os_version.h b/core/include/os_version.h new file mode 100644 index 0000000..86b3bd8 --- /dev/null +++ b/core/include/os_version.h @@ -0,0 +1,6 @@ +#ifndef _VERSION_H +#define _VERSION_H + +#define OS_VERSION_STR "0.0.1" + +#endif /* _VERSION_H */ diff --git a/core/include/sdk_internal.h b/core/include/sdk_internal.h new file mode 100644 index 0000000..314d2ca --- /dev/null +++ b/core/include/sdk_internal.h @@ -0,0 +1,235 @@ +#ifndef _INTERNAL_SDK_STRUCTURES_H +#define _INTERNAL_SDK_STRUCTURES_H + +#include "espressif/esp_wifi.h" +#include "espressif/spi_flash.h" +#include "lwip/netif.h" + +/////////////////////////////////////////////////////////////////////////////// +// Internal structures and data objects // +/////////////////////////////////////////////////////////////////////////////// + +// 'info' is declared in app_main.o at .bss+0x4 + +struct sdk_info_st { + uint32_t _unknown0; + uint32_t _unknown1; + uint32_t _unknown2; + uint8_t _unknown3[12]; + uint8_t softap_mac_addr[6]; + uint8_t sta_mac_addr[6]; +}; + +extern struct sdk_info_st sdk_info; + +// 'rst_if' is declared in user_interface.o at .bss+0xfc + +struct sdk_rst_if_st { + uint32_t version; + uint8_t _unknown[28]; +}; + +extern struct sdk_rst_if_st sdk_rst_if; + +// 'g_ic' is declared in libnet80211/ieee80211.o at .bss+0x0 +// See also: http://esp8266-re.foogod.com/wiki/G_ic_(IoT_RTOS_SDK_0.9.9) + +struct sdk_g_ic_netif_info { + struct netif *netif; + //TODO: rest of this structure is unknown. +}; + +// This is the portion of g_ic which is not loaded/saved to the flash ROM, and +// starts out zeroed on every boot. +struct sdk_g_ic_volatile_st { + void *_unknown0; + void *_unknown4; + + uint8_t _unknown8[8]; + + struct sdk_g_ic_netif_info *station_netif_info; + struct sdk_g_ic_netif_info *softap_netif_info; + uint8_t _unknown18; + uint32_t _unknown1c; + uint32_t _unknown20; + + uint8_t _unknown24[8]; + + uint8_t _unknown2c; + + uint8_t _unknown30[76]; + + uint8_t _unknown7c; + uint8_t _unknown7d; + uint8_t _unknown7e; + uint8_t _unknown7f; + + uint8_t _unknown80[204]; + + void *_unknown14c; + + uint8_t _unknown150[20]; + + uint32_t _unknown164; + void *_unknown168; + void *_unknown16c; + void *_unknown170; + void *_unknown174; + void *_unknown178; + + uint8_t _unknown17c[4]; + + void *_unknown180; + void *_unknown184; + struct station_info *station_info_head; + struct station_info *station_info_tail; + uint32_t _unknown190; + uint32_t _unknown194; + + uint8_t _unknown198[40]; + + void *_unknown1c0; + void *_unknown1c4; + uint32_t _unknown1c8; + + uint8_t _unknown1cc[4]; + + uint16_t _unknown1d0; + + uint8_t _unknown1d2[2]; + + uint8_t _unknown1d4; + + uint8_t _unknown1d5[3]; +}; + +struct sdk_g_ic_unk0_st { + uint32_t _unknown1e4; + uint8_t _unknown1e8[32]; +}; + +// This is the portion of g_ic which is loaded/saved to the flash ROM, and thus +// is preserved across reboots. +struct sdk_g_ic_saved_st { + uint8_t _unknown1d8; + uint8_t boot_info; + uint8_t user0_addr[3]; + uint8_t user1_addr[3]; + uint8_t wifi_mode; + uint8_t wifi_led_enable; + uint8_t wifi_led_gpio; + uint8_t _unknown1e3; + + struct sdk_g_ic_unk0_st _unknown1e4; + + uint8_t _unknown208; + uint8_t _unknown209; + uint8_t _unknown20a; + uint8_t _unknown20b; + uint8_t _unknown20c; + uint8_t _unknown20d; + uint8_t _unknown20e; + uint8_t _unknown20f[64]; + uint8_t _unknown24f; + + uint8_t _unknown250[49]; + + uint8_t _unknown281; + + uint8_t _unknown282[6]; + + uint32_t _unknown288; + uint8_t _unknown28c; + + uint8_t _unknown290[28]; + + uint8_t _unknown2ac[64]; + uint8_t _unknonwn2ec; + + uint8_t _unknown2ed[32]; + + uint8_t _unknown30d; + uint8_t _unknown30e; + uint8_t _unknown30f; + uint8_t _unknown310; + + uint8_t _unknown311[3]; + + uint8_t ap_number; + uint8_t current_ap_id; + + uint8_t _unknown316[502]; + + uint32_t _unknown50c; + uint16_t _unknown510; + uint16_t _unknown512; + uint16_t _unknown514; + + uint8_t _unknown516[2]; + + uint8_t auto_connect; + + uint8_t _unknown519[3]; + + enum sdk_phy_mode phy_mode; + + uint8_t _unknown520[36]; + + uint16_t _unknown544; + + uint8_t _unknown546[2]; +}; + +struct sdk_g_ic_st { + struct sdk_g_ic_volatile_st v; // 0x0 - 0x1d8 + struct sdk_g_ic_saved_st s; // 0x1d8 - 0x548 +}; + +extern struct sdk_g_ic_st sdk_g_ic; + +/////////////////////////////////////////////////////////////////////////////// +// The above structures all refer to data regions outside our control, and a +// simple mistake/misunderstanding editing things here can completely screw up +// how we access them, so do some basic sanity checks to make sure that they +// appear to match up correctly with the actual data structures other parts of +// the SDK are expecting. +/////////////////////////////////////////////////////////////////////////////// + +_Static_assert(sizeof(struct sdk_info_st) == 0x24, "info_st is the wrong size!"); +_Static_assert(sizeof(struct sdk_rst_if_st) == 0x20, "sdk_rst_if_st is the wrong size!"); +_Static_assert(sizeof(struct sdk_g_ic_volatile_st) == 0x1d8, "sdk_g_ic_volatile_st is the wrong size!"); +_Static_assert(sizeof(struct sdk_g_ic_saved_st) == 0x370, "sdk_g_ic_saved_st is the wrong size!"); +_Static_assert(sizeof(struct sdk_g_ic_st) == 0x548, "sdk_g_ic_st is the wrong size!"); + +/////////////////////////////////////////////////////////////////////////////// +// Function Prototypes // +/////////////////////////////////////////////////////////////////////////////// + +sdk_SpiFlashOpResult sdk_SPIRead(uint32_t src_addr, uint32_t *des_addr, uint32_t size); +sdk_SpiFlashOpResult sdk_SPIWrite(uint32_t des_addr, uint32_t *src_addr, uint32_t size); +void sdk_cnx_attach(struct sdk_g_ic_st); +void sdk_ets_timer_init(void); +void sdk_ieee80211_ifattach(struct sdk_g_ic_st, uint8_t *); +void sdk_ieee80211_phy_init(enum sdk_phy_mode); +void sdk_lmacInit(void); +void sdk_os_install_putc1( void (*func)(uint8_t) ); +void sdk_phy_disable_agc(void); +void sdk_phy_enable_agc(void); +void sdk_pm_attach(void); +void sdk_pp_attach(void); +void sdk_pp_soft_wdt_init(void); +int sdk_register_chipv6_phy(uint8_t *); +void sdk_sleep_reset_analog_rtcreg_8266(void); +uint32_t sdk_system_get_checksum(uint8_t *, uint32_t); +void sdk_system_restart_in_nmi(void); +void sdk_wDevEnableRx(void); +void sdk_wDev_Initialize(void); +void sdk_wifi_mode_set(uint8_t); +void sdk_wifi_softap_cacl_mac(uint8_t *, uint8_t *); +void sdk_wifi_softap_set_default_ssid(void); +void sdk_wifi_softap_start(void); +void sdk_wifi_station_connect(void); +bool sdk_wifi_station_get_auto_connect(void); +void sdk_wifi_station_start(void); + +#endif /* _INTERNAL_SDK_STRUCTURES_H */ diff --git a/core/include/xtensa_ops.h b/core/include/xtensa_ops.h new file mode 100644 index 0000000..49d1fbe --- /dev/null +++ b/core/include/xtensa_ops.h @@ -0,0 +1,21 @@ +/** xtensa_ops.h + * + * Special macros/etc which deal with Xtensa-specific architecture/CPU + * considerations. + * + * Part of esp-open-rtos + * Copyright (C) 2015 Superhouse Automation Pty Ltd + * BSD Licensed as described in the file LICENSE + */ + +#ifndef _XTENSA_OPS_H +#define _XTENSA_OPS_H + +// GCC macros for reading, writing, and exchanging Xtensa processor special +// registers: + +#define RSR(var, reg) asm volatile ("rsr %0, " #reg : "=r" (var)); +#define WSR(var, reg) asm volatile ("wsr %0, " #reg : : "r" (var)); +#define XSR(var, reg) asm volatile ("xsr %0, " #reg : "+r" (var)); + +#endif /* _XTENSA_OPS_H */ diff --git a/lib/libmain.remove b/lib/libmain.remove index ae569f8..35145b3 100644 --- a/lib/libmain.remove +++ b/lib/libmain.remove @@ -2,3 +2,4 @@ printf-stdarg.o libc.o xtensa_vectors.o +app_main.o From 06e455a59bc751a0fece4e7fac3a5dec4eedb011 Mon Sep 17 00:00:00 2001 From: Alex Stewart Date: Tue, 25 Aug 2015 09:41:49 -0700 Subject: [PATCH 03/11] Don't rename FreeRTOS hook symbols --- FreeRTOS/Source/portable/esp8266/portmacro.h | 3 --- lib/allsymbols.rename | 4 ---- 2 files changed, 7 deletions(-) diff --git a/FreeRTOS/Source/portable/esp8266/portmacro.h b/FreeRTOS/Source/portable/esp8266/portmacro.h index c7f0501..da68720 100644 --- a/FreeRTOS/Source/portable/esp8266/portmacro.h +++ b/FreeRTOS/Source/portable/esp8266/portmacro.h @@ -182,9 +182,6 @@ 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 - #ifdef __cplusplus } #endif diff --git a/lib/allsymbols.rename b/lib/allsymbols.rename index 2f455f0..7f56f1f 100644 --- a/lib/allsymbols.rename +++ b/lib/allsymbols.rename @@ -669,10 +669,6 @@ user_fatal_exception_handler sdk_user_fatal_exception_handler user_init_flag sdk_user_init_flag user_init_task sdk_user_init_task user_start sdk_user_start -vApplicationIdleHook sdk_vApplicationIdleHook -vApplicationStackOverflowHook sdk_vApplicationStackOverflowHook -vApplicationTickHook sdk_vApplicationTickHook -vPortYield sdk_vPortYield wait_rfpll_cal_end sdk_wait_rfpll_cal_end wDev_AppendRxAmpduLensBlocks sdk_wDev_AppendRxAmpduLensBlocks wDev_AppendRxBlocks sdk_wDev_AppendRxBlocks From beecdc844a48060fbebea1dcf9a496533306a07d Mon Sep 17 00:00:00 2001 From: Alex Stewart Date: Tue, 25 Aug 2015 17:21:51 -0700 Subject: [PATCH 04/11] Add 'sdklike' FLAVOR to makefile --- common.mk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common.mk b/common.mk index e05e78e..245e277 100644 --- a/common.mk +++ b/common.mk @@ -100,6 +100,13 @@ LDFLAGS = -nostdlib -Wl,--no-check-sections -Wl,-L$(BUILD_DIR)sdklib -Wl,-L$(RO ifeq ($(FLAVOR),debug) CFLAGS += -g -O0 LDFLAGS += -g -O0 +else ifeq ($(FLAVOR),sdklike) + # These are flags intended to produce object code as similar as possible to + # the output of the compiler used to build the SDK libs (for comparison of + # disassemblies when coding replacement routines). It is not normally + # intended to be used otherwise. + CFLAGS += -O2 -Os -fno-inline -fno-ipa-cp -fno-toplevel-reorder + LDFLAGS += -O2 else CFLAGS += -g -O2 LDFLAGS += -g -O2 From d55da0f09a9ee96366b453e2fa3b119abf8e8b68 Mon Sep 17 00:00:00 2001 From: Alex Stewart Date: Tue, 25 Aug 2015 17:22:38 -0700 Subject: [PATCH 05/11] Various app_main.c bug fixes --- core/app_main.c | 18 +++++++++--------- core/include/esp/dport_regs.h | 2 +- core/include/sdk_internal.h | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/app_main.c b/core/app_main.c index 86d1cb3..ae8fa07 100644 --- a/core/app_main.c +++ b/core/app_main.c @@ -43,8 +43,8 @@ void user_init(void); #define halt() while (1) {} -extern uint32_t *_bss_start; -extern uint32_t *_bss_end; +extern uint32_t _bss_start; +extern uint32_t _bss_end; // .Ldata003 -- .irom.text+0x0 static const uint8_t IROM default_phy_info[PHY_INFO_SIZE] = { @@ -150,7 +150,7 @@ static void IRAM set_spi0_divisor(uint32_t divisor) { } // .text+0x148 -void sdk_user_fatal_exception_handler(void) { +void IRAM sdk_user_fatal_exception_handler(void) { if (!sdk_NMIIrqIsOn) { vPortEnterCritical(); do { @@ -263,17 +263,17 @@ void IRAM sdk_user_start(void) { } // .text+0x3a8 -void vApplicationStackOverflowHook(xTaskHandle task, char *task_name) { +void IRAM vApplicationStackOverflowHook(xTaskHandle task, char *task_name) { printf("\"%s\"(stack_size = %lu) overflow the heap_size.\n", task_name, uxTaskGetStackHighWaterMark(task)); } // .text+0x3d8 -void vApplicationIdleHook(void) { +void IRAM vApplicationIdleHook(void) { printf("idle %lu\n", WDEV.SYS_TIME); } // .text+0x404 -void vApplicationTickHook(void) { +void IRAM vApplicationTickHook(void) { printf("tick %lu\n", WDEV.SYS_TIME); } @@ -281,7 +281,7 @@ void vApplicationTickHook(void) { static void zero_bss(void) { uint32_t *addr; - for (addr = _bss_start; addr < _bss_end; addr++) { + for (addr = &_bss_start; addr < &_bss_end; addr++) { *addr = 0; } } @@ -299,12 +299,12 @@ static void init_networking(uint8_t *phy_info, uint8_t *mac_addr) { sdk_lmacInit(); sdk_wDev_Initialize(); sdk_pp_attach(); - sdk_ieee80211_ifattach(sdk_g_ic, mac_addr); + sdk_ieee80211_ifattach(&sdk_g_ic, mac_addr); _xt_isr_mask(1); DPORT.DPORT0 = SET_FIELD(DPORT.DPORT0, DPORT_DPORT0_FIELD0, 1); sdk_pm_attach(); sdk_phy_enable_agc(); - sdk_cnx_attach(sdk_g_ic); + sdk_cnx_attach(&sdk_g_ic); sdk_wDevEnableRx(); } diff --git a/core/include/esp/dport_regs.h b/core/include/esp/dport_regs.h index df17103..87efca1 100644 --- a/core/include/esp/dport_regs.h +++ b/core/include/esp/dport_regs.h @@ -53,7 +53,7 @@ _Static_assert(sizeof(struct DPORT_REGS) == 0x60, "DPORT_REGS is the wrong size" /* Currently very little known about this register. The following is based on analysis of the startup code in the Espressif SDK: */ -#define DPORT_DPORT0_FIELD0_M 0x0000007f +#define DPORT_DPORT0_FIELD0_M 0x0000001f #define DPORT_DPORT0_FIELD0_S 0 /* Details for INT_ENABLE register */ diff --git a/core/include/sdk_internal.h b/core/include/sdk_internal.h index 314d2ca..6764094 100644 --- a/core/include/sdk_internal.h +++ b/core/include/sdk_internal.h @@ -207,9 +207,9 @@ _Static_assert(sizeof(struct sdk_g_ic_st) == 0x548, "sdk_g_ic_st is the wrong si sdk_SpiFlashOpResult sdk_SPIRead(uint32_t src_addr, uint32_t *des_addr, uint32_t size); sdk_SpiFlashOpResult sdk_SPIWrite(uint32_t des_addr, uint32_t *src_addr, uint32_t size); -void sdk_cnx_attach(struct sdk_g_ic_st); +void sdk_cnx_attach(struct sdk_g_ic_st *); void sdk_ets_timer_init(void); -void sdk_ieee80211_ifattach(struct sdk_g_ic_st, uint8_t *); +void sdk_ieee80211_ifattach(struct sdk_g_ic_st *, uint8_t *); void sdk_ieee80211_phy_init(enum sdk_phy_mode); void sdk_lmacInit(void); void sdk_os_install_putc1( void (*func)(uint8_t) ); From f6f57aa81c7c90f974521fbc5a63d39ed385d43e Mon Sep 17 00:00:00 2001 From: Alex Stewart Date: Wed, 26 Aug 2015 13:19:53 -0700 Subject: [PATCH 06/11] More app_main fixups from object code comparisons --- core/app_main.c | 7 ++++--- core/include/sdk_internal.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/app_main.c b/core/app_main.c index ae8fa07..8d5a2b9 100644 --- a/core/app_main.c +++ b/core/app_main.c @@ -82,7 +82,7 @@ xTaskHandle sdk_xWatchDogTaskHandle; static void IRAM get_otp_mac_address(uint8_t *buf); static void IRAM set_spi0_divisor(uint32_t divisor); -static void IRAM default_putc(uint8_t c); +static int IRAM default_putc(uint8_t c); static void IRAM default_putc1(uint8_t c); static void zero_bss(void); static void init_networking(uint8_t *phy_info, uint8_t *mac_addr); @@ -167,9 +167,10 @@ void IRAM sdk_user_fatal_exception_handler(void) { } // .Lfunc003 -- .text+0x1d0 -static void IRAM default_putc(uint8_t c) { +static int IRAM default_putc(uint8_t c) { while (FIELD2VAL(UART_STATUS_TXFIFO_COUNT, UART(0).STATUS) > 125) {} UART(0).FIFO = c; + return 0; } // .Lfunc004 -- .text+0x1f4 @@ -467,7 +468,7 @@ static void user_start_phase2(void) { free(phy_info); tcpip_init(NULL, NULL); sdk_wdt_init(); - xTaskCreate(sdk_user_init_task, (signed char *)"uiT", 1024, 0, 14, sdk_xUserTaskHandle); + xTaskCreate(sdk_user_init_task, (signed char *)"uiT", 1024, 0, 14, &sdk_xUserTaskHandle); } // .Lfunc010 -- .irom0.text+0x710 diff --git a/core/include/sdk_internal.h b/core/include/sdk_internal.h index 6764094..9c4da3e 100644 --- a/core/include/sdk_internal.h +++ b/core/include/sdk_internal.h @@ -141,7 +141,7 @@ struct sdk_g_ic_saved_st { uint32_t _unknown288; uint8_t _unknown28c; - uint8_t _unknown290[28]; + uint8_t _unknown28d[31]; uint8_t _unknown2ac[64]; uint8_t _unknonwn2ec; From 3e138c800fc7830acc3588d7c47f7a50c4d66443 Mon Sep 17 00:00:00 2001 From: Alex Stewart Date: Fri, 28 Aug 2015 17:45:38 -0700 Subject: [PATCH 07/11] More app_main.c fixups It's alive! IT'S ALIVE!! --- core/app_main.c | 15 ++++++++------- core/include/sdk_internal.h | 3 --- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/core/app_main.c b/core/app_main.c index 8d5a2b9..025ca9f 100644 --- a/core/app_main.c +++ b/core/app_main.c @@ -23,7 +23,7 @@ #include "esp/wdev_regs.h" #include "os_version.h" -#include "espressif/esp_system.h" +#include "espressif/esp_common.h" #include "sdk_internal.h" /* This is not declared in any header file (but arguably should be) */ @@ -82,8 +82,8 @@ xTaskHandle sdk_xWatchDogTaskHandle; static void IRAM get_otp_mac_address(uint8_t *buf); static void IRAM set_spi0_divisor(uint32_t divisor); -static int IRAM default_putc(uint8_t c); -static void IRAM default_putc1(uint8_t c); +static int IRAM default_putc(char c); +static void IRAM default_putc1(char c); static void zero_bss(void); static void init_networking(uint8_t *phy_info, uint8_t *mac_addr); static void init_g_ic(void); @@ -167,14 +167,14 @@ void IRAM sdk_user_fatal_exception_handler(void) { } // .Lfunc003 -- .text+0x1d0 -static int IRAM default_putc(uint8_t c) { +static int IRAM default_putc(char c) { while (FIELD2VAL(UART_STATUS_TXFIFO_COUNT, UART(0).STATUS) > 125) {} UART(0).FIFO = c; return 0; } // .Lfunc004 -- .text+0x1f4 -static void IRAM default_putc1(uint8_t c) { +static void IRAM default_putc1(char c) { if (c == '\n') { default_putc('\r'); } else if (c == '\r') { @@ -238,8 +238,8 @@ void IRAM sdk_user_start(void) { flash_size = flash_sectors * 4096; sdk_flashchip.chip_size = flash_size; set_spi0_divisor(flash_speed_divisor); - sdk_SPIRead(flash_size - 256, buf32, BOOT_INFO_SIZE); - boot_slot = buf8[0]; + sdk_SPIRead(flash_size - 4096, buf32, BOOT_INFO_SIZE); + boot_slot = buf8[0] & 1; cksum_magic = buf32[1]; cksum_len = buf32[3 + boot_slot]; cksum_value = buf32[5 + boot_slot]; @@ -469,6 +469,7 @@ static void user_start_phase2(void) { tcpip_init(NULL, NULL); sdk_wdt_init(); xTaskCreate(sdk_user_init_task, (signed char *)"uiT", 1024, 0, 14, &sdk_xUserTaskHandle); + vTaskStartScheduler(); } // .Lfunc010 -- .irom0.text+0x710 diff --git a/core/include/sdk_internal.h b/core/include/sdk_internal.h index 9c4da3e..5a5aee5 100644 --- a/core/include/sdk_internal.h +++ b/core/include/sdk_internal.h @@ -212,7 +212,6 @@ void sdk_ets_timer_init(void); void sdk_ieee80211_ifattach(struct sdk_g_ic_st *, uint8_t *); void sdk_ieee80211_phy_init(enum sdk_phy_mode); void sdk_lmacInit(void); -void sdk_os_install_putc1( void (*func)(uint8_t) ); void sdk_phy_disable_agc(void); void sdk_phy_enable_agc(void); void sdk_pm_attach(void); @@ -228,8 +227,6 @@ void sdk_wifi_mode_set(uint8_t); void sdk_wifi_softap_cacl_mac(uint8_t *, uint8_t *); void sdk_wifi_softap_set_default_ssid(void); void sdk_wifi_softap_start(void); -void sdk_wifi_station_connect(void); -bool sdk_wifi_station_get_auto_connect(void); void sdk_wifi_station_start(void); #endif /* _INTERNAL_SDK_STRUCTURES_H */ From 1454e34496495ee1372a620d5ed743339025f671 Mon Sep 17 00:00:00 2001 From: Alex Stewart Date: Sun, 30 Aug 2015 12:11:08 -0700 Subject: [PATCH 08/11] Bug fix for dump_flash_config_sectors --- core/app_main.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/core/app_main.c b/core/app_main.c index 025ca9f..3136b2a 100644 --- a/core/app_main.c +++ b/core/app_main.c @@ -89,8 +89,8 @@ static void init_networking(uint8_t *phy_info, uint8_t *mac_addr); static void init_g_ic(void); static void dump_excinfo(void); static void user_start_phase2(void); -static void dump_flash_data(uint32_t start_addr, uint32_t length); -static void dump_flash_config_sectors(uint32_t start_addr); +static void dump_flash_sector(uint32_t start_sector, uint32_t length); +static void dump_flash_config_sectors(uint32_t start_sector); // .Lfunc001 -- .text+0x14 static void IRAM get_otp_mac_address(uint8_t *buf) { @@ -473,31 +473,38 @@ static void user_start_phase2(void) { } // .Lfunc010 -- .irom0.text+0x710 -static void dump_flash_data(uint32_t start_addr, uint32_t length) { +static void dump_flash_sector(uint32_t start_sector, uint32_t length) { uint8_t *buf; int bufsize, i; bufsize = (length + 3) & 0xfffc; buf = malloc(bufsize); - sdk_spi_flash_read(start_addr, (uint32_t *)buf, bufsize); - for (i = 0; i < length; ) { - printf("%02x ", buf[i]); - if ((i & 0x1f) == 0) { - printf("\n"); + sdk_spi_flash_read(start_sector * sdk_flashchip.sector_size, (uint32_t *)buf +, bufsize); + for (i = 0; i < length; i++) { + if ((i & 0xf) == 0) { + if (i) { + printf("\n"); + } + printf("%04x:", i); } + printf(" %02x", buf[i]); } printf("\n"); free(buf); } // .Lfunc011 -- .irom0.text+0x790 -static void dump_flash_config_sectors(uint32_t start_addr) { +static void dump_flash_config_sectors(uint32_t start_sector) { printf("system param error\n"); - // The original code used start_addr+1, start_addr+2, etc. This is - // obviously wrong as start_addr is clearly a byte address, not a sector - // address. - dump_flash_data(start_addr + sdk_flashchip.sector_size, sizeof(struct sdk_g_ic_saved_st)); - dump_flash_data(start_addr + sdk_flashchip.sector_size * 2, sizeof(struct sdk_g_ic_saved_st)); - dump_flash_data(start_addr + sdk_flashchip.sector_size * 3, BOOT_INFO_SIZE); + // Note: original SDK code didn't dump PHY info + printf("phy_info:\n"); + dump_flash_sector(start_sector, PHY_INFO_SIZE); + printf("\ng_ic saved 0:\n"); + dump_flash_sector(start_sector + 1, sizeof(struct sdk_g_ic_saved_st)); + printf("\ng_ic saved 1:\n"); + dump_flash_sector(start_sector + 2, sizeof(struct sdk_g_ic_saved_st)); + printf("\nboot info:\n"); + dump_flash_sector(start_sector + 3, BOOT_INFO_SIZE); } From 5baa048cbb26069c11dccdb731565ca9981c8cc5 Mon Sep 17 00:00:00 2001 From: Alex Stewart Date: Sun, 30 Aug 2015 13:37:40 -0700 Subject: [PATCH 09/11] app_main.c: load correct g_ic sector from flash --- core/app_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/app_main.c b/core/app_main.c index 3136b2a..1989234 100644 --- a/core/app_main.c +++ b/core/app_main.c @@ -239,11 +239,11 @@ void IRAM sdk_user_start(void) { sdk_flashchip.chip_size = flash_size; set_spi0_divisor(flash_speed_divisor); sdk_SPIRead(flash_size - 4096, buf32, BOOT_INFO_SIZE); - boot_slot = buf8[0] & 1; + boot_slot = buf8[0] ? 1 : 0; cksum_magic = buf32[1]; cksum_len = buf32[3 + boot_slot]; cksum_value = buf32[5 + boot_slot]; - ic_flash_addr = (flash_sectors - 2 + boot_slot) * sdk_flashchip.sector_size; + ic_flash_addr = (flash_sectors - 3 + boot_slot) * sdk_flashchip.sector_size; sdk_SPIRead(ic_flash_addr, buf32, sizeof(struct sdk_g_ic_saved_st)); Cache_Read_Enable(0, 0, 1); zero_bss(); From 0d0d9277dbac6ad7a18b299dfe9af4f4dfbc301d Mon Sep 17 00:00:00 2001 From: Alex Stewart Date: Sun, 20 Sep 2015 14:09:30 -0700 Subject: [PATCH 10/11] Fix format strings in app_main.c --- core/app_main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/app_main.c b/core/app_main.c index 1989234..88ac743 100644 --- a/core/app_main.c +++ b/core/app_main.c @@ -270,12 +270,12 @@ void IRAM vApplicationStackOverflowHook(xTaskHandle task, char *task_name) { // .text+0x3d8 void IRAM vApplicationIdleHook(void) { - printf("idle %lu\n", WDEV.SYS_TIME); + printf("idle %u\n", WDEV.SYS_TIME); } // .text+0x404 void IRAM vApplicationTickHook(void) { - printf("tick %lu\n", WDEV.SYS_TIME); + printf("tick %u\n", WDEV.SYS_TIME); } // .Lfunc005 -- .irom0.text+0x8 @@ -360,12 +360,12 @@ static void dump_excinfo(void) { RSR(excvaddr, excvaddr); RSR(depc, depc); RSR(excsave1, excsave1); - printf("%s=0x%08lx\n", "epc1", epc1); - printf("%s=0x%08lx\n", "epc2", epc2); - printf("%s=0x%08lx\n", "epc3", epc3); - printf("%s=0x%08lx\n", "excvaddr", excvaddr); - printf("%s=0x%08lx\n", "depc", depc); - printf("%s=0x%08lx\n", "excsave1", excsave1); + printf("%s=0x%08x\n", "epc1", epc1); + printf("%s=0x%08x\n", "epc2", epc2); + printf("%s=0x%08x\n", "epc3", epc3); + printf("%s=0x%08x\n", "excvaddr", excvaddr); + printf("%s=0x%08x\n", "depc", depc); + printf("%s=0x%08x\n", "excsave1", excsave1); sdk_system_rtc_mem_read(0, excinfo, 32); // Why? excinfo[0] = 2; excinfo[1] = exccause; From 0f3b4d831c654d6fd2093b3d81eaff8fd825c009 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 21 Sep 2015 08:46:45 +1000 Subject: [PATCH 11/11] bmp180: Fix more 'temperatue' typos (thanks @atomman) --- extras/bmp180/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/bmp180/README.md b/extras/bmp180/README.md index d6073c6..a8c41f5 100644 --- a/extras/bmp180/README.md +++ b/extras/bmp180/README.md @@ -34,12 +34,12 @@ As all data aqquired from the BMP180/BMP085 is provided to the `bmp180_informUse ``` // Own BMP180 User Inform Implementation -bool my_informUser(const xQueueHandle* resultQueue, uint8_t cmd, bmp180_temp_t temperatue, bmp180_press_t pressure) { +bool my_informUser(const xQueueHandle* resultQueue, uint8_t cmd, bmp180_temp_t temperature, bmp180_press_t pressure) { my_event_t ev; ev.event_type = MY_EVT_BMP180; ev.bmp180_data.cmd = cmd; - ev.bmp180_data.temperatue = temperatue; + ev.bmp180_data.temperature = temperature; ev.bmp180_data.pressure = pressure; return (xQueueSend(*resultQueue, &ev, 0) == pdTRUE);