******************************************************************************/
/* DriverLib Includes */
#include "driverlib.h"
/* Standard Includes */
#include
#include
#include
#define BANK1_S30 0x3E000
/* Statics */
uint8_t patternArray[8192];
int main(void)
{
/* Since this program has a huge buffer that simulates the calibration data,
* halting the watch dog is done in the reset ISR to avoid a watchdog
* timeout during the zero
*/
/* Setting our MCLK to 48MHz for faster programming */
MAP_PCM_setCoreVoltageLevel(PCM_VCORE1);
MAP_CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_48);
/* Initializing our buffer to a pattern of 0xA5 */
memset(patternArray, 0xB1, 8192);
/* Unprotecting User Bank 1, Sectors 30 and 31 */
MAP_FlashCtl_unprotectSector(FLASH_MAIN_MEMORY_SPACE_BANK1,
FLASH_SECTOR30 | FLASH_SECTOR31);
/* Trying a mass erase. Since we unprotected User Bank 1,
* sectors 31 and 32, this should erase these sectors. If it fails, we
* trap inside an infinite loop.
*/
if(!MAP_FlashCtl_performMassErase())
while(1);
/* Trying to program the filler data. If it fails, trap inside an infinite
loop */
if(!MAP_FlashCtl_programMemory (patternArray, (void*) BANK1_S30, 8192))
while(1);
/* Setting sector 31 back to protected */
MAP_FlashCtl_protectSector(FLASH_MAIN_MEMORY_SPACE_BANK1,FLASH_SECTOR31);
/* Performing the mass erase again. Now, since we protected Sector31, only
* Sector 30 (0x3E000 - 0x3EFFF) should be erased. Set a breakpoint
* after this call to observe the memory in the debugger.
*/
if(!MAP_FlashCtl_performMassErase())
while(1);
/* Deep Sleeping when not in use */
while (1)
{
MAP_PCM_gotoLPM3();
}
}