Peter Zuidema escreveu: > Hello everyone, > > I've implemented uIP 1.0 in FreeRTOS 4.1.2 for the ARM7 (AT91SAM7) but this > took some time. > > I downloaded the uIP 1.0 source and upgraded the uIP 0.9 demo within > "uIP_Demo_IAR_ARM7". After starting the code I could ping the board butnot > access the webserver. I got bad checksums. > > I discovered that the "UIP_BUFSIZE" was set to 400 and UIP_CONF_BUFFER_SIZE > to 420. After setting this to 1500 it worked (which took a week of testing!) > > Regards, > Peter Zuidema >
If you got bad checksums, you probably had an alignment issue. This is a recurrent issue on ports for uip for arm, due to the way it's written and due to the fact that most compilers does not automagically compensate for unaligned memory access (which is quite ok IMHO). You're probably having a success case changing the buffer size because that have consequences on the buffer allocation alignment, but that does not solve the issue in long term: adding / removing global variables or changing it's properties could lead to future misalignments. As for TCP, you can work with values for bufsize that are smaller than 400 bytes with no problem, as long as the buffer is correctly aligned and the network layer is correctly handled (since packets greater than that value can arrive from ethernet, for instance). With UDP (which I'm using) you have to either have a buffer big enough to accomodate the biggest packet you want to use or have a IP fragmentation handling method (which I couldn't get to work correctly on uip, but I didn't try hard enough). I can't tell you much about how to correctly align the buffer because you're probably working with an ethernet device, right? On my current uip's porting efforts I don't have ethernet framing and I did not test tcp (only udp and icmp), so far I had to add the aligned attribute to the uip buffer to get things to work. While trying the dns resolv routines, I found out that the dns_answer struct usage was rather liberal, and I had to add the packed attribute on it so that alignment was worked around. Proving this point would require further testing, but I suggest for the meanwhile you align the buffer and try again with 400 bytes. If that works, then keep it aligned and set it to the size you would prefer, so that if this is the issue, further changes to your code don't bite you again for the same issue. - Alexandre