Commit graph

2074 commits

Author SHA1 Message Date
Jiang Jiang Jian 65acd99cce Merge branch 'feature/btdm_gattc_add_API_prepare_write_char_desrc' into 'master'
Component/bt:add API to prepare write descriptor for gattc



See merge request !734
2017-05-05 20:34:41 +08:00
zhiweijian 71401bc9b3 Component/bt:add API to prepare write descriptor for gattc 2017-05-05 18:08:47 +08:00
Jiang Jiang Jian fd079a8bd6 Merge branch 'bugfix/set_scan_bug_rebase_#10399' into 'master'
component/bt: component/bt: Check own address and filter policy for validity.

rebase the invalid scan params not report error.

See merge request !736
2017-05-05 17:47:27 +08:00
Ivan Grokhotkov 2260c714e7 add esp_chip_info API 2017-05-05 17:28:30 +08:00
Ivan Grokhotkov 33b8b7855e Merge branch 'bugfix/spiflash_fatfs_fixes_and_tests' into 'master'
FATFS fixes and tests

This MR includes a set of fixes related to FATFS, SDMMC, and wear levelling:

- `esp_vfs_fat_spiflash_mount` uses `FM_SFD` flag when creating the partition. The volume layout (given in `VolToPart` variable) was not compatible with SFD mode, so mkfs was failing. This fixes the volume layout to use "autodetect" for both volumes. Merges https://github.com/espressif/esp-idf/pull/559.

- fix `prepend_drive_to_path`function, which didn't prepend drive to path (while consuming 2k of stack space)

- fix stack overflow in vfs_fat_link function which allocated two 4kbyte `FIL` structures on the stack

- fix support for having two FATFS instances (in flash and SD) mounted at the same time

- unit tests written for FATFS on SDMMC are made common between SDMMC and WL implementations; FATFS unit tests on WL will run during CI

