From 479af576ca7c7c7711a68ca5793d4b3efa6287b5 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 7 Aug 2018 16:03:23 +0300 Subject: [PATCH] ulp: fix calculation or ulp_run argument The argument to ulp_run should be expressed in 32-bit words. Both the address of ulp_entry and RTC_SLOW_MEM already are uint32_t*, so their difference is the difference in addresses divided by sizeof(uint32_t). Therefore the extra division by sizeof(uint32_t) is not needed. --- docs/en/api-guides/ulp.rst | 2 +- examples/system/ulp/main/ulp_example_main.c | 2 +- examples/system/ulp_adc/main/ulp_adc_example_main.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/en/api-guides/ulp.rst b/docs/en/api-guides/ulp.rst index 9f913ff81..a5e54d062 100644 --- a/docs/en/api-guides/ulp.rst +++ b/docs/en/api-guides/ulp.rst @@ -134,7 +134,7 @@ Each ULP program is embedded into the ESP-IDF application as a binary blob. Appl Once the program is loaded into RTC memory, application can start it, passing the address of the entry point to ``ulp_run`` function:: - ESP_ERROR_CHECK( ulp_run((&ulp_entry - RTC_SLOW_MEM) / sizeof(uint32_t)) ); + ESP_ERROR_CHECK( ulp_run(&ulp_entry - RTC_SLOW_MEM) ); .. doxygenfunction:: ulp_run diff --git a/examples/system/ulp/main/ulp_example_main.c b/examples/system/ulp/main/ulp_example_main.c index c03ab20ee..74c4febe4 100644 --- a/examples/system/ulp/main/ulp_example_main.c +++ b/examples/system/ulp/main/ulp_example_main.c @@ -87,7 +87,7 @@ static void init_ulp_program() ulp_set_wakeup_period(0, 20000); /* Start the program */ - err = ulp_run((&ulp_entry - RTC_SLOW_MEM) / sizeof(uint32_t)); + err = ulp_run(&ulp_entry - RTC_SLOW_MEM); ESP_ERROR_CHECK(err); } diff --git a/examples/system/ulp_adc/main/ulp_adc_example_main.c b/examples/system/ulp_adc/main/ulp_adc_example_main.c index 29d8eac9a..fd7d4ef43 100644 --- a/examples/system/ulp_adc/main/ulp_adc_example_main.c +++ b/examples/system/ulp_adc/main/ulp_adc_example_main.c @@ -89,6 +89,6 @@ static void start_ulp_program() ulp_sample_counter = 0; /* Start the program */ - esp_err_t err = ulp_run((&ulp_entry - RTC_SLOW_MEM) / sizeof(uint32_t)); + esp_err_t err = ulp_run(&ulp_entry - RTC_SLOW_MEM); ESP_ERROR_CHECK(err); }