Tuesday, November 9, 2010

Embedded System Development ( linking process )


  1. cross-platform development methodology, includes 
    1. host system
    2. target embedded system
    3. connectivity solutions between host and target (Joint Test Action Group/Background Debug Module)
  2. development tools in the host environment are
    1. cross compiler
    2. linker
    3. source level debugger
  3. tools in the target embedded system
    1. dynamic loader
    2. link loader
    3. debug agent
  4. journey from code to executable
    1. developer writes in C/C++ and assembly
    2. make-file is created, to automate the process of building/rebuilding on modification
    3. compiler and assembler produce object file containing both machine binary code and data in the target system
    4. linker take these object files, and produces either a executable or an object file, used to additional linking with other object fiies
    5. the linker command file (linker script) instructs linker on how to combine the object files and where to place the binary code and data in the target embedded system
    6. the main
  5. symbol table  
    1. created by compiler and contains the symbol name to address mapping
    2. contains the global symbols defined in the file being compiled and the external symbols referenced in the file that the linker needs to resolve
  6. symbol resolution, part of linking process
    1. find where (in other object files) the external symbols are defined
    2. the statically linked library (in which the external symbols are defined) are copied to the final image
  7. symbol relocation, mapping a symbol reference to its defination
    1. done using a fix-up table or relocation table
    2. for fixing up references to addresses in other segments, as when multiple object files are linked together some addressed must be relocated
    3. because of the assumption of the assembler that each object file begins at address 0.
  8. for an executable image, all external symbols must be resolved such that each symbol has an absolute memory address (exception to this rule is DLL)
  9. a relocatable object file is concatenation of multiple object files and is partially resolved, so that it can be linked with other object files at run-time
References:
http://www.cs.princeton.edu/courses/archive/spr03/cs217/lectures/Linker.pdf



Tuesday, October 5, 2010

SIP Messages

  1. request from a client and response from a server are SIP messages
  2. SIP requests are distinguished by having a request line which contains a method name, a Request URI and protocol version
    1. RFC 3261 defines six methods (SIP extensions contains others)
      1. REGISTER for registering contact information
      2. INVITE, ACK and CANCEL for setting up session
      3. BYE for terminating sessions
      4. OPTIONS for querying server capabilities
    2. Request URI is a SIP or SIPS URI, it indicates the user or service to which this request is being addressed, SIP elements may support other URI types like tel URI
    3. SIP version is "SIP/2.0" 

  3. SIP Responses have a status line as their start line, which consist of protocol version, numeric status code and its associated text

    1. Status code is a three digit integer result code, indicating the outcome of an attempt to understand and satisfy a request.
    2. the first digit of the status code defines the class of the response, there can be six values for the first digit, ie six response categories
      1. 1XX: Provisional , the request is received and is in process
      2. 2XX: Success , the request was successfully received, understood, and accepted
      3. 3XX: Redirection , the request needs to be redirected, one reason for that is, the recipient has changed its location
      4. 4XX: Client Error , bad syntax in the request, thus cant be fulfilled at this server
      5. 5XX: Server Error , server failed to fulfill the request (a valid one)
      6. 6XX: Global failure , the request cant be fulfilled at any server
    3. reason phrase is to give a short textual description of the status code, for the human user


