We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
How can I run a c-file bevor the usual startup code?
Which changes do I have to made in the startup code? I'm working with the lpc2214.
thanks in advance JChris
You can't!
that's why it's called "start-up" code: it's required to get things started - and that has to happen before you can run any 'C' code!
I am not very familiar with the ARM toolchain, but I would be surprised to learn that you can't call your own C functions before main(). Isn't that just a matter of jumping to a C function from an assembly file? And then, depending on how soon you call it, the C function must be crafted in such a way that it will cope with lack of initialization of, well, you choose what. For instance, a ram test coded in C could be called before the startup code initializes the static C variables.
but I would be surprised to learn that you can't call your own C functions before main().
Well, that's not what the OP asked for. He was talking about running C functions before the usual startup code, not just before main().
You most certainly can! You just can't rely on a standards-compliant execution environment until the "start-up" code has provided it for you.
For instance, a ram test coded in C could be called before the startup code initializes the static C variables
I want to fill the area between the stack and the heap to get to know if both areas are big enough for my project.
That means I have to run this c-file after the startup code and befor the main function. How can I do that? Where is the right place and the right call for the function?
JChris
"I want to fill the area between the stack and the heap to get to know if both areas are big enough for my project."
So why do you specifically need a 'C' file to do that?
Isn't that precisely the sort of thing that is far more appropriate in assembler?
Why not just include this in the startup?
Where would be the right place to do that in the startup? Just befor entering the main routine?
Could you describe the code I have to adjust to the startup - because I'm not really familiar with assembler.
Thanks in advance JChris
What is the difference between
StartCode(); main(); and void main (void) { StartCode(); ....
Erik