Switch statement & Table of Funciont Pointers (short)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Switch statement & Table of Funciont Pointers (short)

Jump to solution
1,263 Views
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
Labels (1)
Tags (1)
0 Kudos
1 Solution
392 Views
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!!

View solution in original post

0 Kudos
2 Replies
392 Views
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 Kudos
393 Views
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 Kudos