mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
psram: add test for 4M psram
This commit is contained in:
parent
20a666fe03
commit
ff346f92af
@ -1313,7 +1313,7 @@ UT_004_13:
|
||||
- ESP32_IDF
|
||||
- UT_T1_1
|
||||
- psram
|
||||
|
||||
|
||||
UT_005_01:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
@ -1499,6 +1499,20 @@ UT_012_03:
|
||||
- UT_T1_1
|
||||
- 8Mpsram
|
||||
|
||||
UT_012_04:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_1
|
||||
- 8Mpsram
|
||||
|
||||
UT_012_05:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_1
|
||||
- 8Mpsram
|
||||
|
||||
UT_601_01:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
|
@ -1,30 +1,38 @@
|
||||
set(COMPONENT_SRCDIRS ".")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS ". ${CMAKE_CURRENT_BINARY_DIR}")
|
||||
if (CONFIG_TEST_ESP32_SUBTEST_ONLY)
|
||||
set(COMPONENT_SRCDIRS "psram_4m")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS ".")
|
||||
|
||||
set(COMPONENT_REQUIRES unity nvs_flash ulp)
|
||||
register_component()
|
||||
|
||||
register_component()
|
||||
else()
|
||||
set(COMPONENT_SRCDIRS ". psram_4m")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS ". ${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h"
|
||||
COMMAND xxd -i "logo.jpg" "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h"
|
||||
WORKING_DIRECTORY ${COMPONENT_PATH}
|
||||
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/logo.jpg")
|
||||
set(COMPONENT_REQUIRES unity nvs_flash ulp)
|
||||
|
||||
# Calculate MD5 value of header file esp_wifi_os_adapter.h
|
||||
execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_wifi_os_adapter.h
|
||||
COMMAND cut -c 1-7
|
||||
OUTPUT_VARIABLE WIFI_OS_ADAPTER_MD5
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
register_component()
|
||||
|
||||
# Calculate MD5 value of header file esp_wifi_crypto_types.h
|
||||
execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_wifi_crypto_types.h
|
||||
COMMAND cut -c 1-7
|
||||
OUTPUT_VARIABLE WIFI_CRYPTO_MD5
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h"
|
||||
COMMAND xxd -i "logo.jpg" "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h"
|
||||
WORKING_DIRECTORY ${COMPONENT_PATH}
|
||||
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/logo.jpg")
|
||||
|
||||
add_definitions(-DWIFI_OS_ADAPTER_MD5=\"${WIFI_OS_ADAPTER_MD5}\")
|
||||
add_definitions(-DWIFI_CRYPTO_MD5=\"${WIFI_CRYPTO_MD5}\")
|
||||
# Calculate MD5 value of header file esp_wifi_os_adapter.h
|
||||
execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_wifi_os_adapter.h
|
||||
COMMAND cut -c 1-7
|
||||
OUTPUT_VARIABLE WIFI_OS_ADAPTER_MD5
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
add_custom_target(esp32_test_logo DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h")
|
||||
# Calculate MD5 value of header file esp_wifi_crypto_types.h
|
||||
execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_wifi_crypto_types.h
|
||||
COMMAND cut -c 1-7
|
||||
OUTPUT_VARIABLE WIFI_CRYPTO_MD5
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
add_dependencies(${COMPONENT_NAME} esp32_test_logo)
|
||||
add_definitions(-DWIFI_OS_ADAPTER_MD5=\"${WIFI_OS_ADAPTER_MD5}\")
|
||||
add_definitions(-DWIFI_CRYPTO_MD5=\"${WIFI_CRYPTO_MD5}\")
|
||||
|
||||
add_custom_target(esp32_test_logo DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h")
|
||||
|
||||
add_dependencies(${COMPONENT_NAME} esp32_test_logo)
|
||||
endif()
|
@ -6,7 +6,11 @@ COMPONENT_EXTRA_CLEAN := test_tjpgd_logo.h
|
||||
|
||||
COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive
|
||||
|
||||
COMPONENT_SRCDIRS := . test_vectors
|
||||
ifdef CONFIG_TEST_ESP32_SUBTEST_ONLY
|
||||
COMPONENT_SRCDIRS := psram_4m
|
||||
else
|
||||
COMPONENT_SRCDIRS := . test_vectors psram_4m
|
||||
endif
|
||||
|
||||
# Calculate MD5 value of header file esp_wifi_os_adapter.h
|
||||
WIFI_OS_ADAPTER_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp32/include/esp_wifi_os_adapter.h | cut -c 1-7)\"
|
||||
|
69
components/esp32/test/psram_4m/test_4mpsram.c
Normal file
69
components/esp32/test/psram_4m/test_4mpsram.c
Normal file
@ -0,0 +1,69 @@
|
||||
#include "esp_heap_caps.h"
|
||||
#include "unity.h"
|
||||
#include "esp_log.h"
|
||||
#include "driver/spi_common.h"
|
||||
|
||||
static const char TAG[] = "test_psram";
|
||||
|
||||
static void test_psram_content()
|
||||
{
|
||||
const int test_size = 2048;
|
||||
uint32_t *test_area = heap_caps_malloc(test_size, MALLOC_CAP_SPIRAM);
|
||||
|
||||
size_t p;
|
||||
size_t s=test_size;
|
||||
int errct=0;
|
||||
int initial_err=-1;
|
||||
for (p=0; p<(s/sizeof(int)); p+=4) {
|
||||
test_area[p]=p^0xAAAAAAAA;
|
||||
}
|
||||
for (p=0; p<(s/sizeof(int)); p+=4) {
|
||||
if (test_area[p]!=(p^0xAAAAAAAA)) {
|
||||
errct++;
|
||||
if (errct==1) initial_err=p*4;
|
||||
}
|
||||
}
|
||||
if (errct) {
|
||||
ESP_LOGE(TAG, "SPI SRAM memory test fail. %d/%d writes failed, first @ %p\n", errct, s/32, initial_err+test_area);
|
||||
TEST_FAIL();
|
||||
} else {
|
||||
ESP_LOGI(TAG, "SPI SRAM memory test OK");
|
||||
}
|
||||
|
||||
free(test_area);
|
||||
}
|
||||
|
||||
// NOTE: this unit test rely on the config that PSRAM of 8MB is used only when CONFIG_SPIRAM_BNKSWITCH_ENABLE is set
|
||||
TEST_CASE("can use spi when not being used by psram", "[esp32]")
|
||||
{
|
||||
spi_host_device_t host;
|
||||
#if !CONFIG_SPIRAM_SUPPORT || !CONFIG_SPIRAM_SPEED_80M || CONFIG_SPIRAM_BANKSWITCH_ENABLE
|
||||
//currently all 8M psram don't need more SPI peripherals
|
||||
host = -1;
|
||||
#elif CONFIG_SPIRAM_OCCUPY_HSPI_HOST
|
||||
host = HSPI_HOST;
|
||||
#elif CONFIG_SPIRAM_OCCUPY_VSPI_HOST
|
||||
host = VSPI_HOST;
|
||||
#endif
|
||||
|
||||
bool claim_hspi = spicommon_periph_claim(HSPI_HOST, "ut-hspi");
|
||||
if (claim_hspi) ESP_LOGI(TAG, "HSPI claimed.");
|
||||
|
||||
bool claim_vspi = spicommon_periph_claim(VSPI_HOST, "ut-vspi");
|
||||
if (claim_vspi) ESP_LOGI(TAG, "VSPI claimed.");
|
||||
|
||||
if (host == HSPI_HOST) {
|
||||
TEST_ASSERT(claim_hspi==false);
|
||||
TEST_ASSERT(claim_vspi==true);
|
||||
} else if (host == VSPI_HOST) {
|
||||
TEST_ASSERT(claim_vspi==false);
|
||||
TEST_ASSERT(claim_hspi==true);
|
||||
} else {
|
||||
TEST_ASSERT(claim_hspi==true);
|
||||
TEST_ASSERT(claim_vspi==true);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPIRAM_SUPPORT
|
||||
test_psram_content();
|
||||
#endif
|
||||
}
|
@ -13,3 +13,14 @@ config UNITY_FREERTOS_STACK_SIZE
|
||||
default 8192
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Test options"
|
||||
|
||||
config TEST_ESP32_SUBTEST_ONLY
|
||||
bool "Test only 4M PSRAM cases for esp32 component"
|
||||
depends on SPIRAM_SUPPORT
|
||||
default n
|
||||
help
|
||||
If this option is enabled, only 4M PSRAM cases are compiled. Otherwise all cases are included.
|
||||
|
||||
endmenu
|
||||
|
6
tools/unit-test-app/configs/psram_hspi
Normal file
6
tools/unit-test-app/configs/psram_hspi
Normal file
@ -0,0 +1,6 @@
|
||||
TEST_COMPONENTS=esp32
|
||||
CONFIG_TEST_ESP32_SUBTEST_ONLY=y
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
||||
CONFIG_SPIRAM_SUPPORT=y
|
||||
CONFIG_SPIRAM_SPEED_80M=y
|
||||
CONFIG_SPIRAM_OCCUPY_HSPI_HOST=y
|
6
tools/unit-test-app/configs/psram_vspi
Normal file
6
tools/unit-test-app/configs/psram_vspi
Normal file
@ -0,0 +1,6 @@
|
||||
TEST_COMPONENTS=esp32
|
||||
CONFIG_TEST_ESP32_SUBTEST_ONLY=y
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
||||
CONFIG_SPIRAM_SUPPORT=y
|
||||
CONFIG_SPIRAM_SPEED_80M=y
|
||||
CONFIG_SPIRAM_OCCUPY_VSPI_HOST=y
|
Loading…
Reference in New Issue
Block a user