- fix inconsistent definition of PATH_MAX and ARG_MAX (TW12207, TW12104, https://github.com/espressif/esp-idf/issues/289)

See merge request !732
2017-05-05 17:03:17 +08:00
Ivan Grokhotkov 00358beb98 Merge branch 'feature/freertos_timer_tests' into 'master'
Unit tests: Add FreeRTOS timer tests

Basic unit tests for FreeRTOS timers.

See merge request !715
2017-05-05 17:02:55 +08:00
Yulong 3453824bf2 component/bt: component/bt: Check own address and filter policy for validity. 2017-05-05 04:31:24 -04:00
Jiang Jiang Jian a7847dbec9 Merge branch 'bugfix/bt_sniff_mode' into 'master'
component/bt: fix some bugs related to bluetooth sniff mode in controller

1. fix some bugs in bluetooth sniff mode in controller
2. export some symbols to esp32.rom.ld including functions and global variables in ROM code
3. update libbtdm.a which includes "IRAM_ATTR" addition or removal for some functions

See merge request !729
2017-05-05 16:27:37 +08:00
Jiang Jiang Jian 4223c795a7 Merge branch 'feature/btdm_blufi_newcmd' into 'master'
Feature/btdm blufi newcmd

1.add a new cmd for blufi,esp32 close a gatt connection.

See merge request !697
2017-05-05 16:25:41 +08:00
Jiang Jiang Jian 195358ddb7 Merge branch 'bugfix/lwip_loopback' into 'master'
fix(lwip): fix tcp connect fail when enable LOOPIF

when enable the LOOPIF, because of use the loopnetif, the TCP connect will fail. see TW12029

See merge request !711
2017-05-05 15:45:14 +08:00
Ivan Grokhotkov 9f0dae4aeb newlib: define PATH_MAX and ARG_MAX consistently
Fixes https://github.com/espressif/esp-idf/issues/289.
Fixes https://github.com/espressif/esp-idf/issues/534.
2017-05-05 15:21:38 +08:00
Ivan Grokhotkov 53d5c5f668 vfs, fatfs: fix support for two FATFS instances (SD and flash)
- fix null pointer dereference in VFS when VFS implementations are added
  and removed in different order

- vfs_fat_sdmmc, vfs_fat_spiflash: pass correct drive to mkfs
  (previously it would always do mkfs in the first drive)

- add test case
2017-05-05 15:21:38 +08:00
Ivan Grokhotkov 5ac28e843d fatfs: clean up diskio code
- clean up diskio_spiflash, fix the max number of volumes supported
- move SDMMC code into a separate file
2017-05-05 15:21:38 +08:00
Ivan Grokhotkov 4e3ea66ec4 fatfs: run same fatfs tests for WL and SDMMC
This change moves actual test code into test_fatfs_common.c and
refactors setup/teardown code to be contained within separate functions.
For each SDMMC FATFS test, identical test is added which can run with
WL partition in flash.
2017-05-05 15:21:38 +08:00
Ivan Grokhotkov a428af8c9f unit tests: change type of flash_test partition to ‘fat’
This change makes the spi_flash test partition usable for WL and FATFS
tests.
2017-05-05 15:21:37 +08:00
Ivan Grokhotkov d18157e108 vfs_fat: allocate FIL structures on the heap in vfs_fat_link
vfs_fat_link opened two files to perform copy operation. File structures
were allocated on the stack. When _MAX_SS setting was increased in
ffconf.h due to wear levelling feature, the size of these structures
increased to ~4k each (~8k total). This exceeds stack size allocated for
tasks in most typical cases.

This change makes file structures dynamically allocated.
2017-05-05 15:21:37 +08:00
Ivan Grokhotkov 1a73b41b10 vfs_fat: fix prepend_drive_to_path
Originally, prepend_drive_to_path was designed to be a macro, and it
modified local path variables to point to a temporary buffers.
When it was converted into a function, modification to path variables
were no longer visible outside of this function.

In addition to that, prepend_drive_to_path allocated 2k bytes on the
stack for temporary path buffers. This is replaced with path buffers
allocated as part of vfs_fat context object. Locking is added around
parts of code which use these temporary buffers.

Additionally, _lock member of vfs_fat_ctx_t was placed after the
variable-sized files array, which caused the first entry in the
array to be never used. This change fixes the order of members
and adds comments.
2017-05-05 15:21:37 +08:00
Angus Gratton 72c7941b5e Unit tests: Add FreeRTOS timer tests 2017-05-05 14:38:15 +10:00
Jeroen Domburg 8af3fe4e84 Warn against and check for non-DMA-capable pointers being passed to SPI when DMA is used 2017-05-05 12:28:03 +08:00
devsaurus 530c3ca05c components/driver/spi_master: free dma descriptors
Signed-off-by: Jeroen Domburg <jeroen@espressif.com>
2017-05-05 11:13:42 +08:00
zhiweijian fb45ee7a4c Component/bt: add new cmd for blufi ,ESP32 close a gatt connection 2017-05-04 20:31:58 +08:00
Nineis K b65779eefe Fix vfs_fat_spiflash failed to mount / f_mkfs() 2017-05-04 17:31:14 +08:00
Liu Zhi Fu 7308db6f94 esp32: update wifi lib to enable ebuf sanity check
Modify wifi ebuf sanity checking from disaled to enabled
2017-05-04 15:14:11 +08:00
wangmengyang 244fbf1e84 component/bt: fix some bugs related to bluetooth sniff mode in controller
1. fix some bugs in bluetooth sniff mode in controller
2. export some symbols to esp32.rom.ld including functions and global variables in ROM code
3. update libbtdm.a which includes "IRAM_ATTR" addition or removal for some functions
2017-05-04 15:08:07 +08:00
Jiang Jiang Jian 8f9707fd07 Merge branch 'feature/btdm_vhci_intnum' into 'master'
change VHCI interrupt type to software interrupt

component/bt : change VHCI interrupt type to software interrupt(int no 7)

See merge request !717
2017-05-04 14:58:32 +08:00
Jiang Jiang Jian 79d9d35414 Merge branch 'bugfix/gattc_not_pro_svc_chg_evt_#12079' into 'master'
component/bt:fix the bug with gatt client cant not receive the gatt server service change event.

fix the bug with gatt client cant not receive the gatt server service change event.

See merge request !726
2017-05-04 14:51:42 +08:00
Tian Hao d648835def component/bt : fix the comment 2017-05-03 11:58:52 +08:00
Yulong c0825b35c1 component/bt:fix the bug with gatt client cant not receive the gatt server service change event. 2017-05-02 22:53:48 -04:00
Jiang Jiang Jian 1cef8d8ac1 Merge branch 'bugfix/ble_fix_bluedroid6.0_bug_from_7.1' into 'master'
compoent/bt:Fixed the BT/BLE statck bug from bluedroid7.1.1

The bluedroid 7.1.1 has fixed some bug, synchronize to our SDK now.

See merge request !719
2017-05-02 19:38:50 +08:00
Jiang Jiang Jian 29d620fa10 Merge branch 'bugfix/gatts_cannot_set_value_#11754' into 'master'
component/bt:Fixed the bug for #11754:GATT service should provide command to set…

… char/descriptor read value.

See merge request !721
2017-05-02 19:37:45 +08:00
Ivan Grokhotkov 07b61d54f7 Merge branch 'bugfix/rtc_fast_freq_init' into 'master'
esp32: select 8M clock as RTC_FAST_CLK on startup

Even though RTC_CLK_CONFIG_DEFAULT correctly had RTC_FAST_FREQ_8M as the
fast clock, the bootloader modified fast_freq field to the currently
selected RTC_FAST_CLK (so that the clock choice is not affected by the
bootloader). The application startup code never switched to 8M clock,
which caused the default (XTAL/4) to be used as RTC_FAST_CLK. This had
caused a number of issues, such as touch pads not working in deep sleep.

Fixes https://github.com/espressif/esp-idf/issues/542.
Ref TW12053.

See merge request !709
2017-04-28 19:57:42 +08:00
Ivan Grokhotkov e18f8da528 Merge branch 'bugfix/assert_on_pin_task_nonexistent_cpu' into 'master'
Assert when a new task is started on a nonexisting CPU

Previously, starting a task on a CPU ID higher than the amount of CPUs FreeRTOS is configured with would not start the task and possibly have unintended side effects due to some out-of-bounds array writes. Assert on this so the app aborts cleanly.

See merge request !701
2017-04-28 19:55:26 +08:00
Yulong e8a3f87e4f component/bt:Fixed the bug for #11754:GATT service should provide command to set char/descriptor read value. 2017-04-28 07:23:52 -04:00
Yulong 834d980e39 compoent/bt:Fixed the BT/BLE statck bug from bluedroid7.1.1 2017-04-28 05:31:57 -04:00
Liu Zhi Fu e86b2dc9c3 esp32: update WiFi lib for ebuf sanity check fail issue
Fix WiFi ebuf sanity check issue
2017-04-28 17:27:55 +08:00
Tian Hao 5c0d0d4854 component/bt : change VHCI interrupt type to software interrupt(int no 7) 2017-04-28 17:20:06 +08:00
Liu Zhi Fu 5cf3b1c201 esp32/lwip: adjust some lwip options and update wifi lib
1. Modify TCP TX window from 2 to 4
2. Modify TCPIP task stack default size from 2048 to 2560
3. Update wifi lib for TCP performance optimization
2017-04-28 15:25:33 +08:00
Angus Gratton 7db85a386a Merge branch 'bugfix/i2s_driver' into 'master'
I2S driver - fixed support for 24 and 32-bits, fixed tx/rx at the same time

- Modify sample can test with 24, 32-bits audio
- Add i2s sample README
- simply i2s_push function
- change sample rates, bits per sample, channel on fly

See merge request !483
2017-04-28 08:00:07 +08:00
krzychb 1a19747678 Getting started guides 2017-04-27 19:51:42 +02:00
Ivan Grokhotkov 6f0a9f76cd Merge branch 'feature/ci_minor_fixes' into 'master'
ci minor fixes



See merge request !707
2017-04-28 00:25:13 +08:00
Ivan Grokhotkov b8c1720736 Merge branch 'bugfix/spi_master_ci_test_fix' into 'master'
Fix SPI master CI test

CI test fails because the values it checks haven't been updated to the changes in the clock calculations. This fixes that.

See merge request !710
2017-04-28 00:24:28 +08:00
Jiang Jiang Jian 5728c8bd2a Merge branch 'bugfix/freertos_suspend_resume' into 'master'
freertos: Enable vTaskSuspend()/vTaskResume() API

Adds relevant unit tests.

TW11878

See merge request !702
2017-04-27 21:16:15 +08:00
Jiang Jiang Jian 0759897bfb Merge branch 'bugfix/btdm_gattc_adv_bug' into 'master'
component/bt: Fix memory leakage, connection fail bugs

- Fix memory leakage while deregisting gatt app
- Fix Android connection failed problem
- Fix service_uuid_len error in adv data

See merge request !706
2017-04-27 21:13:16 +08:00
Jiang Jiang Jian a21d524ca0 Merge branch 'feature/btdm_ble_bt_separa' into 'master'
Feature/btdm ble bt separa

@Jack @snake @igrokhotkov @angus @island please help to review the code.
Separate the bt/ble code. After the separate, can save 15k~25k ram & 240k~460k code size(depending on the menuconfig).

See merge request !684
2017-04-27 21:12:44 +08:00
Jiang Jiang Jian 899a5d223f Merge branch 'feature/opt_scan_before_connect' into 'master'
optimize scan before station connecting to AP

1. Store the information of AP(ssid, password, bssid, channel, etc)
    into nvs when station connects to AP successfully. If station
    connects to the same AP next time, it will scan the stored channel of the AP
    first.

2. Add a parameter of channel for scanning before connecting to AP.
    If the channel is set to 0, station will scan full channels. If it
    is set to 1~13, station will only scan the channel.

See merge request !704
2017-04-27 21:11:13 +08:00
Liu Han aeecbcc7ee fix(lwip): fix tcp connect fail when enable LOOPIF 2017-04-27 18:59:47 +08:00
Jeroen Domburg 9134c13c73 Fix SPI master CI test 2017-04-27 14:50:02 +08:00
XiaXiaotian 100d2dd938 optimize scan before station connecting to AP
1. Store the information of AP(ssid, password, bssid, channel, etc)
    into nvs when station connects to AP successfully. If station
    connects to the same AP next time, it will scan the stored channel of the AP
    first.

    2. Add a parameter of channel for scanning before connecting to AP.
    If it is set to 1~13, station will scan starting from the channel.
    If the channel of AP is unknown, set it to 0.
2017-04-27 14:28:52 +08:00
Ivan Grokhotkov 1c3b40adeb esp32: select 8M clock as RTC_FAST_CLK on startup
Even though RTC_CLK_CONFIG_DEFAULT correctly had RTC_FAST_FREQ_8M as the
fast clock, the bootloader modified fast_freq field to the currently
selected RTC_FAST_CLK (so that the clock choice is not affected by the
bootloader). The application startup code never switched to 8M clock,
which caused the default (XTAL/4) to be used as RTC_FAST_CLK. This had
caused a number of issues, such as touch pads not working in deep sleep.

Fixes https://github.com/espressif/esp-idf/issues/542.
Ref TW12053.
2017-04-27 12:44:54 +08:00
Jeroen Domburg 46fa2cfb46 Merge branch 'feature/spi_slave' into 'master'
Split common SPI stuff out of master driver; add slave driver; add workaround for DMA issue.

This merge req mainly adds a slave device. In order to do this, the original master driver is refactored into common code shared by master and slave modes, and a slave driver is added.

The other things added are:
- Added a workaround for a 'feature' of the ESP32 silicon that can lock up the receive DMA channel in some situations. This can only be fixed by resetting *both* DMA channels. The workaround implemented makes sure that the reset only happens when both channels are idle
- Got rid of the automatic choice between register- and DMA-based transfers. The master (and slave) code will now always go for a DMA transfer if a DMA channel is given, and always go for register-based transfers if no DMA channel is given.
- Add in a bunch of fixes for outstanding Github issues.

See merge request !659
2017-04-27 12:28:42 +08:00
Jeroen Domburg 04b901e629 SPI: More MR issues fixed, style fixup 2017-04-27 11:49:04 +08:00
Jeroen Domburg bf0c32364a SPI: Also check SPI_TRANS_USE_[T|R]XDATA when decifding to turn on MOSI/MISO. Fixes https://github.com/espressif/esp-idf/issues/488 2017-04-27 11:49:04 +08:00
Jeroen Domburg 881a90b8ab SPI: SPI master clock calculation: n has a minimum of 2 to allow for both a low and a high cycle. Fixes https://github.com/espressif/esp-idf/issues/491 2017-04-27 11:49:04 +08:00
Jeroen Domburg cecb846450 SPI: Fix comment for 3wire, make GPIO pins GPIO_MODE_INPUT_OUTOUT. Fixes https://github.com/espressif/esp-idf/issues/533 2017-04-27 11:49:04 +08:00
Jeroen Domburg 4c06dca15c SPI: Small fixes according to MR comments 2017-04-27 11:49:04 +08:00
Jeroen Domburg e9c372bc2d SPI: Split common SPI stuff out of master driver; add slave driver; add workaround for DMA issue. 2017-04-27 11:49:04 +08:00
Tuan PM fc1ee2666a I2S: fixed support for 24 and 32-bits, fixed tx/rx at the same time and others in log:
Add support 24, 32 bits

@jxmao optimize i2s_zero_buffer

@jxmao correct config support slave mode

@jxmao correct setup pin support tx/rx at the same time

Enhance pin power

@jxmao add dynamic change number of channels

remove nvs_init

remove start log and enhance power pin setup

using enum for i2s_channel and i2s_bits_per_sample, return ESP_ERR_INVALID_ARG when check params

validate i2s_bits_per_sample and channel

check tx & rx buffer before fill zero

remove checking channel as @jxmao suggest

limit dma buffer

modify i2s pin back to gpio mux before configure gpio matrix, resolve github issue #512

Add support 24, 32 bits

reduce push function

Modify sample can test with 24, 32-bits

Add i2s sample README

Fixed i2s_set_clk got reset sometime

can changes bit-wide while running

Fix sample rate calculation for DAC mode from @jeroen

modify example can change bits per sample every 5 seconds

cleanup

add comment for bytes_per_sample

update as @angus suggestions

Add i2s_set_clk api

I2S driver bug fixed as following log:

@jxmao optimize i2s_zero_buffer

@jxmao correct config support slave mode

@jxmao correct setup pin support tx/rx at the same time

Enhance pin power

@jxmao add dynamic change number of channels

remove nvs_init

remove start log and enhance power pin setup

using enum for i2s_channel and i2s_bits_per_sample, return ESP_ERR_INVALID_ARG when check params

validate i2s_bits_per_sample and channel

check tx & rx buffer before fill zero

remove checking channel as @jxmao suggest

limit dma buffer

modify i2s pin back to gpio mux before configure gpio matrix, resolve github issue #512

limit dma buffer to 4092

change gpio_matrix_*_check to inline function, remove some comments and rename test_i2s function to setup_triangle_sine_waves

for change commit title
2017-04-27 10:00:10 +07:00
Anton Maklakov 079b0128de build: Fix comments and avoid build warning 2017-04-27 10:51:45 +08:00
Ivan Grokhotkov 1324e565fa Merge branch 'bugfix/esp32_core_dump_sanity_checks' into 'master'
esp32: Core dump sanity checks

Adds sanity checks when doing core dump to flash

- CRC for core dump flash partition config
- Tasks with corrupted TCBs are skipped
- Assertions to check that nothing is written beyond core dump flash partition

Ref TW11879

See merge request !686
2017-04-27 10:43:58 +08:00
Ivan Grokhotkov fe695a9af8 Merge branch 'feature/cpu_restart_sequence' into 'master'
Restart sequence requires set up for app cpu.

These changes required to make correct restart of CPU form JTAG.

See merge request !703
2017-04-27 09:30:42 +08:00
Alexey Gerenkov 98895af68b esp32: Core dump sanity checks were added
- CRC for core dump flash partition config
 - Tasks with corrupted TCBs are skipped
 - Assertions to check that nothing is written beyond core dump flash partition
2017-04-26 21:13:02 +03:00
Yulong 54aaeacb32 component/bt:Change the bt Kconfig BT_ACL_CONNECTIONS type from choice to int(range). 2017-04-26 05:27:21 -04:00
Yulong c31953a005 component/bt:Fixted the bug of HCI comment timeout error.
1. remove the SMP_INCLUDED == TRUE insite the btm_find_dev_by_handle function.
2. change the Kconfig with BT_ACL_CONNECTIONS
2017-04-26 04:23:45 -04:00
island a3717515a2 component/bt: Fix memory leakage, connection fail bugs
- Fix memory leakage while deregisting gatt app
- Fix Android connection failed problem
- Fix service_uuid_len error in adv data
2017-04-26 16:07:56 +08:00
Dmitry Yakovlev baeab37560 Debug info removed. 2017-04-26 10:31:05 +03:00
Yulong 891257b4dd component/bt:Change the bt Kconfig BT_ACL_CONNECTIONS from int to choice. 2017-04-26 02:28:34 -04:00
Ivan Grokhotkov 0fe765a977 Merge branch 'feature/32k_xtal' into 'master'
add support for 32k XTAL as RTC_SLOW_CLK source

- RTC_CNTL_SLOWCLK_FREQ define is removed; rtc_clk_slow_freq_get_hz
  function can be used instead to get an approximate RTC_SLOW_CLK
  frequency

- Clock calibration is performed at startup. The value is saved and used
  for timekeeping and when entering deep sleep.

- When using the 32k XTAL, startup code will wait for the oscillator to
  start up. This can be possibly optimized by starting a separate task
  to wait for oscillator startup, and performing clock switch in that
  task.

- Fix a bug that 32k XTAL would be disabled in rtc_clk_init.

- Fix a rounding error in rtc_clk_cal, which caused systematic frequency
  error.

- Fix an overflow bug which caused rtc_clk_cal to timeout early if the
  slow_clk_cycles argument would exceed certain value

- Improve 32k XTAL oscillator startup time by introducing bootstrapping
  code, which uses internal pullup/pulldown resistors on 32K_N/32K_P
  pins to set better initial conditions for the oscillator.

Ref TW11683.

Ref https://esp32.com/viewtopic.php?f=13&t=1570

Fixes https://github.com/espressif/esp-idf/issues/337.

See merge request !696
2017-04-26 14:01:59 +08:00
Dmitry Yakovlev 00aa73c6cf Restart sequence requires set up for app cpu. 2017-04-26 07:47:37 +03:00
Ivan Grokhotkov 6353bc40d7 Add support for 32k XTAL as RTC_SLOW_CLK source
- RTC_CNTL_SLOWCLK_FREQ define is removed; rtc_clk_slow_freq_get_hz
  function can be used instead to get an approximate RTC_SLOW_CLK
  frequency

- Clock calibration is performed at startup. The value is saved and used
  for timekeeping and when entering deep sleep.

- When using the 32k XTAL, startup code will wait for the oscillator to
  start up. This can be possibly optimized by starting a separate task
  to wait for oscillator startup, and performing clock switch in that
  task.

- Fix a bug that 32k XTAL would be disabled in rtc_clk_init.

- Fix a rounding error in rtc_clk_cal, which caused systematic frequency
  error.

- Fix an overflow bug which caused rtc_clk_cal to timeout early if the
  slow_clk_cycles argument would exceed certain value

- Improve 32k XTAL oscillator startup time by introducing bootstrapping
  code, which uses internal pullup/pulldown resistors on 32K_N/32K_P
  pins to set better initial conditions for the oscillator.
2017-04-26 12:43:22 +08:00
Angus Gratton 66726ec166 freertos: Enable vTaskSuspend()/vTaskResume() API
Adds relevant unit tests.

TW11878
2017-04-26 12:50:20 +10:00
Yulong 572e320795 component/bt:change the kconfig.
1.change the rowdata to rodata;
2.change BT_ACL_CONNECTIONS to Maximum BT/BLE connection count.
3. change the comments of bt_target.h:505 from 40 to 5.
2017-04-25 22:47:16 -04:00
Angus Gratton 08cfcbb6ea bootloader: Add some debug logging around OTA selection 2017-04-26 11:23:35 +10:00
Angus Gratton e2479b46f7 secure boot: Fix bootloader image verification failure
* Failure prevented secure boot from enabling.
* Also adds unit test cases for esp_image_basic_verify()

Ref https://esp32.com/viewtopic.php?f=2&t=1602
TW11878
2017-04-26 11:23:35 +10:00
Yulong a4d9aadeca component/bt:Merge the new master to this branch 2017-04-25 08:14:54 -04:00
Yulong 09f69fe9ea Merge branch 'master' of ssh://gitlab.espressif.cn:27227/idf/esp-idf 2017-04-25 07:58:24 -04:00
Ivan Grokhotkov b540322dc1 Merge branch 'feature/wear_levelling' into 'master'
wear levelling

This MR adds wear levelling component. It presents an interface similar to the interface of spi_flash and esp_partition. Inside, it stores data inside a partition to in a way that reduces worst case number of erase cycles for any given sector.

Also included are APIs similar to the ones provided for SDMMC to mount FAT filesystem on top of the wear levelling partition. A simple example shows how this API can be used.

Ref TW10338.

See merge request !567
2017-04-25 19:46:11 +08:00
Jeroen Domburg aaeb2bd110 Assert when a new task is started on a nonexisting CPU 2017-04-25 17:47:25 +08:00
Ivan Grokhotkov 8d6a03820a lwip: fix error when building on OS X, only build ppp if enabled
- reorder directories listed in COMPONENT_SRCDIRS so that
  subdirectories precede parent directories

- don’t include PPP source directories if PPP support is not enabled
2017-04-25 17:22:09 +08:00
Yulong 5544f98add component/bt:separate the SMP, GATT module set the macro output the function.
1. close classic bt, can save 233k code size;
2. close smp module, can save 136k code size;
3. close gattc module, can save 24k code size;
4. close gatts module, can save 16k code size;
4. close the bluedroid stack log, can save 120k code size.
2017-04-25 04:55:29 -04:00
Ivan Grokhotkov 8131c77860 Merge branch 'feature/xtal_freq_autodetect' into 'master'
XTAL frequency detection, support for selecting XTAL frequency

This MR adds more robust XTAL frequency detection code (which gets run in the bootloader) and an option to set XTAL frequency in Kconfig. By default we still use autodetection, since it is more reliable than the one used in ROM code.

This will help with issues about XTAL frequency detection in high ambient temperature conditions.

Ref TW12008

See merge request !694
2017-04-25 16:30:36 +08:00
Ivan Grokhotkov fdfa7e6cc2 Merge branch 'bugfix/sdmmc_timeout' into 'master'
sdmmc: handle card removal when CD is not used

When SD card is removed during transaction, SDMMC peripheral can report
a range of errors, such as timeouts, CRC errors, start/end bit errors.
Under normal conditions (card is inserted), SDMMC peripheral also generates
command done or data done interrupts. When the card is removed, such
interrupts may not be always generated.

This change fixes handling of timeout interrupts and SBE interrupts.
It also adds a one second timeout into the event processing loop. This
timeout allows applications to recover in cases when the SDMMC peripheral
doesn’t generate command/data done event on card removal.

Fixes TW11592.

See merge request !678
2017-04-25 16:27:12 +08:00
Jiang Jiang Jian 3f4e917ad6 Merge branch 'feature/ppp_over_serial' into 'master'
Enable experimental/unsupported PPP over Serial driver

From PR #272 https://github.com/espressif/esp-idf/pull/272

See merge request !690
2017-04-25 14:02:55 +08:00
Jiang Jiang Jian 937940c989 Merge branch 'bugfix/fatfs_sdmmc_cleanup' into 'master'
fat/sdmmc: unmount FATFS object on error

Failure to call f_mount(NULL,...) makes FATFS attempt to clean up the old
FS object upon next mount. If previous mount operation has failed, some
parts of FS object may not be fully initialized, which will cause errors
(such as attempting to delete a mutex which wasn’t allocated).

Fixes TW11594.

See merge request !679
2017-04-25 13:48:34 +08:00
Jiang Jiang Jian 775a1fbc6d Merge branch 'bugfix/remove_unneeded_header_file_including' into 'master'
remove unneeded header file including



See merge request !695
2017-04-25 13:23:03 +08:00
Yulong 45999b69d6 component/bt: Set the style to the same, output the macro in the function.
1.After the separate, can save 15k~25k ram & 240k~460k code size(depending on the menuconfig).
2017-04-24 23:46:37 -04:00
Jiang Jiang Jian 90c8bd93e0 Merge branch 'feature/ethernet_lan8720' into 'master'
ethernet: Add LAN8720 phy support, move PHY to components

Encompasses PR #383 https://github.com/espressif/esp-idf/pull/383

Also includes changes to move PHY support functions into ethernet component, similar to #398 https://github.com/espressif/esp-idf/pull/398/files.





See merge request !540
2017-04-24 17:03:37 +08:00
XiaXiaotian 0c358c37f5 remove unneeded header file including 2017-04-24 16:11:26 +08:00
Ivan Grokhotkov 6b237de909 Add XTAL frequency selection to Kconfig
This change allows XTAL frequency to be selected using menuconfig
2017-04-24 15:55:02 +08:00
Ivan Grokhotkov 3323f31cfb soc: implement XTAL frequency detection
ROM code already implements XTAL frequency detection, but it uses the 8M
clock before the clock tuning parameters are initialized. With the
zero clock tuning parameter, 8M clock has significant frequency deviation
at high temperatures, which can lead to erroneous detection of 40 MHz
crystal as a 26 MHz one.

This change adds XTAL frequency detection code to rtc_clk_init routine,
and detection is performed after the 8M clock tuning parameter as been
initialized.
2017-04-24 15:29:30 +08:00
Jiang Jiang Jian 99e461c676 Merge branch 'bugfix/tw7105_tcp_stable_test_abort_issue' into 'master'
lwip: fix tcp stable test abort issue

This MR covers following changes:
1. Modify dhcp server timer to 1 seconds
2. Enable ETHARP_TRUST_IP_MAC. Consider following scenario: we are in throughput test or traffic stability test, if this option is disabled, then every 5 minutes, the IP/MAC entry in arch cache is aged out, however, the traffic continuously send to lwip from application, because there is no IP/MAC entry in ARP cache, then the packets have to be buffered in ARP queue and a ARP request is triggered, but the ARP queue can only holds 3 packets, the later packets will be dropped, then if the traffic is big, a lot of packets will be dropped here before we get the right ARP response. For TCP, this will trigger re-transmit, it's intolerable for some application, such as real time audio, if re-transmit happen, then performance of voice will be impact. For UDP, sometimes it may also cause problem, such as DHCP, if here we failed to send the DHCP here, we has to wait the DHCP timeout etc... so this option is enabled here by default.

See merge request !681
2017-04-24 13:10:21 +08:00
Jiang Jiang Jian 733e404fcf Merge branch 'feature/optimize_text_rodata_in_iram_dram' into 'master'
optimize WiFi text rodata in iram dram

1. optimize text and rodata in wifi lib

2. update smartconfig

See merge request !668
2017-04-24 13:03:07 +08:00
Jiang Jiang Jian 29002a1c83 Merge branch 'feature/add_limit_for_all_dynamic_ebuf' into 'master'
esp32: update wifi lib for limitting dynamic wifi buffer

Add limit for all dynamic wifi ebuf to avoid wifi run out of memory in some extreme scanrio. 
The default max allocated dynamic tx buffer is 32
The default max allocated dynamic rx buffer is 64, make default value is bigger because when all packets we received are small packets, e.g. the length is 64Bytes, then 64K can hold 1000 packets, so 64 maybe a good candidate default value, anyway the customer can configure it via menuconfig.
The default dynamic wifi internal long/long-long mgmt is 32, generally 32 is enough for mgmt packet (beacon/auth/assoc/probe/null etc). Generally when all the 32 mgmt buffer is run out of memory, it means internal wifi state machine may has problem, we need to debug it.

See merge request !683
2017-04-24 11:49:50 +08:00
Jiang Jiang Jian 97142bb8db Merge branch 'feature/support_read_mac_addr_from_customer_efuse' into 'master'
Add customer MAC address that read from efuse



See merge request !673
2017-04-24 11:30:55 +08:00
XiaXiaotian 9d8425bd72 put RODATA of libphy.a into DRAM
There are some RODATAs of libphy.a that are called in ISR. So need
    to put them into DRAM to avoid access them when R/W SPI flash. Due
    to the RODATAs which are called in ISR haven't been picked out to
    put into DRAM, put all of the RODATA of libphy.a into DRAM. This
    will be optimized in the future.
2017-04-24 11:22:49 +08:00
Alexey Gerenkov 77a92e6dcc esp32: Added dumping info from traceport upon reset by any WDT
- Last PC info and waiti mode indication are printed for both CPUs
 - Raw traceport regs values are printed only for log levels higher than DEBUG
2017-04-23 22:07:56 +03:00
Yulong 2cfde4dfd9 compoent/bt:change the code style 2017-04-23 05:52:18 -04:00
Yulong 1016ab1c2a component/bt:separate the smp_br_connect_callback from the BLE only mode 2017-04-23 00:48:23 -04:00
Ivan Grokhotkov 404e89da4d Merge branch 'bugfix/rtc_reg_fields' into 'master'
soc: allow REG_SET_FIELD to be used for bit fields

- Fixes an issue with `rtc_clk_apll_enable`: https://esp32.com/viewtopic.php?f=13&t=1673
- Fixes `rtc_clk_fast_freq_set` function always selecting XTAL/4 as fast clock source.
- Fixes regression in deep sleep current (7uA instead of 5uA).

See merge request !674
2017-04-21 19:40:45 +08:00
Ivan Grokhotkov 8399ed900a Merge branch 'bugfix/xtal_freq_after_wdt_reset' into 'master'
rtc_clk_init: handle case when XTAL frequency has already been set

On first reset, ROM code writes the estimated XTAL frequency into
RTC_APB_FREQ_REG (aka STORE5). If the application doesn’t specify exact
XTAL frequency (which is always the case for now), rtc_clk_init will
guess what kind of XTAL is used (26M or 40M), based on the estimated
frequency. Later, detected frequency is written into RTC_XTAL_FREQ_REG
(aka STORE4).

When the application switches clock source to PLL, APB frequency changes
and RTC_APB_FREQ_REG is updated. If the application encounters an RTC
WDT reset, RTC_APB_FREQ_REG will not be updated prior to reset. Once the
application starts up again, it will attempt to auto-detect XTAL
frequency based on RTC_APB_FREQ_REG, which now has value of 80000000.
This will fail, and rtc_clk_xtal_freq_estimate will fall back to the
default value of 26 MHz. Due to an incorrect XTAL frequency, PLL
initialization will also take incorrect path, and PLL will run at a
different frequency. Depending on the application this may cause just
garbage output on UART or a crash (if WiFi is used).

This change checks if RTC_XTAL_FREQ_REG has already been set before trying
to estimate XTAL frequency based on the value of RTC_APB_FREQ_REG, and
uses RTC_XTAL_FREQ_REG value if it is valid.

Fixes TW11738.

See merge request !691
2017-04-21 19:38:46 +08:00
XiaXiaotian b238bc691d Do not put the whole object files into IRAM. Add attributes to the functions called in ISR instead. 2017-04-21 15:38:01 +08:00
XiaXiaotian 5553fbd537 add base MAC address storage choice.
Base MAC address can be stored in default manufacture-defined or customer
    pre-defined place in EFUSE and other place e.g. flash or EEPROM.
    If choose to use base MAC address which is stored in other place, please
    call esp_base_mac_addr_set_external() before initializing WiFi/BT/Ehternet.
2017-04-21 14:55:11 +08:00
Yulong b5989a6b26 component/bt:Recovery the btm_establish_continue when created the acl connection 2017-04-21 02:43:35 -04:00
Angus Gratton fd3ef4cdfe Merge branch 'bugfix/github_fixes' into 'master'
Various fixes from Github

Some one-line fixes from Github PRs.

See merge request !689
2017-04-21 12:27:32 +08:00
Angus Gratton 94a61389ff Merge branch 'bugfix/driver_const_params' into 'master'
components/driver: 'const' all config calls.

Merges PR #519 https://github.com/espressif/esp-idf/pull/519

See merge request !687
2017-04-21 12:25:15 +08:00
Angus Gratton f3a567b65d PPPoS: Rearrange config items (move TCP/IP stack size to LWIP), mark as experimental/unsupported
Ref #272
2017-04-21 14:23:34 +10:00
Adrian Muzyka 47c722d674 Enable lwip PPPoS support
* Fix some lwip api bugs
 * Added PPP_SUPPORT parameter to lwip Kconfig
 * Added example pppos_client

Merges #272 https://github.com/espressif/esp-idf/pull/272
2017-04-21 14:23:34 +10:00
Liu Zhi Fu 561a1a64f2 esp32: update wifi lib for limitting dynamic wifi buffer
Add limit for all dynamic wifi ebuf to avoid wifi run out of memory in some extreme scanrio
2017-04-21 10:38:00 +08:00
Ivan Grokhotkov 6e9d60ef70 rtc_clk_init: handle case when XTAL frequency has already been set
On first reset, ROM code writes the estimated XTAL frequency into
RTC_APB_FREQ_REG (aka STORE5). If the application doesn’t specify exact
XTAL frequency (which is always the case for now), rtc_clk_init will
guess what kind of XTAL is used (26M or 40M), based on the estimated
frequency. Later, detected frequency is written into RTC_XTAL_FREQ_REG
(aka STORE4).

When the application switches clock source to PLL, APB frequency changes
and RTC_APB_FREQ_REG is updated. If the application encounters an RTC
WDT reset, RTC_APB_FREQ_REG will not be updated prior to reset. Once the
application starts up again, it will attempt to auto-detect XTAL
frequency based on RTC_APB_FREQ_REG, which now has value of 80000000.
This will fail, and rtc_clk_xtal_freq_estimate will fall back to the
default value of 26 MHz. Due to an incorrect XTAL frequency, PLL
initialization will also take incorrect path, and PLL will run at a
different frequency. Depending on the application this may cause just
garbage output on UART or a crash (if WiFi is used).
2017-04-21 10:33:58 +08:00
Angus Gratton 52c378b447 bluedroid: Fix compilation warnings related to aliasing
Merges PR #518 https://github.com/espressif/esp-idf/pull/518
2017-04-21 11:31:40 +10:00
Michael Kellner eeb0aaa09e spidriver: Display length errors correctly
SPI transfer length is bits, not bytes, so the error should indicate bits. Also, there are separate lengths for rx and
tx (confusingly named rxlength and length... if rxlength is 0, length is used). The code checks the tx length for the
rx, so it never validates rxlength.

Originally contributed as part of #511 https://github.com/espressif/esp-idf/pull/511
2017-04-21 11:03:07 +10:00
Jonathan Kaufmann bf82b441ae Fixed bug in ledc_set_fade_with_step where returned while holding critical section.
Merges PR #515 https://github.com/espressif/esp-idf/pull/515
2017-04-21 11:03:07 +10:00
Michael Kellner a523aa3ef5 mbedtls port: Fix detection of EWOULDBLOCK/EAGAIN with non-blocking sockets
Since mbedtls_net_errno is reset by fcntl, it is reset after calling
net_would_block, so the call to mbedtls_net_errno in mbedtls_net_recv
and mbedtls_net_send will always get back 0. This change propagates
the value returned by mbedtls_net_errno up through net_would_block,
to allow the correct error value to be used and avoid a redundant
call to mbedtls_net_errno.

Merges PR #511 https://github.com/espressif/esp-idf/pull/511
2017-04-21 10:46:34 +10:00
Yulong bc807a18d1 component/bt:Finish all the separate code from BT & BLE 2017-04-20 07:18:05 -04:00
Angus Gratton 453b5ded1d ethernet: Add convenience functions esp_eth_smi_wait_value() & esp_eth_smi_wait_set()
Covers the common case of waiting for a particular PHY register to have a particular value.
2017-04-20 18:03:00 +10:00
Angus Gratton 453722ba54 ethernet: Refactor PHY support to be part of ethernet component
Move generic PHY support into its own interface
2017-04-20 18:03:00 +10:00
Liu Zhi Fu ab37f89f55 lwip: fix tcp stable test abort issue
1. Modify dhcp server timer to 1 seconds
2. Enable ETHARP_TRUST_IP_MAC

modify according to review
2017-04-19 17:39:32 +08:00
Yulong 2723504473 add the GATTC_INCLUDED marco to close the bta_gattc module when not used the GATTC 2017-04-19 05:16:24 -04:00
Yulong 0ddadc98a3 separate the btm layer from SMP security 2017-04-19 03:44:01 -04:00
Ivan Grokhotkov 8f02730e1f fat/sdmmc: unmount FATFS object on error
Failure to call f_mount(NULL,...) makes FATFS attempt to clean up the old
FS object upon next mount. If previous mount operation has failed, some
parts of FS object may not be fully initialized, which will cause errors
(such as attempting to delete a mutex which wasn’t allocated).
2017-04-19 15:03:30 +08:00
Jiang Jiang Jian 29b32be97c Merge branch 'bugfix/tw11779_softAP_crash_when_wifi_connect' into 'master'
esp32: update wifi lib to fix wifi connect cause crash

Fix softap wifi connect crash bug

See merge request !672
2017-04-19 14:34:53 +08:00
Ivan Grokhotkov 49848eaed5 sdmmc: handle card removal when CD is not used
When SD card is removed during transaction, SDMMC peripheral can report
a range of errors, such as timeouts, CRC errors, start/end bit errors.
Under normal conditions (card is inserted), SDMMC peripheral also generates
command done or data done interrupts. When the card is removed, such
interrupts may not be always generated.

This change fixes handling of timeout interrupts and SBE interrupts.
It also adds a one second timeout into the event processing loop. This
timeout allows applications to recover in cases when the SDMMC peripheral
doesn’t generate command/data done event on card removal.
2017-04-19 12:50:51 +08:00
Jeroen Domburg b209c6dcbb Make internal stack size variables in FreeRTOS 32-bit instead of 16-bit 2017-04-19 10:47:19 +08:00
Yulong 65ff8bd160 l2cap can send data to low layer when close the classic bt. 2017-04-18 05:42:55 -04:00
Ivan Grokhotkov 5d1bb42c18 soc: allow REG_SET_FIELD to be used with single-bit fields 2017-04-18 17:34:26 +08:00
Ivan Grokhotkov faaf59ccb3 soc: define missing M, V macros for nrx, bb, fe, emac, iomux
Recipe:
- Add _M and _V for single-bit fields
  Search: (#define (\w+)\s*(\(BIT\(\d+\)\)))
  Replace: \1\n#define \2_M \3\n#define \2_V 1

- Add _M and _V for multi-bit fields
  Search: (#define (\w+)\s*(0x[\dA-Fa-f]+))
  Replace: \1\n#define \2_M (\2_V << \2_S)\n#define \2_V \3
2017-04-18 17:34:26 +08:00
Jeroen Domburg f73c6f875c Merge branch 'bugfix/dont_log_before_bss_inited' into 'master'
Remove ESP_EARLY_LOGI before bss is initialized; it crashes the CPU

There's an ESP_EARLY_LOGI line that can get called before the BSS is initialized; the early logging code doesn't cope well with that: it checks if FreeRTOS is up, but the variables it uses for that contains garbage because it isn't cleared yet, giving the wrong result. The logging code then tries to set a mux, crashing the entire system. This patch removes the log line and adds a warning at the BSS initialization line not to do anything complex before that point.

Fixes https://github.com/espressif/esp-idf/issues/523

See merge request !671
2017-04-18 11:21:31 +08:00
Yulong 22ccf6c368 component/bt:rebase the BT_BLE_separate to the new master 2017-04-17 22:53:43 -04:00
Alexey Gerenkov 55f1a63faf esp32: Adds functionality for application tracing over JTAG
- Implements application tracing module which allows to send arbitrary
   data to host over JTAG. This feature is useful for analyzing
   program modules behavior, dumping run-time application data etc.
 - Implements printf-like logging functions on top of apptrace module.
   This feature is a kind of semihosted printf functionality with lower
   overhead and impact on system behaviour as compared to standard printf.
2017-04-17 23:26:29 +03:00
Ivan Grokhotkov ad50a70440 fix test for dumping trace data 2017-04-17 22:19:14 +03:00
Ivan Grokhotkov 639557d975 trace: add Kconfig options for app level trace
CONFIG_MEMMAP_TRACEMEM is now a hidden underlying option, which can be enabled using either CONFIG_ESP32_TRAX or CONFIG_ESP32_APP_TRACE
2017-04-17 22:19:14 +03:00
Ivan Grokhotkov 3ac080fc80 test tracing over JTAG 2017-04-17 22:19:14 +03:00
XiaXiaotian 03e2618d35 Add customer MAC address that read from efuse 2017-04-17 21:24:15 +08:00
Liu Zhi Fu b94e5f7855 esp32: update wifi lib to fix wifi connect cause crash
Fix softap wifi connect crash bug
2017-04-17 19:18:26 +08:00
Ivan Grokhotkov 3624149344 wear_levelling: add unit test sub-component 2017-04-17 11:01:18 +08:00
Ivan Grokhotkov 3a39475d20 wear_levelling: run host side test in CI 2017-04-17 11:01:18 +08:00
Ivan Grokhotkov 8f76fe1d7f move Catch framework header into tools directory 2017-04-17 11:01:18 +08:00
Ivan Grokhotkov 57e380fa99 nvs_flash, wear_levelling: ignore host test files 2017-04-17 11:01:18 +08:00
Ivan Grokhotkov 52b51df859 add wear_levelling component and example 2017-04-17 11:01:17 +08:00
Dmitry Yakovlev aeabbd305c fatfs: add support for small disc sizes (less then 16 MB) 2017-04-17 11:01:17 +08:00
Ivan Grokhotkov 7388efa953 fatfs: add support for variable sector size 2017-04-17 11:01:17 +08:00
Ivan Grokhotkov ed6957302f Kconfig: fix “symbol value '' invalid for PHY_DATA_OFFSET” warning
PHY_DATA_OFFSET is only used if ESP32_PHY_INIT_DATA_IN_PARTITION is set
2017-04-17 11:01:17 +08:00
Jeroen Domburg 76a4082de7 Remove ESP_EARLY_LOGI before bss is initialized; it crashes the CPU 2017-04-16 23:34:03 +08:00
Jiang Jiang Jian 0ea4c3c06b Merge branch 'bugfix/btdm_alarm_event_transfer' into 'master'
component/bt: transfer bluedroid timer events to be handled by BTC task

NVS operation can take long time for timer task to handle. Transfer the alarm event to be handled by BTC task.

See merge request !670
2017-04-14 21:20:19 +08:00
Ivan Grokhotkov 15ec487fde Merge branch 'feature/esp32_d2wd_support' into 'master'
ESP32-D2WD support

Support ESP32-D2WD with integrated flash in ESP-IDF.

Includes fix for https://github.com/espressif/esp-idf/issues /521


See merge request !639
2017-04-14 20:57:39 +08:00
wangmengyang 4f3b391674 component/bt: transfer bluedroid timer events to be handled by BTC task 2017-04-14 18:49:30 +08:00
Yulong 4715fa16ae change the make error in bta_dm_ble_set_rand_address func 2017-04-14 02:52:43 -04:00
Yulong cb5c296829 component/bt:move the bugfix/ble_set_rand_addr_bug here for fix the conflict with the master 2017-04-14 02:45:07 -04:00
Yulong f6f094213e compoment/bt:Change the tabs to space in btc_ble_storage.c & btc_gap_ble.c file 2017-04-13 23:50:14 -04:00
Yulong aff8758fe4 delete the debug log in the btc_ble_storage file 2017-04-13 22:40:37 -04:00
Michel Pollet 349a77cb55 components/driver: 'const' all config calls.
Some were, some weren't. They all could/should be.

Signed-off-by: Michel Pollet <buserror@gmail.com>
2017-04-13 18:33:33 +01:00