Switch statement & Table of Funciont Pointers (short)

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

Switch statement & Table of Funciont Pointers (short)

跳至解决方案
2,060 次查看
SebaS
Contributor III
I've got this code at Page 38

switch(x){
..
..
..
..
}

but I don't know why _CASE_CHECKED (the procedure used by the switch statement) is at another page (PAGE 3C) so it don't work.

The compiler transform the switch into some assembly code with a JSR to _CASE_CHECKED, but since _CASE_CHECKED is in different page, that jump is wrong. It should be a CALL, but it's a JSR..... how can i fix that?

Thanks in advance....

For more info check the longer version:
http://forums.freescale.com/freescale/board/message?board.id=CWCOMM&message.id=3381
标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,189 次查看
SebaS
Contributor III
Thanks a lot!!! Now it's working!!!

I modified the .PRM file and I add this:

NON_BANKED INTO PAGE_C000

and now it's working...... I remember when I first create this project... this line were ther but I deleted because at that page I put the interrupts and I was afraid that would reduce the amount of code at that page.

THANKS!!! especially because you answer really fast!!

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,189 次查看
CrasyCat
Specialist III
Hello
 
How did you create your project?
I highly recommend you to create your project using the project wizard and specifying you want to build for banked memory model.
 
This will ensure you are using the appropriate ansi library file and .prm file.
basically when you are building for BANKED memory model, the run time functions (and _CASE_CHECKED is one of those run time functions) are defined in a section called NON_BANKED.
 
According to its name that section MUST be placed in non banked flash.
If you did not start with the appropriate configuration you may face other such issues.
I would really recommend that you create a brand new project using the  project wizard and specifying the appropriate configuration.
 
You will save yourself a lot of pain and time this way.
 
CrasyCat
0 项奖励
回复
1,190 次查看
SebaS
Contributor III
Thanks a lot!!! Now it's working!!!

I modified the .PRM file and I add this:

NON_BANKED INTO PAGE_C000

and now it's working...... I remember when I first create this project... this line were ther but I deleted because at that page I put the interrupts and I was afraid that would reduce the amount of code at that page.

THANKS!!! especially because you answer really fast!!
0 项奖励
回复