This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Code for Bootstrap Loader

Is there a way to get a copy of the bootstrap loader code that is initially executed by the C16x controller. This code would be very helpful and instructive, as I'm trying to figure out how to load and execute a second application program after my original application (programmed into flash) is running.

Thanks for any help

Parents
  • Hello,
    I just took the following code from an old Infineon appnote, no more available on the Internet; I already implemented it into an application, and it behaves exactly as original on chip bootstrap.
    Hope this helps you
    Bruno

             DISWDT                   ; disable watchdog timer
             MOV   SP,#0FC00h         ; set stackpointer
             MOV   STKUN,#0FC00h      ; set stack underflow pointer
             MOV   STKOV,#0FA00h + 6  ; set stack overflow  pointer
             MOV   CP,#0FC00h         ; set registerbank
    WaitStartBit:
             JB    P3.11,WaitStartBit ; wait for start bit at RXD0
             BSET  T6R                ; start timer T6
    WaitStopBit:
             JNB   P3.11,WaitStopBit  ; wait for stop bit at RXD0
             BCLR  T6R                ; stop timer T6
             MOV   MDL,T6             ;
             SUB   MDL,#36            ; rounding & adjustment
             MOV   R1,#72             ; baudrate = (T6 / 72) - 1
             DIVU  R1                 ;
    InitSerialPort:
             MOV   S0BG,MDL           ; load baudrate generator
             BSET  P3.10              ; initialize TXD0 output
             BSET  DP3.10             ;
             MOV   S0CON,#8001h       ; initialize serial port 0:
                                      ; 8-bit data, no parity, one stop bit
                                      ; receiver not started: single wire option
    SendAcknowledge:
             MOV   S0TBUF,#0C5H       ; send acknowledge byte for baudrate check
    WaitTransmOver:
             JNB   S0TIR,WaitTransmOver ; wait till end of transmission
             BCLR  S0TIR              ; clear transmit interrupt request flag
             BSET  S0REN              ; receiver enabled
    ReceiveData:
             MOV   R0,#0FA40H         ;
    ReceiveLoop:
             JNB   S0RIR,ReceiveLoop  ; wait for receive interrupt request
             MOVB  [R0],S0RBUF        ; store received byte
             BCLR  S0RIR              ; clear receive interrupt request flag
             CMPI1 R0,#0FA5FH         ; all bytes received ?
             JMPR  CC_NE,ReceiveLoop  ; if not, continue loop
             JMPS  0,0FA40H           ; yes: jump to RAM routine
    
    

Reply
  • Hello,
    I just took the following code from an old Infineon appnote, no more available on the Internet; I already implemented it into an application, and it behaves exactly as original on chip bootstrap.
    Hope this helps you
    Bruno

             DISWDT                   ; disable watchdog timer
             MOV   SP,#0FC00h         ; set stackpointer
             MOV   STKUN,#0FC00h      ; set stack underflow pointer
             MOV   STKOV,#0FA00h + 6  ; set stack overflow  pointer
             MOV   CP,#0FC00h         ; set registerbank
    WaitStartBit:
             JB    P3.11,WaitStartBit ; wait for start bit at RXD0
             BSET  T6R                ; start timer T6
    WaitStopBit:
             JNB   P3.11,WaitStopBit  ; wait for stop bit at RXD0
             BCLR  T6R                ; stop timer T6
             MOV   MDL,T6             ;
             SUB   MDL,#36            ; rounding & adjustment
             MOV   R1,#72             ; baudrate = (T6 / 72) - 1
             DIVU  R1                 ;
    InitSerialPort:
             MOV   S0BG,MDL           ; load baudrate generator
             BSET  P3.10              ; initialize TXD0 output
             BSET  DP3.10             ;
             MOV   S0CON,#8001h       ; initialize serial port 0:
                                      ; 8-bit data, no parity, one stop bit
                                      ; receiver not started: single wire option
    SendAcknowledge:
             MOV   S0TBUF,#0C5H       ; send acknowledge byte for baudrate check
    WaitTransmOver:
             JNB   S0TIR,WaitTransmOver ; wait till end of transmission
             BCLR  S0TIR              ; clear transmit interrupt request flag
             BSET  S0REN              ; receiver enabled
    ReceiveData:
             MOV   R0,#0FA40H         ;
    ReceiveLoop:
             JNB   S0RIR,ReceiveLoop  ; wait for receive interrupt request
             MOVB  [R0],S0RBUF        ; store received byte
             BCLR  S0RIR              ; clear receive interrupt request flag
             CMPI1 R0,#0FA5FH         ; all bytes received ?
             JMPR  CC_NE,ReceiveLoop  ; if not, continue loop
             JMPS  0,0FA40H           ; yes: jump to RAM routine
    
    

Children
No data