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

direct the code to main{} in address 0x0000

Hi
i use SW reset command in my code.
after reset, PC is set to address 0x0000.
unfortunately at this address i can't find nor main{} neither JMP to main.
which are the tools i can use (startup.a51 or others) in order to direct the program on address 0x0000 to main{}?

Parents
  • i use a watchdog, but a tailored one.
    No, you don't. That mechanism you describe is not a watchdog. It's just timer ISR that does some work. A watchdog is a timer (internal or external), that upon running out does exactly one thing: cause a bona fide reset of the CPU.

    from inside the watchdog ISR i call to save to FLASH memory function (which calls some other functions).

    Do not call complicated functions from inside an 8051 CPU's ISR. That's almost worse than trying to emulate a reset in SW. If you have to do it, you still have to be extremely careful about how you handle register banks around this.

    And you really can't "return" out of an ISR into any kind of SW reset. You'll still have the "currently inside interrupt" flag of the CPU core active. That's one of those differences between the actual reset state and what you can reach just by jumping to zero which I warned you about. One down, countless many to go...

Reply
  • i use a watchdog, but a tailored one.
    No, you don't. That mechanism you describe is not a watchdog. It's just timer ISR that does some work. A watchdog is a timer (internal or external), that upon running out does exactly one thing: cause a bona fide reset of the CPU.

    from inside the watchdog ISR i call to save to FLASH memory function (which calls some other functions).

    Do not call complicated functions from inside an 8051 CPU's ISR. That's almost worse than trying to emulate a reset in SW. If you have to do it, you still have to be extremely careful about how you handle register banks around this.

    And you really can't "return" out of an ISR into any kind of SW reset. You'll still have the "currently inside interrupt" flag of the CPU core active. That's one of those differences between the actual reset state and what you can reach just by jumping to zero which I warned you about. One down, countless many to go...

Children