Commit Graph

152 Commits

Author SHA1 Message Date
Cao Sen Miao
8cc9260f86 ESP32H2: Add system support for ESP32H2 2022-12-07 11:38:51 +08:00
Song Ruo Jing
56302544f6 Merge branch 'ci/enable_esp32c6_target_test_stage' into 'master'
CI: Enable esp32c6 target test stage

Closes IDF-5830 and IDF-5831

See merge request espressif/esp-idf!21010
2022-11-29 19:54:05 +08:00
KonstantinKondrashov
f6f173e3d3 esp_timer: Fix tests for C2 chip 2022-11-28 20:02:06 +08:00
Song Ruo Jing
7466ddfa8c ci: Make consistence between pytest_*.py and .build-test-rules.yml for esp32c6 (i.e. to pass check_test_scripts_build_test_rules.py) 2022-11-28 11:58:30 +08:00
morris
560ea9b754 systimer: support etm event 2022-11-23 15:32:34 +08:00
KonstantinKondrashov
54b06ecb62 esp_timer: Fix the stop alarm triggering when the timer list is empty
Related to ESP32-C6 chip only because this chip can power down the digital domain
during the light sleep. And after wakes up, systimer gets resumed,
and the alarm value < count value, so it leads the alarm fired immediately.
We get one unnecessary interrupt at light sleep exit time.

Other chips do not power down the digital domain related to systimer.
2022-11-17 14:32:16 +00:00
Kevin (Lao Kaiyao)
5bed8fab49 Merge branch 'refactor/rename_h2_to_h4' into 'master'
esp32h2: renaming esp32h2 to esp32h4

Closes IDF-6098

See merge request espressif/esp-idf!20676
2022-11-09 19:19:43 +08:00
Marius Vikhammer
8d24aa1760 ci: fix esp_timer 26 MHz not being assigned to correct runner 2022-11-09 12:30:46 +08:00
Marius Vikhammer
e9671ee04f esp_timer: fix ESP_TIMER_ISR dispatch method due to off by one error 2022-11-09 11:17:35 +08:00
laokaiyao
8677216576 esp32h2: renaming esp32h2 to esp32h4 2022-11-08 17:05:33 +08:00
KonstantinKondrashov
9f41525d99 esp_timer: Migrate esp_timer unit tests from unit-test-app to component test app 2022-11-05 22:53:38 +08:00
Martin Vychodil
c9c7573f71 Storage: Partition APIs moved to the new component 'esp_partition'
All the partition handling API functions and data-types were moved from the 'spi_flash' component to the new one named 'esp_partition'. See Storage 5.x migration guide for more details
2022-11-02 21:54:45 +01:00
Omar Chebib
c8614a0dbf esp_timer: add a function to restart timer
Timers, periodic or not, can now be restarted thanks to esp_timer_restart function.
This is done atomically, which can be used to feed a periodic timer, or simply change the period.
2022-10-18 04:42:27 +00:00
Omar Chebib
30d12af191 TWDT: refactor the TWDT to be driver agnostic
This refactoring brings a private API for the TWDT implementation, which
can now use a hardware timer (Timer Group) or a software timer (esp_timer)
2022-09-15 14:37:59 +08:00
Omar Chebib
53c7dd4efc WDT: implement interrupt wdt and task wdt for ESP32-C2
ESP32-C2 has a single group timer, thus it will use it for the interrupt watchdog,
which is more critical than the task watchdog. The latter is implement in
software thanks to the `esp_timer`component.
2022-09-15 14:37:59 +08:00
wuzhenghui
308e4dcbfa esp32c6: add esp_timer support 2022-09-06 09:13:20 +00:00
Darian Leung
a73dd07d12 esp_hw_support: Fix esp_light_sleep_start() deadlock
esp_light_sleep_start() will stall the other CPU via esp_ipc_isr_stall_other_cpu(). After stalling the other CPU,
will call esp_clk_... API which themselves take locks. If the other stalled CPU is holding those locks, this will
result in a deadlock.

