Commit graph

594 commits

Author SHA1 Message Date
liuzhifu bd2e55def3 component/esp32: adjust some APIs
1. Modify wifi_init_config_t to:
   typedef struct {
      wifi_event_handler_t event_handler;  /**< WiFi event handler */
   } wifi_init_config_t;
2. Modify argument of esp_wifi_set/get_promiscuous from uint8_t/uint8_t* to bool/bool*
2016-09-26 19:45:36 +08:00
Wu Jian Gang 96e0afd30f components/nghttp: rename Makefile to component.mk 2016-09-26 19:21:55 +08:00
liuhan 3c33350af9 components/nghttp: add HTTP2.0 protocol feature
Develop and Issue HTTP2.0 protocol parse function, see nghttp file.
2016-09-26 18:56:20 +08:00
wangmengyang b9167f70cd component/bt: add VHCI mutex protetion
1. add mutex to VHCI APIs
2. remove bss/data log print during initialization;
3. add bss/data symbols in esp32.rom.ld
4. add & modify BTDM OSI functions
2016-09-26 18:52:15 +08:00
Ivan Grokhotkov e3ffcd22d5 Merge branch 'feature/init_refactoring' into 'master'
Startup flow refactoring

This set of commits changes the startup code in a way that lets the application choose if/when to initialize WiFi/BT.

Application entry point is now a more familiar `main()` function. This function is executed in its own task. Application may choose to do some initialization from main function, create some tasks and then return from `main`. Simple applications may choose to do all their work from `main`.

Additionally this MR splits event handling code into two parts. 

- One part is a set of standard handlers for WiFi and DHCP events. Most applications will use this set of handlers, and it is made available via new `esp_event_process_default` function. 
- Another part is the default implementation of event handling loop. Some applications may choose to use default event loop through `esp_event_loop_` set of APIs, which start an event handling task and call user-provided event callback from this task. Other applications may create an event queue and implement event loop themselves. In this case application has to provide `esp_event_send` function. In this case the implementation provided by `esp_event_loop_` module is unused.

esp-idf-template has been updated to match this set of changes: https://github.com/espressif/esp-idf-template/tree/feature/init_refactoring
BT example has also been updated.

We need to provide examples of both event handling approaches. This will be done in a separate follow-up MR.

See merge request !112
2016-09-26 17:06:12 +08:00
Ivan Grokhotkov 991fde1f9d compoenents/esp32: don't alias start_cpu1 to start_cpu0_default 2016-09-26 15:58:58 +08:00
Ivan Grokhotkov adfb9fafaa components/freertos: fix a bug with an uninitialised return value
introduced in d63dac0
2016-09-26 15:57:54 +08:00
Angus Gratton 25f6d06e01 Merge branch 'bugfix/spelling_and_crlf_fix_in_panic' into 'master'
Fix a spelling mistake in panic message, add carriage return to stack canary message

Probably the most trivial mr ever, but the spelling error was reported as a bug and the missing \r bugged me ever since I saw it.

See merge request !113
2016-09-26 15:53:05 +08:00
Angus Gratton 46e88e9f24 esptool: Bump upstream revision
Fixes github #14 (unexpected errors writing to DIO flash)

Also speed boost when writing compressed data (can now go via stub)
2016-09-26 17:21:11 +10:00
Ivan Grokhotkov 7cef0308dc Change application entry point name back to app_main 2016-09-26 14:48:41 +08:00
Ivan Grokhotkov dabe53f082 Merge branch 'master' into feature/init_refactoring
* master:
  components/spi_flash: remove stray level of indentation
  components/nvs: fix broken sentences in comment blocks
  Roll back submodule version
  Spinlocks already come initialized. Remove the code that would essentially re-initialize them at runtime
  Remove all references to prvLockQueue / prvUnlockQueue
  components/esp32: clean up unused function warnings in single core mode
  clean up warnings
  components/nvs: fix build, use log library instead of printf
  components/spi_flash: add flash operation counters option to Kconfig
  components/nvs: add erase function
  components/nvs: fix formatting
  components/nvs: batch writes when possible
  components/spi_flash: add performance counters
  components/nvs: maintain item hash list at page level
  components/nvs: avoid reading just-erased page

# Conflicts:
#	components/esp32/cpu_start.c
#	components/esp32/event_default_handlers.c
2016-09-26 14:35:09 +08:00
Ivan Grokhotkov 123788c1ab gitlab-ci: build SSC with matching branch name, if available 2016-09-26 14:17:31 +08:00
Ivan Grokhotkov 1dc7fda812 Merge branch 'feature/nvs_speed_improvement' into 'master'
nvs: speed improvement and erase APIs

