Commit graph

73 commits

Author SHA1 Message Date
Ivan Grokhotkov f52952cb45 esp32: panic: do digital reset if cache error interrupt is set
Even if frame->exccause != PANIC_RSN_CACHEERR, it is possible that
the cache error interrupt status is set. For example, this may happen
due to an invalid cache access in the panic handler itself.
Check cache error interrupt status instead of frame->exccause to
decide whether to do CPU reset or digital reset.

Also remove unnecessary esp_dport_access_int_pause from
esp_cache_err_get_cpuid, since the panic handler already calls
esp_dport_access_int_abort on entry.
2019-12-30 09:49:07 +01:00
Ivan Grokhotkov 477e66103c Merge branch 'feature/esp32s2beta_apptrace_port' into 'master'
esp32s2: Adds apptrace support

Closes IDF-510 and IDF-1032

See merge request espressif/esp-idf!5610
2019-11-22 05:33:35 +08:00
chenjianqiang 9f9da9ec96 feat(timer): refator timer group driver
1. add hal and low-level layer for timer group
2. add callback functions to handle interrupt
3. add timer deinit function
4. add timer spinlock take function
2019-11-21 14:14:19 +08:00
Alexey Gerenkov 30ff7198b8 apptrace: Renames Kconfig options 2019-11-13 15:24:01 +03:00
Ivan Grokhotkov 5830f529d8 Merge branch 'master' into feature/esp32s2beta_merge 2019-10-02 19:01:39 +02:00
Roland Dobai 5a916ce126 Support ELF files loadable with gdb 2019-09-24 07:19:50 +00:00
Angus Gratton 438d513a95 Merge branch 'master' into feature/esp32s2beta_merge 2019-09-16 16:18:48 +10:00
Alex Lisitsyn 7ff9538c48 espcoredump: fix issue with spi_flash access
spi_flash has been updated and its functions work from flash by default instead of IRAM that cause issue
add Kconfig value into espcoredump to enable spi_flash legacy mode (CONFIG_SPI_FLASH_USE_LEGACY_IMPL) when core dump is selected
fix spi_flash issues to work correctly with legacy mode when CONFIG_SPI_FLASH_USE_LEGACY_IMPL is used
2019-09-06 15:37:55 +08:00
Angus Gratton 367ecc2d60 Merge branch 'refactor/timerg_in_test' into 'master'
timer_group: refactoring to avoid direct register access in the ISR

See merge request espressif/esp-idf!5656
2019-08-14 15:32:16 +08:00
Michael (XIAO Xufeng) 264ffbeb14 timer_group: use the LL 2019-08-09 13:46:31 +08:00
Mahavir Jain 5203a15439 esp32_gdbstub: fix build error with esp32-2019r1 toolchain
Fixes https://github.com/espressif/esp-idf/issues/3866
2019-08-07 11:56:13 +05:30
Anton Maklakov afbaf74007 tools: Mass fixing of empty prototypes (for -Wstrict-prototypes) 2019-08-01 16:28:56 +07:00
Darian Leung 037c079e9a esp32: Refactor backtrace and add esp_backtrace_print()
This commit refactors backtracing within the panic handler so that a common
function esp_backtrace_get_next_frame() is used iteratively to traverse a
callstack.

A esp_backtrace_print() function has also be added that allows the printing
of a backtrace at runtime. The esp_backtrace_print() function allows unity to
print the backtrace of failed test cases and jump back to the main test menu
without the need reset the chip. esp_backtrace_print() can also be used as a
debugging function by users.

- esp_stack_ptr_is_sane() moved to soc_memory_layout.h
- removed uncessary includes of "esp_debug_helpers.h"
2019-06-19 18:30:18 +08:00
Konstantin Kondrashov 399d2d2605 all: Using xxx_periph.h
Using xxx_periph.h in whole IDF instead of xxx_reg.h, xxx_struct.h, xxx_channel.h ... .