This commit adds a workaround calling esp_clk_private_lock() to take the lock before stalling the other CPU.
2022-08-10 18:52:32 +08:00
Ivan Grokhotkov
401c10ecfb build system: re-add -Wno-format as private flag for some components 2022-08-03 16:42:47 +04:00
laokaiyao
4ab8f00b47 ci: setup 26mhz esp32c2 runner 2022-07-29 17:10:34 +08:00
morris
d94432fea8 systimer: refactor hal to accomodate more xtal choices 2022-07-25 16:08:52 +08:00
Jakob Hasse
1f75fc0aa1 bugfix (esp_timer): made os spinlock static 2022-07-19 15:35:32 +08:00
Ivan Grokhotkov
bb771fb7c4
esp_timer: perform initialization using ESP_SYSTEM_INIT_FN
(startup.c still calls esp_timer_early_init directly)
2022-07-12 16:58:15 +02:00
Ivan Grokhotkov
5b54ae76d4 esp_timer, hal: add support for non-integer systimer frequency
When ESP32-C2 is paired with a 26 MHz XTAL, the systimer tick
frequency becomes equal to 26 / 2.5 = 10.4 MHz. Previously we always
assumed that systimer tick frequency is integer (and 1 MHz * power of
two, above that!).
This commit introduces a new LL macro, SYSTIMER_LL_TICKS_PER_US_DIV.
It should be set in such a way that:

1. SYSTIMER_LL_TICKS_PER_US / SYSTIMER_LL_TICKS_PER_US_DIV equals the
   actual systimer tick frequency,
2. and SYSTIMER_LL_TICKS_PER_US is integer.

For ESP32-C2 this means that SYSTIMER_LL_TICKS_PER_US = 52 and
SYSTIMER_LL_TICKS_PER_US_DIV = 5.

This introduced two possible issues:

1. Overflow when multiplying systimer counter by 5
   - Should not be an issue, since systimer counter is 52-bit, so
     counter * 5 is no more than 55-bit.
2. The code needs to perform:
   - divide by 5: when converting from microseconds to ticks
   - divide by 52: when converting from ticks to microseconds
   The latter potentially introduces a performance issue for the
   esp_timer_get_time function.
2022-07-11 12:24:37 +08:00
Cao Sen Miao
a690a87829 spi_flash: Remove legacy spi_flash drivers 2022-07-01 11:01:34 +08:00
jingli
30e7af2ffb system/sleep: simplify code for time compensation when wakeup from light sleep 2022-06-14 14:49:26 +08:00
Michael (XIAO Xufeng)
6a8aed12ee ci: partially enable ut tests for esp32c2
Disabled test cases are tracked in:

 IDF-4465, IDF-5045, IDF-5057, IDF-5058, IDF-5059, IDF-5060, IDF-5061, IDF-5131

- test_fatfs: IDF-5136

- test_pm: IDF-5053

- test_cache_mmu: IDF-5138

- test_partitions: IDF-5137

- test_vfs: IDF-5139

- test_freertos: IDF-5140

- test_wpa_supplicant: IDF-5046

- test_mbedtls: IDF-5141

- test_pthread: IDF-5142

- test_protocomm: IDF-5143

- test_lightsleep: IDF-5053

- test_taskwdt: IDF-5055

- test_tcp_transport: IDF-5144

- test_app_update: IDF-5145

- test_timer: IDF-5052

- test_spi: IDF-5146

- test_rtc_clk: IDF-5060

- test_heap: IDF-5167

ci: fixed issues for tests of libgcc, ets_timer, newlib

