Síntesis Hw De Alto Nivel Con Vivado
Total Page:16
File Type:pdf, Size:1020Kb
Advanced Workshop on FPGA- based Systems-On-Chip for Scientific Instrumentation and Reconfigurab!e Computin FreeRTOS and TCP/IP communication: the lwIP library Fernando Rincón [email protected] Smr3249 – ICTP (Nov. & Dic. 2018) Con&en&' ● T(e l%IP TCP/IP s&ac* – The ne&work '&ac* – The socke& conce+& ● A T-+ica$ Ne&%or* A++$ica&ion ● UDP vs TCP ● .'ef0$ net%or* too$' ● (&&+'1))%%%.xi$in2.com)video)'oc/net%orking-wi&(4$%i+4/oc0'ed4/ree4 r&o'.h&ml 2 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) $%IP TCP/IP stac* ● $%IP stand' for 5i3(&%ei3(t IP: – Sma$$ foo&+rin& im+$emen&a&ion – S+ecia$$- %el$ '0i&ed /or embedded sy'&ems ● Su++orts a large n0mber of protoco$' – .DP, TCP, ICMP7 ARP, ... ● API'1 – Ber*e$e- 'oc*et'1 ● re:0ire' an ".S. – Ra% API ● Wi&( or %i&(o0t "S ● 8ore contro$7 b0t more comp$e2 to u'e ● Inc$0ded in xilin2 SD< – ,$'o incl0des driver for =i$in2 >&(erne& driver – =,PP102? is &(e reference a++$ica&ion no&e 3 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) T(e network stack ● T(e net%ork desi3n i' organi@ed a' a layer s&ac*. ● >ac( layer provides a set o/ service' to t(e up+er layer and req0ires 'ervice' from t(e lo%er layer. ● T(e la-er 'n' o/ a node main&ain' a virt0a$ conver'a&ion wi&( t(e same $a-er t(e des&ina&ion node. T(a& conver'a&ion m0'& mee& a s+eciBc +ro&oco$. 4 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) Network sockets ● Soc*et1 – 9a'ic a6'&rac&ion for ne&%ork pro3rammin3 – Com6ina&ion o/ IP + port – In&er-proce'' comm0nica&ion 5 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) Network sockets ● From t(e programming poin& o/ view – Channel a6'&rac&ion ● 9er*eley 'oc*e&' (BSD 'oc*et' | P"SIX 'oc*et') – De fac&o s&andard API ● lwip_socket(AF_INET, SOCK_STREAM, 0) 5%IP Soc*et API – D$i&e’ version o/ BSD socke&'' client server +roces' +roces' write read 9-&es → socket read socket write G 9-&es 6 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) FreeRTOS net%ork ap+lication ● Basic &em+$a&e /or socke& orien&ed +ro3rammin31 – Firs& 'e&0p a ne&%ork &(read and '&ar& Free TOS &a'* 'chedu$er – T(en &(e ne&work &(read1 ● Initia$ize' $wip ● ConB30re' a ne&%or* in&er/ace ● ise' &(e in&er/ace ● S&ar&' ano&(er &(read /or &he rece+&ion ● In'&a$$' an- o&(er ne&%or* &a'*' (ne% &hread') re:0ired 6- &(e a++$ica&ion – WeE$$ '0++o'e an ec(o 'erver ● Fina$$y it de$e&e' it'e$/ – T(ere/ore a/&er ini&ia$i@a&ion 'evera$ &(reads are active1 ● ece+&ion ● Echo 'erver 7 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) FreeRTOS net%ork ap+lication ● Ini&ia$i@a&ion: ;e need FreeRT"S &o '&art tas* e2ecu&ion /or &(e rest o/ &(e +roced0re >:0iva$en& &o a FreeRTOS ta'* 8 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) FreeRTOS net%ork ap+lication ● Ne&%or* configura&ion t(read Sta&ic IP conB30ra&ion H (con&in0es in &(e nex& '$ide) 9 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) FreeRTOS net%ork ap+lication ● Ne&%or* configura&ion t(read Ta'*s t(a& wi$$ remain active: ● Network data recep&ion ● Echo server (t(a& processes da&a received) This ta'* is I0'& /or conB30ra&ion +0rpo'es 10 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) Network programmin3 concep&'1 Error contro$ ● Ne&%or* communica&ion a& t(e IP level i' 0nre$ia6$e ● If relia6i$i&y i' req0ired a& t(e trans+ort layer. Error con&ro$ i' re'+onsi6$e for1 – De&ec& and discard corr0+& packe&' – <ee+ &rack o/ lo'& and discarded packe&' (re'end) – Discard duplica&e' – 90Jer o0&4o/4order packe&' ● Imp$emen&ed t(ro03(1 – Se:0ence n0m6ers (in +acke&') – ,cknowled3emen& and timers 11 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) Network programming concepts: Flo% con&ro$ ● 9o&( t(e sender and receiver adI0'& t(e tran'mi''ion s+eed ● '$iding windo%1 – 90Jer u'ed to make &(e tran'mis'ion more eKcien& ● See videos – a' well a' to con&rol the flo% o/ da&a so tha& the de'&ina&ion doe' no& become overwhelmed wi&h da&a ● T(e de'tination can reduce the si@e o/ t(e window 12 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) .DP ● .nrelia6$e +rotoco$ – No error con&rol ● T(e client i3nore' i/ &(e pac*et arrived correc&ly to &(e 'erver – No flow con&rol ● No %ay &o adj0't &(e 'peed of 6o&( &(e 'ender and receiver ● 90& &(en wh- using .DPM – >2&remel- sim+$e (minim0m over(ead) F The fa'&es& wa- (lowe'& $a&enc-) – Con&rol can be provided 6- de Aplica&ion La-er ● 90t &(atE' on you as a +ro3rammer ● No (elp from &(e ne&%or* 'tac* – T(ere are ma- a++$ication' w(ere loosin3 par& of t(e in/ormation can be &olerated: ● >2. Video conference 13 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) .DP ● UDP timing diagram T(i' packet %i$l be di'carded 14 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) .DP ● UDP soc*et Pro3rammin3 Lo% 15 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) TCP ● Connec&ion4orien&ed +ro&ocol ● e$iab$e – etransmission of lo't or corr0pted pac*e&' – C0m0$ative and se$ective AC<' ● Comp$e2 +rotocol %i&( mu$&ip$e +(ase' ((ig(er $atenc-7 $o%er &(ro03(+0&) – Connection e'ta6$ishmen& – Data tran'/er – Connection teardo%n ● .'ed %(en $oo'in3 in/orma&ion canE& 6e &o$era&ed – OTTP / HTTPS – >4mail7 te2t me'sa3in3 16 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) TCP ● TCP communica&ion flo% – Da&a tran'/ers m0'& 6e ackno%ledge' – 90& ackno%led3e' are packed. No& one per packe& received 17 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) TCP ● TCP soc*et Programming flo% 18 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) TCP 19 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) TCP 20 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) $%IP performance ● De+end' on – &he concre&e hard%are (a$'o the CP. no& j0'& t(e ne&wor* in&erface) – and API u'ed ( ,; or socke&) 21 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) Network too$s: netcat ● T(e s%i'' arm- kni/e for ne&%or* o+era&ions ● Can be conB30red to be a c$ient or a 'erver1 – .DP exam+le1 ● Server: nc 4$0 -p <port> RP(ostnameQS ● Clien&: nc -0 P(os&nameQ <+or&Q – TCP exam+$e1 ● Server: nc 4l -p <port> RP(ostnameQS ● Clien&: nc <(os&nameQ <por&Q 22 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) Net%ork tools: Wireshark ● Mo'& po+0$ar net%or* traKc sniffer ● Ca+&0re' and ana$-@es any kind o/ ne&%or* traKc – ;i$$ he$p yo0 to unders&and t(e ne&work '&ac* – Pro&ocol di''ec&or ● 80$&i4+$a&/orm (even mo6i$e p(one') – Free so/&%are 23 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018) Net%ork tools: Wireshark Ca+&ured pac*e&' Pac*et enca+'0$a&ion Pac*et con&en&' 24 Free T"S + lwIP Smr3249 – ICTP (Nov. & Dic. 2018).