Hello.
I am using processor_sdk_rtos_am335x_6_03_00_106.
Which consists of GNUC 7.3.1, BIOS_6_76_03_01, and xdctools_3_55_02_22_core.
And I have found that the compiler assumes char is unsigned, and yet CCS only let you enable the flag for -funsigned-char. So these are out of sync.
Given this code:
static unsigned int usiValue;
static int siValue;
static unsigned char uscValue;
static char scValue;
signed char hopperStatusHoldoff;
Int main()
{
MMUConfigure();
UARTStdioInit();
UARTprintf("enter main()\n");
usiValue = 0;
usiValue -= 1;
if (usiValue < 0) {
UARTprintf("Unsigned int went negative \n");
} else {
UARTprintf("Unsigned int went positive \n");
}
siValue = 0;
siValue -= 1;
if (siValue < 0) {
UARTprintf("Signed int went negative \n");
} else {
UARTprintf("Signed int went positive \n");
}
uscValue = 0;
uscValue -= 1;
if (uscValue < 0) {
UARTprintf("Unsigned char went negative \n");
} else {
UARTprintf("Unsigned char went positive \n");
}
scValue = 0;
scValue -= 1;
if (scValue < 0) {
UARTprintf("Signed char went negative \n");
} else {
UARTprintf("Signed char went positive \n");
}
while (1) { ; }
return(0);
}
You would expect that it you subtract 1 from zero in a signed data type, it would go negative.
It doesn't. in fact the output is this:
enter main() Unsigned int went positive Signed int went negative Unsigned char went positive Signed char went negative
So, subtracting 1 from a signed char type turned it into __UINT8_MAX__
Why do I think it's supposed to be signed? Because this flag is NOT set:

So, what is you SET that flag? No change.
In other words CCS has this flag as an option, that doesn't do anything because the compiler is already defaulting to 'char' being unsigned.
In order to get this to function properly, it is necessary to add this flag:

And it is really necessary to add it to both the C and C++. When adding that flag, the output is correct.
enter main() Unsigned int went positive Signed int went negative Unsigned char went positive Signed char went negative
So, CCS is wrong in making this flag available to the compiler.
My only concern is what settings are the BIOS libraries compiled with in this version, and would they conflict if the main project is set to -fsigned-char (as shown above)...?