test_pm: support on C2
2022-06-02 14:23:35 +08:00
KonstantinKondrashov
ac4c7d99fe dport: Move DPORT workaround to G0 2022-05-31 13:44:18 +08:00
Marius Vikhammer
cf1b222cac build system: removed target component
After refactoring the target components (e.g. esp32) no longer contained any real functionality.
What remained in these components have been moved elsewhere and the component itself deleted from the
build system.
2022-05-24 09:12:59 +08:00
Ivan Grokhotkov
708e99497b
global: add dependency on esp_timer component and include esp_timer.h
Some components were including esp_timer.h without declaring a
dependency on esp_timer component. This used to work due to a
transitive public dependency on esp_timer from freertos component.
Add explicit dependencies where needed.
Also some source files were using esp_timer functions without
including the header file. This used to work because esp_timer.h was
included from freertos port header file. This commit adds esp_timer.h
includes where needed.
2022-04-25 18:39:23 +02:00
Anton Maklakov
bbe2bb9994 components: correct abs() use for 64-bit argument 2022-04-21 12:22:15 +07:00
songruo
60bb5c913d clk_tree: prework of introducing clk subsystem control
1. Clean up clk usage in IDF, replace rtc_clk_xtal/apb_freq_get with
   upper level API esp_clk_xtal/apb_freq
2. Fix small errors and wrong comments related to clock
3. Add clk_tree_defs.h to provide an unified clock id for each chip
   Modify the NGed drivers to adopt new clock ids
2022-04-11 12:09:06 +08:00
Marius Vikhammer
a6543f0d21 docs: fix broken references to misc API functions and types. 2022-03-27 16:46:57 +08:00
Laukik Hase
c5decf291e ci: Fix for ETSTimers arm & disarm run from IRAM UT
- For ESP32 | SPIRAM_MALLOC_ALWAYSINTERNAL=0
- Forced `esp_timer_create` to allocate resource from the internal memory
- WiFi/BT coexistence will sometimes arm/disarm timers from an ISR
  where flash may be disabled. This can lead to a cache-based
  exception as the timer instance will be located in the PSRAM.
2022-03-10 05:01:17 +00:00
Sudeep Mohanty
a9fda54d39 esp_hw_support/esp_system: Re-evaluate header inclusions and include directories
This commit updates the visibility of various header files and cleans up
some unnecessary inclusions. Also, this commit removes certain header
include paths which were maintained for backward compatibility.
2022-03-07 11:18:08 +05:30
Marius Vikhammer
edb76f14d6 esp_timer: remove legacy ESP32 FRC timer implementation. 2022-02-10 15:17:49 +08:00
Anton Maklakov
3a04b712fa Merge branch 'bugfix/fix_abs_using' into 'master'
build: fix abs() use

See merge request espressif/esp-idf!16952
2022-02-10 05:18:32 +00:00
morris
ef00bd59dc esp_rom: extract int matrix route and cpu ticks getter 2022-02-09 13:52:20 +08:00
Anton Maklakov
8bb06df68f components: correct abs() use for unsigned and 64-bit arguments 2022-01-29 12:07:16 +07:00
laokaiyao
cf049e15ed esp8684: rename target to esp32c2 2022-01-19 11:08:57 +08:00
Mahavir Jain
203f82cc49 Fix various warnings generated from Coverity scan
esp_timer:
Control flow issues  (DEADCODE)
    Execution cannot reach this statement: "break;".

protocomm_httpd:
(UNUSED_VALUE)
    Assigning value from "cookie_session_id" to "cur_cookie_session_id" here, but that stored value is overwritten before it can be used.

esp_flash_api:
Null pointer dereferences  (REVERSE_INULL)
    Null-checking "chip" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
2021-12-09 09:38:53 +05:30
Cao Sen Miao
eddc196081 esp_clk: refactor target/clk.h to private/esp_clk.h 2021-11-26 14:56:30 +08:00
morris
2e008825a9 Merge branch 'feat/rm_makefiles' into 'master'
Build & config: Remove leftover files from the unsupported make build system

Closes IDF-4273 and IDF-2827

