I have written some code for a Silabs C8051F330 CPU, compiled it and then obviously some C51STARTUP code is generated that initialize the variables. Using my USB debug adaptor I discover the execution got stuck in the C51STARTUP code and it never exits it to the main program. What could be a possible cause for this and how can I fix it?
What I have done is not to initialize any variable in the definition of it but rather later, just before running the main program. That cannot make much of a difference. XDATA variables are always of static storage duration, and such variables are always initialized to something, regardless of whether there's an initializer in the definition or not. If you don't supply one, the initializer is zero by default.
So you've only switched those variables from being, effectively, initialized via a big memcpy() from ROM to RAM, to a big memset(). That's at most a factor of two faster itself, and at lesst 50% slower in total, once your manual post-initialization has been done.
To really have an effect, you would have to disable the intialization mechanism centrally in the runtime environment. And the place for doing that is not in STARTUP.A51, but rather INIT.A51