Цитата(aaarrr @ Mar 17 2008, 15:54)

Для Keil'a должно быть
Код
#define PACK_STRUCT_START __packed
Спасибо, помогло. Правда не PACK_STRUCT_START, а PACK_STRUCT_BEGIN, но это не важно.
Теперь столкнулся со следующей проблемой: при приеме ICMP пакета из EMAC читается длина на 4 байта меньше реального размера пакета. При увеличении длины на 4 байта под отладчиком весь пакет из EMAC-а вычитывается правильно и отвечает на пинг. Никто с таким не сталкивался?
вот что вычитал:
Цитата
> I was just going through the FreeRTOS LPC2368 Webserver Demo. There is
> just one small thing that's been bugging me...in "emac.c", in function
> "StartReadFrame()", there is the following statement:
>
> RxLen = (RX_STAT_INFO(idx) & RINFO_SIZE) - 3;
>
> Since the "RxSize" field in RX status info is "actual RX size - 1",
> subtracting "3" from this field would make RxLen equal to "actual RX
> size - 4 ". So that means in the end 4 bytes less frame data will be
> stored, why is that so? Or am I interpreting it wrong here...
>
The last four bytes contain the Ethernet CRC, which is not passed to the
TCP/IP stack so are left to languish in the buffer.
но тогда срабатывает этот код в lwIP:
Цитата
if (inet_chksum_pbuf(p) != 0) {
LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo\n"));
pbuf_free(p);
ICMP_STATS_INC(icmp.chkerr);
snmp_inc_icmpinerrors();
return;
}
Как это понимать? Нужно ли последнее слово или нет?