See merge request espressif/esp-idf!15829
2021-11-16 03:44:41 +00:00
Roland Dobai
766aa57084 Build & config: Remove leftover files from the unsupported "make" build system 2021-11-11 15:32:36 +01:00
Sudeep Mohanty
5806e57773 esp_timer: Added esp_timer_get_period/expiry_time APIs
Added the following new APIs to the esp_timer module:
- esp_timer_get_period(): Returns the period of a timer in microseconds.
- esp_timer_get_expiry_time(): Returns the timeout value of a one-shot timer in microseconds.

Signed-off-by: Sudeep Mohanty <sudeep.mohanty@espressif.com>
2021-11-11 15:13:05 +05:30
morris
16677b0d3c global: make periph enable/disable APIs private
peripheral enable/disable usually should be managed by driver itself,
so make it as espressif private APIs, not recommended for user to use it
in application code.
However, if user want to re-write the driver or ports to other platform,
this is still possible by including the header in this way:
"esp_private/peripheral_ctrl.h"
2021-11-08 10:37:47 +08:00
Cao Sen Miao
5add6593f4 ESP8684: Add esp_gdbstub, mbedtls, esp_timer 2021-11-06 17:33:45 +08:00
Cao Sen Miao
b0123199da esp_timer: init rtc timer and system timer in early init 2021-10-26 19:07:34 +08:00
Ivan Grokhotkov
249abb3fe8 esp_timer: allow querying the timer before esp_timer_init is called 2021-10-26 19:07:34 +08:00
Andrei Safronov
9159aa58d3 tests: refactoring of the gcc's inner functions, because clang doesn't support them 2021-09-10 19:51:27 +03:00
Konstantin Kondrashov
29f581fc70 freertos(esp32s3): SysTick uses systimer 2021-08-04 20:33:44 +08:00
Jiang Jiang Jian
97507ebe49 Merge branch 'feature/support_esp32s3_lightsleep' into 'master'
support esp32s3 normal lightsleep

See merge request espressif/esp-idf!14369
2021-07-28 15:09:37 +00:00
Li Shuai
3c30099327 light sleep: add esp_timer light sleep test case 2021-07-28 15:44:02 +08:00
KonstantinKondrashov
c19b37d2a9 esp_system: Adds sync of FRC & RTC counters in esp_restart
In case when FRC and RTC counters are very different then
the need to sync them before to restart the ESP
to get the correct system time after reboot.
2021-07-21 10:23:24 +05:00
Shu Chen
6fce2930d0 esp32h2: enable more components to support esp32h2
Involved components:
 * app_trace
 * esp-tls
 * esp_adc_cal
 * esp_pm
 * esp_serial_slave_link
 * esp_timer
 * freertos
 * idf_test
 * log
 * mbedtls
 * newlib
 * perfmon
 * spi_flash
 * spiffs
 * ulp
 * unity
 * vfs
2021-07-01 19:53:11 +08:00
Rahul Tank
3159ba1d5a Add esp_timer_is_active function for Nimble stack to use esp_timer instead of FreeRTOS timer 2021-06-30 10:06:40 +05:30
KonstantinKondrashov
f9ad16bb66 esp_timer: Timers with skip_unhandled_events option won't wake up system from light sleep 2021-06-19 12:45:17 +08:00
morris
988c88a6b1 systimer: optimise esp_timer_get_time 2021-04-26 11:54:02 +08:00
morris
ec898b771e systimer: strip hal driver 2021-04-22 21:08:39 +08:00
Marius Vikhammer
b4d2fb56a0 ci: enable previously disabled unit tests 2021-03-29 18:36:41 +08:00
Renz Bagaporo
d7e9567c00 esp_system, esp_timer: fix time function description 2021-03-25 15:47:19 +08:00
Renz Bagaporo
74de5a7c58 esp_timer: correct startup time 2021-03-25 15:38:27 +08:00
Marius Vikhammer
91439e3818 docs: updated system api-reference chapters for C3 2021-03-15 18:51:12 +08:00
KonstantinKondrashov
7bbf4a3422 esp_timer: Fix Test ESP_TIMER_ISR dispatch method is not blocked 2021-02-24 16:08:17 +08:00
Angus Gratton
fb1488abba Merge branch 'feature/esp_timer_isr_dispatch_method_restore' into 'master'
esp timer: Add ISR dispatch method