Structure of SIP Protocol Stack

  1. fairly independent processing stages
  2. element "containing" a layer means elements compliance with the rules defined by that layer
  3. lowest layer is "syntax and encoding" layer
    1. encoding is specified using BCNF (Backus-Naur form grammar)
  4. second layer is "transport layer"
    1. defines how a client sends requests and receives responses
    2. defines how a server receives requests and sends responses
    3. all SIP elements contain a transport layer

  5. third layer is "transaction layer"
    1. transaction is a 
      1. request send by client transaction (using transport layer) to a server transaction
      2. along with all the responses to that request send by the server transaction back to the client
    2. handles application layer retransmissions
    3. matching of responses to request
    4. handles application layer timeouts
    5. statefull proxies, and User Agents have a transaction layer
    6. stateless proxies don't have a transaction layer
    7. Transaction layer has two components, which are represented by a finite state machine constructed to process a particular requests
      1. Client Component (client transaction)
      2. Server Component (server transaction)
  6. the fourth layer is "transaction user"
    1. each of the SIP entities except a stateless proxy is a transaction user
      1. when a TU wishes to send a request it creates a client transaction instance and passes it the request, along with destination IP address, port, and transport to which to send the request
      2. a TU that creates a client transaction can also cancel it, using a CANCEL request, which constitute its own transaction, but references the transaction to be canceled
      3. on canceling the server stops further processing, revert to the state that existed before the transaction was initiated, and generate a specific error response to that transaction
  7. the SIP elements, UA clients and servers, stateless and stateful proxies, and registrar, contains a core that distinguish them from each other. Cores except for the state less proxies are TU. 


Monday, September 20, 2010

Loosely coupled and highly cohesive

  1. Coupling
    1. among classes
    2. among subsystems, modules
    3. related classes knowing the internal details of each other
    4. when one is changed, other has to be changed
    5. makes the system difficult to understand
    6. no possibility of reuse of the entwined code
  2. Cohesion
    1. inside the class, among the class attributes and behavior
    2. well defined roles for the classes within the system
    3. the data is closely related with the functions which the class is providing
  3.  

  4. Law of Demeter (more specific case of "low coupling", LoD)
    1. motto is "only talk to your immediate friends"
    2. each unit should have only limited knowledge about other units "closely" related to the current unit (method/function "f")
    3. in context of OOD, closely related
      1. are the functions of the class in which unit (function "f") exists
      2. other argument classes of unit (function "f")
      3. functions of immediate part classes (computed and stored) of class of unit (function "f")
        1. computed classes are the classes that are the return type of functions of this class
        2. stored classes are the classes of the data members of this class

Tuesday, September 14, 2010

Overview Of SIP Operation I

  1. basic functions of SIP (HTTP like request/response transaction model)

    1. Location of an endpoint
    2. signal of a desire to communicate
    3. negotiation of session parameters for the session
    4. teardown of session once established
  2. Request handling in SIP is often classified as either INVITE or non-INVITE (an ACK is only sent in response to a response for an INVITE request,INVITE/200/ACK)
  3. SIP messages are text-encoded
INVITE message example, with header fields (minimum required set)
  1. INVITE sip:bob@biloxi.com SIP/2.0
  2. Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bK776asdhds
  3. Max-Forwards: 70
  4. To: Bob <sip:bob@biloxi.com>
  5. From: Alice <sip:alice@atlanta.com>;tag=1928301774
  6. Call-ID: a84b4c76e66710@pc33.atlanta.com
  7. CSeq: 314159 INVITE
  8. Contact: <sip:alice@pc33.atlanta.com>
  9. Content-Type: application/sdp
  10. Content-Length: 142

Pointers to pointers, and arrays and strings II

  1. (*ptoStruct).member; is same as ptoStruct->member
  2. char name[40] = “mithun”, allocate 40 bytes on static memory block, and occupy the first 7 bytes (6 + ‘\0’), and “name” is a array constant, un modifiable lvalue
  3. char name[] = “mithun” , count number of chars, allocate memory for count+1 on static memory block, and “name” is a array constant un modifiable lvalue
  4. char* name = “mithun” ,  allocate the memory for number of characters + 1 for nul, and also 4 bytes for the pointer variable “name”, and “name” is a variable
  5. in the array notation name is the address of the first element i.e. &name[0], and will always point to the same location (a constant).

SIP Overview

  1. An application layer control protocol (works with both IPv4 and IPv6), that can

    1. establish modify and terminate multimedia sessions (conferences), such as IP telephony calls
    2. invite participants to existing sessions (like multicast conferences)
    3. existing sessions can be modified by adding/removing media from an existing session
    4. transparently supports name mapping and redirection services (support to personal mobility)
    5. a single externally visible ID can be maintained regardless of the network location (SIP URI)