Porting

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

Porting

463 Views
Aswin_5232
Contributor II

I am trying to port code from cosmic compiler to code warrior 5.2 for HCS12 controller, when I am calling a function which is inside another function , the value passed to the first function is not updated correctly,

 

eg. void Update_Display(uint8_t update)
{

LCD_srWriteToDisplay(string1,SCREEN_LINE_WIDTH,20,0);

}

inside  LCD_srWriteToDisplay function, the arguments are not having the same value which I have passed. 

0 Kudos
Reply
1 Reply

426 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Aswin_5232,

TN234, https://www.nxp.com/docs/en/application-note/TN234.pdf

explains this issue in the section “Porting non‑ANSI‑C Keywords”, where it shows that Cosmic’s @near/@far must be replaced with CodeWarrior’s __near/__far, including for functions, because CW uses different calling conventions for near vs. far calls.
If a function ends up in banked code but is not declared __far, CW will generate a near call, causing the function to read wrong parameters.

 

Regards,

Daniel

 

0 Kudos
Reply