NVS initialization speed issue raised in https://ezredmine.espressif.com/issues/6881 has been addressed for single core mode through optimization of `spi_flash_*` routines. This MR addresses same issue for dual core mode.

- An index table is added at Page level, it allows doing fast search of item index based on key name and namespace. This heavily reduces the number of flash reads.
- Write operations are batched when writing/erasing long variable-length values (str and blob). This gives a 33% reduction in the number of writes for a 64-byte value, 50% reduction for a 96-byte value.
- Add optional (configurable via menuconfig) perfomance counters for spi_flash APIs

With these changes, total init time for NVS goes down from 2 seconds to 140 ms.
Additional RAM usage is 128-640 bytes per page, depending on content. Typical RAM usage for current use case (storing wifi configuration parameters) is 256 bytes.

This change also exposes APIs to erase single key or the whole namespaces, needed for https://ezredmine.espressif.com/issues/6769.

See merge request !105
2016-09-26 12:51:01 +08:00
Ivan Grokhotkov bdfd4ec3db components/spi_flash: remove stray level of indentation 2016-09-26 12:47:17 +08:00
Ivan Grokhotkov 6f2ed934d2 components/nvs: fix broken sentences in comment blocks 2016-09-26 12:41:04 +08:00
Ivan Grokhotkov 890fadc394 components/esp32: fix renaming of esp_event_set_cb, minor clean up 2016-09-26 12:35:09 +08:00
Ivan Grokhotkov 62aaec630c components/esp32: remove "_user" part from entry points, weaken start_cpu0/1
With this change applications can override very early part of startup procedure by implementing "start_cpu0" and "start_cpu1" functions.
2016-09-26 12:29:00 +08:00
Jeroen Domburg 14de3a3815 Fix a spelling mistake in panic message, add carriage return to stack canary message 2016-09-26 11:18:43 +08:00
Wangjialin ec45e1a593 components/driver: modify LEDC driver
1. modify ledc struct header: combine high speed and low speed channel
2. modify ledc init function
3. add timer control api
4. modify typo in ledc.h
2016-09-26 09:56:03 +08:00
Angus Gratton 3ccec16706 Merge branch 'bugfix/clean_up_warnings' into 'master'
Clean up warnings and remove unused parts of FreeRTOS

For third party components (lwip and expat), compilation flags are adjusted to silence existing warnings (i have manually checked that all warnings are benign).
In components/esp32, replaced use of WIFI_DEBUG with ESP_LOG functions.

Additionally prvLockQueue/prvUnlockQueue have been removed, dragging some other bits of FreeRTOS along.

Original issue: https://github.com/espressif/esp-idf/issues/18

See merge request !111
2016-09-26 08:16:31 +08:00
Ivan Grokhotkov b190dc3e9f components/lwip,esp32: fixes for C++
- put contents of a few headers into c++ guard blocks
- fix off-by-one error in do_global_ctors
- remove system_init from startup code (should be called from main)
2016-09-26 03:05:25 +08:00
Ivan Grokhotkov 10c69514b7 components/bt: fix compilation, remove ./ from makefile 2016-09-26 01:45:12 +08:00
Ivan Grokhotkov 5a762d9eee components/esp32: clarify type of queue in wifi_init_config_t, add default init macro 2016-09-26 01:35:31 +08:00
Ivan Grokhotkov e9b54b6b45 components/esp32: add ESP_ERROR_CHECK
Convenience macro to do error check and assert in cases when error recovery is not expected
2016-09-26 01:34:05 +08:00
Ivan Grokhotkov 53de9f115f Event handling refactoring
This change separates definitions in esp_event.h and functions in event.c into several parts:
- event structure definitions (esp_event.h)
- default implementations of event handlers (event_default_handlers.c)
- default implementation of event loop (event_loop.c, esp_event_loop.h)

