mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	[esp32] Add config option to execute from PSRAM (#9907)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
		| @@ -65,6 +65,7 @@ def set_core_config() -> Generator[SetCoreConfigCallable]: | ||||
|         *, | ||||
|         core_data: ConfigType | None = None, | ||||
|         platform_data: ConfigType | None = None, | ||||
|         full_config: dict[str, ConfigType] | None = None, | ||||
|     ) -> None: | ||||
|         platform, framework = platform_framework.value | ||||
|  | ||||
| @@ -83,7 +84,7 @@ def set_core_config() -> Generator[SetCoreConfigCallable]: | ||||
|             CORE.data[platform.value] = platform_data | ||||
|  | ||||
|         config.path_context.set([]) | ||||
|         final_validate.full_config.set(Config()) | ||||
|         final_validate.full_config.set(full_config or Config()) | ||||
|  | ||||
|     yield setter | ||||
|  | ||||
|   | ||||
| @@ -8,10 +8,13 @@ import pytest | ||||
|  | ||||
| from esphome.components.esp32 import VARIANTS | ||||
| import esphome.config_validation as cv | ||||
| from esphome.const import PlatformFramework | ||||
| from esphome.const import CONF_ESPHOME, PlatformFramework | ||||
| from tests.component_tests.types import SetCoreConfigCallable | ||||
|  | ||||
|  | ||||
| def test_esp32_config(set_core_config) -> None: | ||||
| def test_esp32_config( | ||||
|     set_core_config: SetCoreConfigCallable, | ||||
| ) -> None: | ||||
|     set_core_config(PlatformFramework.ESP32_IDF) | ||||
|  | ||||
|     from esphome.components.esp32 import CONFIG_SCHEMA | ||||
| @@ -60,14 +63,49 @@ def test_esp32_config(set_core_config) -> None: | ||||
|             r"Option 'variant' does not match selected board. @ data\['variant'\]", | ||||
|             id="mismatched_board_variant_config", | ||||
|         ), | ||||
|         pytest.param( | ||||
|             { | ||||
|                 "variant": "esp32s2", | ||||
|                 "framework": { | ||||
|                     "type": "esp-idf", | ||||
|                     "advanced": {"execute_from_psram": True}, | ||||
|                 }, | ||||
|             }, | ||||
|             r"'execute_from_psram' is only supported on ESP32S3 variant @ data\['framework'\]\['advanced'\]\['execute_from_psram'\]", | ||||
|             id="execute_from_psram_invalid_for_variant_config", | ||||
|         ), | ||||
|         pytest.param( | ||||
|             { | ||||
|                 "variant": "esp32s3", | ||||
|                 "framework": { | ||||
|                     "type": "esp-idf", | ||||
|                     "advanced": {"execute_from_psram": True}, | ||||
|                 }, | ||||
|             }, | ||||
|             r"'execute_from_psram' requires PSRAM to be configured @ data\['framework'\]\['advanced'\]\['execute_from_psram'\]", | ||||
|             id="execute_from_psram_requires_psram_config", | ||||
|         ), | ||||
|         pytest.param( | ||||
|             { | ||||
|                 "variant": "esp32s3", | ||||
|                 "framework": { | ||||
|                     "type": "esp-idf", | ||||
|                     "advanced": {"ignore_efuse_mac_crc": True}, | ||||
|                 }, | ||||
|             }, | ||||
|             r"'ignore_efuse_mac_crc' is not supported on ESP32S3 @ data\['framework'\]\['advanced'\]\['ignore_efuse_mac_crc'\]", | ||||
|             id="ignore_efuse_mac_crc_only_on_esp32", | ||||
|         ), | ||||
|     ], | ||||
| ) | ||||
| def test_esp32_configuration_errors( | ||||
|     config: Any, | ||||
|     error_match: str, | ||||
|     set_core_config: SetCoreConfigCallable, | ||||
| ) -> None: | ||||
|     set_core_config(PlatformFramework.ESP32_IDF, full_config={CONF_ESPHOME: {}}) | ||||
|     """Test detection of invalid configuration.""" | ||||
|     from esphome.components.esp32 import CONFIG_SCHEMA | ||||
|     from esphome.components.esp32 import CONFIG_SCHEMA, FINAL_VALIDATE_SCHEMA | ||||
|  | ||||
|     with pytest.raises(cv.Invalid, match=error_match): | ||||
|         CONFIG_SCHEMA(config) | ||||
|         FINAL_VALIDATE_SCHEMA(CONFIG_SCHEMA(config)) | ||||
|   | ||||
| @@ -18,4 +18,5 @@ class SetCoreConfigCallable(Protocol): | ||||
|         *, | ||||
|         core_data: ConfigType | None = None, | ||||
|         platform_data: ConfigType | None = None, | ||||
|         full_config: dict[str, ConfigType] | None = None, | ||||
|     ) -> None: ... | ||||
|   | ||||
							
								
								
									
										12
									
								
								tests/components/esp32/test.esp32-s3-idf.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								tests/components/esp32/test.esp32-s3-idf.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| esp32: | ||||
|   variant: esp32s3 | ||||
|   framework: | ||||
|     type: esp-idf | ||||
|     advanced: | ||||
|       execute_from_psram: true | ||||
|  | ||||
| psram: | ||||
|   mode: octal | ||||
|   speed: 80MHz | ||||
|  | ||||
| logger: | ||||
		Reference in New Issue
	
	Block a user