mirror of
https://github.com/espressif/esp-mqtt.git
synced 2025-10-03 18:41:49 +02:00
partition: use esp_partition_munmap instead of spi_flash_munmap
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
#include "test_mqtt_client_broker.h"
|
#include "test_mqtt_client_broker.h"
|
||||||
#include "test_mqtt_connection.h"
|
#include "test_mqtt_connection.h"
|
||||||
#include "esp_mac.h"
|
#include "esp_mac.h"
|
||||||
#include "spi_flash_mmap.h"
|
#include "esp_partition.h"
|
||||||
|
|
||||||
static void test_leak_setup(const char * file, long line)
|
static void test_leak_setup(const char * file, long line)
|
||||||
{
|
{
|
||||||
@@ -59,10 +59,10 @@ TEST_CASE("mqtt init and deinit", "[mqtt][leaks=0]")
|
|||||||
|
|
||||||
static const char* this_bin_addr(void)
|
static const char* this_bin_addr(void)
|
||||||
{
|
{
|
||||||
spi_flash_mmap_handle_t out_handle;
|
esp_partition_mmap_handle_t out_handle;
|
||||||
const void *binary_address;
|
const void *binary_address;
|
||||||
const esp_partition_t* partition = esp_ota_get_running_partition();
|
const esp_partition_t* partition = esp_ota_get_running_partition();
|
||||||
esp_partition_mmap(partition, 0, partition->size, SPI_FLASH_MMAP_DATA, &binary_address, &out_handle);
|
esp_partition_mmap(partition, 0, partition->size, ESP_PARTITION_MMAP_DATA, &binary_address, &out_handle);
|
||||||
return binary_address;
|
return binary_address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
#include "test_mqtt5_client_broker.h"
|
#include "test_mqtt5_client_broker.h"
|
||||||
#include "test_mqtt_connection.h"
|
#include "test_mqtt_connection.h"
|
||||||
#include "esp_mac.h"
|
#include "esp_mac.h"
|
||||||
#include "spi_flash_mmap.h"
|
#include "esp_partition.h"
|
||||||
|
|
||||||
static esp_mqtt5_user_property_item_t user_property_arr[3] = {
|
static esp_mqtt5_user_property_item_t user_property_arr[3] = {
|
||||||
{"board", "esp32"},
|
{"board", "esp32"},
|
||||||
@@ -89,10 +89,10 @@ TEST_CASE("mqtt5 init and deinit", "[mqtt5][leaks=0]")
|
|||||||
|
|
||||||
static const char* this_bin_addr(void)
|
static const char* this_bin_addr(void)
|
||||||
{
|
{
|
||||||
spi_flash_mmap_handle_t out_handle;
|
esp_partition_mmap_handle_t out_handle;
|
||||||
const void *binary_address;
|
const void *binary_address;
|
||||||
const esp_partition_t* partition = esp_ota_get_running_partition();
|
const esp_partition_t* partition = esp_ota_get_running_partition();
|
||||||
esp_partition_mmap(partition, 0, partition->size, SPI_FLASH_MMAP_DATA, &binary_address, &out_handle);
|
esp_partition_mmap(partition, 0, partition->size, ESP_PARTITION_MMAP_DATA, &binary_address, &out_handle);
|
||||||
return binary_address;
|
return binary_address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,7 +13,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "esp_system.h"
|
#include "esp_system.h"
|
||||||
#include "esp_partition.h"
|
#include "esp_partition.h"
|
||||||
#include "spi_flash_mmap.h"
|
|
||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
#include "esp_event.h"
|
#include "esp_event.h"
|
||||||
#include "esp_netif.h"
|
#include "esp_netif.h"
|
||||||
@@ -41,10 +40,10 @@ extern const uint8_t mqtt_eclipseprojects_io_pem_end[] asm("_binary_mqtt_eclip
|
|||||||
//
|
//
|
||||||
static void send_binary(esp_mqtt_client_handle_t client)
|
static void send_binary(esp_mqtt_client_handle_t client)
|
||||||
{
|
{
|
||||||
spi_flash_mmap_handle_t out_handle;
|
esp_partition_mmap_handle_t out_handle;
|
||||||
const void *binary_address;
|
const void *binary_address;
|
||||||
const esp_partition_t *partition = esp_ota_get_running_partition();
|
const esp_partition_t *partition = esp_ota_get_running_partition();
|
||||||
esp_partition_mmap(partition, 0, partition->size, SPI_FLASH_MMAP_DATA, &binary_address, &out_handle);
|
esp_partition_mmap(partition, 0, partition->size, ESP_PARTITION_MMAP_DATA, &binary_address, &out_handle);
|
||||||
// sending only the configured portion of the partition (if it's less than the partition size)
|
// sending only the configured portion of the partition (if it's less than the partition size)
|
||||||
int binary_size = MIN(CONFIG_BROKER_BIN_SIZE_TO_SEND, partition->size);
|
int binary_size = MIN(CONFIG_BROKER_BIN_SIZE_TO_SEND, partition->size);
|
||||||
int msg_id = esp_mqtt_client_publish(client, "/topic/binary", binary_address, binary_size, 0, 0);
|
int msg_id = esp_mqtt_client_publish(client, "/topic/binary", binary_address, binary_size, 0, 0);
|
||||||
|
Reference in New Issue
Block a user