Purpose of this change is to allow applications choose their own poison:
- full control of event loop at the expense of more bootstrap code
- pre-defined event task firing event callbacks, but less code in app_main.c
2016-09-26 01:17:32 +08:00
Ivan Grokhotkov cc8dd46da2 clean up warnings
For third party components (lwip and expat), compilation flags are adjusted to silence existing warnings (i have manually checked that all warnings are benign).
In components/esp32, replaced use of WIFI_DEBUG with ESP_LOG functions.
Only remaining warning is in FreeRTOS queue.c, and it may be a useful one.
2016-09-26 00:52:32 +08:00
Ivan Grokhotkov e1c782a206 components/esp32,bt: fix typos in comments 2016-09-26 00:51:56 +08:00
Ivan Grokhotkov b936441b9b Startup flow refactoring
This change removes implicit WiFi/BT initialization from startup code.
"main" task is started once essential part of startup code is complete.
This task calls application-provided "int main(void)" function, which can call WiFi/BT init functions if necessary.
2016-09-26 00:50:57 +08:00
Ivan Grokhotkov 6818c4c971 Roll back submodule version 2016-09-23 18:08:39 +08:00
Jeroen Domburg b8bfa9fa35 Spinlocks already come initialized. Remove the code that would essentially re-initialize them at runtime 2016-09-23 17:46:16 +08:00
Jeroen Domburg d63dac0320 Remove all references to prvLockQueue / prvUnlockQueue 2016-09-23 17:43:52 +08:00
Wu Jian Gang 4480ab6c8c Merge branch 'feature/btdm_controller' into 'master'
BT support

Initial version of BT support.

BT and WiFi are mutually exclusive at this point, so we have a new option to select which stack is used.
Precompiled BT libraries are added as a submodule.


See merge request !109
2016-09-23 15:26:47 +08:00
Ivan Grokhotkov 6718e321f2 components/esp32: clean up unused function warnings in single core mode 2016-09-23 15:02:17 +08:00
snake 6bb5a93221 add 'extern C' in header files 2016-09-23 14:54:30 +08:00
Wangjialin 3f1c5c4d5b 1. add a macro 'GPIO_IS_VALID_OUTPUT_GPIO' and 'GPIO_IS_VALID_OUTPUT_GPIO' in gpio.h
2. add PIN_FUNC_GPIO in io_mux_reg.h, put the io_mux_regs in order
3. use braces around single line if statements in ledc.c and gpio.c
2016-09-23 14:52:26 +08:00
Ivan Grokhotkov 5e6b2e9c45 clean up warnings
For third party components (lwip and expat), compilation flags are adjusted to silence existing warnings (i have manually checked that all warnings are benign).
In components/esp32, replaced use of WIFI_DEBUG with ESP_LOG functions.
Only remaining warning is in FreeRTOS queue.c, and it may be a useful one.
2016-09-23 14:46:39 +08:00
snake 7b79e4c9ae add .h license header 2016-09-23 11:02:46 +08:00
snake 95c48d4b84 1. clean up the macro. 2. change component/bt/lib url to use new lib 2016-09-23 10:48:55 +08:00
Wangjialin 85cd269ef8 add ledc driver code 2016-09-23 09:21:37 +08:00
Ivan Grokhotkov 1c7508885c components/nvs: fix build, use log library instead of printf 2016-09-23 09:00:28 +08:00
Ivan Grokhotkov f2149eabee components/spi_flash: add flash operation counters option to Kconfig 2016-09-23 08:44:45 +08:00
Ivan Grokhotkov 2a68f60874 components/nvs: add erase function
This change exposes functions to erase single key and to erase all keys from namespace.
TW6769, TW6839
2016-09-23 08:08:03 +08:00
wangmengyang 5383af1e2e BLE ADV Demo 2016-09-22 21:15:54 +08:00
Ivan Grokhotkov e87d80d478 components/nvs: fix formatting 2016-09-22 21:05:47 +08:00
Ivan Grokhotkov 076141aab9 components/nvs: batch writes when possible
Introduces new internal function, Page::alterEntryRangeState, which gathers changes to multiple elements of entry state table into a single write, provided that these changes fall into a single word. This allows changing state of up to 16 entries in a single write.
Also adds new function, writeEntryData, which writes the whole payload of SZ and BLOB type entries in one go, instead of splitting it into multiple 32-byte writes.
This reduces number of writes required for SZ and BLOB entries.
2016-09-22 21:05:17 +08:00
Ivan Grokhotkov 822a9981d8 Merge branch 'master' into feature/btdm_controller
* master:
  esp32/lib: update to f6d55836
2016-09-22 18:40:54 +08:00
Ivan Grokhotkov c6e1d0b30a Kconfig: make WiFi and BT mutually exclusive
Also move memory map options from top-level Kconfig to esp32/Kconfig.
2016-09-22 18:36:23 +08:00
Ivan Grokhotkov bc256cc36d components/bt: add library as submodule 2016-09-22 17:54:19 +08:00
Ivan Grokhotkov db407074f1 components/bt: remove binary library 2016-09-22 17:52:07 +08:00
snake 993287af61 add btdm_controller 1st 2016-09-22 16:40:31 +08:00