Commit Graph

874 Commits

Author SHA1 Message Date
Kedar Sovani
a41b1a9d1f esp32: Register event handlers on the esp_wifi_init() call 2017-08-16 15:54:28 +05:30
Kedar Sovani
55a6aca355 wifi: Map esp_wifi_init() to esp_wifi_init_internal()
Follow-on patches will include additional functionality in
esp_wifi_init()
2017-08-16 15:54:28 +05:30
Kedar Sovani
8063b93497 wifi_lib: Update to the change in the wifi_lib repository 2017-08-16 15:54:13 +05:30
Deng Xin
57bc38d867 Add the fast crypto function in supplicant
optimize the speed when do wifi connect
2017-08-09 21:36:13 +08:00
XiaXiaotian
1c4f7f2081 add get and set wifi maximum transmit power API 2017-07-28 15:06:52 +08:00
Liu Zhi Fu
c99c5d13e6 esp32: add menuconfig options to configure BA window
Make AMPDU Block Ack Window configurable in menuconfig because we need to configure it
in some special cases, such as iperf test etc
2017-07-25 13:11:38 +08:00
Ivan Grokhotkov
292c2abd3b Merge branch 'bugfix/init_nvs_in_bluetooth' into 'master'
bt: call nvs_flash_init in examples, show error if NVS is not initialized

See merge request !1003
2017-07-20 14:25:49 +08:00
Angus Gratton
105c4b7386 Merge branch 'feature/esptool_image_padding' into 'master'
esptool: Optimise app image size by using RAM-loaded data for padding

See merge request !1017
2017-07-19 15:52:22 +08:00
Angus Gratton
2d9770fd00 linker script: Add some comments about significance of 0x18 byte offset 2017-07-19 17:38:05 +10:00
Angus Gratton
c230e4280c linker scripts: Limit DROM/IROM section lengths correctly 2017-07-19 16:33:48 +10:00
Angus Gratton
d92c541b1a esptool: Optimise generated image size by using RAM-loaded data for padding
Can save almost 128KB from some images.
2017-07-19 16:24:17 +10:00
Angus Gratton
d664e32394 build system: Use component.mk for all components, refactor bootloader build
For config-only components, component.mk should now contain "COMPONENT_CONFIG_ONLY := 1"

Also refactored some of the generation of linker paths, library list. This required cleaning up the way the bootloader
project works, it's now mostly independent from the parent.
2017-07-19 09:10:48 +10:00
Ivan Grokhotkov
0ae916d555 Merge branch 'feature/high_level_interrupts' into 'master'
Break out high-level interrupts so a component can override them

See merge request !675
2017-07-18 10:42:31 +08:00
Angus Gratton
4029ed1df4 Merge branch 'bugfix/rom_gpio_typo' into 'master'
bugfix(typo): fix typo in rom/gpio.h

See merge request !1009
2017-07-18 06:53:30 +08:00
Ivan Grokhotkov
979fce0df5 bt: call nvs_flash_init in examples, show error if NVS is not initialized
NVS is used to store PHY calibration data, WiFi configuration, and BT
configuration. Previously BT examples did not call nvs_flash_init,
relying on the fact that it is called during PHY init. However PHY init
did not handle possible NVS initialization errors.

This change moves PHY init procedure into the application, and adds
diagnostic messages to BT config management routines if NVS is not
initialized.
2017-07-17 21:29:50 +08:00
Wangjialin
10340d718f bugfix(typo): fix typo in rom/gpio.h 2017-07-17 15:41:02 +08:00
Angus Gratton
e50870c2dc Merge branch 'bugfix/bootloader_stack_smash' into 'master'
Fix crashes when >approx 185KB of DRAM is statically allocated

See merge request !983
2017-07-17 14:11:35 +08:00
Angus Gratton
f824829a13 Merge branch 'bugfix/dont_link_unused_data_sections' into 'master'
ld: Save RAM by removing unused .data sections at link time

See merge request !985
2017-07-17 14:10:12 +08:00
Jiang Jiang Jian
fc4d3df890 Merge branch 'bugfix/tw13744_make_low_rate_work' into 'master'
esp32: update wifi lib to make low rate work

