From ec26c6163c9d1cf0422537e8f167a783736aca0c Mon Sep 17 00:00:00 2001 From: caleb crome Date: Sun, 12 Feb 2023 11:24:21 -0800 Subject: [PATCH] Turn data cache on This fixes https://github.com/hathach/tinyusb/issues/1894. I'm not really sure if this is the correct way to fix it, and I have not tested on all the rest of the family members, however, this lets the i.MX1010 work again. The problem: the latest SDK update does not enable the data cache by default This causes an assert in board_init() when attemping to control clock gating. I haven't investigated further as to *why* it's a problem, but it is a problem. --- hw/bsp/imxrt/family.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/bsp/imxrt/family.c b/hw/bsp/imxrt/family.c index fc6e9e266..ecd18bad3 100644 --- a/hw/bsp/imxrt/family.c +++ b/hw/bsp/imxrt/family.c @@ -55,6 +55,12 @@ const uint8_t dcd_data[] = { 0x00 }; void board_init(void) { + // make sure the dcache is on. +#if defined(__DCACHE_PRESENT) && __DCACHE_PRESENT + if (SCB_CCR_DC_Msk != (SCB_CCR_DC_Msk & SCB->CCR)) + SCB_EnableDCache(); +#endif + // Init clock BOARD_BootClockRUN(); SystemCoreClockUpdate();