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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/18/09 12:11
Read: times


 
#163569 - modules
Responding to: ???'s previous message
in the bootloader:

$NOMOD51

$include   (CAPPBASE.h)

EXTRN      CODE (?C_STARTUP)
EXTRN      CODE (ISR_EI0)
............

EXTRN      BIT  (GBboot)

CSEG       AT    000h     ;reset
           ljmp  startup
CSEG       AT    003h     ;int 0
           ljmp  ISC_EI0
.......

// here switches between boot and app.
                              
ISC_EI0:   jnb   GBboot,appET0          //int 0
           ljmp  ISR_EI0   
appET0:    ljmp  APPBASE + 000h
....

startup:;  setb  GBboot
           mov   dptr,#0fbffh
           mov   a,#0
           movc  a,@a+dptr
           jnz   startAP               ; if last page of flash is erased we are in app mode
           ljmp   ?C_STARTUP
startAP:   clr   GBboot 
           ljmp  APPBASE + 060h

           end


in the app


$NOMOD51

$include   (MAPPBASE.h)

EXTRN      CODE (ISR_EI0)
EXTRN      CODE (?C_STARTUP)

CSEG       AT    APPBASE + 000h    ;int 0
           ljmp  ISR_EI0
.......

CSEG       AT    APPBASE + 060h    ;int 20
           ljmp  ?C_STARTUP

           end


startup modified like this
$INCLUDE   (cyf120.h)

?C_C51STARTUP    SEGMENT   CODE
?STACK           SEGMENT   IDATA

RSEG       ?STACK
DS         1

EXTRN      CODE (?C_START)
PUBLIC     ?C_STARTUP

           RSEG  ?C_C51STARTUP

?C_STARTUP:
;; disable watchdog (should be enabled after initialization)


Erik




List of 5 messages in thread
TopicAuthorDate
Bootloader code in C - ISR locations            01/01/70 00:00      
   I have done something similar .....            01/01/70 00:00      
      my application code is in C but bootloader in assembly 8051            01/01/70 00:00      
         modules            01/01/70 00:00      
            Thanks            01/01/70 00:00      

Back to Subject List