See merge request !965
2017-07-13 14:26:02 +08:00
Ivan Grokhotkov
7fc25f18d2 Merge branch 'feature/enable_brownout_detector' into 'master'
Enable brownout detector

See merge request !811
2017-07-13 11:40:37 +08:00
Angus Gratton
d8d2933bde Merge branch 'bugfix/gdbstub_handler_noreturn' into 'master'
gdbstub: Mark the panic handler entry as noreturn

See merge request !975
2017-07-12 17:23:59 +08:00
Angus Gratton
cfbb1a652b Merge branch 'doc/esp_random' into 'master'
esp_random: Add some documentation about using before RF subsystem is on

See merge request !976
2017-07-12 16:18:43 +08:00
Angus Gratton
99fe61716c startup: Add assertion checks around various initialisation sequences
These may fail if close to 192KB of static RAM is allocated (remaining early heap RAM is too small.)
2017-07-12 13:06:56 +08:00
Angus Gratton
2b0f623259 bootloader/early boot: Error out if >192KB of static DRAM is allocated (temporary fix)
Currently the last 128KB of DRAM is reserved for the bootloader & early boot stacks. This means if >192KB of static DRAM
is allocated, the only available heap is this region - which is disabled until the scheduler starts. As a result, you
get either heap corruption on early boot if the static data overlaps startup heap (leading to very weird errors), or
FreeRTOS will fail to start when it can't malloc() anything.

Long term fix is to move the stacks & bootloader data to the very end of RAM, and only reserve that part for early
boot. This is a little fiddly because of also wanting to make sure this memory is not preemptively fragmented when it
gets reintroduced to the heap. This will become more important if/when we have more static allocation options in the
future.

For now, these errors make it clear why the boot has failed.

Ref TW13909
2017-07-12 13:06:56 +08:00
Angus Gratton
187b5fb888 ld: Remove unused .data sections at link time
Reduces static RAM, code size.
2017-07-12 13:05:54 +08:00
Angus Gratton
3bb90bab97 esp_random: Add some documentation about using before RF subsystem is on 2017-07-11 14:27:20 +08:00
Angus Gratton
c049cd55a6 gdbstub: Mark the panic handler entry as noreturn
Fixes a warning in panic.c when this panic mode is enabled.
2017-07-11 10:18:08 +08:00
Angus Gratton
71c70cb15c heap: Refactor heap regions/capabilities out of FreeRTOS
Remove tagged heap API, rename caps_xxx to heap_caps_xxx

Also includes additional heap_caps_xxx inspection functions.
2017-07-10 17:46:03 +08:00
Angus Gratton
5ee49fd311 heap: Add new multi_heap heap implementation to replace FreeRTOS-based tagged heaps 2017-07-10 17:46:03 +08:00
Ivan Grokhotkov
01b185977c brownout detector: enable by default
Because of errata related to BOD reset function, brownout is handled as follows:

- attach an ISR to brownout interrupt
- when ISR happens, print a message and do a software restart
- esp_restart_nonos enables RTC watchdog, so if restart fails,
  there will be  one more attempt to restart (using the RTC
  watchdog)
2017-07-10 17:25:55 +08:00
Ivan Grokhotkov
780569c04a esp32: fix RTC watchdog configuration in esp_restart
RTC watchdog didn’t have any actions configured for any of the stages.
This change configures it to use SW_SYSTEM_RESET at stage 0 and a
full reset at stage 1. The timeout is now calculated based on
RTC_SLOW_CLK frequency.
2017-07-10 17:21:49 +08:00
Liu Zhi Fu
e1f13eda49 esp32: update wifi lib to make low rate work
Make low rate work
2017-07-07 22:05:54 +08:00
Jeroen Domburg
d3290479b2 Merge panic and dport high level interrupt code to both use int level 4 2017-07-07 12:51:33 +08:00
Jeroen Domburg
1d748db209 Break out high-level interrupts so a component can override them 2017-07-07 12:51:33 +08:00
Ivan Grokhotkov
a054ced740 esp_chip_info: populate ‘model’ field 2017-07-06 11:01:40 +08:00
Ivan Grokhotkov
ef63811e6d phy_init: fix log level for "PHY data partition validated" message 2017-07-05 11:29:53 +08:00
Ivan Grokhotkov
0837b3b743 Merge branch 'doc/wifi_set_vendor_ie' into 'master'
Document the WiFi Vendor-Specific Information Element API

