Commit graph

503 commits

Author SHA1 Message Date
Ivan Grokhotkov a2e0c2432e esp32: sanity check ISR handler address passed into esp_intr_alloc
Return ESP_ERR_INVALID_ARG if the handler is not in IRAM (or RTC fast memory)
2017-01-11 11:38:17 +08:00
Ivan Grokhotkov 833102cbf3 esp32: place cross-core interrupt handler into IRAM
esp_intr_alloc is called with ESP_INTR_FLAG_IRAM, so the ISR should be in IRAM.
2017-01-11 00:52:45 +08:00
Jeroen Domburg a3f6728797 Merge branch 'feature/watchpoint_on_stack_canary' into 'master'
Add option to automatically set a watchpoint at the end of the swapped-in task

This should make stack overflows easier to debug because it triggers a debug exception as soon as the stack is overwritten, not later when a context switch happens. Marked as a FreeRTOS debug feature because it doesn't give a nice error message and uses up a watchpoint.

See merge request !389
2017-01-10 14:01:07 +08:00
Jeroen Domburg 881157e1ed Add documentation to panic handler functions, move watchpoint stuff from tasks.c to port.c, account for non-32-bytes-aligned stacks when setting watchpoint, add debug reason explanation to panic handler 2017-01-10 13:05:19 +08:00
qiyueixa d5464074dd update wifi libs 2017-01-09 18:44:27 +08:00
Jeroen Domburg ca57a86f20 Add option to automatically set a watchpoint at the end of the swapped-in task 2017-01-09 16:42:45 +08:00
Jiang Jiang Jian 633cd49f88 Merge branch 'bugfix/detect_ocd_when_panic' into 'master'
Fix OpenOCD detection code

In the current master, detection of an attached OCD is broken. This fixes it.

I also snuck in two unrelated checks in intr_alloc which return from a function that is asserted earlier in the code. This makes the code behave better when they are called erroneously in a production build.

See merge request !377
2017-01-09 13:25:45 +08:00
Jeroen Domburg 11a994d5d8 Calling esp_intr_noniram_[en|dis]able twice is an error, so abort instead of doing an assert which disappears in non-debug mode 2017-01-09 12:04:21 +08:00
Liu Zhi Fu 084c14f1e4 esp32: fix wifi timer thread-safe issue
Update wifi lib to fix a wifi timer thread-safe issue
2017-01-09 10:21:29 +08:00
Ivan Grokhotkov 5b5a4355e7 Merge branch 'feature/sd_driver_new' into 'master'
SDMMC peripheral driver, SD protocol driver, FATFS library, VFS integration

This MR contains:
- SDMMC host peripheral driver
- SD protocol driver in sdmmc component (can be extended to support MMC/eMMC and SPI based hosts)
- ChaN's FATFS library v0.12b
- VFS integration
- FAT access via VFS is thread-safe (unless same file is read/written/unlinked/renamed from different tasks)
- Support for POSIX directory-related functions in VFS (and in vfs_fatfs.c)
- unit test for the above
- Example
- API documentation