Closes IDF-1172 and IDF-1173

See merge request espressif/esp-idf!11572
2021-02-23 06:21:14 +00:00
Marius Vikhammer
451465ff8c esp_timer: fix "esp_timer orders timers correctly" headerline handling
Discard header lines from esp_timer_dump that comes before the actual timer
info. "esp_timer orders timers correctly" would crash when reading the header lines.
2021-02-18 11:59:42 +08:00
Sachin Parekh
296d10e675 esp_timer: Label each column of timer dump 2021-02-11 18:40:51 +05:30
KonstantinKondrashov
63d4911cdb esp_timer: Add ESP_TIMER_ISR dispatch method
Using own spinlock for each list (TASK and ISR disp method)
Reduced the dependency of ISR on the TASK dispatch method
2021-02-08 19:10:11 +08:00
KonstantinKondrashov
bcbee89030 esp_timer: Add a Kconfig option to configure the interrupt level 2021-02-08 18:27:10 +08:00
Marius Vikhammer
9c8e4fd4c5 C3: build and run unit tests
Enable building and running of unit tests in CI for C3 as well as fix
related compile errors

Also enables building of C3 test apps
2021-01-11 11:34:37 +08:00
ninh
e908a32381 put pm_slp_iram_opt and pm_rtos_iram_opt related attributes in esp_pm/linker.lf 2021-01-06 03:40:28 +00:00
Liu Ning
57aa65eeed components/pm: Add sleep related code iram opt chioce 2020-12-23 14:45:36 +08:00
KonstantinKondrashov
aa96c9a4d8 esp_timer: Add an option to skip unhandled events for periodic timers
- Added an option to skip unhandled events for periodic timers. Useful for light sleep.
- Added doc about this case
- Added Test a latency between a call of callback and real event (14-16us). and UT to check skip_unhandled_events.
- Fixed for esp_timer_dump() if name of timer is NULL
- Refactored timer_process_alarm()
- Added the delete function after using in UTs
2020-12-09 17:19:19 +08:00
Angus Gratton
5228d9f9ce esp32c3: Apply one-liner/small changes for ESP32-C3 2020-12-01 10:58:50 +11:00
Angus Gratton
7c08be5771 hal: Add initial ESP32-C3 support
From internal commit 7761d6e8
2020-11-30 15:23:15 +11:00
Angus Gratton
420aef1ffe Updates for riscv support
* Target components pull in xtensa component directly
* Use CPU HAL where applicable
* Remove unnecessary xtensa headers
* Compilation changes necessary to support non-xtensa gcc types (ie int32_t/uint32_t is no
  longer signed/unsigned int).

Changes come from internal branch commit a6723fc
2020-11-13 07:49:11 +11:00
Angus Gratton
66fb5a29bb Whitespace: Automated whitespace fixes (large commit)
Apply the pre-commit hook whitespace fixes to all files in the repo.

(Line endings, blank lines at end of file, trailing whitespace)
2020-11-11 07:36:35 +00:00
KonstantinKondrashov
e0d0200aed esp_timer: Use Task Notification instead of semaphore 2020-11-06 06:43:22 +00:00
Angus Gratton
4df4bd9558 Merge branch 'bugfix/clock_getres_accuracy_resolution' into 'master'
newlib: Fix clock_getres() improves accuracy

See merge request espressif/esp-idf!10743
2020-10-22 16:50:29 +08:00
Angus Gratton
e5f06d7f47 Merge branch 'feature/esp32s3_support_gettimeofday' into 'master'
time: Fix gettimeofday for ESP32-S3

