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

Bootloader Startup.asm code Help

Hi,

I'm starting learning 8051 mcu, came up with the startup code written in assembly.
I have few things I need to know.

Here is the sample startup source code of bootloader:

My questions start with ????? below.


;SOME INITIALIZATION HERE

CSEG    AT      0

?C_STARTUP:     LJMP    Start
                LJMP    ISRApp_ExternalInt0
                LJMP    _WritePageOnFlash
                ds      2 ????? Why reserve 2-bytes?

                LJMP    ISRApp_Timer0
                LJMP    GetP2Value
                ds      2 ????? Why reserve 2-bytes?

                ...

                LJMP    ISRApp_UART1
                ds      10 ????? Why reserve 10-bytes, does it overlap the 8-byte interrupt interval?
                LJMP    ISRApp_SMB1
                ...

CSEG   AT       1400h
Base:                   dw      $
ISRApp_Reset:           lcall   Error ????? Why it calls Error?
ISRApp_ExternalInt0:    lcall   Error
ISRApp_Timer0           lcall   Error

...

ISRApp_UART1            lcall   Error


Error:
      clr EA
Loop:
      jmp Loop


...

END

Also, what I don't understand here is, why it didn't indicate CSEG AT 03h for Interrup 0, CSEG AT 0Bh for Interrup 1, etc. as to what states here http://www.keil.com/support/docs/132.htm?

Hope somebody can lighten me up here.

I used Silabs 8051 mcu w/ keil's C51.

thanks
gee

Parents
  • Yes! I did it! I understand now why and what "ds 2 or 5 or sometimes 10" serve after each "ljmp" of interrupt. The answer is in Startup.lst. Since NOIV is used, I should manually calculate the redirected address of each interrupt and ds x compensate for the next Interrupt address, "ljmp" eats 3-bytes and "ds x" should be added to point to the next 8-byte interval of interrupt.

    1 question remains, why all redirected interrupt calls "Error" label?

    Hope somebody can explain me on this.

    thanks in advance
    Gee

Reply
  • Yes! I did it! I understand now why and what "ds 2 or 5 or sometimes 10" serve after each "ljmp" of interrupt. The answer is in Startup.lst. Since NOIV is used, I should manually calculate the redirected address of each interrupt and ds x compensate for the next Interrupt address, "ljmp" eats 3-bytes and "ds x" should be added to point to the next 8-byte interval of interrupt.

    1 question remains, why all redirected interrupt calls "Error" label?

    Hope somebody can explain me on this.

    thanks in advance
    Gee

Children