See merge request !933
2017-06-30 16:37:18 +08:00
Angus Gratton
9297edaf60 ipc task: Allow configuration of IPC task stack size
Fixes regression in 3fe0022ef
2017-06-30 15:04:19 +10:00
Angus Gratton
5c925bf96e esp_wifi.h: Document the Vendor-Specific Information Element functions 2017-06-29 17:29:23 +10:00
Angus Gratton
b3603ccf58 esp_wifi header: Fix typo 2017-06-29 17:19:17 +10:00
Angus Gratton
3fe0022efa stack sizes: Revert stack size increases added in 8d43859
Set min stack size to 2048 if AppTrace support is enabled, 512 bytes otherwise.
2017-06-29 14:57:13 +10:00
Angus Gratton
415a7d742a dport_access: Fix spurious warning in unicore mode, refactor 2017-06-29 13:57:13 +10:00
Ivan Grokhotkov
9b955f4c9f Merge branch 'feature/sysview_via_apptrace' into 'master'
sysview via apptrace

See merge request !708
2017-06-29 08:40:13 +08:00
Jan Mrázek
f698a1b2d3 Add missing support for C++ exceptions
Specifying -fexceptions for the compiler is not enough.

- add necessary zero padding after .eh_frame section
- link .gcc_except_table_table in a way flash script does not complain
- call __registrer_frame_info before global constructors

Kudos jcmvbkbc for the necessary help.
2017-06-28 13:53:42 +08:00
Alexey Gerenkov
8d43859b6a esp32: SEGGER SystemView Tracing Support
Implements support for system level traces compatible with SEGGER
SystemView tool on top of ESP32 application tracing module.
That kind of traces can help to analyse program's behaviour.
SystemView can show timeline of tasks/ISRs execution, context switches,
statistics related to the CPUs' load distribution etc.

Also this commit adds useful feature to ESP32 application tracing module:
 - Trace data buffering is implemented to handle temporary peaks of events load
2017-06-27 20:52:43 +03:00
Ivan Grokhotkov
3f8f618df5 Merge branch 'feature/lwip_expose_more_config' into 'master'
lwip: Expose more config in IDF menuconfig

See merge request !909
2017-06-27 12:53:42 +08:00
Ivan Grokhotkov
aeeb6cff17 Merge branch 'test/add_dual_core_dport_access_unit_test_case' into 'master'
test: add UT case for accessing dport and apb at the same time

See merge request !910
2017-06-27 12:47:37 +08:00
Liu Zhi Fu
a7ef510551 esp32: update wifi lib to fix a sniffer issue
Fix sniffer only receives the first MDPU in AMPDU when the AMPDU is not for our station/soft-AP
2017-06-24 10:45:20 +08:00
He Yin Ling
7c6208c9e0 test: add UT case for dual dport and apb access 2017-06-23 16:15:57 +08:00
Jiang Jiang Jian
1480251aa7 Merge branch 'bugfix/spiflash_rom_symbols' into 'master'
spiflash rom: Add symbols accidentally removed in refactor

See merge request !804
2017-06-23 15:24:04 +08:00
Angus Gratton
8aa09aea10 event handler: Add debug event handler for confirmed IPv6 LL address 2017-06-23 16:15:16 +10:00
Ivan Grokhotkov
85baf0afaa Merge branch 'buxfix/panic_handler_not_halting_cpu' into 'master'
Panic Handler not halting when running on both cores

See merge request !903
2017-06-23 11:34:03 +08:00
XiaXiaotian
8411aa7362 Fix the bug that lora vendor size was not added to probe response.
Restore priority of tasks in wifi lib.
2017-06-22 15:06:58 +08:00
Darian Leung
21f02a6955 Bugfix - Panic Handler not halting when running on both cores
Bug occurs when core dump destination in menuconfig is set to flash. When
programme crashes, xt_unhandled_exception or panicHandler will both trigger
commonErrorHandler. commonErrorHandler calls esp_core_dump_to_flash which
will attempt to use DPORT functions and hang due to trying to a stall and already
stalled processor (already stalled in xt_unhandled_exception and panicHandler).
Program will eventually be rebooted when wdt expires.

