AnsweredAssumed Answered

Reading Flash from Second Stage Boot Loader Question

Question asked by spdavis on Mar 31, 2015
Latest reply on Apr 1, 2015 by spdavis

Hello All,

      I have developed a simple second stage boot loader for the SHARC 21469 using the example code that accompanies EE345v01.  Currently, I hard code the address of the application to be loaded.  Once fully developed, the second stage boot loader will read a “status” word from flash to determine what application to load from flash, do a CRC check on the selected application, and then load it to memory.

     After getting the simple version of the second stage boot loader to work, I then added code to read the flash status word to determine which app to load, rather than hard coding it.  Reading flash works (using code from the 21469 serial flash driver), however it breaks the “dma reads from flash” in the “boot_kernel_serial.asm” part of the second stage boot loader.  If I have the serial flash code activated in the second stage boot loader, then the call to READ_THREEx32 returns “0xffffffff” for each value and loading the application to flash fails.

     The offending code from the serial flash driver seems to be:




                // for the flag pins to act as chip select

                SRU(FLAG4_O, DPI_PB05_I);

                SRU(HIGH, DPI_PBEN05_I);


                //First set flag 4 as an output

                sysreg_bit_set( sysreg_FLAGS, FLG4O ); //asm("bit set flags FLG4O;") Sets FLG4 output to 1;

                sysreg_bit_set( sysreg_FLAGS, FLG4 ); //asm("bit set flags FLG4;") Sets FLG4 Value to 1;


                *pSPIDMAC = 0;

                *pSPIBAUD = 0;

                *pSPIFLG = 0xF80;

                *pSPICTL = 0x400;


After reading flash and before jumping to “load_application_serial” , I attempt to reset the flags and DPI by doing the following:


                sysreg_bit_clr( sysreg_FLAGS, FLG4O );

                sysreg_bit_clr( sysreg_FLAGS, FLG4 );

               *pSRU2_PIN0 = 0x18017556;

                SRU(LOW, DPI_PBEN05_I);


However, that does not help.


If I comment out the line “SRU(FLAG4_O, DPI_PB05_I)” in the serial flash driver, then the call to “READ_THREEx32” works as expected. Of course, now the "flash read" to get the status word does not work.


Any ideas on what I may be overlooking would be appreciated.