mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
test_apps: Add a test to verify working of custom partition subtypes
This commit is contained in:
parent
b6d69840e8
commit
24f9e348c9
@ -1,5 +1,10 @@
|
||||
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
|
||||
|
||||
tools/test_apps/build_system/custom_partition_subtypes:
|
||||
enable:
|
||||
- if: IDF_TARGET in ["esp32", "linux"]
|
||||
reason: the test should be run on ESP32 and linux
|
||||
|
||||
tools/test_apps/build_system/ldgen_test:
|
||||
disable:
|
||||
- if: IDF_TARGET == "esp32c2"
|
||||
|
@ -0,0 +1,25 @@
|
||||
# The following lines of boilerplate have to be in your project's
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
project(custom_partition_subtypes)
|
||||
|
||||
idf_build_get_property(build_dir BUILD_DIR)
|
||||
idf_build_get_property(idf_path IDF_PATH)
|
||||
idf_build_get_property(python PYTHON)
|
||||
set(blank_file ${build_dir}/blank_file.bin)
|
||||
idf_component_get_property(partition_table_dir partition_table COMPONENT_DIR)
|
||||
|
||||
partition_table_get_partition_info(partition "--partition-type app --partition-subtype my_app1" "name")
|
||||
partition_table_get_partition_info(partition_size "--partition-type app --partition-subtype my_app1" "size")
|
||||
|
||||
add_custom_command(OUTPUT ${blank_file}
|
||||
COMMAND ${python} ${partition_table_dir}/gen_empty_partition.py
|
||||
${partition_size} ${blank_file})
|
||||
|
||||
add_custom_target(blank_bin ALL DEPENDS ${blank_file})
|
||||
add_dependencies(flash blank_bin)
|
||||
|
||||
esptool_py_flash_to_partition(flash "${partition}" "${blank_file}")
|
@ -0,0 +1,3 @@
|
||||
| Supported Targets | ESP32 | Linux |
|
||||
| ----------------- | ----- | ----- |
|
||||
|
@ -0,0 +1 @@
|
||||
idf_component_register()
|
@ -0,0 +1,2 @@
|
||||
idf_build_set_property(EXTRA_PARTITION_SUBTYPES "app, my_app1, 0x40" APPEND)
|
||||
idf_build_set_property(EXTRA_PARTITION_SUBTYPES "app, my_app2, 0x41" APPEND)
|
@ -0,0 +1 @@
|
||||
idf_component_register(SRCS test_main.c)
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <esp_partition.h>
|
||||
#include <esp_log.h>
|
||||
|
||||
static const char *TAG = "test_main";
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
const esp_partition_t *my_app1 = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_MY_APP1, NULL);
|
||||
if (my_app1 == NULL) {
|
||||
ESP_LOGE(TAG, "Failed to find custom my_app1");
|
||||
} else {
|
||||
ESP_LOGI(TAG, "Found custom partition @ 0x%x (0x%x)", my_app1->address, my_app1->size);
|
||||
}
|
||||
|
||||
const esp_partition_t *my_app2 = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_MY_APP2, NULL);
|
||||
if (my_app2 == NULL) {
|
||||
ESP_LOGE(TAG, "Failed to find custom my_app1");
|
||||
} else {
|
||||
ESP_LOGI(TAG, "Found custom partition @ 0x%x (0x%x)", my_app2->address, my_app2->size);
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
|
||||
nvs, data, nvs, , 0x6000,
|
||||
phy_init, data, phy, , 0x1000,
|
||||
fctry, app, factory, , 1M,
|
||||
my_app1, app, my_app1, , 256K,
|
||||
my_app2, app, my_app2, , 256K,
|
|
@ -0,0 +1,2 @@
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
Loading…
x
Reference in New Issue
Block a user