Added esp_dport_access_int_deinit after calls to haltOtherCore() so that DPORT
functions don't try to halt and already halted cpu hence preventing hang.

Fixes TW#12944 https://github.com/espressif/esp-idf/issues/646
2017-06-21 16:58:48 +08:00
Liu Zhi Fu
59479eb7dd esp32: update wifi lib to fix a wifi connect issue
Fix WiFi fails to connect TP842N bug
2017-06-19 21:23:24 +08:00
Jiang Jiang Jian
07ccbb8dbc Merge branch 'bugfix/rtc_time_issues' into 'master'
Fixes for RTC time issues

See merge request !849
2017-06-16 15:29:56 +08:00
Jiang Jiang Jian
7c50916c53 Merge branch 'bugfix/phy_init_procedure' into 'master'
component/esp32 : fix phy init with NULL init_data

See merge request !879
2017-06-16 15:03:03 +08:00
Tian Hao
bb4a87dbfe component/esp32 : fix phy init with NULL init_data
1. fix phy init with NULL init_data
2. do full calibration without CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE
3. fix libphy.a printf
2017-06-16 12:09:13 +08:00
Ivan Grokhotkov
8ccb2a4990 esp32: make time monotonic across resets
Small changes to clock calibration value will cause increasing errors
the longer the device runs. Consider the case of deep sleep, assuming
that RTC counter is used for timekeeping:
- before sleep:
   time_before = rtc_counter * calibration_val
- after sleep:
   time_after = (rtc_counter + sleep_count) * (calibration_val + epsilon)
where 'epsilon' is a small estimation error of 'calibration_val'.
The apparent sleep duration thus will be:
time_after - time_before = sleep_count * (calibration_val + epsilon)
                           + rtc_counter * epsilon

Second term on the right hand side is the error in time difference
estimation, it is proportional to the total system runtime (rtc_counter).

To avoid this issue, this change makes RTC_SLOW_CLK calibration value
persistent across restarts. This allows the calibration value update to
be preformed, while keeping time after update same as before the update.
2017-06-16 12:06:04 +08:00
Jiang Jiang Jian
a64f5de091 Merge branch 'bugfix/sw_reset_fixes' into 'master'
Fixes for esp_restart

See merge request !865
2017-06-15 22:10:13 +08:00
Tian Hao
09f7cf45dd component/bt : fix interrupt number conflict
1. the typical problem is when push keyboard on serial tool, the bluetooth may stop.
2017-06-15 19:41:54 +08:00
Ivan Grokhotkov
8cb0d52c43 esp_system: remove link time dependency on WiFi stack
- esp_restart will not pull in WiFi stack (if it is not used otherwise)
- esp_restore is moved into a separate file to break link time
  dependency
2017-06-15 18:15:36 +08:00
Ivan Grokhotkov
9353666cc1 esp32: reset APP CPU when doing esp_restart
This fixes a bug introduced by !848, where APP CPU would not be reset
during esp_restart, if esp_restart was called from a task running on APP
CPU, and wouldn’t be reset by PRO CPU on startup.
This change replaces stalling APP CPU with resetting it.

Also adds a non-automated esp_restart tests.
2017-06-15 18:15:35 +08:00
Ivan Grokhotkov
a72b1abc51 esp32: disable DPORT access protection when doing esp_restart
DPORT access protection can not work when the other CPU is stalled.
Writes to DPORT registers in esp_restart caused the program to hang due
to access protection, and the reset happened due to RTC_WDT, not SW_RST.
This change adds esp_dport_access_int_deinit function and calls it from
esp_restart once the other core is stalled.
2017-06-15 18:15:35 +08:00
XiaXiaotian
435b907475 fix the bug that wifi assert at ieee80211_output.c line 733 2017-06-14 21:20:28 +08:00
Jiang Jiang Jian
db87a640ea Merge branch 'feature/optimize_task_priority_in_wifi_lib' into 'master'
Optimize priorities of pp, pm, timer, wps and wpa2 tasks.

See merge request !861
2017-06-14 14:01:53 +08:00
Angus Gratton
8e0ec6a9ab Merge branch 'bugfix/abort_in_interrupt_context' into 'master'
Panic handler backtrace fixes