Cleaned up header files from unnecessary headers (releated to soc/... headers).
2019-06-03 14:15:08 +08:00
Roland Dobai 6c0a7a66f3 Rename Kconfig options (components/app_trace) 2019-05-21 09:32:55 +02:00
Roland Dobai 0ae53691ba Rename Kconfig options (components/esp32) 2019-05-21 09:09:01 +02:00
morris f5b03c9ea3 misc adjustment of esp32 component 2019-04-03 19:57:46 +08:00
morris a2f07b0806 move common include files from esp32 into esp_common 2019-03-26 11:57:03 +08:00
morris fcedf442ce move common source files from esp32 to esp_common 2019-03-22 10:35:03 +08:00
morris c159984264 separate rom from esp32 component to esp_rom
1. separate rom include files and linkscript to esp_rom
2. modefiy "include rom/xxx.h" to "include esp32/rom/xxx.h"
3. Forward compatible
4. update mqtt
2019-03-21 18:51:45 +08:00
morris 956c25dedd move esp32 chip specific includes to esp32/xxx.h 2019-03-18 17:14:05 +08:00
Ivan Grokhotkov 37b55a5eb5 esp32: print ELF file SHA256 in panic handler 2019-02-27 13:30:25 +08:00
Ivan Grokhotkov 04c511c9b5 panic: dump some instruction memory on IllegalInstruction exception 2018-12-07 16:50:00 +08:00
Roland Dobai d4e572bdb1 esp32: Add macro to check a condition without abort
Closes https://github.com/espressif/esp-idf/issues/2325
2018-10-09 08:57:23 +02:00
Ivan Grokhotkov 90f5456dba Merge branch 'feature/rtc_cpu_freq_config' into 'master'
soc/rtc: Refactoring, support CPU frequencies lower than XTAL

See merge request idf/esp-idf!2856
2018-08-22 11:32:08 +08:00
Ivan Grokhotkov bec70ce298 esp32: use new CPU frequency setting API 2018-08-21 13:02:46 +08:00
Ivan Grokhotkov 0aa384d40c esp32: add API to get reset reason 2018-08-20 16:49:20 +08:00
Konstantin Kondrashov a8e46775c6 soc/rtc_wdt: Add API functions for rtc_wdt
Added functions:
rtc_wdt_protect_off/on
rtc_wdt_set_length_of_reset_signal
rtc_wdt_set_stage
rtc_wdt_set_time
rtc_wdt_feed
rtc_wdt_disable/enable
2018-08-14 17:48:02 +05:00
Ivan Grokhotkov 2f7d327978 panic: remove extra newline 2018-06-15 15:49:23 +08:00
Roland Dobai 07acbb5664 ESP_ERROR_CHECK converts error code to text
If CONFIG_ESP_ERR_TO_NAME_LOOKUP is enabled, ESP_ERROR_CHECK
prints error message in addition to the error code.
2018-05-31 12:53:37 +02:00
Jack 624828ce83 Dump the frame of the other core when interrupt watchdog happens 2018-01-18 23:10:29 +00:00
Ivan Grokhotkov 8e8cb1a139 panic: prevent INT WDT from re-triggering in OCD mode
When INT WDT fires, panicHandler is invoked. In OCD mode, panicHandler
sets a breakpoint on the PC from the exception frame and returns.
However in case of INT WDT, interrupt flag is still set in TIMERG1
peripheral, which causes INT WDT to trigger again. This causes an
endless stream of "Core  0 panic'ed (Interrupt wdt timeout on CPU1)"
messages. OpenOCD also gets terribly confused at this point.

Disable watchdogs when exiting panic handler in OCD mode.
Clear TIMERG1 WDT interrupt flag to prevent re-entry into panic handler.
2018-01-09 01:46:24 +08:00
houchenyao f80824a2d8 test: support test for UT cases expect to reset 2017-11-07 12:19:39 +08:00
Jeroen Domburg b3fd494e71 Panic: stop dport access handler without trying to use a lock 2017-09-11 17:24:22 +08:00
Alexey Gerenkov fb8b0c534a esp32: Fixes infinite loop caused by exception during core dumping 2017-09-05 11:15:27 +08:00
Ivan Grokhotkov 65b046f17f dport access: introduce pause/resume instead of deinit 2017-09-01 10:36:14 +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 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
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 9b955f4c9f Merge branch 'feature/sysview_via_apptrace' into 'master'
sysview via apptrace

See merge request !708
2017-06-29 08:40:13 +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
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
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
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
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
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
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
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
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 a8f1918d88 panic handler: access exception frame members via struct fields 2017-04-13 15:27:38 +08:00