Hello,
I'm working in a project to control an electrical motor using the Piccolo and the CCS4. The motor must be controlled, through the CAN bus, modifying the internal variables in order to get the function desired. Some variables are in e2prom too. Thus, the addresses of each memory variable, that can be externaly modified, must be known and precisely defined: the CAN bus user only will be able to modify the variable if he knows the address.
And here I have found the problem: I have not been able to find a way to fix the address to the variables. I have created a new module to group all the variables that the CAN bus can modify, but once compiled and linked I have found that the final addresses asigned by the system have not the same order defined in the module. Here is the example:
e2prom.c module: int32 e2prom_StartAdd;
SOC_DATA_ST SocCanales[CANALES_AD_NUM];
T_NTC_ST T_Tmotor1[SIZE_T_NTC];
T_NTC_ST T_Tmotor2[SIZE_T_NTC];
T_NTC_ST T_Tmotor3[SIZE_T_NTC];
T_NTC_ST T_Twater1[SIZE_T_NTC];
T_NTC_ST T_Twater2[SIZE_T_NTC];
T_NTC_ST T_Tpcb[SIZE_T_NTC];
ADC_CONFIG_ST IuConfig, IvConfig, IwConfig, IdcConfig, VdcConfig;
ADC_CONFIG_ST VuConfig, VvConfig, VwConfig;
ADC_CONFIG_ST AceleraP1Config, AceleraP2Config, FrenoP1Config, FrenoP2Config;
ADC_CONFIG_ST Tmotor1Config, Tmotor2Config, Tmotor3Config;
ADC_CONFIG_ST Twater1Config, Twater2Config, TpcbConfig;
int32 e2prom_EndAdd;
And the linker map file:
000093c0 _e2prom_EndAdd As you can see, the addresses don't correspond to the definition order in the source file. How could I get the right control of the addresses, please? Regards,
000093c2 _e2prom_StartAdd
000093c4 _FrenoP1Config
000093ce _FrenoP2Config
000093d8 _AceleraP2Config
000093e2 _VwConfig
000093ec _AceleraP1Config
000093f6 _VvConfig
00009400 _Twater2Config
0000940a _TpcbConfig
00009414 _Twater1Config
0000941e _Tmotor2Config
00009428 _Tmotor3Config
00009432 _Tmotor1Config
00009440 _IvConfig
0000944a _IuConfig
00009454 _IwConfig
0000945e _VdcConfig
00009468 _IdcConfig
00009472 _VuConfig
00009480 _SocCanales
000094c0 _T_Tmotor2
00009500 _T_Tmotor1
00009540 _T_Twater2
00009580 _T_Tpcb
000095c0 _T_Tmotor3
00009600 _T_Twater1