HC12: __NEAR_SEG or not ?

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

HC12: __NEAR_SEG or not ?

跳至解决方案
3,278 次查看
pittbull
Contributor III
Hello,

I'm using CW for S12X.
My code uses the banked memory model.
In that code I have some (non XGATE) interrupt handlers that look like this:

#pragma CODE_SEG __NEAR_SEG NON_BANKED
__interrupt void Isr (void)
{
...
}
#pragma CODE_SEG DEFAULT

Sometimes the compiler shows a warning message "Segment already used with different attributes".
When I remove the modifier '__NEAR_SEG', the warning disappears...
Anyway, the program works fine, regardless of __NEAR_SEG or not.

Is the __NEAR_SEG modifier really necessary?
I think NON_BANKED is quite enough to force the code into non-paged flash, or am I wrong?

Thanks in advance,
-> pittbull

Message Edited by CrasyCat on 2007-04-13 11:36 AM

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
2,120 次查看
CompilerGuru
NXP Employee
NXP Employee
To start with the summary, add the __NEAR_SEG where it is missing. Don't remove it from where you already have it :smileyhappy:

The __NEAR_SEG tells the compiler that functions declared/defined in this section can be called with the near calling convention (with JSR/BSR).
If you drop it, the compiler will default to the banked calling convention (CALL) instead.
So using the __NEAR_SEG provides the opportunity to place some often used functions into the non banked area.
For interrupt functions only, as they are not called by a normal function call, the __NEAR_SEG does indeed have no effect.


Daniel

在原帖中查看解决方案

0 项奖励
回复
2 回复数
2,121 次查看
CompilerGuru
NXP Employee
NXP Employee
To start with the summary, add the __NEAR_SEG where it is missing. Don't remove it from where you already have it :smileyhappy:

The __NEAR_SEG tells the compiler that functions declared/defined in this section can be called with the near calling convention (with JSR/BSR).
If you drop it, the compiler will default to the banked calling convention (CALL) instead.
So using the __NEAR_SEG provides the opportunity to place some often used functions into the non banked area.
For interrupt functions only, as they are not called by a normal function call, the __NEAR_SEG does indeed have no effect.


Daniel
0 项奖励
回复
2,120 次查看
pittbull
Contributor III
Thank you, CompilerGuru :smileywink:
0 项奖励
回复