_startupData and start08.c

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

_startupData and start08.c

Jump to solution
2,184 Views
CyrilG_
Contributor I
Hello,

Every time I change my source code and I rebuilt it, the startupData changes (I can notice a difference by looking in the s19 file). The problem I am having is that I am working on some in-chip programmability and I can not update the part of the flash where the startup routine is stored. And the startupData is stored in this particular section. Is there any way to keep this part constant? What are this startupData used for ?, is it possible to know where it takes its initialization?

Thanks
Cyril
Labels (1)
Tags (1)
0 Kudos
1 Solution
604 Views
CompilerGuru
NXP Employee
NXP Employee
toCopyDownBeg points to the .copy section. As this section must be the last in a section list,
you could allocate .copy into its own segment in the prm file.
And yes, with __ONLY_INIT_SP globals wont be initialized, not even to 0.

Daniel

PS: I think the more usual setup is to have multiple applications for the fixed and the updated part just to make sure those are really independent and changes like this do not break the compatibility. Of course this approach works too, one just needs to be quite careful with all changes.

View solution in original post

0 Kudos
4 Replies
604 Views
CrasyCat
Specialist III
Hello
 
The startup structure is created by the linker and contains information processed at application startup.
Different fields and their usage are documented in the Build Tools reference manual.
 
Take a look at {Install}\Help\PDF\Build_Tools_Utilities.pdf.
In chapter "SmartLinker" section "Program Startup" you should be able to find information of the startup structure.
Looking into the .map file you can also see how this structure is initialized (and check what did change since last build).
 
You can decide to get rid of the startup code and startup structure but in that case you have to make sure that all global variables are initialized through assignment in the application code.
You cannot have any global variable defined with an initialization value in that case.
 
If this is the way you want to go just add the option -D__ONLY_INIT_SP to your compiler command line and make sure you rebuild at least the file start08.c
 
Be careful if you are working in that configuration it is your responsibility as a programmer to ensure that application global variables are initialized properly.
 
CrasyCat
0 Kudos
604 Views
CyrilG_
Contributor I
Thanks for this information. I tried what you said and I was able to pinpoint exactly what variable changes everytime I change the source code. It is the variable  toCopyDownBeg. Is there any way to keep this value constant (maybe by modifying the prm file?) or the only way is like you said, use the __ONLY_INIT_SP compiler option ? In the latter option,  I just have to ensure that all the global variables are initialized somewhere in the code (and not when I declare them), is that right?
 
Thanks
Cyril
0 Kudos
605 Views
CompilerGuru
NXP Employee
NXP Employee
toCopyDownBeg points to the .copy section. As this section must be the last in a section list,
you could allocate .copy into its own segment in the prm file.
And yes, with __ONLY_INIT_SP globals wont be initialized, not even to 0.

Daniel

PS: I think the more usual setup is to have multiple applications for the fixed and the updated part just to make sure those are really independent and changes like this do not break the compatibility. Of course this approach works too, one just needs to be quite careful with all changes.

0 Kudos
604 Views
CyrilG_
Contributor I
Thank you, it worked perfectly. In the prm file I added to a line to put the .copy in a particular location in memory and now I don't have any problem.
Regards,

Cyril
0 Kudos