AnsweredAssumed Answered

How to programmatically duplicate "don't use data cache" settings

Question asked by kbrafford on Oct 21, 2010
Latest reply on Oct 27, 2010 by matchaze

I have a project on a BF532 that has async flash, started in bypass mode.  In that async flash as part of my startup split-ldr run-from-flash build I have copied the Edinborough Boot Rom code that knows how to process a 16-bit boot stream.  I use that setup to do some sanity checking and then boot the appropriate code load, as there are several in my flash.


One of the several code loads is a reloader app that is used when the main code load looks corrupted.  That reloader app is also able to be triggered to be booted at run time by a working code load itself (like when the user wants to install a new rev), calling the same Edinborough boot stream processing code out in async flash.


That works great, as long as I don't use data chache.  That is, if I have my main code load set to "Enable Instruction Cache" and "Disable cache and disable memory protection" for the data cache settings, I can successfully jump to my copy of the Edinborough code, passing in the address of my reloader, and my reloader boots nicely.


But if I turn on the data cache, that scheme goes off into the weeds for some reason, and I haven't been able to debug and isolate the reason.


Is there some code I can add to the routine I call right before I trigger my reloader boot:


void turn_off_peripherals() {
   volatile int i;
   // turn off all the goodies
   // turn off interrupts
   // first, mask all of thm
   *pSIC_IMASK = 0x00000000;
   *pSPI_CTL =   0x0400;
   *pSPI_STAT = 0x0010;
   // reset the priority
   *pSIC_IAR0  = 0x10000000;
   *pSIC_IAR1  = 0x33322221;
   *pSIC_IAR2  = 0x66655444;
   // turn off the timers
   *pTIMER_DISABLE  = 0x0007;            // turn them all off     
   *pTIMER0_CONFIG  = 0x0000;            // no IRQ
   *pTIMER1_CONFIG  = 0x0000;            //
   *pTIMER2_CONFIG  = 0x0000;            //
   *pTIMER_STATUS   = 0xFFFF;            // clear all the W1C bits (clear IRQs)
   // turn off the core timer
   *pTCNTL = 0x00000008;                 // disable core timer and clear W1C bit
   // disable interrupts for UART
   *pUART_IER = 0x0000; 


    //*pDMEM_CONTROL = 0x0001001;  // this didn't seem to matter
   //*pIMEM_CONTROL = 0x0000001;  // this didn't seem to matter
   for (i = 0; i < 1000; i++) {


That will make my blackfin nicely start acting like I wasn't even using data cache, so my reloader will trigger like it does when I don't use data cache at all?


Thanks for your help!


--Keith Brafford