See merge request espressif/esp-idf!10871
2020-10-20 14:09:36 +08:00
Konstantin Kondrashov
9386cafbc3 time: Fix gettimeofday for ESP32-S3 2020-10-20 14:09:32 +08:00
Michael (XIAO Xufeng)
1966f00f0b soc: updates caps usage
We should define caps as 1 if true. When use the caps macros, #if and
 #if ! should be used instead of #ifdef/#ifndef.
2020-10-17 16:10:17 +08:00
KonstantinKondrashov
7ae7adf16a newlib: Fix clock_getres() improves accuracy
Returns not rounded value of resolution for WITH_RTC and !WITH_FRC
2020-10-07 18:01:35 +08:00
Renz Bagaporo
f33f49331f ci: update configs to include/exclude esp_pm in unit test 2020-09-25 05:24:10 +00:00
morris
cc66334014 esp_timer: initial support on esp32-s3 2020-09-22 15:15:03 +08:00
morris
75a372a9f0 unit_test: support reference clock, test delay function 2020-09-22 15:15:03 +08:00
morris
61f89b97c6 bringup esp32-s3 on FPGA 2020-09-22 15:15:03 +08:00
Ivan Grokhotkov
4fe7a58a60 Merge branch 'bugfix/config_pm_use_rtc_timer_ref' into 'master'
esp_timer: fix CONFIG_PM_USE_RTC_TIMER_REF option usage

Closes IDFGH-2958

See merge request espressif/esp-idf!8399
2020-09-15 00:41:16 +08:00
Ivan Grokhotkov
0acf94f10f esp_timer: fix CONFIG_PM_USE_RTC_TIMER_REF option usage
Also remove PM_USE_RTC_TIMER_REF in esp32s2, since this option is only
used in FRC implementation of esp_timer.

Closes https://github.com/espressif/esp-idf/issues/4991
2020-09-04 19:19:26 +00:00
Jakob Hasse
20c068ef3b cmock: added cmock as component
* changing dependencies from unity->cmock
* added component.mk and Makefile.projbuild
* ignore test dir in gen_esp_err_to_name.py
* added some brief introduction of CMock in IDF
2020-09-02 16:38:37 +08:00
Renz Bagaporo
e70f240e12 esp_timer: do init check in timer implementation 2020-09-01 15:01:11 +08:00
Renz Bagaporo
c70c227591 esp_system: private system time functions for now 2020-08-11 17:52:36 +08:00
Renz Bagaporo
da88671491 esp_system: link time, not runtime, dependency on esp_timer 2020-08-11 17:52:36 +08:00
Renz Bagaporo
346cf4430d esp_system: introduce system time functions
- Introduce system time function and concept of system time provider.
esp_timer is system time provider when present.
- Set the reference point for system time, g_startup_time.
- Use the system time functions in newlib instead of calling esp_timer
functions directly
2020-08-10 15:12:38 +08:00
morris
2917651478 esp_rom: extract common ets apis into esp_rom_sys.h 2020-07-27 15:27:01 +08:00
Krzysztof
f925da9179 docs: correct function description following https://esp32.com/viewtopic.php?f=5&t=16332 2020-06-30 17:56:03 +02:00
Angus Gratton
084e170a8f Merge branch 'refactor/esp_ipc' into 'master'
Split esp_ipc to a seaparate component

Closes IDF-1295

See merge request espressif/esp-idf!8520
2020-05-25 15:03:04 +08:00
Darian Leung
11d96b39d0 esp_ipc: Move to new component
This commit moves esp_ipc into a separate component.
2020-05-18 16:51:45 +08:00
David Cermak
f13f8927b1 esp-timer: fix (ignore) false positive memory alloc/free issue found by static analyser 2020-05-13 07:30:26 +02:00
morris
890fc0fe67 esp_timer: alias esp_timer_get_time
alias esp_timer_get_time to improve performance
2020-04-01 16:51:43 +08:00
morris
2d1885b906 systimer: add HAL layer 2020-04-01 16:51:43 +08:00