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.
Implemented a while ago in [r13762].
Related
Commit: [r13762]
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:
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
I vote to have them all behave like the mcs51.
Could we re-open this feature-request ticket then? Or shall I start a new one?
I have submitted a patch: [patches:#453].
Related
Patches:
#453Last edit: Maarten Brock 2023-01-14
Further unified (return value handling via [patches:#453] in [r13796].
Related
Commit: [r13796]
Patches:
#453Has the manual been updated as well?
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
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.