Menu

#859 Unify and rename _sdcc_external_startup

None
closed-fixed
None
5
2023-01-23
2022-11-12
No

About half of our ports do call _sdcc_external_startup before initializing global variables. For the mcs51 port only, this is documented in the manual.

I think it would make sense for all ports to behave the same. Since we need the functionality for target devices that have watchdogs that are active on reset, behaving the same would mean adding support in all ports.

I also think we should rename the function (even though this breaks backward compatibility), and use a reserved name instead. __sdcc_external_startup looks like a reasonable choice to me.

Related

Bugs: #3544
Wiki: NGI0-Entrust-SDCC

Discussion

  • Philipp Klaus Krause

    Implemented a while ago in [r13762].

     

    Related

    Commit: [r13762]

  • Philipp Klaus Krause

    • status: open --> closed-fixed
    • Group: -->
     
  • Philipp Klaus Krause

    • assigned_to: Philipp Klaus Krause
     
  • Basil Hussain

    Basil Hussain - 2023-01-02

    Question: is the intention to fully unify behaviour of __sdcc_external_startup across all platforms?

    If so, there currently remains a discrepancy. The manual, when discussing MCS51 startup, says:

    If this routine returns a nonzero value, the static & global variable initialization will be skipped and the function main will be invoked.

    The current STM8 init code implementation does not do this. No return value is checked. And as far as I can tell from the changes in [r13762], no other platforms where __sdcc_external_startup has been introduced do either.

    Can, or should, the non-MCS51 implementations be changed to match?

     

    Related

    Commit: [r13762]


    Last edit: Basil Hussain 2023-01-02
    • Maarten Brock

      Maarten Brock - 2023-01-03

      I vote to have them all behave like the mcs51.

       
      • Basil Hussain

        Basil Hussain - 2023-01-10

        Could we re-open this feature-request ticket then? Or shall I start a new one?

         
    • Basil Hussain

      Basil Hussain - 2023-01-14

      I have submitted a patch: [patches:#453].

       

      Related

      Patches: #453


      Last edit: Maarten Brock 2023-01-14
  • Philipp Klaus Krause

    • status: closed-fixed --> open
     
  • Philipp Klaus Krause

    • status: open --> closed-fixed
     
  • Maarten Brock

    Maarten Brock - 2023-01-19

    Has the manual been updated as well?

     
    • Philipp Klaus Krause

      I hadn't; though the old manual wasn't wrong either. I've just comitted a simplification and improvement of the manual (moved a sentence out of the mcs51-specific part of the manual, and deleted some now-redundant stuff in the mcs51-specific part): [r13798].

       

      Related

      Commit: [r13798]


      Last edit: Philipp Klaus Krause 2023-01-19
      • Maarten Brock

        Maarten Brock - 2023-01-23

        If I see correctly, you removed the part about initializing an external memory interface (EMIF). I think this is an important example of what to do in __sdcc_external_startup. Many microcontrollers with an EMIF have it on pins that can be used for many different functions and default to the EMIF being switched off. Initialising variables in that external memory will fail of course if the EMIF is still disabled.

         

Log in to post a comment.

MongoDB Logo MongoDB