1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

20 Commits

Author SHA1 Message Date
M Hightower
831d6431bc Add typedef for putc1, fn_putc1_t. (#6550)
* Add typedef for putc1, fn_putc1_t.
Replaced relevant usage of `(void *)` with `fn_putc1_t`.
Correct usage of `ets_putc()`, returning 0, in libc_replacement.cpp
This PR assumes PR https://github.com/esp8266/Arduino/pull/6489#issue-315018841 has merged and removes `uart_buff_switch` from `umm_performance.cpp`
Updated method of defining `_rom_putc1` to be more acceptable (I hope) to the new compiler.

* Use PROVIDE to expose ROM function entry point, ets_uart_putc1.
Added comments to ets_putc() and ets_uart_putc1() to explain their
differences. Change prototype of ets_putc() to conform with fp_putc_t.
Updated _isr_safe_printf_P to use new definition, ets_uart_putc1.
2019-09-27 14:23:16 -07:00
M Hightower
127199ab6d proposed umm_malloc improvements (#6274)
*   Correct critical section with interrupt level preserving and nest support
  alternative. Replace ets_intr_lock()/ets_intr_unlock() with uint32_t
  oldValue=xt_rsil(3)/xt_wrs(oldValue). Added UMM_CRITICAL_DECL macro to define
  storage for current state. Expanded UMM_CRITICAL_... to  use unique
  identifiers. This helpt facilitate gather function specific  timing
  information.

  Replace printf with something that is ROM or IRAM based so that a printf
  that occurs during an ISR malloc/new does not cause a crash. To avoid any
  reentry issue it should also avoid doing malloc lib calls.

  Refactor realloc to avoid memcpy/memmove while in critical section. This is
  only effective when realloc is called with interrupts enabled. The copy
  process alone can take over 10us (when copying more than ~498 bytes with a
  80MHz CPU clock). It would be good practice for an ISR to avoid realloc.
  Note, while doing this might initially sound scary, this appears to be very
  stable. It ran on my troublesome sketch for over 3 weeks until I got back from
  vacation and  flashed an update. Troublesome sketch - runs ESPAsyncTCP, with
  modified fauxmo emulation for 10 devices. It receives lost of Network traffic
  related to uPnP scans, which includes lots of TCP connects disconnects RSTs
  related to uPnP discovery.

  I have clocked umm_info critical lock time taking as much as 180us. A common
  use for the umm_info call is to get the free heap result. It is common
  to try and closely monitor free heap as a method to detect memory leaks.
  This may result in frequent calls to umm_info. There has not been a clear
  test case that shows an issue yet; however, I and others think they are or
  have had crashes related to this.

  I have added code that adjusts the running free heap number from _umm_malloc,
  _umm_realloc, and _umm_free. Removing the need to do a long interrupts
  disabled calculation via _umm_info.

  Build optional, min/max time measurements for locks held while in info,
  malloc, realloc, and free. Also, maintain a count of how many times each is
  called with INTLEVEL set.

* Fixed. travis build complaint.

* Changes for https://github.com/esp8266/Arduino/pull/6274#pullrequestreview-259579883

* Added requested comment and missing comment for UMM_CRITICAL_PERIOD_ANALYZE.

* Updated comments and update xt_rsil()

* Moved xt_rsil&co (pulled in __STRINGIFY) definitions out of
Arduino.h, to cores/esp8266/core_esp8266_features.h
Added esp_get_cycle_count() to core_esp8266_features.h.
Updated umm_malloc and Esp.h to use new defines and location.

* Added "#ifndef CORE_MOCK" around conflicted area.

* Moved performance measurment and ESP specific definitions to
umm_performance.h/cpp. Removed testing asserts.

* Commented out umm analyze. Delay CRITICAL_SECTION_EXIT() in
umm_realloc() to avoid exposing a transient OOM condition to ISR.

* Missed file change. This commit has: Delay CRITICAL_SECTION_EXIT() in
umm_realloc() to avoid exposing a transient OOM condition to ISR.

* 2nd Path. Removed early release of critical section around memmove
to avoid a possible OOM for an ISR.

* improved variable name

* Resolved ISR OOM concern with `_umm_realloc()`

Updated realloc() to do a preliminary free() of unused space,
before performing a critical section exit and memmove.
This change was applied to the current _umm_realloc().
This change should reduce the risk of an ISR getting an
OOM, during a realloc memmove operation.
Added additional stats for verifying correct operation.

* Resolved ISR OOM concern in _umm_realloc()

Updated realloc() to do a preliminary free() of unused space,
before performing a critical section exit and memmove.
This change was applied to the current _umm_realloc().
This change should reduce the risk of an ISR getting an
OOM when interrupting an active realloc memmove operation.
Added additional stats for verifying correct operation.
Updated: for clarity and Travis-CI fail.

* Update to keep access to alternate printf in one file.

* Updated to use ISR safe versions of memmove, memcpy, and memset.

The library versions of memmove, memcpy, and memset were in flash.
Updated to use ROM functions ets_memmove, ets_memcpy, and ets_memset.
Additional note, the library version of memmove does not appear to
have been optimized. It took almost 10x longer than the ROM version.
Renamed printf macro to DBGLOG_FUNCTION and moved to umm_malloc_cfg.h.
Changed printf macro usage to use DBGLOG_FUNCTION.

* Update umm_malloc.cpp

Fix comment
2019-08-18 20:48:23 -04:00
Ivan Grokhotkov
5d5ea92a4d
Move continuation stack from .bss onto sys stack (#4622) 2018-04-18 11:19:49 +08:00
Develo
a2d16f38d4
Extern C blocks (#1352) (#4044)
* Add extern C guard blocks to SDK header files #1352

* fixed some extern C blocks in core and libraries
2017-12-30 02:03:26 -03:00
Ivan Grokhotkov
e04903225e sdk: update to v2.1.0-10-g509eae8 2017-10-15 01:40:10 -05:00
Ivan Grokhotkov
4c587e28bc Fix Exception 2 when using printf or vprintf
ets_vprintf signature is not the same as vprintf, it takes an output function as a first argument.
2016-04-17 02:12:01 +03:00
Me No Dev
bfe9f7be69 Update and move lwIP headers, add options to use different lwIP build for generic device
Makefile added to lwip source folder to build and install liblwip_gcc.a
2016-04-10 21:55:22 +03:00
Ivan Grokhotkov
477e9cfb8a Update SDK to 1.5.2 (#1653)
patch included: http://bbs.espressif.com/viewtopic.php?f=46&t=1856
2016-03-29 17:24:37 +03:00
Ivan Grokhotkov
b66ddbf93a Update to SDK 1.5 (#1102) 2015-12-17 23:14:59 +03:00
Makuna
57642c10b6 Interrupt cleanup
Fixes issue of reentrant calls to nointerrupts()
exposed functional replacements to cli sei and SREG when dealing with
interrupts
InterruptLock class to auto stop and restore interrupt level
Fix user ISR calls to be like Arduino with interrupts disabled fully.
2015-08-03 19:35:17 -07:00
Ivan Grokhotkov
e5d2ba5db8 Pass timeout to optimistic_yield, add cont_can_yield check 2015-07-20 15:48:25 +03:00
Makuna
0b2fb8d3ee never yield within an ISR 2015-07-15 15:06:41 -07:00
Markus Sattler
d4ddb66fc4 update SDK to v1.2.0_15_07_03 2015-07-07 18:09:23 +03:00
John Doe
8ba054c6b0 readd wrongly deleted definition 2015-06-16 13:22:00 +03:00
John Doe
56bb877ef0 add SLC interrupt routines 2015-06-16 01:09:16 +03:00
Markus Sattler
7c45873ffb update to SDK 1.1.1_15_06_05 2015-06-06 13:48:53 +02:00
John Doe
6ab3c76e03 register and clock changes 2015-06-02 00:11:20 +03:00
Makuna
3c3bc0f523 Timer0 and Servo library support
This exposes the Timer0
This provides a Servo library support compatible with Arduino Servo
library but only supports the two timers the esp8266 has available
2015-05-29 13:30:15 -07:00
Markus Sattler
f18bb28813 fix bug #343
add __attribute__ to printf functions for better compiler warning handling.
remove ICACHE_FLASH_ATTR, all cpp files are automatic in FLASH (ld script)
2015-05-28 18:58:09 +02:00
Ivan Grokhotkov
870b8b9478 Move tools to platform directory 2015-05-18 16:04:30 +03:00