Hi
I'm using CW 5.0 for S12XE family
I'd like to know whether it is possible to create a CW project where I specify only the eeprom (D-flash) data structures (no code etc.).
Theorically, I'd like to build this project and then use the S19 file as it is to program only the D-Flash content through a BDM programmer.
Thank you very much.
Davide
Solved! Go to Solution.
Thank you very much. It works fine.
Contrary to what I said before, the INIT specifier dosn't work for const structure, because the linker modifies the structure allocation to the .init segment (that is not linked at the address I want).
I've solved this problem by specifying the "Link as ROM library" option in the linker.
So now my .prm file looks like this:
SEGMENTS
EEPROM_00 = READ_ONLY DATA_FAR IBCC_FAR 0x000800 TO 0x000BFB FILL 0xFF;
CRC32_EE_00 = READ_ONLY DATA_FAR IBCC_FAR 0x000BFC TO 0x000BFF;
END
PLACEMENT
EEPROM_CONFIGURATION INTO EEPROM_00;
END
CHECKSUM
CHECKSUM_ENTRY
METHOD_CRC32
OF READ_ONLY 0x000800 TO 0x000BFB
INTO READ_ONLY 0x000BFC SIZE 4
UNDEFINED 0xff
END
END
ENTRIES /* keep the following unreferenced variables */
/* OSEK: always allocate the vector table and all dependent objects */
//_vectab OsBuildNumber _OsOrtiStackStart _OsOrtiStart
list of the structures names that must be allocated
END
STACKSIZE 0
Thank you again for your help
Davide
Sure, why not.
In the linker prm file tell the linker with the INIT directive to start linking at your global constant instead of the default _Startup, also refer to the same constant with the INIT directive. Remove all VECTOR entries (and whatever you use to setup the vector table). Remove the start12.c (and any other not used c files) from the project (or at least from the build configuration).
Then there are some warnings (about the stack, initialization and similar) which you can be disabled.
So after the changes, the prm would loke like:
STACKSIZE 0//VECTOR 0 _StartupINIT SampleConstantMAIN SampleConstant
Thank you for your answer.
It seems working, but the problem now is that the compiler/linker doesn't allocate the const structures that I've defined (there are more than one) because they are not used anywhere.
I couldn't find how to disable this optimization, could you please advise how to do it?
Many thanks
Davide
Try adding this to your prm file:
ENTRIES /* keep the following unreferenced variables */
*
END
Above will also link all *.lib functions, so probably you will need to remove libraries from your data-only project.
Another option is to link everything from specified object files:
ENTRIES
myFile1.o:* myFile2.o:*
END
Thank you very much. It works fine.
Contrary to what I said before, the INIT specifier dosn't work for const structure, because the linker modifies the structure allocation to the .init segment (that is not linked at the address I want).
I've solved this problem by specifying the "Link as ROM library" option in the linker.
So now my .prm file looks like this:
SEGMENTS
EEPROM_00 = READ_ONLY DATA_FAR IBCC_FAR 0x000800 TO 0x000BFB FILL 0xFF;
CRC32_EE_00 = READ_ONLY DATA_FAR IBCC_FAR 0x000BFC TO 0x000BFF;
END
PLACEMENT
EEPROM_CONFIGURATION INTO EEPROM_00;
END
CHECKSUM
CHECKSUM_ENTRY
METHOD_CRC32
OF READ_ONLY 0x000800 TO 0x000BFB
INTO READ_ONLY 0x000BFC SIZE 4
UNDEFINED 0xff
END
END
ENTRIES /* keep the following unreferenced variables */
/* OSEK: always allocate the vector table and all dependent objects */
//_vectab OsBuildNumber _OsOrtiStackStart _OsOrtiStart
list of the structures names that must be allocated
END
STACKSIZE 0
Thank you again for your help
Davide