]> granicus.if.org Git - esp-idf/commitdiff
ulp: fix calculation or ulp_run argument
authorIvan Grokhotkov <ivan@espressif.com>
Tue, 7 Aug 2018 13:03:23 +0000 (16:03 +0300)
committerIvan Grokhotkov <ivan@espressif.com>
Tue, 7 Aug 2018 13:14:57 +0000 (16:14 +0300)
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
examples/system/ulp/main/ulp_example_main.c
examples/system/ulp_adc/main/ulp_adc_example_main.c

index 9f913ff814c93474380fc14c8e8694f7a25b0fdb..a5e54d062f0c6cbfd4195d332ab4b742906f629e 100644 (file)
@@ -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
 
index c03ab20eec64d4bfbe10ad4d6271816e9cc08d1d..74c4febe401e828390180146f1d5305de9ce7470 100644 (file)
@@ -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);
 }
 
index 29d8eac9af59e7edbb4891735cd88471eac31d0a..fd7d4ef4387d35396366026c1325735418219e57 100644 (file)
@@ -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);
 }