See merge request !835
2017-06-14 13:45:36 +08:00
XiaXiaotian
28e84a5299 Optimize priorities of pp, pm, timer, wps and wpa2 tasks. 2017-06-14 11:06:57 +08:00
Jiang Jiang Jian
69e8085624 Merge branch 'bugfix/wps_receive_m2d_fail_process' into 'master'
ESP32: Add error wps fail reason

See merge request !855
2017-06-14 10:57:59 +08:00
Ivan Grokhotkov
6e704fc421 Merge branch 'bugifx/cplusplus_guards' into 'master'
add C++ include guards to header files which are missing them

See merge request !799
2017-06-14 09:14:02 +08:00
Ivan Grokhotkov
71d7716a45 Merge branch 'bugfix/esp_event_send_init_check' into 'master'
esp_event_send: check if the event loop is initialized

See merge request !817
2017-06-14 09:11:50 +08:00
Angus Gratton
5d7bffea2b panic handler: Print backtraces with calling address not return address
This seems to clean up some of the more wrong addr2line output results (not
sure why, something to do with optimisations I think - perhaps the return
address may also be a jump target from some earlier line of the code.)
2017-06-14 10:30:04 +10:00
Deng Xin
3d963f1c61 Merge branch bugfix/wps_receive_m2d_fail_process to master
ESP32: Add error wps fail reason enum in esp_event.h
see merge request !226
2017-06-13 21:48:48 +08:00
Liu Zhi Fu
bf4dd5175b esp32: update wifi lib to fix assoc timeout issue
Fix assoc timeout thread-safe issue
2017-06-13 20:08:00 +08:00
Jiang Jiang Jian
1ce18758d4 Merge branch 'bugfix/tw13140_fix_throughput_test_crash_issue' into 'master'
esp32: update wifi lib to fix wifi crash bug

See merge request !840
2017-06-13 18:22:39 +08:00
Angus Gratton
47e789f538 abort handler: Fix abort stack trace when abort() called in ISR
Previously, this resulted in task stack frames turning up incorrectly in the backtrace, ie

Backtrace: 0x400d22a0:0x3ffb0fa0 0x40085a3c:0x3ffb0fc0 0x400f32c4:0x3ffb0fe0 0x40081965:0x3ffb1010
0x400d22a0: esp_vApplicationIdleHook at /home/esp/esp-idf/components/esp32/./freertos_hooks.c:
52
0x40085a3c: prvIdleTask at /home/esp/esp-idf/components/freertos/./tasks.c:4431
0x400f32c4: i2c_isr_handler_default at /home/esp/esp-idf/components/driver/./i2c.c:598
0x40081965: _xt_lowint1 at xtensa_vectors.o:?

Fix is to implement abort() via an unhandled exception rather than a breakpoint, I think
because of relative priority of exception types.

Another approach would be to assign a software-only INUM to abort()ing and defined a
PANIC_RSN_ABORTED, but this is more complex and interrupt numbers are more scarce than RAM!
2017-06-13 10:19:01 +10:00
Ivan Grokhotkov
f327a9b1cf esp32: don’t reset APP CPU if it was already reset by OpenOCD
When ‘reset halt’ command is executed, OpenOCD will take the APP CPU
out of reset and enable the clock. At this point, user can set a
breakpoint on code which will run on APP CPU. Previously, app startup
code would do another reset of APP CPU, thereby removing any breakpoints
which may have been set. This change makes APP CPU reset conditional on
DPORT_APPCPU_CLKGATE_EN bit, which is 0 by default but is set to 1 by
OpenOCD after reset.
2017-06-12 15:16:57 +08:00
Liu Zhi Fu
c1e8988240 esp32: update wifi lib to fix wifi crash bug
Fix a wifi crash bug which happens in throughput test
2017-06-08 20:51:21 +08:00
Liu Zhi Fu
f40be8eb77 esp32: add sniffer filter api
Add sniffer filter to filter specified packets
2017-06-06 19:07:12 +08:00
jack
ba32dd30a1 bugfix:Fix bug that wdt reset information for CPU1 was not correct 2017-06-05 18:26:14 +08:00
Ivan Grokhotkov
17da994345 esp_event_send: check if the event loop is initialized
Fixes https://github.com/espressif/esp-idf/issues/668
2017-06-05 11:01:26 +08:00
XiaXiaotian
66ef886d77 Add dport protect in libphy.a 2017-06-01 19:43:55 +08:00
Jiang Jiang Jian
ab0f7264ee Merge branch 'bugfix/tw12174_connect_ap_fail' into 'master'
Fix the bug that station fails to connect to AP sometimes.

