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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/17/09 16:43
Read: times


 
#163537 - Bootloader code in C - ISR locations


I had written the following code in assembly 8051 for bootloader for Silabs IC :
C8051F044R. The bootloader code is written to occupy flash locations 
0x0000 to 0x05ff. The application code starts at 0x0600.
The bootloader ISR vectors points to application code ISRs.
I need to do the same thing in 'C' using Keil compiler.
Can someone guide me as to how it is done in 'C'? 

I have written my assembly 8051 code below.

Thanks.

;-----------------------------------------------------------------------------
; reset and interrupt vector table definitions in BOOTLOADER CODE
;-----------------------------------------------------------------------------
; jump to specified locations for each and every interrupt vector.
Cseg at 0
         Jmp main
org 03h  ; External Interrupt 0 
          ljmp 603h
org 0bh  ;Timer 0 Overflow
         ljmp 60bh
org 13h  ;External Interrupt 1
         ljmp 613h
org 01bh ;Timer 1 Overflow
         ljmp 61bh
org 023h ; UART0         
         ljmp 623h
org 02bh ; Timer 2 Overflow
         ljmp 62bh
org 033h ; SPI0
         ljmp 633h
org 03bh ; SMB0
         ljmp 63bh
org 043h ; RESERVED
         ljmp 643h
org 04bh ; ADC0 Window Compare
         ljmp 64bh
org 053h ; ADC0 Conversion Complete
         ljmp 653h
org 05bh ; Programmable Counter Array
         ljmp 65bh
org 063h ; Comparator0
         ljmp 663h
org 06bh ; Comparator1
         ljmp 66bh
org 073h ; Timer 3 Overflow
        ljmp 673h



;-----------------------------------------------------------------------------
; reset and interrupt vector table in APPLICATION CODE STARTING AT 0x600
;-----------------------------------------------------------------------------

cseg at 600h
ljmp  main	
						
org 603h; External Interrupt 0 
reti            
org 60bh					
ljmp  timerr0_isr; timer0 overflow interrupt
org 613h
reti; External Interrupt 1
org 61bh 											;Timer 1 Overflow
reti;Timer 1 Overflow				
org 623h					
ljmp  uart0_isr; uart0 interrupt						
org 62bh            
ljmp  timer2_isr; timer2 overflow interrupt
org 633h ; SPI0
reti
org 63Bh
ljmp SMBus_ISR; SMBus Interrupt Vector
org 643h ; RESERVED
reti
org 64bh ; ADC0 Window Compare
reti
org 653h ; ADC0 Conversion Complete
reti
org 65bh ; Programmable Counter Array
reti
org 663h ; Comparator0
reti
org 66bh ; Comparator1
reti
org 673h
ljmp timer3_isr; timer3 overflow interrupt









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