Tool/software: Code Composer Studio
ide: CCS v8.2.0
compiler: TI v5.2.5
chip: am3552
snippet:
while(1)
{
frameLen = my_recv_UDP(AS_UDP_Dev_Health_socket, rxBuf, sizeof(rxBuf), (struct sockaddr*)&ra, sizeof(ra));
if(frameLen <= 0){
OSTimeDlyHMSM(0, 0, 1, 0,OS_OPT_TIME_HMSM_STRICT,&err);
continue;
}
pktLen = (rxBuf[1] >> 8)+(rxBuf[2]); //packet len
dataLen = pktLen - 24; //data len
typedef struct
{
u8 buf[24+dataLen];
union{
u8 stx;
u8 len[2];
union{
u8 low;
u8 high;
}cmdlen;
u8 pid;
u8 seriID;
u8 cmdID[2];
u8 cmdVer;
u8 srcIDInfo[7];
u8 destIDInfo[7];
u8 data[dataLen];
u16 cksum;
}rxBuf;
}rxBuf_s;
rxBuf_s* rxBuf_p = (rxBuf_s*)&rxBuf[0];
/*following code is omitted*/
Hello.
I'm dealing with socket programming and here is a udp example.
Because one doesn't know how many data in udp frame until receive it, I only can decide array length after receiving it.
This array is so-called variable-length array, introduced in C99.
It seems that this compiler version doesn't support it.
I've read this article: https://e2e.ti.com/support/tools/ccs/f/81/t/297429?Variable-length-arrays-and-MSP430-compiler
It says variable length array is supported by compiler since 4.2.0 when the --gcc option is used.
Where can I find this setting of gcc option? Thank you.