FreeRTOS+SMAC on 13192-SARD(CW5.1). Strange asm code.

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

FreeRTOS+SMAC on 13192-SARD(CW5.1). Strange asm code.

1,938 Views
cheese
Contributor I
I`m trying to work with FreeRTOS + HCS08 + SMAC from here:
http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&message.id=508
with CW5.1.
In the ordinal SMAC C-code

if (MCPSDataRequest(&gsTxPacket) == SUCCESS)

is compiled to

JSR 0x1a57 ;jumping to MCPSDataRequest
CMP #0x77

And that is resonable, because MCPSDataRequest returns value via A register.
But in the mentioned project FreeRTOS + HCS08 + SMAC the same C-code compiled to

JSR 0x2A50 ;jumping to MCPSDataRequest
CPHX #0x0077

comparing the HX register value with SUCCESS. But the returned value is still in A register and this check fails.
So, how to get back the right behavior?
Thanks in advance.
Labels (1)
0 Kudos
Reply
2 Replies

838 Views
CompilerGuru
NXP Employee
NXP Employee
What is the return type of MCPSDataRequest?
There are different reasons why this could happen:
- for implicit parameter declaratios, the return value is an int by ANSI. Therefore dont use implicit parameter declarations if anything returns just 8 bits (well actually never ever use implicit parameter declarations).
- The returned type of MCPSDataRequest could be configured to be of a different size, for example enums can be configured to be 8 bit or 16 bit.

my feeling is that the code has some implicit parameter declarations. Does do create warnings by default and those warnings should be taken seriously.

Daniel
0 Kudos
Reply

838 Views
cheese
Contributor I
Yes, it was really implicit delaration.
Thanks a lot, the problem is solved
0 Kudos
Reply