本文整理汇总了C++中ESP_LOGE函数的典型用法代码示例。如果您正苦于以下问题:C++ ESP_LOGE函数的具体用法?C++ ESP_LOGE怎么用?C++ ESP_LOGE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ESP_LOGE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: encrypt_and_load_partition_table
static esp_err_t encrypt_and_load_partition_table(esp_partition_info_t *partition_table, int *num_partitions)
{
esp_err_t err;
/* Check for plaintext partition table */
err = bootloader_flash_read(ESP_PARTITION_TABLE_OFFSET, partition_table, ESP_PARTITION_TABLE_MAX_LEN, false);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to read partition table data");
return err;
}
if (esp_partition_table_verify(partition_table, false, num_partitions) == ESP_OK) {
ESP_LOGD(TAG, "partition table is plaintext. Encrypting...");
esp_err_t err = esp_flash_encrypt_region(ESP_PARTITION_TABLE_OFFSET,
FLASH_SECTOR_SIZE);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to encrypt partition table in place. %x", err);
return err;
}
}
else {
ESP_LOGE(TAG, "Failed to read partition table data - not plaintext?");
return ESP_ERR_INVALID_STATE;
}
/* Valid partition table loded */
return ESP_OK;
}
开发者ID:tve,项目名称:esp-idf,代码行数:26,代码来源:flash_encrypt.c
示例2: esp_flash_encrypt_region
esp_err_t esp_flash_encrypt_region(uint32_t src_addr, size_t data_length)
{
esp_err_t err;
uint32_t buf[FLASH_SECTOR_SIZE / sizeof(uint32_t)];
if (src_addr % FLASH_SECTOR_SIZE != 0) {
ESP_LOGE(TAG, "esp_flash_encrypt_region bad src_addr 0x%x",src_addr);
return ESP_FAIL;
}
for (size_t i = 0; i < data_length; i += FLASH_SECTOR_SIZE) {
rtc_wdt_feed();
uint32_t sec_start = i + src_addr;
err = bootloader_flash_read(sec_start, buf, FLASH_SECTOR_SIZE, false);
if (err != ESP_OK) {
goto flash_failed;
}
err = bootloader_flash_erase_sector(sec_start / FLASH_SECTOR_SIZE);
if (err != ESP_OK) {
goto flash_failed;
}
err = bootloader_flash_write(sec_start, buf, FLASH_SECTOR_SIZE, true);
if (err != ESP_OK) {
goto flash_failed;
}
}
return ESP_OK;
flash_failed:
ESP_LOGE(TAG, "flash operation failed: 0x%x", err);
return err;
}
开发者ID:tve,项目名称:esp-idf,代码行数:32,代码来源:flash_encrypt.c
示例3: encrypt_bootloader
static esp_err_t encrypt_bootloader()
{
esp_err_t err;
uint32_t image_length;
/* Check for plaintext bootloader (verification will fail if it's already encrypted) */
if (esp_image_verify_bootloader(&image_length) == ESP_OK) {
ESP_LOGD(TAG, "bootloader is plaintext. Encrypting...");
err = esp_flash_encrypt_region(ESP_BOOTLOADER_OFFSET, image_length);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to encrypt bootloader in place: 0x%x", err);
return err;
}
if (esp_secure_boot_enabled()) {
/* If secure boot is enabled and bootloader was plaintext, also
need to encrypt secure boot IV+digest.
*/
ESP_LOGD(TAG, "Encrypting secure bootloader IV & digest...");
err = esp_flash_encrypt_region(FLASH_OFFS_SECURE_BOOT_IV_DIGEST,
FLASH_SECTOR_SIZE);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to encrypt bootloader IV & digest in place: 0x%x", err);
return err;
}
}
}
else {
ESP_LOGW(TAG, "no valid bootloader was found");
}
return ESP_OK;
}
开发者ID:tve,项目名称:esp-idf,代码行数:32,代码来源:flash_encrypt.c
示例4: malloc
scan_list_t *list_new_item(void)
{
scan_list_t *newItem = (scan_list_t *) malloc(sizeof(scan_list_t));
if (newItem == NULL) {
ESP_LOGE(TAG, "malloc list item failed!");
return NULL;
}
memset(newItem, 0, sizeof(scan_list_t));
newItem->bda = (char *) malloc(BDA_SIZE);
if (newItem->bda == NULL) {
ESP_LOGE(TAG, "alloc for BDA failed!");
free(newItem);
return NULL;
}
newItem->uuid = (char *)malloc(UUID_SIZE);
if (newItem->uuid == NULL) {
ESP_LOGE(TAG, "alloc for UUID failed!");
free(newItem->bda);
free(newItem);
return NULL;
}
return newItem;
}
开发者ID:Nicholas3388,项目名称:LuaNode,代码行数:26,代码来源:my_list.c
示例5: ESP_LOGD
/**
* @brief Initialize the I2C interface.
*
* @param [in] address The address of the slave device.
* @param [in] sdaPin The pin to use for SDA data.
* @param [in] sclPin The pin to use for SCL clock.
* @return N/A.
*/
void I2C::init(uint8_t address, gpio_num_t sdaPin, gpio_num_t sclPin, uint32_t clockSpeed, i2c_port_t portNum) {
ESP_LOGD(LOG_TAG, ">> I2c::init. address=%d, sda=%d, scl=%d, clockSpeed=%d, portNum=%d", address, sdaPin, sclPin, clockSpeed, portNum);
assert(portNum < I2C_NUM_MAX);
m_portNum = portNum;
m_sdaPin = sdaPin;
m_sclPin = sclPin;
m_address = address;
i2c_config_t conf;
conf.mode = I2C_MODE_MASTER;
conf.sda_io_num = sdaPin;
conf.scl_io_num = sclPin;
conf.sda_pullup_en = GPIO_PULLUP_ENABLE;
conf.scl_pullup_en = GPIO_PULLUP_ENABLE;
conf.master.clk_speed = 100000;
esp_err_t errRc = ::i2c_param_config(m_portNum, &conf);
if (errRc != ESP_OK) {
ESP_LOGE(LOG_TAG, "i2c_param_config: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
}
if (!driverInstalled) {
errRc = ::i2c_driver_install(m_portNum, I2C_MODE_MASTER, 0, 0, 0);
if (errRc != ESP_OK) {
ESP_LOGE(LOG_TAG, "i2c_driver_install: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
}
driverInstalled = true;
}
} // init
开发者ID:hliebscher,项目名称:esp32-snippets,代码行数:35,代码来源:I2C.cpp
示例6: ESP_LOGD
/**
* @brief Read the value of the remote characteristic.
* @return The value of the remote characteristic.
*/
std::string BLERemoteCharacteristic::readValue() {
ESP_LOGD(LOG_TAG, ">> readValue(): uuid: %s, handle: %d 0x%.2x", getUUID().toString().c_str(), getHandle(), getHandle());
// Check to see that we are connected.
if (!getRemoteService()->getClient()->isConnected()) {
ESP_LOGE(LOG_TAG, "Disconnected");
throw BLEDisconnectedException();
}
m_semaphoreReadCharEvt.take("readValue");
// Ask the BLE subsystem to retrieve the value for the remote hosted characteristic.
// This is an asynchronous request which means that we must block waiting for the response
// to become available.
esp_err_t errRc = ::esp_ble_gattc_read_char(
m_pRemoteService->getClient()->getGattcIf(),
m_pRemoteService->getClient()->getConnId(), // The connection ID to the BLE server
getHandle(), // The handle of this characteristic
ESP_GATT_AUTH_REQ_NONE); // Security
if (errRc != ESP_OK) {
ESP_LOGE(LOG_TAG, "esp_ble_gattc_read_char: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
return "";
}
// Block waiting for the event that indicates that the read has completed. When it has, the std::string found
// in m_value will contain our data.
m_semaphoreReadCharEvt.wait("readValue");
ESP_LOGD(LOG_TAG, "<< readValue(): length: %d", m_value.length());
return m_value;
} // readValue
开发者ID:LefterisAd,项目名称:esp32-snippets,代码行数:36,代码来源:BLERemoteCharacteristic.cpp
示例7: ESP_LOGD
/**
* @brief Start scanning.
* @param [in] duration The duration in seconds for which to scan.
* @return N/A.
*/
BLEScanResults BLEScan::start(uint32_t duration) {
ESP_LOGD(LOG_TAG, ">> start(duration=%d)", duration);
m_semaphoreScanEnd.take(std::string("start"));
m_scanResults.m_vectorAdvertisedDevices.clear();
esp_err_t errRc = ::esp_ble_gap_set_scan_params(&m_scan_params);
if (errRc != ESP_OK) {
ESP_LOGE(LOG_TAG, "esp_ble_gap_set_scan_params: err: %d, text: %s", errRc, GeneralUtils::errorToString(errRc));
m_semaphoreScanEnd.give();
return m_scanResults;
}
errRc = ::esp_ble_gap_start_scanning(duration);
if (errRc != ESP_OK) {
ESP_LOGE(LOG_TAG, "esp_ble_gap_start_scanning: err: %d, text: %s", errRc, GeneralUtils::errorToString(errRc));
m_semaphoreScanEnd.give();
return m_scanResults;
}
m_stopped = false;
m_semaphoreScanEnd.wait("start"); // Wait for the semaphore to release.
ESP_LOGD(LOG_TAG, "<< start()");
return m_scanResults;
} // start
开发者ID:cuda-convnet,项目名称:WiFi_Kit_series,代码行数:35,代码来源:BLEScan.cpp
示例8: ESP_LOGD
/**
* @brief Start the service.
* Here we wish to start the service which means that we will respond to partner requests about it.
* Starting a service also means that we can create the corresponding characteristics.
* @return Start the service.
*/
void BLEService::start() {
// We ask the BLE runtime to start the service and then create each of the characteristics.
// We start the service through its local handle which was returned in the ESP_GATTS_CREATE_EVT event
// obtained as a result of calling esp_ble_gatts_create_service().
//
ESP_LOGD(LOG_TAG, ">> start(): Starting service (esp_ble_gatts_start_service): %s", toString().c_str());
if (m_handle == NULL_HANDLE) {
ESP_LOGE(LOG_TAG, "<< !!! We attempted to start a service but don't know its handle!");
return;
}
BLECharacteristic *pCharacteristic = m_characteristicMap.getFirst();
while(pCharacteristic != nullptr) {
m_lastCreatedCharacteristic = pCharacteristic;
pCharacteristic->executeCreate(this);
pCharacteristic = m_characteristicMap.getNext();
}
// Start each of the characteristics ... these are found in the m_characteristicMap.
m_semaphoreStartEvt.take("start");
esp_err_t errRc = ::esp_ble_gatts_start_service(m_handle);
if (errRc != ESP_OK) {
ESP_LOGE(LOG_TAG, "<< esp_ble_gatts_start_service: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
return;
}
m_semaphoreStartEvt.wait("start");
ESP_LOGD(LOG_TAG, "<< start()");
} // start
开发者ID:EdWeller,项目名称:esp32-snippets,代码行数:39,代码来源:BLEService.cpp
示例9: selected_boot_partition
/*
* Selects a boot partition.
* The conditions for switching to another firmware are checked.
*/
static int selected_boot_partition(const bootloader_state_t *bs)
{
int boot_index = bootloader_utility_get_selected_boot_partition(bs);
if (boot_index == INVALID_INDEX) {
return boot_index; // Unrecoverable failure (not due to corrupt ota data or bad partition contents)
} else {
// Factory firmware.
#ifdef CONFIG_BOOTLOADER_FACTORY_RESET
if (bootloader_common_check_long_hold_gpio(CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET, CONFIG_BOOTLOADER_HOLD_TIME_GPIO) == 1) {
ESP_LOGI(TAG, "Detect a condition of the factory reset");
bool ota_data_erase = false;
#ifdef CONFIG_BOOTLOADER_OTA_DATA_ERASE
ota_data_erase = true;
#endif
const char *list_erase = CONFIG_BOOTLOADER_DATA_FACTORY_RESET;
ESP_LOGI(TAG, "Data partitions to erase: %s", list_erase);
if (bootloader_common_erase_part_type_data(list_erase, ota_data_erase) == false) {
ESP_LOGE(TAG, "Not all partitions were erased");
}
return bootloader_utility_get_selected_boot_partition(bs);
}
#endif
// TEST firmware.
#ifdef CONFIG_BOOTLOADER_APP_TEST
if (bootloader_common_check_long_hold_gpio(CONFIG_BOOTLOADER_NUM_PIN_APP_TEST, CONFIG_BOOTLOADER_HOLD_TIME_GPIO) == 1) {
ESP_LOGI(TAG, "Detect a boot condition of the test firmware");
#ifdef CONFIG_BOOTLOADER_APP_TEST_IN_OTA_1
/* In this case, test bin will locate in ota_1 by default.
This is the solution for small Flash. */
return 1;
#else
if (bs->test.offset != 0) {
boot_index = TEST_APP_INDEX;
return boot_index;
} else {
ESP_LOGE(TAG, "Test firmware is not found in partition table");
return INVALID_INDEX;
}
#endif
}
#endif
#ifdef CONFIG_ESP8266_BOOT_COPY_APP
if (boot_index == 1) {
ESP_LOGI(TAG, "Copy application from OAT1 to OTA0, please wait ...");
int ret = esp_patition_copy_ota1_to_ota0(bs);
if (ret) {
ESP_LOGE(TAG, "Fail to initialize OTA0");
return INVALID_INDEX;
}
boot_index = 0;
}
#endif
// Customer implementation.
// if (gpio_pin_1 == true && ...){
// boot_index = required_boot_partition;
// } ...
}
return boot_index;
}
开发者ID:espressif,项目名称:ESP8266_RTOS_SDK,代码行数:64,代码来源:bootloader_start.c
示例10: esp_phy_get_init_data
const esp_phy_init_data_t* esp_phy_get_init_data()
{
const esp_partition_t* partition = esp_partition_find_first(
ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_PHY, NULL);
if (partition == NULL) {
ESP_LOGE(TAG, "PHY data partition not found");
return NULL;
}
ESP_LOGD(TAG, "loading PHY init data from partition at offset 0x%x", partition->address);
size_t init_data_store_length = sizeof(phy_init_magic_pre) +
sizeof(esp_phy_init_data_t) + sizeof(phy_init_magic_post);
uint8_t* init_data_store = (uint8_t*) malloc(init_data_store_length);
if (init_data_store == NULL) {
ESP_LOGE(TAG, "failed to allocate memory for PHY init data");
return NULL;
}
esp_err_t err = esp_partition_read(partition, 0, init_data_store, init_data_store_length);
if (err != ESP_OK) {
ESP_LOGE(TAG, "failed to read PHY data partition (0x%x)", err);
return NULL;
}
if (memcmp(init_data_store, PHY_INIT_MAGIC, sizeof(phy_init_magic_pre)) != 0 ||
memcmp(init_data_store + init_data_store_length - sizeof(phy_init_magic_post),
PHY_INIT_MAGIC, sizeof(phy_init_magic_post)) != 0) {
ESP_LOGE(TAG, "failed to validate PHY data partition");
return NULL;
}
ESP_LOGD(TAG, "PHY data partition validated");
return (const esp_phy_init_data_t*) (init_data_store + sizeof(phy_init_magic_pre));
}
开发者ID:danathughes,项目名称:esp-idf,代码行数:30,代码来源:phy_init.c
示例11: ESP_LOGD
/**
* @brief Execute the creation of the descriptor with the BLE runtime in ESP.
* @param [in] pCharacteristic The characteristic to which to register this descriptor.
*/
void BLEDescriptor::executeCreate(BLECharacteristic* pCharacteristic) {
ESP_LOGD(LOG_TAG, ">> executeCreate(): %s", toString().c_str());
if (m_handle != NULL_HANDLE) {
ESP_LOGE(LOG_TAG, "Descriptor already has a handle.");
return;
}
m_pCharacteristic = pCharacteristic; // Save the characteristic associated with this service.
esp_attr_control_t control;
control.auto_rsp = ESP_GATT_RSP_BY_APP;
m_semaphoreCreateEvt.take("executeCreate");
esp_err_t errRc = ::esp_ble_gatts_add_char_descr(
pCharacteristic->getService()->getHandle(),
getUUID().getNative(),
(esp_gatt_perm_t)(ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE),
&m_value,
&control);
if (errRc != ESP_OK) {
ESP_LOGE(LOG_TAG, "<< esp_ble_gatts_add_char_descr: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
return;
}
m_semaphoreCreateEvt.wait("executeCreate");
ESP_LOGD(LOG_TAG, "<< executeCreate");
} // executeCreate
开发者ID:LefterisAd,项目名称:esp32-snippets,代码行数:31,代码来源:BLEDescriptor.cpp
示例12: connect_to_http_server
static bool connect_to_http_server()
{
ESP_LOGI(TAG, "Server IP: %s Server Port:%s", EXAMPLE_SERVER_IP, EXAMPLE_SERVER_PORT);
sprintf(http_request, "GET %s HTTP/1.1\r\nHost: %s:%s \r\n\r\n", EXAMPLE_FILENAME, EXAMPLE_SERVER_IP, EXAMPLE_SERVER_PORT);
int http_connect_flag = -1;
struct sockaddr_in sock_info;
socket_id = socket(AF_INET, SOCK_STREAM, 0);
if (socket_id == -1) {
ESP_LOGE(TAG, "Create socket failed!");
return false;
}
// set connect info
memset(&sock_info, 0, sizeof(struct sockaddr_in));
sock_info.sin_family = AF_INET;
sock_info.sin_addr.s_addr = inet_addr(EXAMPLE_SERVER_IP);
sock_info.sin_port = htons(atoi(EXAMPLE_SERVER_PORT));
// connect to http server
http_connect_flag = connect(socket_id, (struct sockaddr *)&sock_info, sizeof(sock_info));
if (http_connect_flag == -1) {
ESP_LOGE(TAG, "Connect to server failed! errno=%d", errno);
close(socket_id);
return false;
} else {
ESP_LOGI(TAG, "Connected to server");
return true;
}
return false;
}
开发者ID:mr-nice,项目名称:esp-idf,代码行数:32,代码来源:ota_example_main.c
示例13: i2c_cmd_link_append
static esp_err_t i2c_cmd_link_append(i2c_cmd_handle_t cmd_handle, i2c_cmd_t *cmd)
{
i2c_cmd_desc_t *cmd_desc = (i2c_cmd_desc_t *) cmd_handle;
if (cmd_desc->head == NULL) {
cmd_desc->head = (i2c_cmd_link_t *) heap_caps_calloc(1, sizeof(i2c_cmd_link_t), MALLOC_CAP_8BIT);
if (cmd_desc->head == NULL) {
ESP_LOGE(I2C_TAG, I2C_CMD_MALLOC_ERR_STR);
goto err;
}
cmd_desc->cur = cmd_desc->head;
cmd_desc->free = cmd_desc->head;
} else {
cmd_desc->cur->next = (i2c_cmd_link_t *) heap_caps_calloc(1, sizeof(i2c_cmd_link_t), MALLOC_CAP_8BIT);
if (cmd_desc->cur->next == NULL) {
ESP_LOGE(I2C_TAG, I2C_CMD_MALLOC_ERR_STR);
goto err;
}
cmd_desc->cur = cmd_desc->cur->next;
}
memcpy((uint8_t *) &cmd_desc->cur->cmd, (uint8_t *) cmd, sizeof(i2c_cmd_t));
cmd_desc->cur->next = NULL;
return ESP_OK;
err:
return ESP_FAIL;
}
开发者ID:espressif,项目名称:ESP8266_RTOS_SDK,代码行数:32,代码来源:i2c.c
示例14: app_main
void app_main()
{
vTaskDelay(1000 / portTICK_PERIOD_MS);
ESP_ERROR_CHECK(nvs_flash_init_partition("Mynvs"));
nvs_handle handle;
ESP_ERROR_CHECK(nvs_open_from_partition("Mynvs","store", NVS_READWRITE, &handle));
int32_t val = 0;
esp_err_t result = nvs_get_i32(handle, "val", &val);
switch (result)
{
case ESP_ERR_NOT_FOUND:
ESP_LOGE(TAG, "Value not set yet");
break;
case ESP_OK:
ESP_LOGI(TAG, "Value is %d", val);
break;
default:
ESP_LOGE(TAG, "Error (%s) opening NVS handle!\n", esp_err_to_name(result));
break;
}
val++;
ESP_ERROR_CHECK(nvs_set_i32(handle, "val", val));
ESP_ERROR_CHECK(nvs_commit(handle));
nvs_close(handle);
}
开发者ID:Mair,项目名称:esp32-course,代码行数:28,代码来源:main.c
示例15: bootloader_common_erase_part_type_data
bool bootloader_common_erase_part_type_data(const char *list_erase, bool ota_data_erase)
{
const esp_partition_info_t *partitions;
const char *marker;
esp_err_t err;
int num_partitions;
bool ret = true;
partitions = bootloader_mmap(ESP_PARTITION_TABLE_OFFSET, ESP_PARTITION_TABLE_MAX_LEN);
if (!partitions) {
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", ESP_PARTITION_TABLE_OFFSET, ESP_PARTITION_TABLE_MAX_LEN);
return false;
}
ESP_LOGD(TAG, "mapped partition table 0x%x at 0x%x", ESP_PARTITION_TABLE_OFFSET, (intptr_t)partitions);
err = esp_partition_table_verify(partitions, true, &num_partitions);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to verify partition table");
ret = false;
} else {
ESP_LOGI(TAG, "## Label Usage Offset Length Cleaned");
for (int i = 0; i < num_partitions; i++) {
const esp_partition_info_t *partition = &partitions[i];
char label[sizeof(partition->label) + 1] = {0};
if (partition->type == PART_TYPE_DATA) {
bool fl_ota_data_erase = false;
if (ota_data_erase == true && partition->subtype == PART_SUBTYPE_DATA_OTA) {
fl_ota_data_erase = true;
}
// partition->label is not null-terminated string.
strncpy(label, (char *)&partition->label, sizeof(label) - 1);
if (fl_ota_data_erase == true || (bootloader_common_label_search(list_erase, label) == true)) {
err = bootloader_flash_erase_range(partition->pos.offset, partition->pos.size);
if (err != ESP_OK) {
ret = false;
marker = "err";
} else {
marker = "yes";
}
} else {
marker = "no";
}
ESP_LOGI(TAG, "%2d %-16s data %08x %08x [%s]", i, partition->label,
partition->pos.offset, partition->pos.size, marker);
}
}
}
bootloader_munmap(partitions);
return ret;
}
开发者ID:tve,项目名称:esp-idf,代码行数:53,代码来源:bootloader_common.c
示例16: SEGGER_RTT_ESP32_FlushNoLock
/*********************************************************************
*
* SEGGER_RTT_ESP32_FlushNoLock()
*
* Function description
* Flushes buffered events.
*
* Parameters
* min_sz Threshold for flushing data. If current filling level is above this value, data will be flushed. TRAX destinations only.
* tmo Timeout for operation (in us). Use ESP_APPTRACE_TMO_INFINITE to wait indefinetly.
*
* Return value
* None.
*/
void SEGGER_RTT_ESP32_FlushNoLock(unsigned long min_sz, unsigned long tmo)
{
esp_err_t res = esp_apptrace_write(ESP_APPTRACE_DEST_TRAX, s_events_buf, s_events_buf_filled, tmo);
if (res != ESP_OK) {
ESP_LOGE(TAG, "Failed to flush buffered events (%d)!\n", res);
}
// flush even if we failed to write buffered events, because no new events will be sent after STOP
res = esp_apptrace_flush_nolock(ESP_APPTRACE_DEST_TRAX, min_sz, tmo);
if (res != ESP_OK) {
ESP_LOGE(TAG, "Failed to flush apptrace data (%d)!\n", res);
}
s_events_buf_filled = 0;
}
开发者ID:altran-nl,项目名称:esp-idf,代码行数:27,代码来源:SEGGER_RTT_esp32.c
示例17: bootloader_utility_load_boot_image
void bootloader_utility_load_boot_image(const bootloader_state_t *bs, int start_index)
{
int index = start_index;
esp_partition_pos_t part;
esp_image_metadata_t image_data;
if(start_index == TEST_APP_INDEX) {
if (try_load_partition(&bs->test, &image_data)) {
load_image(&image_data);
} else {
ESP_LOGE(TAG, "No bootable test partition in the partition table");
bootloader_reset();
}
}
/* work backwards from start_index, down to the factory app */
for(index = start_index; index >= FACTORY_INDEX; index--) {
part = index_to_partition(bs, index);
if (part.size == 0) {
continue;
}
ESP_LOGD(TAG, TRY_LOG_FORMAT, index, part.offset, part.size);
if (try_load_partition(&part, &image_data)) {
load_image(&image_data);
}
log_invalid_app_partition(index);
}
/* failing that work forwards from start_index, try valid OTA slots */
for(index = start_index + 1; index < bs->app_count; index++) {
part = index_to_partition(bs, index);
if (part.size == 0) {
continue;
}
ESP_LOGD(TAG, TRY_LOG_FORMAT, index, part.offset, part.size);
if (try_load_partition(&part, &image_data)) {
load_image(&image_data);
}
log_invalid_app_partition(index);
}
if (try_load_partition(&bs->test, &image_data)) {
ESP_LOGW(TAG, "Falling back to test app as only bootable partition");
load_image(&image_data);
}
ESP_LOGE(TAG, "No bootable app partitions in the partition table");
bzero(&image_data, sizeof(esp_image_metadata_t));
bootloader_reset();
}
开发者ID:tve,项目名称:esp-idf,代码行数:50,代码来源:bootloader_utility.c
示例18: sdcard_mount
esp_err_t sdcard_mount(const char* base_path)
{
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
// To use 1-line SD mode, uncomment the following line:
host.flags = SDMMC_HOST_FLAG_1BIT;
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
slot_config.gpio_cd = g_gpio;
slot_config.width = 1;
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
.format_if_mount_failed = false,
.max_files = SD_CARD_OPEN_FILE_NUM_MAX
};
sdmmc_card_t* card;
ESP_LOGI(TAG, "Trying to mount with base path=%s", base_path);
esp_err_t ret = esp_vfs_fat_sdmmc_mount(base_path, &host, &slot_config, &mount_config, &card);
switch (ret) {
case ESP_OK:
// Card has been initialized, print its properties
sdmmc_card_print_info(card);
ESP_LOGI(TAG, "CID name %s!\n", card->cid.name);
break;
case ESP_ERR_INVALID_STATE:
ESP_LOGE(TAG, "File system already mounted");
break;
case ESP_FAIL:
ESP_LOGE(TAG, "Failed to mount filesystem. If you want the card to be formatted, set format_if_mount_failed = true.");
break;
default:
ESP_LOGE(TAG, "Failed to initialize the card (%d). Make sure SD card lines have pull-up resistors in place.", ret);
break;
}
return ret;
}
esp_err_t sdcard_unmount(void)
{
esp_err_t ret = esp_vfs_fat_sdmmc_unmount();
if (ret == ESP_ERR_INVALID_STATE) {
ESP_LOGE(TAG, "File system not mounted");
}
return ret;
}
开发者ID:xieweimin,项目名称:esp-adf,代码行数:50,代码来源:sdcard.c
示例19: getConnectionInfo
/**
* Retrieve the connection info. A rc==0 means ok.
*/
static int getConnectionInfo(connection_info_t *pConnectionInfo) {
nvs_handle handle;
size_t size;
esp_err_t err;
uint32_t version;
err = nvs_open(BOOTWIFI_NAMESPACE, NVS_READWRITE, &handle);
if (err != 0) {
ESP_LOGE(tag, "nvs_open: %x", err);
return -1;
}
// Get the version that the data was saved against.
err = nvs_get_u32(handle, KEY_VERSION, &version);
if (err != ESP_OK) {
ESP_LOGD(tag, "No version record found (%d).", err);
nvs_close(handle);
return -1;
}
// Check the versions match
if ((version & 0xff00) != (g_version & 0xff00)) {
ESP_LOGD(tag, "Incompatible versions ... current is %x, found is %x", version, g_version);
nvs_close(handle);
return -1;
}
size = sizeof(connection_info_t);
err = nvs_get_blob(handle, KEY_CONNECTION_INFO, pConnectionInfo, &size);
if (err != ESP_OK) {
ESP_LOGD(tag, "No connection record found (%d).", err);
nvs_close(handle);
return -1;
}
if (err != ESP_OK) {
ESP_LOGE(tag, "nvs_open: %x", err);
nvs_close(handle);
return -1;
}
// Cleanup
nvs_close(handle);
// Do a sanity check on the SSID
if (strlen(pConnectionInfo->ssid) == 0) {
ESP_LOGD(tag, "NULL ssid detected");
return -1;
}
return 0;
} // getConnectionInfo
开发者ID:EdWeller,项目名称:esp32-snippets,代码行数:52,代码来源:bootwifi.c
示例20: log_invalid_app_partition
static void log_invalid_app_partition(int index)
{
const char *not_bootable = " is not bootable"; /* save a few string literal bytes */
switch(index) {
case FACTORY_INDEX:
ESP_LOGE(TAG, "Factory app partition%s", not_bootable);
break;
case TEST_APP_INDEX:
ESP_LOGE(TAG, "Factory test app partition%s", not_bootable);
break;
default:
ESP_LOGE(TAG, "OTA app partition slot %d%s", index, not_bootable);
break;
}
}
开发者ID:tve,项目名称:esp-idf,代码行数:15,代码来源:bootloader_utility.c
注:本文中的ESP_LOGE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论