@@ -219,7 +219,20 @@ def prepare(module, options):
219
219
maximum = "64Ki" ,
220
220
default = "3Ki" ))
221
221
222
- if "f" in options [":target" ].get_driver ("core" )["type" ]:
222
+ core = options [":target" ].get_driver ("core" )["type" ]
223
+ if "m7" in core :
224
+ module .add_option (
225
+ BooleanOption (
226
+ name = "enable_icache" ,
227
+ description = "Enable Instruction-Cache" ,
228
+ default = True ))
229
+ module .add_option (
230
+ BooleanOption (
231
+ name = "enable_dcache" ,
232
+ description = "Enable Data-Cache" ,
233
+ default = True ))
234
+
235
+ if "f" in core :
223
236
module .add_option (
224
237
EnumerationOption (
225
238
name = "float-abi" ,
@@ -331,8 +344,7 @@ def validate(env):
331
344
def build (env ):
332
345
env .substitutions = env .query ("vector_table" )
333
346
core = env .substitutions ["core" ]
334
- with_icache = "m7" in core
335
- with_dcache = with_icache and not (env .has_module (":platform:dma" ) or env .has_module (":platform:bdma" ))
347
+ enable_dcache = env .get ("enable_dcache" , False ) and not (env .has_module (":platform:dma" ) or env .has_module (":platform:bdma" ))
336
348
env .substitutions .update ({
337
349
"target" : env [":target" ].identifier ,
338
350
"with_fault_storage" : env .has_module (":platform:fault" ),
@@ -341,12 +353,14 @@ def build(env):
341
353
"with_fpu" : env .get ("float-abi" , "soft" ) != "soft" ,
342
354
"with_multicore" : env .has_module (":platform:multicore" ),
343
355
"with_msplim" : sum (c .isnumeric () for c in core ) == 2 ,
344
- "with_icache" : with_icache ,
345
- "with_dcache" : with_dcache ,
356
+ "enable_icache" : env .get ("enable_icache" , False ),
357
+ "enable_dcache" : enable_dcache ,
358
+ "has_icache" : env .has_option ("enable_icache" ),
359
+ "has_dcache" : env .has_option ("enable_dcache" ),
346
360
})
347
361
env .outbasepath = "modm/src/modm/platform/core"
348
362
349
- if env .substitutions [ "with_icache" ] and not env . substitutions [ "with_dcache" ] :
363
+ if env .get ( "enable_dcache" , False ) and not enable_dcache :
350
364
env .log .warning ("Cortex-M7 D-Cache is disabled due to using DMA!" )
351
365
352
366
# startup script
0 commit comments