mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
system: fix printf format errors in all system and cxx examples
This commit is contained in:
parent
f7d6f83c41
commit
55879e36ab
@ -21,4 +21,3 @@ else()
|
||||
idf_component_get_property(experimental_cpp_component_lib experimental_cpp_component COMPONENT_LIB)
|
||||
target_link_libraries(${COMPONENT_LIB} PUBLIC ${log_lib} ${mqtt_lib} ${experimental_cpp_component_lib})
|
||||
endif()
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "mqtt_client.h"
|
||||
#include "esp_log.h"
|
||||
@ -126,7 +127,7 @@ Client::Client(esp_mqtt_client_config_t const &config) : handler(esp_mqtt_clien
|
||||
|
||||
void Client::mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data) noexcept
|
||||
{
|
||||
ESP_LOGD(TAG, "Event dispatched from event loop base=%s, event_id=%d", base, event_id);
|
||||
ESP_LOGD(TAG, "Event dispatched from event loop base=%s, event_id=%" PRIi32, base, event_id);
|
||||
auto *event = static_cast<esp_mqtt_event_t *>(event_data);
|
||||
auto &client = *static_cast<Client *>(handler_args);
|
||||
switch (event->event_id) {
|
||||
|
@ -1,3 +1,2 @@
|
||||
idf_component_register(SRCS "mqtt_ssl_example.cpp"
|
||||
INCLUDE_DIRS ".")
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <inttypes.h>
|
||||
#include "esp_mqtt_client_config.hpp"
|
||||
#include "nvs_flash.h"
|
||||
#include "protocol_examples_common.h"
|
||||
@ -49,7 +50,7 @@ namespace mqtt = idf::mqtt;
|
||||
extern "C" void app_main(void)
|
||||
{
|
||||
ESP_LOGI(TAG, "[APP] Startup..");
|
||||
ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
|
||||
ESP_LOGI(TAG, "[APP] Free memory: %" PRIu32 " bytes", esp_get_free_heap_size());
|
||||
ESP_LOGI(TAG, "[APP] IDF version: %s", esp_get_idf_version());
|
||||
|
||||
esp_log_level_set("*", ESP_LOG_INFO);
|
||||
|
@ -1,3 +1,2 @@
|
||||
idf_component_register(SRCS "mqtt_tcp_example.cpp"
|
||||
INCLUDE_DIRS ".")
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
@ -7,6 +7,8 @@
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "nvs_flash.h"
|
||||
#include "protocol_examples_common.h"
|
||||
|
||||
@ -44,7 +46,7 @@ private:
|
||||
extern "C" void app_main(void)
|
||||
{
|
||||
ESP_LOGI(TAG, "[APP] Startup..");
|
||||
ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
|
||||
ESP_LOGI(TAG, "[APP] Free memory: %" PRIu32 " bytes", esp_get_free_heap_size());
|
||||
ESP_LOGI(TAG, "[APP] IDF version: %s", esp_get_idf_version());
|
||||
|
||||
esp_log_level_set("*", ESP_LOG_INFO);
|
||||
|
@ -1,5 +1,3 @@
|
||||
idf_component_register(SRCS "cmd_nvs.c"
|
||||
INCLUDE_DIRS .
|
||||
REQUIRES console nvs_flash)
|
||||
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
@ -292,12 +292,12 @@ static esp_err_t get_value_from_nvs(const char *key, const char *str_type)
|
||||
} else if (type == NVS_TYPE_I32) {
|
||||
int32_t value;
|
||||
if ((err = nvs_get_i32(nvs, key, &value)) == ESP_OK) {
|
||||
printf("%d\n", value);
|
||||
printf("%"PRIi32"\n", value);
|
||||
}
|
||||
} else if (type == NVS_TYPE_U32) {
|
||||
uint32_t value;
|
||||
if ((err = nvs_get_u32(nvs, key, &value)) == ESP_OK) {
|
||||
printf("%u\n", value);
|
||||
printf("%"PRIu32"\n", value);
|
||||
}
|
||||
} else if (type == NVS_TYPE_I64) {
|
||||
int64_t value;
|
||||
|
@ -1,5 +1,3 @@
|
||||
idf_component_register(SRCS "cmd_system.c"
|
||||
INCLUDE_DIRS .
|
||||
REQUIRES console spi_flash driver)
|
||||
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
#include "esp_log.h"
|
||||
#include "esp_console.h"
|
||||
@ -105,7 +106,7 @@ static int get_version(int argc, char **argv)
|
||||
printf("Chip info:\r\n");
|
||||
printf("\tmodel:%s\r\n", model);
|
||||
printf("\tcores:%d\r\n", info.cores);
|
||||
printf("\tfeature:%s%s%s%s%d%s\r\n",
|
||||
printf("\tfeature:%s%s%s%s%"PRIu32"%s\r\n",
|
||||
info.features & CHIP_FEATURE_WIFI_BGN ? "/802.11bgn" : "",
|
||||
info.features & CHIP_FEATURE_BLE ? "/BLE" : "",
|
||||
info.features & CHIP_FEATURE_BT ? "/BT" : "",
|
||||
@ -149,7 +150,7 @@ static void register_restart(void)
|
||||
|
||||
static int free_mem(int argc, char **argv)
|
||||
{
|
||||
printf("%d\n", esp_get_free_heap_size());
|
||||
printf("%"PRIu32"\n", esp_get_free_heap_size());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -168,7 +169,7 @@ static void register_free(void)
|
||||
static int heap_size(int argc, char **argv)
|
||||
{
|
||||
uint32_t heap_size = heap_caps_get_minimum_free_size(MALLOC_CAP_DEFAULT);
|
||||
printf("min heap size: %u\n", heap_size);
|
||||
printf("min heap size: %"PRIu32"\n", heap_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,2 @@
|
||||
idf_component_register(SRCS "deep_sleep_example_main.c"
|
||||
INCLUDE_DIRS ".")
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <inttypes.h>
|
||||
#include "sdkconfig.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
@ -207,7 +208,7 @@ void app_main(void)
|
||||
touch_pad_sleep_channel_read_smooth(TOUCH_PAD_NUM9, &touch_value);
|
||||
wake_threshold = touch_value * 0.1; // wakeup when touch sensor crosses 10% of background level
|
||||
touch_pad_sleep_set_threshold(TOUCH_PAD_NUM9, wake_threshold);
|
||||
printf("Touch pad #%d average: %d, wakeup threshold set to %d\n",
|
||||
printf("Touch pad #%d average: %"PRIu32", wakeup threshold set to %"PRIu32"\n",
|
||||
TOUCH_PAD_NUM9, touch_value, (uint32_t)(touch_value * 0.1));
|
||||
#endif
|
||||
printf("Enabling touch pad wakeup\n");
|
||||
|
@ -1,3 +1,2 @@
|
||||
idf_component_register(SRCS "app_main.c"
|
||||
INCLUDE_DIRS "")
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_attr.h"
|
||||
@ -92,7 +93,7 @@ void app_main(void)
|
||||
{
|
||||
//Get the partition used for SPI1 erase operation
|
||||
const esp_partition_t *part = s_get_partition();
|
||||
ESP_LOGI(TAG, "found partition '%s' at offset 0x%x with size 0x%x", part->label, part->address, part->size);
|
||||
ESP_LOGI(TAG, "found partition '%s' at offset 0x%"PRIx32" with size 0x%"PRIx32, part->label, part->address, part->size);
|
||||
//Erase whole region
|
||||
ESP_ERROR_CHECK(esp_flash_erase_region(part->flash_chip, part->address, part->size));
|
||||
|
||||
|
@ -1,3 +1,2 @@
|
||||
idf_component_register(SRCS "real_time_stats_example_main.c"
|
||||
INCLUDE_DIRS ".")
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/semphr.h"
|
||||
@ -109,7 +110,7 @@ static esp_err_t print_real_time_stats(TickType_t xTicksToWait)
|
||||
if (k >= 0) {
|
||||
uint32_t task_elapsed_time = end_array[k].ulRunTimeCounter - start_array[i].ulRunTimeCounter;
|
||||
uint32_t percentage_time = (task_elapsed_time * 100UL) / (total_elapsed_time * portNUM_PROCESSORS);
|
||||
printf("| %s | %d | %d%%\n", start_array[i].pcTaskName, task_elapsed_time, percentage_time);
|
||||
printf("| %s | %"PRIu32" | %"PRIu32"%%\n", start_array[i].pcTaskName, task_elapsed_time, percentage_time);
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,7 +156,7 @@ static void stats_task(void *arg)
|
||||
|
||||
//Print real time stats periodically
|
||||
while (1) {
|
||||
printf("\n\nGetting real time stats over %d ticks\n", STATS_TICKS);
|
||||
printf("\n\nGetting real time stats over %"PRIu32" ticks\n", STATS_TICKS);
|
||||
if (print_real_time_stats(STATS_TICKS) == ESP_OK) {
|
||||
printf("Real time stats obtained\n");
|
||||
} else {
|
||||
|
@ -1,3 +1,2 @@
|
||||
idf_component_register(SRCS "himem_example_main.c"
|
||||
INCLUDE_DIRS ".")
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/queue.h"
|
||||
@ -40,7 +41,7 @@ static bool check_mem_seed(int seed, void *mem, int len, int phys_addr)
|
||||
for (int i = 0; i < len / 4; i++) {
|
||||
uint32_t ex = rand_r(&rseed);
|
||||
if (ex != *p) {
|
||||
printf("check_mem_seed: %x has 0x%08x expected 0x%08x\n", phys_addr+((char*)p-(char*)mem), *p, ex);
|
||||
printf("check_mem_seed: %x has 0x%08"PRIx32" expected 0x%08"PRIx32"\n", phys_addr+((char*)p-(char*)mem), *p, ex);
|
||||
return false;
|
||||
}
|
||||
p++;
|
||||
|
@ -1,4 +1,3 @@
|
||||
idf_component_register(SRCS "main.c"
|
||||
"asm_funcs.S"
|
||||
INCLUDE_DIRS ".")
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include "esp_timer.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_ipc_isr.h"
|
||||
@ -36,26 +37,26 @@ void app_main(void)
|
||||
uint32_t ps_other_cpu = 0;
|
||||
ESP_LOGI(TAG, "call get_ps_other_cpu");
|
||||
esp_ipc_isr_asm_call_blocking(get_ps_other_cpu, &ps_other_cpu);
|
||||
ESP_LOGI(TAG, "PS_INTLEVEL = 0x%x", ps_other_cpu & XCHAL_PS_INTLEVEL_MASK);
|
||||
ESP_LOGI(TAG, "PS_EXCM = 0x%x", (ps_other_cpu & XCHAL_PS_EXCM_MASK) >> XCHAL_PS_EXCM_SHIFT);
|
||||
ESP_LOGI(TAG, "PS_UM = 0x%x", (ps_other_cpu & XCHAL_PS_UM_MASK) >> XCHAL_PS_UM_SHIFT);
|
||||
ESP_LOGI(TAG, "PS_INTLEVEL = 0x%"PRIx32, ps_other_cpu & XCHAL_PS_INTLEVEL_MASK);
|
||||
ESP_LOGI(TAG, "PS_EXCM = 0x%"PRIx32, (ps_other_cpu & XCHAL_PS_EXCM_MASK) >> XCHAL_PS_EXCM_SHIFT);
|
||||
ESP_LOGI(TAG, "PS_UM = 0x%"PRIx32, (ps_other_cpu & XCHAL_PS_UM_MASK) >> XCHAL_PS_UM_SHIFT);
|
||||
|
||||
ESP_LOGI(TAG, "call extended_ipc_isr_asm");
|
||||
arg_data_t arg = { 0 };
|
||||
arg.in[0] = 0x01;
|
||||
arg.in[1] = 0x02;
|
||||
arg.in[2] = 0x03;
|
||||
ESP_LOGI(TAG, "in[0] = 0x%x", arg.in[0]);
|
||||
ESP_LOGI(TAG, "in[1] = 0x%x", arg.in[1]);
|
||||
ESP_LOGI(TAG, "in[2] = 0x%x", arg.in[2]);
|
||||
ESP_LOGI(TAG, "in[0] = 0x%"PRIx32, arg.in[0]);
|
||||
ESP_LOGI(TAG, "in[1] = 0x%"PRIx32, arg.in[1]);
|
||||
ESP_LOGI(TAG, "in[2] = 0x%"PRIx32, arg.in[2]);
|
||||
esp_ipc_isr_asm_call_blocking(extended_ipc_isr_asm, (void*)&arg);
|
||||
ESP_LOGI(TAG, "out[0] = (in[0] | in[1] | in[2]) = 0x%x", arg.out[0]);
|
||||
ESP_LOGI(TAG, "out[0] = (in[0] | in[1] | in[2]) = 0x%"PRIx32, arg.out[0]);
|
||||
assert(0x03 == arg.out[0]);
|
||||
ESP_LOGI(TAG, "out[1] = (in[0] & in[1] & in[2]) = 0x%x", arg.out[1]);
|
||||
ESP_LOGI(TAG, "out[1] = (in[0] & in[1] & in[2]) = 0x%"PRIx32, arg.out[1]);
|
||||
assert(0x06 == arg.out[1]);
|
||||
ESP_LOGI(TAG, "out[2] = in[2] = 0x%x", arg.out[2]);
|
||||
ESP_LOGI(TAG, "out[2] = in[2] = 0x%"PRIx32, arg.out[2]);
|
||||
assert(0x03 == arg.out[2]);
|
||||
ESP_LOGI(TAG, "out[3] = PS of other cpu = 0x%x", arg.out[3]);
|
||||
ESP_LOGI(TAG, "out[3] = PS of other cpu = 0x%"PRIx32, arg.out[3]);
|
||||
assert(ps_other_cpu == arg.out[3]);
|
||||
ESP_LOGI(TAG, "End");
|
||||
}
|
||||
|
@ -3,4 +3,3 @@ idf_component_register(SRCS "advanced_https_ota_example.c" "ble_helper/bluedroid
|
||||
INCLUDE_DIRS "." "./ble_helper/include/"
|
||||
# Embed the server root certificate into the final binary
|
||||
EMBED_TXTFILES ${project_dir}/server_certs/ca_cert.pem)
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
@ -7,6 +7,7 @@
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/event_groups.h"
|
||||
@ -102,7 +103,7 @@ static esp_err_t validate_image_header(esp_app_desc_t *new_app_info)
|
||||
*/
|
||||
const uint32_t hw_sec_version = esp_efuse_read_secure_version();
|
||||
if (new_app_info->secure_version < hw_sec_version) {
|
||||
ESP_LOGW(TAG, "New firmware security version is less than eFuse programmed, %d < %d", new_app_info->secure_version, hw_sec_version);
|
||||
ESP_LOGW(TAG, "New firmware security version is less than eFuse programmed, %"PRIu32" < %"PRIu32, new_app_info->secure_version, hw_sec_version);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
#endif
|
||||
|
@ -4,6 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "bluedroid_gatts.h"
|
||||
#include "esp_log.h"
|
||||
#include "string.h"
|
||||
@ -170,7 +171,7 @@ void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gat
|
||||
esp_ble_gatts_create_service(gatts_if, &gl_profile_tab[PROFILE_A_APP_ID].service_id, GATTS_NUM_HANDLE_TEST_A);
|
||||
break;
|
||||
case ESP_GATTS_READ_EVT: {
|
||||
ESP_LOGI(TAG, "GATT_READ_EVT, conn_id %d, trans_id %d, handle %d\n", param->read.conn_id, param->read.trans_id, param->read.handle);
|
||||
ESP_LOGI(TAG, "GATT_READ_EVT, conn_id %d, trans_id %"PRIu32", handle %d\n", param->read.conn_id, param->read.trans_id, param->read.handle);
|
||||
esp_gatt_rsp_t rsp;
|
||||
memset(&rsp, 0, sizeof(esp_gatt_rsp_t));
|
||||
rsp.attr_value.handle = param->read.handle;
|
||||
@ -184,7 +185,7 @@ void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gat
|
||||
break;
|
||||
}
|
||||
case ESP_GATTS_WRITE_EVT: {
|
||||
ESP_LOGI(TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %d, handle %d", param->write.conn_id, param->write.trans_id, param->write.handle);
|
||||
ESP_LOGI(TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %"PRIu32", handle %d", param->write.conn_id, param->write.trans_id, param->write.handle);
|
||||
if (!param->write.is_prep) {
|
||||
ESP_LOGI(TAG, "GATT_WRITE_EVT, value len %d, value :", param->write.len);
|
||||
esp_log_buffer_hex(TAG, param->write.value, param->write.len);
|
||||
|
@ -3,4 +3,3 @@ idf_build_get_property(project_dir PROJECT_DIR)
|
||||
idf_component_register(SRCS "native_ota_example.c"
|
||||
INCLUDE_DIRS "."
|
||||
EMBED_TXTFILES ${project_dir}/server_certs/ca_cert.pem)
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
@ -7,6 +7,7 @@
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_system.h"
|
||||
@ -87,11 +88,11 @@ static void ota_example_task(void *pvParameter)
|
||||
const esp_partition_t *running = esp_ota_get_running_partition();
|
||||
|
||||
if (configured != running) {
|
||||
ESP_LOGW(TAG, "Configured OTA boot partition at offset 0x%08x, but running from offset 0x%08x",
|
||||
ESP_LOGW(TAG, "Configured OTA boot partition at offset 0x%08"PRIx32", but running from offset 0x%08"PRIx32,
|
||||
configured->address, running->address);
|
||||
ESP_LOGW(TAG, "(This can happen if either the OTA boot data or preferred boot image become corrupted somehow.)");
|
||||
}
|
||||
ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08x)",
|
||||
ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08"PRIx32")",
|
||||
running->type, running->subtype, running->address);
|
||||
|
||||
esp_http_client_config_t config = {
|
||||
@ -134,7 +135,7 @@ static void ota_example_task(void *pvParameter)
|
||||
|
||||
update_partition = esp_ota_get_next_update_partition(NULL);
|
||||
assert(update_partition != NULL);
|
||||
ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%x",
|
||||
ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%"PRIx32,
|
||||
update_partition->subtype, update_partition->address);
|
||||
|
||||
int binary_file_length = 0;
|
||||
|
@ -1,3 +1,2 @@
|
||||
idf_component_register(SRCS "pthread_example.c"
|
||||
INCLUDE_DIRS ".")
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include <inttypes.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_pthread.h"
|
||||
@ -25,7 +26,7 @@ void app_main(void)
|
||||
// Create a pthread with the default parameters
|
||||
res = pthread_create(&thread1, NULL, example_thread, NULL);
|
||||
assert(res == 0);
|
||||
printf("Created thread 0x%x\n", thread1);
|
||||
printf("Created thread 0x%"PRIx32"\n", thread1);
|
||||
|
||||
// Create a pthread with a larger stack size using the standard API
|
||||
res = pthread_attr_init(&attr);
|
||||
@ -33,7 +34,7 @@ void app_main(void)
|
||||
pthread_attr_setstacksize(&attr, 16384);
|
||||
res = pthread_create(&thread2, &attr, example_thread, NULL);
|
||||
assert(res == 0);
|
||||
printf("Created larger stack thread 0x%x\n", thread2);
|
||||
printf("Created larger stack thread 0x%"PRIx32"\n", thread2);
|
||||
|
||||
res = pthread_join(thread1, NULL);
|
||||
assert(res == 0);
|
||||
@ -49,7 +50,7 @@ void app_main(void)
|
||||
|
||||
res = pthread_create(&thread1, NULL, example_thread, NULL);
|
||||
assert(res == 0);
|
||||
printf("Created thread 0x%x with new default config\n", thread1);
|
||||
printf("Created thread 0x%"PRIx32" with new default config\n", thread1);
|
||||
res = pthread_join(thread1, NULL);
|
||||
assert(res == 0);
|
||||
printf("Thread has exited\n\n");
|
||||
@ -58,10 +59,10 @@ void app_main(void)
|
||||
static void *example_thread(void * arg)
|
||||
{
|
||||
usleep(250 * 1000);
|
||||
printf("This thread has ID 0x%x and %u bytes free stack\n", pthread_self(), uxTaskGetStackHighWaterMark(NULL));
|
||||
printf("This thread has ID 0x%"PRIx32" and %u bytes free stack\n", pthread_self(), uxTaskGetStackHighWaterMark(NULL));
|
||||
|
||||
sleep(1);
|
||||
printf("Thread 0x%x exiting\n", pthread_self());
|
||||
printf("Thread 0x%"PRIx32" exiting\n", pthread_self());
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,3 +1,2 @@
|
||||
idf_component_register(SRCS "sysview_tracing.c"
|
||||
INCLUDE_DIRS ".")
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include "esp_log.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
@ -126,7 +127,7 @@ static void example_task(void *p)
|
||||
SYSVIEW_EXAMPLE_WAIT_EVENT_START();
|
||||
xTaskNotifyWait(0, 0, &event_val, portMAX_DELAY);
|
||||
SYSVIEW_EXAMPLE_WAIT_EVENT_END(event_val);
|
||||
ESP_LOGI(TAG, "Task[%p]: received event %d", xTaskGetCurrentTaskHandle(), event_val);
|
||||
ESP_LOGI(TAG, "Task[%p]: received event %"PRIu32, xTaskGetCurrentTaskHandle(), event_val);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,2 @@
|
||||
idf_component_register(SRCS "sysview_heap_log.c"
|
||||
INCLUDE_DIRS ".")
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
@ -7,6 +7,7 @@
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "esp_sysview_trace.h"
|
||||
#include "esp_heap_trace.h"
|
||||
#include "esp_log.h"
|
||||
@ -57,7 +58,7 @@ static void alloc_task(void *p)
|
||||
void *p = malloc(sz/2);
|
||||
// WARNING: the previous allocated memory is intentionally not deallocated in order to cause memory leak!
|
||||
p = malloc(sz);
|
||||
ESP_LOGI(TAG, "Task[%p]: allocated %d bytes @ %p", xTaskGetCurrentTaskHandle(), sz, p);
|
||||
ESP_LOGI(TAG, "Task[%p]: allocated %"PRIu32" bytes @ %p", xTaskGetCurrentTaskHandle(), sz, p);
|
||||
if (xQueueSend(queue, ( void * )&p, portMAX_DELAY) != pdPASS) {
|
||||
ESP_LOGE(TAG, "Failed to send to queue!");
|
||||
}
|
||||
@ -96,7 +97,7 @@ void app_main(void)
|
||||
for (int i = 0; i < num_allocers; i++) {
|
||||
ESP_LOGI(TAG, "Wait notify %d", i);
|
||||
uint32_t val = ulTaskNotifyTake(pdFALSE, portMAX_DELAY);
|
||||
ESP_LOGI(TAG, "Got notify val %d", val);
|
||||
ESP_LOGI(TAG, "Got notify val %"PRIu32, val);
|
||||
}
|
||||
// here GDB will stop at brekpoint and execute OpenOCD command to stop tracing
|
||||
heap_trace_stop();
|
||||
|
@ -19,5 +19,3 @@ set(ulp_exp_dep_srcs "ulp_example_main.c")
|
||||
# 4. Call function to build ULP binary and embed in project using the argument
|
||||
# values above.
|
||||
ulp_embed_binary(${ulp_app_name} "${ulp_s_sources}" "${ulp_exp_dep_srcs}")
|
||||
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include "esp_sleep.h"
|
||||
#include "nvs.h"
|
||||
#include "nvs_flash.h"
|
||||
@ -106,18 +107,18 @@ static void update_pulse_count(void)
|
||||
uint32_t pulse_count = 0;
|
||||
esp_err_t err = nvs_get_u32(handle, count_key, &pulse_count);
|
||||
assert(err == ESP_OK || err == ESP_ERR_NVS_NOT_FOUND);
|
||||
printf("Read pulse count from NVS: %5d\n", pulse_count);
|
||||
printf("Read pulse count from NVS: %5"PRIu32"\n", pulse_count);
|
||||
|
||||
/* ULP program counts signal edges, convert that to the number of pulses */
|
||||
uint32_t pulse_count_from_ulp = (ulp_edge_count & UINT16_MAX) / 2;
|
||||
/* In case of an odd number of edges, keep one until next time */
|
||||
ulp_edge_count = ulp_edge_count % 2;
|
||||
printf("Pulse count from ULP: %5d\n", pulse_count_from_ulp);
|
||||
printf("Pulse count from ULP: %5"PRIu32"\n", pulse_count_from_ulp);
|
||||
|
||||
/* Save the new pulse count to NVS */
|
||||
pulse_count += pulse_count_from_ulp;
|
||||
ESP_ERROR_CHECK(nvs_set_u32(handle, count_key, pulse_count));
|
||||
ESP_ERROR_CHECK(nvs_commit(handle));
|
||||
nvs_close(handle);
|
||||
printf("Wrote updated pulse count to NVS: %5d\n", pulse_count);
|
||||
printf("Wrote updated pulse count to NVS: %5"PRIu32"\n", pulse_count);
|
||||
}
|
||||
|
@ -19,5 +19,3 @@ set(ulp_exp_dep_srcs "ulp_adc_example_main.c")
|
||||
# 4. Call function to build ULP binary and embed in project using the argument
|
||||
# values above.
|
||||
ulp_embed_binary(${ulp_app_name} "${ulp_s_sources}" "${ulp_exp_dep_srcs}")
|
||||
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include "esp_sleep.h"
|
||||
#include "soc/rtc_cntl_reg.h"
|
||||
#include "soc/sens_reg.h"
|
||||
@ -44,10 +45,10 @@ void app_main(void)
|
||||
init_ulp_program();
|
||||
} else {
|
||||
printf("Deep sleep wakeup\n");
|
||||
printf("ULP did %d measurements since last reset\n", ulp_sample_counter & UINT16_MAX);
|
||||
printf("Thresholds: low=%d high=%d\n", ulp_low_thr, ulp_high_thr);
|
||||
printf("ULP did %"PRIu32" measurements since last reset\n", ulp_sample_counter & UINT16_MAX);
|
||||
printf("Thresholds: low=%"PRIu32" high=%"PRIu32"\n", ulp_low_thr, ulp_high_thr);
|
||||
ulp_last_result &= UINT16_MAX;
|
||||
printf("Value=%d was %s threshold\n", ulp_last_result,
|
||||
printf("Value=%"PRIu32" was %s threshold\n", ulp_last_result,
|
||||
ulp_last_result < ulp_low_thr ? "below" : "above");
|
||||
}
|
||||
printf("Entering deep sleep\n\n");
|
||||
|
@ -1,8 +1,6 @@
|
||||
idf_component_register(SRCS "ulp_riscv_adc_example_main.c"
|
||||
INCLUDE_DIRS ""
|
||||
REQUIRES soc ulp esp_adc)
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
||||
#
|
||||
# ULP support additions to component CMakeLists.txt.
|
||||
#
|
||||
|
@ -13,6 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include "esp_sleep.h"
|
||||
#include "ulp_riscv.h"
|
||||
#include "ulp_adc.h"
|
||||
@ -39,8 +40,8 @@ void app_main(void)
|
||||
/* ULP Risc-V read and detected a temperature above the limit */
|
||||
if (cause == ESP_SLEEP_WAKEUP_ULP) {
|
||||
printf("ULP-RISC-V woke up the main CPU\n");
|
||||
printf("Threshold: high = %d\n", ulp_adc_threshold);
|
||||
printf("Value = %d was above threshold\n", ulp_wakeup_result);
|
||||
printf("Threshold: high = %"PRIu32"\n", ulp_adc_threshold);
|
||||
printf("Value = %"PRIu32" was above threshold\n", ulp_wakeup_result);
|
||||
}
|
||||
|
||||
/* Go back to sleep, only the ULP Risc-V will run */
|
||||
|
@ -1,8 +1,6 @@
|
||||
idf_component_register(SRCS "ulp_riscv_rtc_i2c_example_main.c"
|
||||
INCLUDE_DIRS ""
|
||||
REQUIRES soc ulp)
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
||||
#
|
||||
# ULP support additions to component CMakeLists.txt.
|
||||
#
|
||||
|
@ -13,6 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include <math.h>
|
||||
#include "esp_sleep.h"
|
||||
#include "ulp_riscv.h"
|
||||
@ -90,7 +91,7 @@ void app_main(void)
|
||||
bmp180_read_ut_data(&ut_data);
|
||||
bmp180_read_up_data(&up_data, oss_mode);
|
||||
printf("Uncompensated Temperature = %d\n", ut_data);
|
||||
printf("Uncompensated Pressure = %d\n", up_data);
|
||||
printf("Uncompensated Pressure = %"PRIu32"\n", up_data);
|
||||
printf("\n");
|
||||
|
||||
/* Calculate real temperature value */
|
||||
@ -119,8 +120,8 @@ void app_main(void)
|
||||
ulp_timer_stop();
|
||||
ulp_riscv_halt();
|
||||
|
||||
printf("Uncompensated Temperature = %d\n", ulp_ut_data);
|
||||
printf("Uncompensated Pressure = %d\n", ulp_up_data);
|
||||
printf("Uncompensated Temperature = %"PRIu32"\n", ulp_ut_data);
|
||||
printf("Uncompensated Pressure = %"PRIu32"\n", ulp_up_data);
|
||||
|
||||
/* Read the calibration data again */
|
||||
printf("Reading calibration data from BMP180 ...\n");
|
||||
|
Loading…
Reference in New Issue
Block a user