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

How to modify startup.a51 to execute codes before main() ?

Hi,

I have couple of lines of codes to insert into startup.a51. However, placing them at different places of startup.a51, either cause memory overlap (this disable my interrupts) or not to be executed at all.

Hope someone can shine some light, where usually should codes to be executed before main() be placed at ?

In addition, should I change the optimization options etc ?

Thanks

  • Why do you need code to execute before main?
    The reason for that may well affect the answer to your question!

    "I have couple of lines of codes to insert into startup.a51. However, placing them at different places of startup.a51, either cause memory overlap (this disable my interrupts) or not to be executed at all."

    Then you clearly haven't inserted them properly!
    startup.a51 is just an assembler file; there's nothing special about it.
    If you're causing memory overlaps, then you haven't properly located your code; if it's not getting executed, you must've put it in an unreachable place!

    Note that you might also need to adjust your linker settings.