Looking at signature for strcmppgm2ram
signed char strcmppgm2ram(const char * str1, const rom char * str2 );
I don't understand why do you have rom char * for CommVariable. From chapter 2.4.3 ram/rom Qualifiers of MPLAB® C18 C Compiler User’s Guide
Because the PICmicro microcontrollers use separate program memory and data memory address busses in their design, MPLAB C18 requires extensions to distinguish between data located in program memory and data located in data memory. /---/ Pointers can point to either data memory (ram pointers) or program memory (rom pointers). Pointers are assumed to be ram pointers unless declared as rom.
And in 2.7.3 String Constants:
An important consequence of the separate address spaces for MPLAB C18 is that pointers to data in program memory and pointers to data in data memory are not compatible. /---/ because they refer to different address spaces. /---/ MPLAB C18 automatically places all string constants in program memory. This type of a string constant is “array of char located in program memory”, (const rom char []).
And also it's not clear the purpose of type casting to const far rom char* for the second argument. That may cause stack corruption because far pointer has bigger size (24 bits). So, it looks like it should be rewritten as:
void CommTransmit (const char *CommVariable )
{
if (!strcmppgm2ram(CommVariable, "test")) {
USART_transmit('g');
}
}