I'm using the Makefile on Linux, so if your build environment is different you may have to link in dswifi9d yourself. It is a little ugly and I just noticed there's potential for a pretty enormous memory leak in the main loop, but I don't think it should be troubling us here.
tftp.c contains pretty much all the networking stuff, and if I haven't changed it too much, tftp.c.orig can be swapped in to try the select()-based version.
The .nds is of the version with my own timeout loops written. Which, by the way, has proved to be no more reliable than the select() version after all, and slightly slower to boot. (The latter is to be expected.)
main.c allocates and fills a buffer of 1 MiB and will send it to any connecting TFTP client. In my tests I used the client in the tftp-hpa package on Ubuntu/Debian (primarily because it let me use a port number other than 69 and I developed the server on Linux first). Tested it with this command:
Code: Select all
while time tftp 172.22.216.131 -c get test;do date;done
EDIT: I just got a Guru Meditation Error running it again, at least a handful of packets away from the end of file.
Code: Select all
Guru Meditation Error! data abort! pc: 00154a04 addr: 00154a04 r0: 0b004000 r8: 00001800 r1: 0b008daa r9: 0000000c r2: 0000544e r10: 0b0084f4 r3: 0000045c r11: 00000e10 r4: 0241a2c4 r12: ffff6eaa r5: 00001800 sp: 0b003dc0 r6: 0000916c lr: ffff0290 r7: 00000708 pc: 00154a0c 0b003dc0: 00001800 0b008daa 0b003dc8: 0000544e 0000045c 0b003dd0: ffff6eaa 02001a9e 0b003dd8: 72070400 04408018 0b003de0: 000abd90 35820040 0b003de8: 00154a08 0be91a00 0b003df0: 15008b00 604713e9 0b003df8: 91432200 4900b6f6 0b003e00: 0003aaaa 00080000 0b003e08: 20000045 00400000