Download presentation
Presentation is loading. Please wait.
Published byOwen Powers Modified over 9 years ago
1
TM Freescale, the Freescale logo, AltiVec, C-5, CodeTest, CodeWarrior, ColdFire, C-Ware, mobileGT, PowerQUICC, StarCore, and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, CoreNet, the Energy Efficient Solutions Logo, Flexis, MXC, Platform in a Package, Processor Expert, QorIQ, QUICC Engine, SmartMOS, TurboLink and VortiQa are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. Rapid Prototyping Solutions Add Ethernet to your Embedded Application Craig Honegger President, Embedded Access Inc.
2
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 2 Module Objectives ► The objective of this module is: Introduce networking concepts Provide an overview of MQX network capabilities Implement a simple Web server
3
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 3 Module Agenda ► Introduction to RTCS RTCS Sockets Application protocols HTTP server ► Hands-on Exercise – Build Your Own Embedded Web Server ► Additional Resources
4
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 4 RTCS ► Designed for embedded processors ► Uses standard socket interface ► Scalable at compile and/or run-time Only used protocols are included Data requirements tunable Protocol behavior controllable ► TCP/IP aware Debugger Integration ► Integrated with 3rd party packages 4
5
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 5 TCP/IP Protocols 5 RPC XDR Telnet HTTP FTP POP3* SMTP* DNS SNMP SNTP SSL* IP-E IPCP PAP CHAP CCP PPP ARP Ethernet Serial PPPoE** TFTP SSH* XML* BootP DHCP RIP Sockets ICMP TCP UDP IGMP NAT** IP HDLC LCP
6
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 6 UDP vs. TCP UDP (RFC 768) ► Data sent in packets ► Simple layer on top of IP ► Connectionless (mail) ► Unreliable ► No buffering ► Packets can be lost ► Small code size ► High maximum data rate ► Used to transfer time- dependent data (voice) TCP (RFC 793) ► Data sent in streams ► Complex protocol ► Connection based (phone) ► Reliable (re-transmission) ► Buffered data transfer ► No packets are lost ► Large code size ► Lower maximum data rate ► Used to transfer accuracy critical data (files)
7
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 7 RTCS Overview 7 Application Task Application Task Application Task Application Task RTCS MQX Application Task Application Task Serial ADC I2CI2C I2CI2C Enet TCP/IP Task TCP/IP Task RTCS API FTP Server FTP Server ARP ICMP TCP UDP IGMP IP IP-E HTTP Server HTTP Server Telnet Client Telnet Client FTP Client FTP Client Telnet Server Telnet Server SNMP Agent SNMP Agent DHCP Server DHCP Server SNTP Client SNTP Client
8
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 8 RTCS Initialization Sequence ► Create RTCS ► Initialize interface(s) ► Bind RTCS to interface ► Initialize RTCS applications 8 RTCS MQX Enet RTCS Apps RTCS Apps TCP/IP Task TCP/IP Task
9
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 9 RTCS Initialization ► RTCS is started by calling RTCS_create() ► Prototype is in ► Creates one TCP/IP task ► Creates internal data structures (PCBs, IP routing table, etc.) 9 RTCS TCP/IP Task TCP/IP Task
10
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 10 Interface Initialization ► Initialize device driver ► Assign MAC address ► Assign IP address, subnet, gateway ► Bind interface to stack RTCS MQX Enet TCP/IP Task TCP/IP Task
11
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 11 Sample Code
12
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 12 Sockets ► Data transfer is done with sockets ► A socket is one end-point of a two-way communication link ► Socket defines: Protocol Local IP-address and port # Remote IP-address and port # ► TCP and UDP sockets supported 12
13
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 13 Bound to stream (TCP) Using sockets recvfrom() sendto() bind() connect() getsockopt() listen() accept() recv() Unbound Bound to datagram (UDP) socket() send() select() setsockopt() shutdown ()
14
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 14 Establishing a TCP Connection - Server Ground Bound Listening Connected Socket() Send(), Recv() Accept() Bind () Listen() Connect()
15
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 15 Establishing a TCP Connection - Client Ground Bound Listening Connected Socket() Send(), Recv() Accept() Bind () Listen() Connect()
16
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 16 Sample Code
17
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 17 Socket Options ► Socket options can be set to override default socket behavior using setsockopt(): ► Options include: Window sizes Various timeouts Blocking vs. non-blocking mode Send and receive push flags
18
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 18 Compile Time Configuration ► Close to 100 compile time configuration settings ► Each protocol can be individually enabled/disabled ► Protocol statistics can be individually enabled/disabled ► Level of error checking performed is configurable 18
19
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 19 Run-Time Configuration ► Allows dynamic control of RTCS, including: RTCS task priority and stack size RTCS memory allocation (where, how much) Enabled protocols and protocol behavior Socket behavior 19
20
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 20 Application Layer Protocols 20 RTCS MQX TCP/IP Task RTCS API FTP Server FTP Server HTTP Server HTTP Server Telnet Client Telnet Client FTP Client FTP Client Telnet Server Telnet Server SNMP Agent SNMP Agent DHCP Server DHCP Server SNTP Client SNTP Client TFTP Server TFTP Server TFTP Client TFTP Client DHCP Client DHCP Client DNS Resolver DNS Resolver
21
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 21 Application protocols Clients: ► Use arbitrary port number ► Active connection ► Connect to one server Servers: ► Use standard port number ► Passive connection ► Connect with many clients Telnet Client Telnet Client Telnet Server Telnet Server Telnet Client Telnet Client Telnet Client Telnet Client Telnet Client Telnet Client
22
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 22 HTTP Server ► HTTP 1.1 with persistent connections ► PUT and GET methods ► Form decoding ► Support for multiple virtual WEB folders ► Static file-system content: pages, images, multimedia, Java archives ► Dynamic page content, suitable for AJAX applications CGI-like dynamic content pages ASP-like in-page placeholders ► Basic authentication 22
23
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 23 HTTP Server ► Web pages may be: From memory (flash or RAM) using TFS From internal or external file system storage (e.g., MFS/USB) Dynamically created via CGI functions 23 HTTP Server HTTP Server MFS TFS CGI Table CGI USB CF SD Etc. MQX I/O Subsystem Others HTTP Client HTTP Client
24
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 24 HTTP Server Initialization ► Install file-system ► Initialize HTTP server, specify root directory and home page ► Register CGI table and function callback table, if required ► Start server
25
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 25 Sample Code
26
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 26 Module Agenda ► Introduction to RTCS RTCS Sockets Application protocols HTTP Server ► Hands-on exercise – build your own embedded Web server ► Additional resources
27
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 27 Instructions ► Lab Handout provides: Directions on assembling Tower System and connecting cables Three separate labs: Web server Simple application server FTP & Telnet servers Each Lab is independent; Labs can be done in any order
28
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 28 Lab 1: Web Server ► Objectives: Add a Web server to your project Customize look of the Web server Add form input for controlling Tower System hardware (LEDs) Add CGI for obtaining Tower System inputs (switches)
29
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 29 Lab 2: Simple Application Server ► Objectives: Create a simple TCP server framework Test with Telnet Client
30
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 30 Module Agenda ► Introduction to RTCS RTCS Sockets Application protocols HTTP Server ► Hands-on exercise – build your own embedded Web server ► Additional resources
31
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 31 More Information ► Demos Telnet Server Web server SNTP* SMTP with sockets* DNS Resolution* DHCP Client* Digital Sign** Web HVAC 31 *MCF51CN demos only, ** MPC5125 demo only
32
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 32 Freescale MQX™ Documentation ► MQXUG User Guide MQXUG ► MQXRM Reference Manual MQXRM ► MQXUSBHOSTAPIRM USB Host API Reference Manual MQXUSBHOSTAPIRM ► MQXUSBDEVAPI USB Device API Reference MQXUSBDEVAPI ► MQXUSBHOSTUG USB Host User Guide MQXUSBHOSTUG ► MQXRTCSUG RTCS User Guide MQXRTCSUG ► MQXMFSUG File System User Guide MQXMFSUG ► MQXIOUG I/O Drivers User Guide MQXIOUG ► MQXFS Software Solutions Fact Sheets MQXFS
33
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 33 Further Reading and Training ► TWR-MCF51CN-KIT Lab Document ► MCF5225x – Lab Document ► MQX Release Notes ► MQX User’s Guide ► Writing First MQX Application (AN3905) ► Using MQX: RTCS, USB, and MFS (AN3907) ► How to Develop I/O Drivers for MQX (AN3902)
34
TM Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © Freescale Semiconductor, Inc. 2010. 34 Further Reading and Training (Cont.) ► Videos: www.freescale.com/mqx MCF5225x and Freescale MQX introduction Getting started with MCF5225x and Freescale MQX Lab Demos And more…. ► vFTF technical session videos: www.freescale.com/vftf Introducing a modular system, Serial-to-Ethernet V1 ColdFire® MCU and Complimentary MQX™ RTOS Writing First MQX Application Implementing Ethernet Connectivity with the Complimentary Freescale MQX™ RTOS
35
TM
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.