
#include "f28p65x_device.h"
#include "f28p65x_examples.h"
#include "device.h"
#include "F28x_Project.h"
#define SaveMarkAddress         0x90800
#define StartEraseAddress       0x91000
uint32 MarkAddress = SaveMarkAddress;
uint16 *MarkPtr = (uint16 *)SaveMarkAddress;


void BootLoaderEntry(void);
void MainEntry(void);
void ProgrammEntry(void);

void BootCom();

#pragma CODE_SECTION(BootCom,"BOOTBANK");
#pragma CODE_SECTION(BootLoaderEntry,"BOOTBANK");
#pragma CODE_SECTION(MainEntry,"BOOTBANK");
#pragma CODE_SECTION(ProgrammEntry,"BOOTBANK");

void BootLoaderEntry(void)
{
    uint16 i,j,k;

    while(1)
    {
//        for(i=0;i<6;i++)
//        {
//            for(j=0;j<20;j++)
//            {
//                for(k=0;k<60000;k++);
//            }
//
//            for(j=0;j<20;j++)
//            {
//                for(k=0;k<60000;k++);
//            }
//        }
//        BootCom();
    }
}

void MainEntry(void)
{
    asm(" .ref _c_int00");
    asm(" LB _c_int00");

}

void ProgrammEntry(void)
{
    MarkPtr = (uint16 *)SaveMarkAddress;
    MarkAddress = SaveMarkAddress;
    while(*MarkPtr != 0xFFFF)
    {
        MarkPtr += 8;
        MarkAddress += 8;
    }
    if (*(MarkPtr-8) == 0xFFF1)
    {
        BootLoaderEntry();
    }
    else
    {
        MainEntry();
    }
}


void BootCom()
{

}

