@@ -30,8 +30,25 @@ if(SPATZ_CLUSTER_CFG MATCHES "^(spatz_cluster\.(default|mempool|smallvrf|32b|dou
3030elseif ("${SPATZ_CLUSTER_CFG} " MATCHES "^spatz_cluster.carfield\\ .(l2|dram)\\ .hjson$" )
3131 set (_plat_folder "cheshire" )
3232else ()
33- message (FATAL_ERROR
34- "Unknown configuration SPATZ_CLUSTER_CFG: ${SPATZ_CLUSTER_CFG} for platform assignment" )
33+ if (NOT DEFINED SPATZ_CLUSTER_PLATFORM)
34+ message (WARNING
35+ "Unknown configuration SPATZ_CLUSTER_CFG: ${SPATZ_CLUSTER_CFG} for platform assignment" )
36+ else ()
37+ message (STATUS
38+ "Overwriting platform with SPATZ_CLUSTER_PLATFORM: ${SPATZ_CLUSTER_PLATFORM} " )
39+ set (_plat_folder "${SPATZ_CLUSTER_PLATFORM} " )
40+ endif ()
41+ endif ()
42+
43+ # 3. Check for platform folder assignment and throw a FATAL_ERROR if missing
44+ if (NOT _plat_folder)
45+ # Check if a platform was set (either by the match above or externally)
46+ # If no platform was set AND the platform folder is missing, throw FATAL_ERROR
47+ message (FATAL_ERROR
48+ "Could not determine platform folder. "
49+ "Configuration 'SPATZ_CLUSTER_CFG' was unmatched AND "
50+ "required variable 'SPATZ_CLUSTER_PLATFORM' is not set." )
51+
3552endif ()
3653
3754set (PLATFORM_SOURCE_FOLDER "src/platforms/${_plat_folder} " CACHE STRING "Path to the platform-specific sources" )
@@ -60,6 +77,16 @@ string(TOUPPER "${_key}" _key)
6077set (_orig_var "MEM_${_key} _ORIGIN" )
6178set (_size_var "MEM_${_key} _SIZE" )
6279
80+ if (NOT DEFINED ${_orig_var} AND DEFINED SPATZ_CLUSTER_MEMORY_ORIGIN)
81+ message (STATUS "Overriding memory origin with SPATZ_CLUSTER_MEMORY_ORIGIN: ${SPATZ_CLUSTER_MEMORY_ORIGIN} " )
82+ set (_orig_var "SPATZ_CLUSTER_MEMORY_ORIGIN" )
83+ endif ()
84+
85+ if (NOT DEFINED ${_size_var} AND DEFINED SPATZ_CLUSTER_MEMORY_SIZE)
86+ message (STATUS "Overriding memory size with SPATZ_CLUSTER_MEMORY_SIZE: ${SPATZ_CLUSTER_MEMORY_SIZE} " )
87+ set (_size_var "SPATZ_CLUSTER_MEMORY_SIZE" )
88+ endif ()
89+
6390if (DEFINED ${_orig_var} AND DEFINED ${_size_var} )
6491 # perform the lookup
6592 set (MEM_DRAM_ORIGIN "${${_orig_var} }" CACHE STRING "Base address of external memory" )
0 commit comments