I work with many different processors for different projects for different customers.
I am trying to configure a standard project.prm for the different micro's - - - -
but some of the memory (Ram and Flash) locations will be need to be different for different projects.
If I define the locations in the PRM file, how can I get the C source code to know what these are.
or if defined in a project_defines.C file can I get the linker to know about the settings.
as I am trying to reduce the number of places that things need to be changed - - - - -
Thanks Jim P
解決済! 解決策の投稿を見る。
You may define custom data segment and placement to that segment. Then just put your data to that segment using compiler pragmas:
#pragma DATA_SEG placement
...data structs or varuiables...
#pragma DATA_SEG default
If needed, you can always get address of your custom data using address operator (&variable).
To get start or end of segment use linker defined symbols __SEG_START_xxx, __SEG_END_xxx, __SEG_SIZE_xxx, where xxx is placement. You need to declare those linker defined symbols in your code like
extern int __SEG_START_xxx[];
In case data has to be not initialized, change type of segment in prm from READ_WRITE or READ_ONLY to NO_INIT .
You may define custom data segment and placement to that segment. Then just put your data to that segment using compiler pragmas:
#pragma DATA_SEG placement
...data structs or varuiables...
#pragma DATA_SEG default
If needed, you can always get address of your custom data using address operator (&variable).
To get start or end of segment use linker defined symbols __SEG_START_xxx, __SEG_END_xxx, __SEG_SIZE_xxx, where xxx is placement. You need to declare those linker defined symbols in your code like
extern int __SEG_START_xxx[];
In case data has to be not initialized, change type of segment in prm from READ_WRITE or READ_ONLY to NO_INIT .
Thanks that was what I was looking for.
the back link from linker to source code.
I am looking at trying to have my code portable for different applications.
and was not liking the idea of setting a settings area in the linker and then having to
besure that the code knew where the area was.
The settings are the application settings and for debug and check out can be changed from the PC interface.
this solves the problem.
also looking at possible logging area in flash and this again would be application / processor dependent and not wanting to have to set this in different locations
thanks again
Jim P