Trim hard coded address ?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Trim hard coded address ?

908 次查看
Stephman
Contributor I

Hi there,

 

I'm copying the trim value from flash to the ICSTRM register of my S08EL32 during boot.

I'm using the following syntax:

ICSTRM = *(unsgined char*) 0xFFAF;

 

This works fine

However my ICS code is not portable as the address may change from a derivative to another, and the TRIM register in flash is not referenced in the derivative header file from lib.

 

Any solution other than fill-in the header file or adding somewhere else for each project the flash TRIM definition ?

 

Regards

Stephane

标签 (1)
0 项奖励
4 回复数

637 次查看
bigmac
Specialist III

Hello Stephane,

This would seem to be a significant omission from the device header file for the 'EL32 device.  Normally, the register NVICSTRM should be defined.  Have a look at the device header file for another S08 device that uses the ICS module.

A workaround might be to provide your own definition for this register within a special header file, to be #included following the usual device header.  This file would incorporate an #ifndef NVICSTRM  ..  #endif construct surrounding the register definition.  You could copy the definition code from the header file for the other device.  You might also incorporate the code for non-volatile fine trim bit.

Regards,

Mac

637 次查看
Stephman
Contributor I

Hi bigmac,

Indeed there is no NVICSTRM definition in the header file of the s08el32 !

The others NVxxxx register are defined but not this one which was part of my misunderstanding.

I will have to add the definition somewhere but it will not be portable meaning I will have to modify this definition for an other MCU.

Well... no choice.

Tahnks

Stephane

0 项奖励

637 次查看
Encoder1
Contributor III


Hi Stephane, you are right. ICSTRM is not defined in the derivative header and you have to declare it in the first part of your program as an "environmental variable" for that family of processors.

It is not a big problem if you decide to change the family to upgrade that variable. There are always in my experience small things you have to change whenever you change the processor, mostly ports and periferals so one more do not really impair a lot the general portability of the code.

:smileywink:

Salvatore

637 次查看
Stephman
Contributor I

Thanks for your quick answer Encoder1

Yes I do agree this is not a big deal to add the definition somewhere but indeed it makes the code not portable. I will have to modify this definition according to the MCU used. No matter for me, but when the code is used by someone else it's less elegant that the user have to modify something outside the code in order to let it work.

But apparently this might be an omission from Freescale and there is not really other choice now.

Thanks

Stephane

0 项奖励