@@ -8,7 +8,6 @@ project(arm_executor_runner)
88
99option (SEMIHOSTING "Enable semihosting" OFF )
1010option (ET_ARM_BAREMETAL_METHOD_ALLOCATOR_POOL_SIZE "Set ET_ARM_BAREMETAL_METHOD_ALLOCATOR_POOL_SIZE to specify memory alloction pool size" OFF )
11- option (ET_ARM_BAREMETAL_TEMP_ALLOCATOR_POOL_SIZE "Set ET_ARM_BAREMETAL_TEMP_ALLOCATOR_POOL_SIZE to specify temp alloction pool size" OFF )
1211option (ET_BUNDLE_IO "Set to compile in BundleIO support" OFF )
1312option (ET_ATOL "Set atol to use for BundleIO testing" OFF )
1413option (ET_RTOL "Set rtol to use for BundleIO testing" OFF )
@@ -99,20 +98,45 @@ if(NOT ${SEMIHOSTING})
9998 get_filename_component (ET_PTE_FILE_PATH ${ET_PTE_FILE_PATH} REALPATH)
10099endif ()
101100
101+ if (SYSTEM_CONFIG MATCHES "Ethos_U55" )
102+ add_subdirectory (${ETHOS_SDK_PATH} /core_platform/targets/corstone-300 target )
103+ elseif (SYSTEM_CONFIG MATCHES "Ethos_U85" )
104+ add_subdirectory (${ETHOS_SDK_PATH} /core_platform/targets/corstone-320 target )
105+ else ()
106+ message (FATAL_ERROR "Unsupported SYSTEM_CONFIG ${SYSTEM_CONFIG} ." )
107+ endif ()
102108
109+ if (MEMORY_MODE MATCHES "Dedicated_Sram" )
110+ target_compile_definitions (ethosu_target_common INTERFACE
111+ ETHOSU_MODEL=1
112+ ETHOSU_ARENA=1)
113+ elseif (MEMORY_MODE MATCHES "Shared_Sram" OR MEMORY_MODE MATCHES "Sram_Only" )
114+ target_compile_definitions (ethosu_target_common INTERFACE
115+ ETHOSU_MODEL=1
116+ ETHOSU_ARENA=0)
117+ else ()
118+ message (FATAL_ERROR "Unsupported MEMORY_MODE ${MEMORY_MODE} . Memory_mode can be Shared_Sram, Sram_Only or Dedicated_Sram(applicable for the Ethos-U85)" )
119+ endif ()
120+
121+ # By default, use 2MB of temporary scratch buffer
122+ # For Dedicated_Sram, use 128MB for the temporary scratch buffer and
123+ # 384KB for the fast scratch buffer(the cache, applicable only for Ethos-U65 and Ethos-U85)
124+ set (ET_ARM_BAREMETAL_SCRATCH_TEMP_ALLOCATOR_POOL_SIZE 0x200000)
125+ if (MEMORY_MODE MATCHES "Dedicated_Sram" )
126+ set (ET_ARM_BAREMETAL_SCRATCH_TEMP_ALLOCATOR_POOL_SIZE 0x8000000)
127+ set (ET_ARM_BAREMETAL_FAST_SCRATCH_TEMP_ALLOCATOR_POOL_SIZE 0x60000)
128+ endif ()
129+ message (STATUS "ET_ARM_BAREMETAL_SCRATCH_TEMP_ALLOCATOR_POOL_SIZE = ${ET_ARM_BAREMETAL_SCRATCH_TEMP_ALLOCATOR_POOL_SIZE} " )
130+ message (STATUS "ET_ARM_BAREMETAL_FAST_SCRATCH_TEMP_ALLOCATOR_POOL_SIZE = ${ET_ARM_BAREMETAL_FAST_SCRATCH_TEMP_ALLOCATOR_POOL_SIZE} " )
103131
104132# Dependencies from the Ethos-U Core This is the platform target of
105133# Corstone-300, that includes ethosu_core_driver and bare-metal bringup
106134# libraries. We link against ethosu_target_init which includes all of these
107135# dependencies.
108- if (SYSTEM_CONFIG STREQUAL "Ethos_U55_High_End_Embedded" )
109- add_subdirectory (${ETHOS_SDK_PATH} /core_platform/targets/corstone-300 target )
136+ if (SYSTEM_CONFIG MATCHES "Ethos_U55_High_End_Embedded" )
110137 set (TARGET_BOARD "corstone-300" )
111- if (MEMORY_MODE STREQUAL "Shared_Sram" )
138+ if (MEMORY_MODE MATCHES "Shared_Sram" )
112139 target_compile_definitions (ethosu_target_common INTERFACE
113- # ETHOSU_MODEL=0 place pte file/data in SRAM area
114- # ETHOSU_MODEL=1 place pte file/data in DDR area
115- ETHOSU_MODEL=1
116140 # Configure NPU architecture timing adapters
117141 # This is just example numbers and you should make this match your hardware
118142 # SRAM
@@ -144,7 +168,7 @@ if(SYSTEM_CONFIG STREQUAL "Ethos_U55_High_End_Embedded")
144168 ETHOSU_TA_HISTBIN_1=0
145169 ETHOSU_TA_HISTCNT_1=0
146170 )
147- elseif (MEMORY_MODE STREQUAL "Sram_Only" )
171+ elseif (MEMORY_MODE MATCHES "Sram_Only" )
148172 target_compile_definitions (ethosu_target_common INTERFACE
149173 # This is just example numbers and you should make this match your hardware
150174 # SRAM
@@ -180,14 +204,11 @@ if(SYSTEM_CONFIG STREQUAL "Ethos_U55_High_End_Embedded")
180204 else ()
181205 message (FATAL_ERROR "Unsupported memory_mode ${MEMORY_MODE} for the Ethos-U55. The Ethos-U55 supports only Shared_Sram and Sram_Only." )
182206 endif ()
183- elseif (SYSTEM_CONFIG STREQUAL "Ethos_U55_Deep_Embedded" )
207+ elseif (SYSTEM_CONFIG MATCHES "Ethos_U55_Deep_Embedded" )
184208 add_subdirectory (${ETHOS_SDK_PATH} /core_platform/targets/corstone-300 target )
185209 set (TARGET_BOARD "corstone-300" )
186- if (MEMORY_MODE STREQUAL "Shared_Sram" )
210+ if (MEMORY_MODE MATCHES "Shared_Sram" )
187211 target_compile_definitions (ethosu_target_common INTERFACE
188- # ETHOSU_MODEL=0 place pte file/data in SRAM area
189- # ETHOSU_MODEL=1 place pte file/data in DDR area
190- ETHOSU_MODEL=1
191212 # Configure NPU architecture timing adapters
192213 # This is just example numbers and you should make this match your hardware
193214 # SRAM
@@ -219,9 +240,8 @@ elseif(SYSTEM_CONFIG STREQUAL "Ethos_U55_Deep_Embedded")
219240 ETHOSU_TA_HISTBIN_1=0
220241 ETHOSU_TA_HISTCNT_1=0
221242 )
222- elseif (MEMORY_MODE STREQUAL "Sram_Only" )
243+ elseif (MEMORY_MODE MATCHES "Sram_Only" )
223244 target_compile_definitions (ethosu_target_common INTERFACE
224- ETHOSU_MODEL=1
225245 # Configure NPU architecture timing adapters
226246 # This is just example numbers and you should make this match your hardware
227247 # SRAM
@@ -256,14 +276,11 @@ elseif(SYSTEM_CONFIG STREQUAL "Ethos_U55_Deep_Embedded")
256276 else ()
257277 message (FATAL_ERROR "Unsupported memory_mode ${MEMORY_MODE} for the Ethos-U55. The Ethos-U55 supports only Shared_Sram and Sram_Only." )
258278 endif ()
259- elseif (SYSTEM_CONFIG STREQUAL "Ethos_U85_SYS_DRAM_Low" )
279+ elseif (SYSTEM_CONFIG MATCHES "Ethos_U85_SYS_DRAM_Low" )
260280 add_subdirectory (${ETHOS_SDK_PATH} /core_platform/targets/corstone-320 target )
261281 set (TARGET_BOARD "corstone-320" )
262- if (MEMORY_MODE STREQUAL "Dedicated_Sram" )
282+ if (MEMORY_MODE MATCHES "Dedicated_Sram" )
263283 target_compile_definitions (ethosu_target_common INTERFACE
264- # ETHOSU_MODEL=0 place pte file/data in SRAM area
265- # ETHOSU_MODEL=1 place pte file/data in DDR area
266- ETHOSU_MODEL=1
267284 # Configure NPU architecture timing adapters
268285 # This is just example numbers and you should make this match your hardware
269286 # SRAM
@@ -295,11 +312,8 @@ elseif(SYSTEM_CONFIG STREQUAL "Ethos_U85_SYS_DRAM_Low")
295312 ETHOSU_TA_HISTBIN_1=0
296313 ETHOSU_TA_HISTCNT_1=0
297314 )
298- elseif (MEMORY_MODE STREQUAL "Sram_Only" )
315+ elseif (MEMORY_MODE MATCHES "Sram_Only" )
299316 target_compile_definitions (ethosu_target_common INTERFACE
300- # ETHOSU_MODEL=0 place pte file/data in SRAM area
301- # ETHOSU_MODEL=1 place pte file/data in DDR area
302- ETHOSU_MODEL=1
303317 # Configure NPU architecture timing adapters
304318 # This is just example numbers and you should make this match your hardware
305319 # SRAM
@@ -333,13 +347,9 @@ elseif(SYSTEM_CONFIG STREQUAL "Ethos_U85_SYS_DRAM_Low")
333347 )
334348 endif ()
335349elseif (SYSTEM_CONFIG STREQUAL "Ethos_U85_SYS_DRAM_Mid" OR SYSTEM_CONFIG STREQUAL "Ethos_U85_SYS_DRAM_High" )
336- add_subdirectory (${ETHOS_SDK_PATH} /core_platform/targets/corstone-320 target )
337350 set (TARGET_BOARD "corstone-320" )
338- if (MEMORY_MODE STREQUAL "Dedicated_Sram" )
351+ if (MEMORY_MODE MATCHES "Dedicated_Sram" )
339352 target_compile_definitions (ethosu_target_common INTERFACE
340- # ETHOSU_MODEL=0 place pte file/data in SRAM area
341- # ETHOSU_MODEL=1 place pte file/data in DDR area
342- ETHOSU_MODEL=1
343353 # Configure NPU architecture timing adapters
344354 # This is just example numbers and you should make this match your hardware
345355 # SRAM
@@ -371,11 +381,8 @@ elseif(SYSTEM_CONFIG STREQUAL "Ethos_U85_SYS_DRAM_Mid" OR SYSTEM_CONFIG STREQUAL
371381 ETHOSU_TA_HISTBIN_1=0
372382 ETHOSU_TA_HISTCNT_1=0
373383 )
374- elseif (MEMORY_MODE STREQUAL "Sram_Only" )
384+ elseif (MEMORY_MODE MATCHES "Sram_Only" )
375385 target_compile_definitions (ethosu_target_common INTERFACE
376- # ETHOSU_MODEL=0 place pte file/data in SRAM area
377- # ETHOSU_MODEL=1 place pte file/data in DDR area
378- ETHOSU_MODEL=1
379386 # Configure NPU architecture timing adapters
380387 # This is just example numbers and you should make this match your hardware
381388 # SRAM
@@ -434,7 +441,7 @@ endif()
434441# the memory traffic of Region 1 should pass via the external memory(3) and the traffic for Region 2 should pass via the SRAM(0)
435442#
436443
437- if (MEMORY_MODE STREQUAL "Sram_Only" )
444+ if (MEMORY_MODE MATCHES "Sram_Only" )
438445 target_compile_definitions (ethosu_core_driver PRIVATE
439446 NPU_QCONFIG=1
440447 NPU_REGIONCFG_0=1
@@ -445,7 +452,7 @@ if(MEMORY_MODE STREQUAL "Sram_Only")
445452 NPU_REGIONCFG_5=0
446453 NPU_REGIONCFG_6=0
447454 NPU_REGIONCFG_7=0)
448- elseif (MEMORY_MODE STREQUAL "Dedicated_Sram" )
455+ elseif (MEMORY_MODE MATCHES "Dedicated_Sram" )
449456 target_compile_definitions (ethosu_core_driver PRIVATE
450457 NPU_QCONFIG=3
451458 NPU_REGIONCFG_0=3
@@ -632,8 +639,9 @@ if(ET_ARM_BAREMETAL_METHOD_ALLOCATOR_POOL_SIZE)
632639 target_compile_definitions (arm_executor_runner PUBLIC ET_ARM_BAREMETAL_METHOD_ALLOCATOR_POOL_SIZE=${ET_ARM_BAREMETAL_METHOD_ALLOCATOR_POOL_SIZE} )
633640endif ()
634641
635- if (ET_ARM_BAREMETAL_TEMP_ALLOCATOR_POOL_SIZE)
636- target_compile_definitions (arm_executor_runner PUBLIC ET_ARM_BAREMETAL_TEMP_ALLOCATOR_POOL_SIZE=${ET_ARM_BAREMETAL_TEMP_ALLOCATOR_POOL_SIZE} )
642+ target_compile_definitions (arm_executor_runner PUBLIC ET_ARM_BAREMETAL_SCRATCH_TEMP_ALLOCATOR_POOL_SIZE=${ET_ARM_BAREMETAL_SCRATCH_TEMP_ALLOCATOR_POOL_SIZE} )
643+ if (DEFINED ET_ARM_BAREMETAL_FAST_SCRATCH_TEMP_ALLOCATOR_POOL_SIZE)
644+ target_compile_definitions (arm_executor_runner PUBLIC ET_ARM_BAREMETAL_FAST_SCRATCH_TEMP_ALLOCATOR_POOL_SIZE=${ET_ARM_BAREMETAL_FAST_SCRATCH_TEMP_ALLOCATOR_POOL_SIZE} )
637645endif ()
638646
639647if (ET_BUNDLE_IO)
0 commit comments