首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

[求助]CodeWarrior C语言编译

[求助]CodeWarrior C语言编译

在CodeWarrior for HC(S)12 V3.1环境中使用C语言:
1:#pragma CODE_SEG DEFAULT


2:#pragma CODE_SEG __NEAR_SEG NON_BANKED


3:#pragma TRAP_PROC


分别是什么意思?


另外在编译程序时出现如下错误提示:
1:Warning:  C12056: SP debug info incorrect because of optimization or inline assembler main.c line 766.
如何解决? 谢谢各位老师!


 

1.定义默认的程序段。
2.#pragma 语句中的属性为_ _NEAR_SEG。它很明确的告诉大家此数据段放在non-banked存储器。我想楼主说得应该是中断向量中的吧。#pragma CODE_SEG __NEAR_SEG INTERRUPT_ROUTINES
3.#pragma TRAP_PROC 的作用是可以用RTI指令替换RTS指令来结束中断服务程序。因为有些中断服务程序存放在固定Flash,而有些可以存放在分页Flash中的。
我也想知道那个warning是什么意思。。
我也经常遇到这个warning
正在进行NE64的研究学习,欢迎和我讨论~ saga0807@hotmail.com
把warning所指的程序贴出来看看。
海纳百川  有容乃大
那个Warning我也经常碰到,但是找不到为什么会出现这样的原因,基本上出现这个Warning的情况是:那个函数太大了,而且重复的地方比较多,然后我把这些重复的地方单独提出来作个函数,然后在那个大函数里面调用这个重复的函数,就解决了。但是原因不清楚
水泡泡
 我的QQ是:52449804 
 我的网站是: www.dyic.com.cn
 欢迎访问和留言跟我联系
C12056: SP debug info incorrect because of optimization or inline assembler
[DISABLE, INFORMATION, WARNING, ERROR]



Description
The compiler investigates the generated code to detect the current SP value for every instruction. During this process, he detects that two different control flows generate different SP values for a single instruction.

This situation may arise because of different situations:

inline assembler
In inline assembler code, it is legal to have this situation as long as the stack is correct at the end of the inline assembler block.

optimization
Especially because of the common code optimization -Of/-Onf there are situations where this occurs in correct code. It is impossible to generate correct debug info for this optimization in some cases.

The debugger may show local variables and the call chain incorrect for some parts in a function, for which this message occurs. But this message does not mean that the code generated is wrong in any sense.

Previous versions of the compiler did generate this warning in other situations, for which this version generates correct debug info.

Example (for C code):
void f(int);
void g(void);
void h(void);
void main(void) {
f(1); f(2); f(3);
h();
f(1); f(2); f(3);
g();
f(1); f(2);
}
The compiler first detects that "f(1); f(2); f(3);" occurs twice and puts this code separately.

The two code patterns are replaced by a JSR to the new code.

This situation can be thought as the following non C pseudo code (C does not support local functions):

void main(void) {
void tmp0(void) {
f(1); f(2); f(3);
}
tmp0();
h();
tmp0();
g();
f(1); f(2);
}
In a next step, the compiler detects that the code "f(1); f(2);" also occurs twice. So

he generates a second internal function.

void main(void) {
void tmp1(void) {
f(1); f(2);
}
void tmp0(void) {
tmp1(); f(3);
}
tmp0();
h();
tmp0();
g();
tmp1();
}
Now the new code of the function tmp1 (actually tmp1 is not really a function, it is a part of main!) is called once directly from main and once indirectly by using tmp0. This two call chains now use a different amount of stack and the message

"C12056: SP debug info incorrect because of optimization or inline assembler"

is issued.
Good Good Study!Day Day Up!
CodeWariror 8- & 16-bit tools: Compiler warning: "SP debug ..." Options

marc.paquette
Moderator
Posts: 96
Registered: 01-17-2006



Reply 1 of 1

Viewed 236 times


To help you find solutions to problems that have already been solved, we have posted this message. It contains an entire topic ported from a separate forum. The original message and all replies are in this single message.

Posted: Nov 01, 2005 - 02:02 PM

Hello.

I been using codewarrior version 3.1 for hc12 controller series. When working with a project i got 5 compiler warnings with the following message:
"SP debug info incorrect because of optimization or inline assember"

Any ideas how to fix this?

Regards
Gabriel



Posted: Nov 01, 2005 - 06:42 PM

Hi,

I don't remember offhand, but look in the compiler manual and search for the error ID. The error description will list common causes and ways to avoid it.

regards,
Mario


Posted: Nov 02, 2005 - 07:12 AM

Hello,

This warning is generated when an optimization or inline assembly function causes a trouble with the bedug info.

Then the user could met some problem debugging his application.

Refer to the compiler manual to get more info on this warning.
See in the Manual_Compiler_HC12.pdf at \help\pdf

Regards
Pascal Irrle



Posted: Nov 04, 2005 - 09:53 AM

Alright thanks.

I better check the compiler manual first.

Gabriel


---
Marc Paquette
CodeWarrior Ombudsman
Freescale Semiconductor

yuccacl
OK
这个告警好象不必理会,虽然FREESCALE的文档讲了一下,但我也没看明白到底什么意思
              非学无以广才,非志无以成学;              
返回列表