Will be done in other MRs:
- Support for spi_flash IO driver for FatFs
- SPI host driver and support for SPI mode commands in sdmmc component
- MMC/eMMC support in sdmmc component
- Support for slightly higher 53/26.6MHz clocks (currently I'm using 20MHz for DS and 40MHz for HS, instead of 25MHz/50MHz per standard), and arbitrary low clocks (e.g. 4MHz).

See merge request !353
2017-01-09 06:48:25 +08:00
Ivan Grokhotkov edd924f273 sdmmc: add peripheral driver and protocol layer 2017-01-09 04:51:24 +08:00
Wu Jian Gang ecf720d3b3 Merge branch 'bugfix/fix_wifi_auth_fail_issue' into 'master'
esp32: fix wifi auth issue

Fix wifi auth failed issue by default phy mode to 11N

See merge request !382
2017-01-07 21:12:45 +08:00
Ivan Grokhotkov b1c754bbb5 Merge branch 'feature/cplusplus' into 'master'
C++ support

This change adds necessary support for compiling C++ programs:
- linking against libstdc++
- implementation of static initialization guards using FreeRTOS primitives: since we don't have condition variables at our disposal, and we don't want to allocate a synchronization primitive for every guard variable generated by the compiler, we imitate condition variables using a combination of a mutex, counting semaphore, and a counter (based on [Microsoft Research paper](https://www.microsoft.com/en-us/research/wp-content/uploads/2004/12/ImplementingCVs.pdf), albeit because we don't need *arbitrary* code to use these CVs, implementation gets simpler).

Note that libstdc++ also contains an implementation of `__cxa_guard_{acquire,release,abort}` functions. These implementations come from an `#ifndef GXX_THREADS` branch, i.e. are not aware of multthreading. There are three ways of replacing these libstdc++ functions with our implementation:

1. Move our code into gcc. Pros: cleanest solution. Cons: Such changes are unlikely to be merged by any upstream, so we end up maintaining our own forks of {gcc,crosstool-ng}.
2. Use library as it is built by crosstool, use `ar` to delete one object file (`guards.o`), add this library to ESP-IDF. Pros: easy to implement. Cons: libstdc++ is a 15MB binary 😯 
3. Keep using libstdc++ from crosstool, force our implementation to be linked using a `-u` linker flag. Pros: no impact on repo size, easy to implement. Cons: somewhat less clean than 1 (and about as hacky as 2).

For the reasons mentioned, option (3) looks like the best tradeoff.

Ref. TW6702

See merge request !364
2017-01-07 18:50:12 +08:00
Ivan Grokhotkov 339267ffc9 Merge branch 'feature/bootloader_rng' into 'master'
Enable bootloader entropy source for RNG

Enables an entropy source when bootloader starts up, which both seeds the RNG for use before WiFi/BT stack is enabled and provides an adequate RNG for secure boot & flash encryption key generation.

A prerequisite was enabling 80MHz operation, so the CPU is now set to 80MHz as soon as second stage bootloader starts running.

See merge request !363
2017-01-07 18:46:10 +08:00
Ivan Grokhotkov 4f909b8ecc Merge branch 'bugfix/ets_delay_on_app_cpu' into 'master'
esp32: ets_update_cpu_frequency should set tick scale for both CPUs

ets_update_cpu_frequency ROM function updates g_ticks_per_us, which is has two copies, one for each CPU.
The APP CPU copy of g_ticks_per_us never got updated, resulting in shorter delays produced by ets_delay_us on the APP CPU.

This MR replaces ROM ets_update_cpu_frequency with a copy in IRAM which updates scaling factors on both of the CPUs.

So now we get expected delays (in microseconds):
```
ets_delay_us core=0 expected=50000 actual=50014
ets_delay_us core=1 expected=50000 actual=50015
vTaskDelay core=0 expected=50000 actual=49428
vTaskDelay core=1 expected=50000 actual=50000
```

Reported on the forum: http://esp32.com/viewtopic.php?f=2&t=713#p3722

See merge request !373
2017-01-07 18:45:14 +08:00
Jeroen Domburg 0bfe08578b Add sdkconfig include to cpu_util.h so CONFIG_ESP32_DEBUG_OCDAWARE actually resolves 2017-01-07 18:44:20 +08:00
Liu Zhi Fu 0e7f7a2112 esp32: fix wifi auth issue
Fix wifi auth failed issue by default phy mode to 11N
2017-01-07 16:32:03 +08:00
Liu Zhi Fu a575b9e893 esp32: modify ld file to fix a crash issue 2017-01-07 16:12:07 +08:00
Jeroen Domburg 718969f6ed Merge branch 'driver/spi' into 'master'
SPI master driver

This merge requests adds an SPI Master driver. This driver is (of course) multithread capable, has device abstraction, has command queueing, DMA support and all other sorts of nice things you'd expect from a SPI driver.


See merge request !332
2017-01-06 16:28:52 +08:00
Ivan Grokhotkov a69a798878 Merge branch 'bugfix/tw9540_workaround_appdata_overwrite_bootdata' into 'master'
modify bootloader dram start address, swap app bss and data segments

Modify bootloader dram_seg from address 0x3ffc0000 to 0x3fff0000, len from 0x20000 to 0x10000.
Also put app .data before .bss, to reduce the chance .data collides with ROM bootloader stack.

See merge request !375
2017-01-06 15:59:22 +08:00
Ivan Grokhotkov 1cbc2fa046 esp32: ets_update_cpu_frequency should set tick scale for both CPUs 2017-01-06 15:00:17 +08:00
Ivan Grokhotkov 845cd09570 cxx: link against libstdc++, remove abi.cpp 2017-01-06 14:56:02 +08:00
Jeroen Domburg 23455de4c2 Add SPI Master driver, example, test and docs 2017-01-06 14:20:32 +08:00
Ivan Grokhotkov 61c6ce86d2 esp32: put .data before .bss
This change reduces chances that a large .bss segment will push .data all the way into
0x3ffe1320 — 0x3ffe5320 range where the bootloader stack is, creating a problem when
bootloader will be loading application into memory.
With this change, .data would need to be at least 200k big to cause problems.
2017-01-06 13:46:06 +08:00
Wu Jian Gang e2d05d8592 Merge branch 'feature/wifi_deinit' into 'master'
wifi: add wifi rx buffer number config in menuconfig



See merge request !370
2017-01-06 13:32:25 +08:00
XiaXiaotian 7853893731 wifi: add wifi rx buffer number config in menuconfig 2017-01-06 10:12:27 +08:00
Ivan Grokhotkov ded13ac8e6 Merge branch 'feature/btdm_blufi' into 'master'
Feature/btdm blufi

This is new BLUFI for config wifi connection through bluetooth.


See merge request !359
2017-01-05 21:54:45 +08:00
wangmengyang 2e7748d625 component/bt: modify bluetooth API
1. VHCI api and doxygen
2. Controller api and doxygen
3. bluedroid init/enable api and doxygen
4. cleanup demo codes
2017-01-05 20:02:06 +08:00
qiyueixa 7778273314 esp32: update wifi libs
1. add wifi low rate feature
2017-01-05 18:43:09 +08:00
qiyueixa 5677149833 esp32: add wifi low rate feature
1. add low_rate_enable flag to scan results to identify if AP low rate is enabled.
2. add WIFI_PROTOCOL_LR for users to enable low rate feature.
2017-01-05 18:22:07 +08:00
Liu Zhi Fu be994740b4 Merge branch 'master' of ssh://gitlab.espressif.cn:27227/idf/esp-idf into feature/throughput_optimization_phrase_1 2017-01-05 11:37:56 +08:00
Liu Zhi Fu 0fb2ab9f5c lwip/freertos/esp32: add throughput optimization related code
1. Update wifi lib which contains ampdu and other optimizations
2. Add throughput code debug code
3. Other misc modification about throughput optimization
2017-01-05 11:37:08 +08:00
Angus Gratton 63e9806d85 esp_random: XOR the RNG register value several times before returning it
Probably unnecessary, but avoids returning internal RNG state as-is.
2017-01-04 17:07:12 +11:00
Angus Gratton 3922ce47b2 bootloader: Enable early boot RNG entropy source
This reverts commit ceb8566970.
2017-01-04 17:07:12 +11:00
Angus Gratton 2e3ca1c2f7 bootloader: Boost bootloader CPU to 80MHz
Partially needed to use RNG, also useful to improve boot performance.
2017-01-04 16:07:19 +11:00
Wang Jia Lin bf3093feca Merge branch 'driver_merge_tmp/merge_i2c' into 'master'
driver: i2c code

1. add i2c master code
2. add i2c slave code
3. add i2c example code

See merge request !318
2017-01-03 16:44:08 +08:00
Angus Gratton 2407faf6c6 Merge branch 'feature/print_halt_abort' into 'master'
panic handlers: Print the PC address where abort() was called, don't dump registers



See merge request !338
2017-01-03 13:44:34 +08:00
Angus Gratton 5e96070c27 linker script: Remove KEEP from RAM-resident sections
Reduce RAM usage when not all data/bss sections in source files were used.
2017-01-03 11:02:12 +11:00
Wangjialin 9c7cc86793 1. modify i2c_set_pin function
2. update example comments and other minor changes
3. rename API:  i2c_cmd_link_create/i2c_cmd_link_delete (+4 squashed commits)

Squashed commits:
[2e0ac3e] 1. coding style: add one space after condition key words.
2. modify i2c.h, use gpio_num_t instead of int, improve comments of return values
3. add i2c index in index.rst
4. add readme for i2c example
[4991d92] update i2c.doc
[88b672e] driver: i2c

1. add mux and spin lock to run in a thread-safe way.
2. modify example code
[4eb15fe] driver: i2c code

1. add i2c master code
2. add i2c slave code
3. add i2c example code
4. add DRAM_ATTR for I2C array
2017-01-03 00:57:19 +08:00
Angus Gratton 3cfe738fcf Merge branch 'bugfix/minor_issues' into 'master'
Bugfixes from Github

Many small fixes for open github issues.

See merge request !334
2016-12-28 13:18:34 +08:00
Angus Gratton 06e03ff52e Replace backwards-compatible portTICK_RATE_MS with FreeRTOS v8+ portTICK_PERIOD_MS
Closes github #51 https://github.com/espressif/esp-idf/issues/51
2016-12-28 10:23:13 +11:00
Angus Gratton 1e44f72e98 esp_wifi_init: Update comment about init event_q
Closes github #28 https://github.com/espressif/esp-idf/issues/28
2016-12-28 10:17:56 +11:00
Angus Gratton c1a6d55116 WiFi interface: SSID and password fields should be uint8_t in all cases
Closes github #40 https://github.com/espressif/esp-idf/issues/40
2016-12-28 10:17:56 +11:00
Angus Gratton da977149f6 panic handlers: Print the PC address where abort() was called, don't dump registers 2016-12-28 10:09:40 +11:00
Angus Gratton 4cfbe80b0f Merge branch 'bugfix/bootloader_stack' into 'master'
bootloader: Check if DRAM segments are going to collide with stack



See merge request !330
2016-12-22 12:15:18 +08:00
Angus Gratton bae0149920 Merge branch 'bugfix/minor_fixes' into 'master'
Minor fixes from various sources

- Fix memory debugging code. Noticed by Tuan.
- intr_enable/disable should be in IRAM. Noticed by rojer
- Still old timer code in examples in doxygen comments. Noticed on the forum by jumjum123
- Timer example was broken. Noticed on the forum by jumjum123

See merge request !325
2016-12-21 06:54:33 +08:00
Angus Gratton 198889ad26 bootloader: Check if DRAM segments are going to collide with stack 2016-12-20 16:14:07 +11:00
Deomid Ryabkov 1597f7a035 Add IRAM_ATTR to esp_intr_{enable,disable}
So it's safe to invoke from ISR

Signed-off-by: Jeroen Domburg <jeroen@espressif.com>
2016-12-19 18:49:28 +08:00
Ivan Grokhotkov 4853df9c83 phy init data update
This changes 54M target power from 16 dBm to 15 dBm, and bumps init_data version from 0 to 1.
2016-12-19 14:23:39 +08:00
Wangjialin b00b75db7e driver: sigma-delta
1. add sigma-delta code and example.
2. add gpio output signal in io matrix.

Squashed commits:
[a25e7d4] minor changes for doc
[6a03a1e] minor changes on comments and doc.
[97dd9e4] Add doc.
update index.rst
change example index
2016-12-18 17:20:17 +08:00