See merge request !802
2017-06-01 19:40:02 +08:00
Angus Gratton
b428d28950 spiflash rom: Add symbols accidentally removed in refactor 2017-06-01 09:08:29 +10:00
XiaXiaotian
d2f24f1b81 Fix the bug that station fails to connect to AP sometimes. 2017-05-31 20:27:02 +08:00
jack
fc130fba86 fix bug that files missing commit in MR 773 2017-05-31 19:37:39 +08:00
Ivan Grokhotkov
06accaf851 add C++ include guards to header files which are missing them
Fixes https://github.com/espressif/esp-idf/issues/628
2017-05-31 17:20:17 +08:00
Angus Gratton
d718cbd873 Merge branch 'bugfix/deep_sleep_example_stub_delay' into 'master'
sdkconfig: set CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 by default

See merge request !758
2017-05-29 12:11:56 +08:00
Ivan Grokhotkov
3c583a7655 sdkconfig: set CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 by default
To increase the chances that the examples work out of the box, this
change is raising the default deep sleep wakeup delay to 1ms.
If GPIO15 is low at startup, ROM code takes less time to execute
(because no logging is performed), so more time may be needed to allow
flash chip to become ready.
2017-05-25 10:51:39 +08:00
Liu Zhi Fu
365b66b95b esp32: update wifi lib to fix ota fail bug
Fix ota fails on dual core
2017-05-23 11:38:45 +08:00
Ivan Grokhotkov
a38cecefa7 Merge branch 'bugfix/fix_dport_access_in_isr' into 'master'
Fix Dport access in interrupts

Dport accesses would re-enable interrupts unconditionally, breaking things when called in an ISR. This saves and restores the interrupt status, fixing this.

This fixes a crash in the SPI slave driver, and possibly other things.

See merge request !772
2017-05-19 19:08:34 +08:00
wangmengyang
25b07ed79a component/bt: bugfix for handling HCI_Host_Number_Of_Completed_Packets in BT controller 2017-05-19 17:36:02 +08:00
Jeroen Domburg
fded7b4270 Dport accesses would re-enable interrupts unconditionally, breaking things when called in an ISR. This saves and restores the interrupt status, fixing this. 2017-05-19 15:25:02 +08:00
Ivan Grokhotkov
67a147fc6f Merge branch 'bugfix/bt_controller_log_clean_up' into 'master'
component/bt: disable information loggings from bt controller

clean-up information loggings during controller initialization

See merge request !769
2017-05-19 11:50:11 +08:00
Angus Gratton
dbb862299d Merge branch 'bugfix/github_small_prs' into 'master'
Small PR fixes from github

Small bug fixes & typo corrections from github.

See merge request !762
2017-05-19 07:51:47 +08:00
wangmengyang
df3164bd58 component/bt: disable information loggings from bt controller 2017-05-18 21:44:06 +08:00
Jiang Jiang Jian
0d66ac256b Merge branch 'bugfix/minor_fix_about_wifi_api_comments' into 'master'
esp32: minor fix for wifi api comments

Minor fix about the comments of wifi_promiscuous_pkt_type_t

See merge request !760
2017-05-18 14:59:50 +08:00
Tian Hao
52515d0edf component/esp32 : update wifi library and phy library 2017-05-17 11:46:53 +08:00
Deomid Ryabkov
3ac3a78d7d Print the name of the task that hit the stack watchpoint
This may be enough to troubleshoot (increase stack size).

Merges https://github.com/espressif/esp-idf/pull/607
2017-05-17 11:36:13 +10:00
Ankit Daftery
66191fc0b5 doc: Update wifi scan description
Code was refactored, updating documentation to reflect that

Merges https://github.com/espressif/esp-idf/pull/593
2017-05-17 11:36:13 +10:00