Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/01/01 08:47
Read: times


 
#13717 - RE: boot from c
The boot loader I mentioned is written completely in C, only 2 configuration bytes are set in assembly as DB directive.

There is a copy of main() routine:

void main ()
{
IE0 = 0; // disable interrupts
IPH0 = 0; // in the case of warm restart
IPL0 = 0;
PCON &= 0xcf; // don't change POF flag
PCON |= 0x04; // GF0 - mark WDOG or HARDWARE reset
TFERel = 0; // Clear TFE Relay

fmemcpy (&_NCONST_T_, &_NCONST_S_, (unsigned int)&_NCONST_L_);// near constants
fmemcpy (&_PR_FLASH_SROM_T_, &_PR_FLASH_SROM_S_,(unsigned int)&_PR_FLASH_SROM_L_);
main_SROM (version);
}

First the NEAR constants and then Programming routines are copied from the storage location in FLASH boot sector to SRAM with fmemcopy. Then the programming routine main_SROM () is started which has just been relocated from FLASH to RAM and is now beeing executed within SRAM. During the FLASH programming, no CODE can be executed from FLASH for data lines D0-D7 reflect FLASH programming status. That's why the programming routines are executed from SRAM. After the FLASH programming is done and application is valid, the 4 byte signature and timestamp info is written at last 16 bytes of application code sector and the application code is started with:

((void (code far *) (void)) K2100ISDN) ();//start system K2100 code

I repeat, there is NO assembly instruction used for this loader.

It supports double 128K code - the last active one and old one, in case of last code download failure.

Franc

List of 8 messages in thread
TopicAuthorDate
boot from c            01/01/70 00:00      
RE: boot from c            01/01/70 00:00      
RE: boot from c            01/01/70 00:00      
RE: boot from c            01/01/70 00:00      
RE: boot from c            01/01/70 00:00      
RE: boot from c            01/01/70 00:00      
RE: boot from c            01/01/70 00:00      
RE: boot from c            01/01/70 00:00      

Back to Subject List