Monday, September 30, 2013

HelloWorld on OLinuXino (ArchLinux ARM) using C

So assuming you have an iMX233-OLinuXino-MAXI and are running ArchLinux on it, here is how you you would go about running a HelloWorld application on it:
  1. Gain access to OLinuXino's console over serial port and login using the credentials (login: root & password:root)
  2. Issue the command to OLinuXino for performing a full system upgrade, make sure the board is connected to your WiFi router using an Ethernet cable as it will use the internet to fetch the latest packages:
    pacman -Syu
  3. Reboot the board by issuing the command:
    reboot
  4. Install the compiler and other basic development tools onto OLinuXino (When asked, press enter to keep all options at default):
    pacman -S base-devel
  5. Reboot the board.
  6. Use the nano text editor to write a helloworld program:
    nano hello.c
  7. Type the code:

    #include <stdio.h>
    #include <stdlib.h>
    int main(void) {
            puts("!!!Hello World!!!");
            exit(EXIT_SUCCESS);
    }




  • Press Control+O to save the file and Control+X to exit.
  • Compile the file:
    gcc hello.c
  • Run the compiled executable and observe the output:
    ./a.out



  • In case you want to now try compiling kernel modules, look here.

    Wednesday, September 25, 2013

    The 3rd annual M2M Conclave India 2013 - A Report


    Date: 2013 September 20
    Venue: The Lalit, Mumbai
    Actual duration: 10am to 6pm

    Actual Agenda: The conference was split into 3 sessions of 5 speakers each. These shorter sessions were easier to bear. As always, 5 star hotels can never get their air conditioning right - it was too cold for sit for long durations inside the hall. This was ironic as the conference touched on using M2M for improved building automation many times.
    Originally each session had a theme but at runtime, most speakers deviated from the topic at hand and delved deeper into various issues involved in M2M implementations. Their insightful experiences were valuable.

    A few stalls had been put up by M2M device manufacturers and a few system integrators.
    Actual Audience Composition: A large number of delegates were from cellular service providers like Vodafone, Idea, MTNL. Rest were from organizations involved in manufacture of M2M hardware and/or M2M service providers.

    Combined Summary of the conference: A successful M2M implementation requires lots of components. Other than the hardware, most of these components are in form of services like: Cellular data, managed IT and managed non-IT equipment, Cloud computing backbone, User interface, Analytics tools. Current players in this field (specially India) provide one or some of these services. They must form partnerships with each other to come out with a bundled M2M product cum service offering for end customers with a single point of contact for issue resolution.

    Here is a summary of the talks given by various speakers:

    Session 1
    Successful Business Models & Ecosystem Integration for making M2M a Business Success in India

    (Keynote) Mr Emil Berthelsen, Machina Research

    • Machina Research provides market intelligence in the field of M2M. According to them: The M2M Revenue opportunity in India will grow from USD6.3 billion in 2013 to USD29.7 billion in 2022 (These revenues are made up of device, installation, data connectivity (where integral and required) and service revenue)
    • In India, mandated initiatives like R-APDRP, JnNURM, Aadhaar & NREGA are driving the adoption of M2M in corresponding sectors namely Energy Utilities, Smart Cities/Public Transportation, Retail/Healthcare & Agrculture
    • But in this early stage, M2M market is still fragmented whichever way you look: in terms of Technology (WiFi, 3G/4G, ZigBee etc.), in terms of Providers (Hardware, Connectivity, Integration, Servicing, etc.) and in terms of Sectors (Utilities, Retail, Construction etc.).
    • If you just look at "services" part of M2M, in India, this will generate around USD9.1 billion by end of 2022 and 90% of this revenue will come from the services bundled with a particular M2M connection.
    • So for those looking to provide the "services" part of M2M, 2 immediate opportunity areas have been identified: Vertical Application Development (i.e. solution tuned for a particular sector like cell tower management) and Horizontal Application Platform development and M2M Application Stores (i.e.Google Play or iTunes App Store)
    • As Big Data is accumulated via these M2M devices, focus will shift to monetizing thru data analytics
    • Three business models will emerge as new opportunity areas from Big Data/M2M: Deliver new services to improve customer experiences, use data assets for insights and hence gain competitive advantage for the group, act as broker of data or selling the insights gained to others.

    Mr RM Agarwal, Department of Telecom, Government of India

    • DoT is in process of forming policies and regulations for the M2M sector.
    • Currently, they are driving on adoption of IPv6 by all major telecom and internet service providers as that when M2M devices come up, they don't fall short of IP addresses.
    • Talked about the proposed Smart Cities Project : 7 cities
    • 14 Smart Grid projects have been proposed by Ministry of Power
    • National Mission for Electric Mobility (NMEM) - Sale of 6-7 million electric vehicles by 2020
    • Policies are being formed around: security, lawful interception, KYC (current KYC forbids resale of SIM card, so when a SIM card is present inside an electric vehicle which is being resold, what laws must be followed?)
    • Policies will be formed on basis of inputs (via means of survey) from Academia, Industry and M2M vendors. They have prepared a questionnaire which they have circulated amongst professionals working in the M2M field to take their inputs. The questionnaire is here. My response is here.

    Mr Vishnu Rajanikanth, Volvo Group Telematics

    • Truck telematics can help all stake holders to track the asset - for example banks who have lent money for buying the truck can keep a check on the productivity of the asset and thereby assess the quality of their investment. Insurance companies/Warranty providers can ensure the authenticity of claims. 
    • Partnerships with content providers will help enable new kinds of use. For example combining traffic data with truck's GPS coordinates will help estimate time of arrival.
    • We need to figure our where we are in the M2M Hype Cycle and set our expectations and strategies accordingly.

    Mr Nilesh Sangoi, Meru Cabs

    • Meru Cabs was started in 2007, and today serves 1 million customers per month through 20,000 trips per day across 4 cities in India. 5500+ cabs.
    • Each cab is fitted with mobile data terminals with GPRS connectivity, GPS receivers & Credit/Debit card reader.
    • Automated overspeeding alarm using GPS
    • Website and mobile app enable consumer self service - Oracle ERP & Siebel CRM based system capable of handling more than 25,000 cabs per day - developed in house
    • Centralized system for all cities
    • Learnings: In house algorithm developed: after a booking, GPS coordinates of the customers pickup location is identified via GIS, bid is sent out to 5 cabs closest to customers. System identifies the right cab based on algorithm. SMS is sent to customer with cab details, whole process is completed in 1 minute.
    • Learnings: GPRS coverage in India is very unreliable specially at night when the Telecom providers are performing various testing and may shut down the network for multiple durations. Service providers are not geared for 24x7 support.
    • Learnings: Strudy hardware is required. Current hardware is not immune to high temperatures caused by sunlight. 
    • Opportunities: Analytics and improvement of dispatch algorithms, NFC payements, Traffic data integration and route optimization, cheaper hardware, smart phone apps, in cab entertainment

    Mr Shankar Halder, Pinnacle Consulting

    • Current state of M2M is like the story of the Blind men and the Elephant - Each player in the field has their own interpretation of what M2M should be like.
    • Market fragmentation must be overcome through partnerships - end customer must be presented with a unified frontend - a single point of contact for service requests with regards to the bundled M2M offering
    • Hence biggest challenge is to form alliances

    Session 2
    How M2M Ecosystem will Create New Revenue Streams in India

    Mr Parag Harolikar, Tech Mahindra

    • Whose focussing on field services? You make a device and the web infrastructure to support it, but at the end you need personnel to go and install the device in the field which might possibly a hazardous location out in a village. You will need personnel to respond to service calls
    • M2M is sort of a new way of doing Business Process Reengineering - or atleast BPR is one of the application areas of M2M.
    • Presented the case study of Nano Ganesh - Remote control of agriculture water pumpset: Ossian trained local entrepreneurs/handymen from the village (local electricians or those having mobile shops) on how to install the Nano Ganesh. Such people (besides earning revenue from their already existing business) earn commission and fees for installing the device for local farmers. "For farmers these handymen are like Gods! because they are able to listen to them and solve their local problems!"

    Mr Sachin Deshpande, Radius

    • According to the Cisco Internet Business Solutions Group (IBSG), IoT is simply the point in time when more “things or objects” were connected to the Internet than people. (Reference: The Internet of Things How the Next Evolution of the Internet Is Changing Everything)
    • Talked about his company's M2M platform called Xenius and showed us a demo by logging into an existing installation at a township in Delhi. (The names Xenia™, the 'mother intelligence' of the system, and Xenius™, the 'child intelligence', are both derived from the Latin word 'genius', meaning: 'the guardian spirit or deity who watches over a system from birth'.)

    Mr Derick Jose, Flutura

    • The best talk of the conclave: He actually shared the wisdom gained from years of experience in the field.
    • Year 2008 saw the Inflection point (Number of connected sensors became greater than number of connected humans)
    • It is important to know what problem you are solving using M2M - So ask the customer. For example power leakage problem can be divided into two categories: theft and technical. A Smart meter must be able to distinguish between the two. If your smart meter and its associated big data analytics can help you optimize electrician deployment for travel to multiple simultaneous leakage events then that's a plus point
    • Modern day data analytics tools allow you to zoom in and zoom out of data.. from Bird's eye view to event view to worm's eye view. This was not possible using Traditional RDBMS and requires cloud backend. Different zoom levels can bring out different insights.
    • Devices can be classified depending on levels of intelligence. Or you can say that a non instrumented facility evolves by passing through these levels.
      • Level 0: Instrumented
        Does not have any sensors today.
        E.g. Lamps, Motors
      • Level 1: Instrumented/Not Transmitted
        Sensors trapped + Events Recorded + Locally Flushed
        E.g. Pumps, Motors - Tripper Unit
      • Level 2: Edge Intelligence
        Device has local intelligence
        E.g. if boiler temperature > threshold, take action
      • Level 3: Visualisation
        Help visually explore the device
        E.g. Geospatial map + Engineering map of devices
      • Level 4: Central + Reactive Intelligence
        Single stream alerts/alarm
        E.g. if boiler temperature > threshold, take action AND.., Net sweeper logs
      • Level 5: Real Time + Triangulated Intelligence
        Device has central intelligence
        E.g. If a smoke detector detects smoke, check the 2-3 surrounding smoke detector to confirm - like in a smart building
      • Level 6: Predictive Intelligence
        With which probability will the device experience failure
    • More details regarding this here on their blog article: 5 Levels of Intelligence in Industrial IOT
    • Triangulation: Focus on the sensed part of the data (correlation and detecting of events) and not the storage of raw sensor data itself. Sort the event instead.
    • Big data solution architecture must reduce massive risks and unlock process efficiency
    • Machine Learning: The technicians working in the field develop intuition and muscle memory. This intuition must be captured and passed on as inputs to other field technicians to enhace their practical skills and experience. The system must assist in capturing these nuggests of knowledge and facilitate sharing amongst the teams. This can be done inform of annotations to the data/captured events etc.
    • Gamification and Habit Design must be incorporated into the M2M solution. Big data can be used to improve the working habits of the technicians and other personnel working at various levels with the aim of improving  their wellbeing, quality of working conditions and  sustainability.
    • Different personnel have different agendas, so the data must be presented differently to different people. People like field technicians, process optimizers, head office designers and command center guy have different expectations from the system when it is presenting data to them

    Sudhakar Marthi, WebNMS

    • Promoted his M2M solution: WebNMS. WebNMS is a division of Zoho Corporation
    • Talked about using M2M for warranty management and product lifecycle management
    • Their WebNMS hardware also has a web camera which shows you the live photo of the asset being monitored

    Session 3
    M2M Monetization Strategies in India - Smart Devices, Smart Consumers & Smart Enterprises

    Mr Dhananjaya L, Vodafone India

    • He is the new product development head at Vodafone
    • He says that cutomers complain about SIM card getting spoilt regularly. Perhaps we need a new kinds of industrial/automotive grade SIM card capable of withstanding high temperatures.
    • Its difficult for end customer (when faced with a problem) to differentiate between the device being defective or the SIM card being defective.

    Mr Prashant Pareira, Nelco - A Tata company

    • Nelco is provider of "Managed M2M service", they are the one stop shop for managing all issues relating to your automation equipment. They guarantee the uptime for your critical equipment.
    • When the end customer asks questions like: "who do I contact when things go wrong with my M2M installation?" or "how will my energy bill change when I use this M2M solution?", they need some one to answer such questions. A managed M2M provider is the one who should answer such question.
    • M2M: means automating operational and business processes based on events
    • Adopter of M2M have realized invisible benefits:
      • 20% reduction in total service cost
      • 35% reduction in equipment down time
      • 20-35% improvement in service force productivity
      • 5-10% return on sales
    • M2M managed services is part of "Non IT managed services" which includes things like onsite maintenance of fire alarm system, PA system, Security system, Diesel Generator,  etc.
    • He compared the projected growth of M2M managed services (Non IT managed services) to the growth of "managed IT services" a decade or two ago:
      • Non IT managed service requires onsite to remote ratio of 60:40 as compared to the onsite to remote ratio of 20:80 for managed IT services.
      • Growth and maturation of non IT managed services might take 15 years as compared to 5 years taken by IT managed services
    • Presented a case study of light house automation at Andaman and Nicobar islands - no people, no electricity, used solar, used VSATs

    Mr Kartik Gopal, Mahindra Reva

    • Mahindra e2o is one of the earliest global electric cars. Its a personal car with anytime,anywhere connectivity.
    • Connected card: You are connected to the network at office and at home, even at mall/airports/restaurants .. so why not stay connected while travelling.
    • Their context for connectivity for the connected car:
      • Readily available digitized data inside the car.
      • Lower volumes compared to internal combustion engine car means strong business need for lowering diagnostics costs
      • Global market focus: vehicle performance under diverse environmental conditions.
      • Enable unique methods to address 'range anxiety'
    • Telematics application focus in the e2o:
      • Remote Diagnostics:
        • ~80% of time required for fault rectification is diagnostics
        • Developing prognostic algorithms
        • Enabling 2 customer promises: we will tell you there is a problem in the carbefore you get to know it & we will fix your car wherever it is.
      • Improving Vehicle Design:
        • Real-life data from vehicles on-road, under diverse conditions.
        • Warrany condition reporting.
      • Customer & Brand connect:
        • Addressing 'range anxiety'
        • Getting to 'wow'
    • Battery is 30% cost of your car
    • Mahindra e2o has a mobile app to control and monitor certain aspects of your car: control your AC, check battery level, get SMS alerts if there is an error like charging failure etc..
    • Technical challenges for the telematics unit of an always connected car:
      • High sustained data rates: 400 bytes per second
      • Enabling 24x7 connectivity without consuming too much data
      • Network variability during driving
      • Multiplicity of technical skills required for end-to-end solution enablement.
    • Currently, Mahendra uses a Vodafone SIM inside the car to transfer data over to their servers. The Vodafone SIM card is registered in the name of Mahendra and not the end customers so that the KYC norms are not broken when the car is re sold.

    Mr Vineet Malhotra, Kale Logistics

    • Logistics field is made up of SMEs
    • 57% of M2M spends happens in logistics industry?
    • Smart phone can act as an M2M device
    • Data Quality and Validity varies depending on the medium used to collect the data:
      • Phone (Voice) 38%
      • Paper 44%
      • Email/Excel 53%
      • ERP 71%
      • Smart Phone (using Apps) 96%
      • M2M device 100%
    • Presented a case study where a business process was automated using smart phone app: http://blueflock.com/home/
    • Instrumentation equipment like a multimeter are now available which communicate with cellphones to take automated readings (like for example measuring battery health at a cell tower)
    • Using smart phones increases efficiency of the service force without taking away jobs
    • Presented another case study for inexpensive use of technology for container management in a yard.

    Mr Nitin Joshi, Vighnaharta

    • In terms of technology: India is tricky with contrast to western world because of low penetration of devices and lack of infrastructure
    • Talked about his intrusion detection product
    • Have been in device automation field since 1989
    • M2M began with serial device servers, now we are moving to cloud and slowly all the functionality will be integrated in the device itself.
    • Presented a case study of a cell tower and its diesel genset. They used monitoring to curb diesel theft and track working hrs of the genset and cost per kWh.
    • They have included 2-way audio public address system in their ATM security/monitoring systems - when some tried to steal from the ATM, a loud audio warning can be given to the intruders to deter them from the act.

    Tuesday, September 24, 2013

    UART1 echo on LM4F232H5QD Evaluation Board using CodeComposer Studio

    NOTE: TI renamed Stellaris LM4F232H5QD to Tiva C Series TM4C123GH6PGE - Both these part numbers refer to the same chip. StellarisWare is now superseded by/renamed to TivaWare 2.0. The LM4F232 USB+CAN Evaluation Kit is now rebranded as Tiva™ C Series TM4C123G USB+CAN Development Kit. This blog post refers to the old StellarisWare (SW-LM3S-9107(Stellarisware).exe) and old CodeComposer Studio (CCS5.2.1.00018_win32) and the old part numbers for the microcontroller chip and the evaluation kit.

    The Texas Instruments Stellaris LM4F232H5QD Evaluation Board is supplied with uart_echo project (C:\StellarisWare\boards\ek-lm4f232\uart_echo) which shows how to use UART0. The UART0 appears on the computer as a virtual serial port. The PA0/PA1 pins which act as the TX/RX pins of UART0 are connected to the computer via the on board In-Circuit Interface.

    If we want to use UART1 instead of UART0, the code must be modified accordingly.
    A special point worth noting is that UART1's TX/RX signals can be made available on 2 pairs of pins: PC4/PC5 or PB0/PB1. We need to tell the microcontroller which of the pairs to use explicitly.

    To use UART1, you will need a USB-to-Serial board like the one based on FT232RL available from Sparkfun. You can hook up the board to the Evaluation Kit as shown:

    PC4 of LM4F232H5QD is connected to TX-O of FT232
    PC5 of LM4F232H5QD is connected to RX-I of FT232
    The following steps will not only show you the code for accessing UART1 but also show you how to create and configure a new CodeComposer Project. You will need a Windows PC - I used Windows 7 32bit edition.

    1. Install Code Composer Studio from the Disc supplied with the kit. When asked for the Processor Support, select "Stellaris Cortex M MCUs". Leave all other options at default.
    2. Install StellarisWare. It will be installed to C:\StellarisWare
    3. Connect the LM4F232H5QD Evaluation Board to the Computer. Use the USB ICD miniUSB connector on the evaluation board.
    4. Windows won't be able to locate the drivers for the same. You will have to manually specify the location for the driver. The drivers can be found at: "C:\ti\ccsv5\ccs_base\emulation\drivers\stellaris\icdi"
    5. You will have to perform the driver installation process three times as the USB device enumerates as three separate devices. Use the Windows device manager to do this:
    6. Connect the FT232 board to the computer and install the driver for it. Use HyperTerminal/ Bray's Terminal/TeraTerm or PuTTY to open the corresponding COM Port at 115200 8-N-1. We will use it shortly.
    7. Start CodeComposer Studio. A new workspace will be created.
    8. Select File>New>CCS Project to create a new project with the following settings:
      1. Project name: uart1_echo
      2. Family: ARM
      3. Variant: Cortex M | Stellaris LM4F232H5QD 
      4. Connection: Stellaris In-Circuit Debug Interface
      5. Template: Empty Project (with main.c)
    9. Replace the content of main.c with the following lines of code:
        1
        2
        3
        4
        5
        6
        7
        8
        9
       10
       11
       12
       13
       14
       15
       16
       17
       18
       19
       20
       21
       22
       23
       24
       25
       26
       27
       28
       29
       30
       31
       32
       33
       34
       35
       36
       37
       38
       39
       40
       41
       42
       43
       44
       45
       46
       47
       48
       49
       50
       51
       52
       53
       54
       55
       56
       57
       58
       59
       60
       61
       62
       63
       64
       65
       66
       67
       68
       69
       70
       71
       72
       73
       74
       75
       76
       77
       78
       79
       80
       81
       82
       83
       84
       85
       86
       87
       88
       89
       90
       91
       92
       93
       94
       95
       96
       97
       98
       99
      100
      101
      102
      103
      104
      105
      106
      107
      108
      109
      110
      111
      112
      113
      114
      115
      116
      117
      118
      119
      120
      121
      122
      123
      #include "inc/hw_ints.h"
      #include "inc/hw_memmap.h"
      #include "inc/hw_types.h"
      #include "driverlib/debug.h"
      #include "driverlib/fpu.h"
      #include "driverlib/gpio.h"
      #include "driverlib/interrupt.h"
      #include "driverlib/sysctl.h"
      #include "driverlib/uart.h"
      #include "driverlib/rom.h"
      #include "grlib/grlib.h"
      #include "drivers/cfal96x64x16.h"
      
      #ifdef DEBUG
      void
      __error__(char *pcFilename, unsigned long ulLine)
      {
      }
      #endif
      
      void UARTIntHandler(void) {
       unsigned long ulStatus;
      
       // Get the interrrupt status.
       ulStatus = ROM_UARTIntStatus(UART1_BASE, true);
      
       // Clear the asserted interrupts.
       ROM_UARTIntClear(UART1_BASE, ulStatus);
      
       // Loop while there are characters in the receive FIFO.
       while (ROM_UARTCharsAvail(UART1_BASE)) {
        // Read the next character from the UART and write it back to the UART.
        ROM_UARTCharPutNonBlocking(UART1_BASE, ROM_UARTCharGetNonBlocking(UART1_BASE));
       }
      }
      
      // Send a string to the UART.
      void UARTSend(const unsigned char *pucBuffer, unsigned long ulCount) {
       // Loop while there are more characters to send.
       while (ulCount--) {
        // Write the next character to the UART.
        ROM_UARTCharPutNonBlocking(UART1_BASE, *pucBuffer++);
       }
      }
      
      // This example demonstrates how to send a string of data to the UART.
      int main(void) {
          tRectangle sRect;
          tContext sContext;
      
       // Enable lazy stacking for interrupt handlers.  This allows floating-point
       // instructions to be used within interrupt handlers, but at the expense of
       // extra stack usage.
       ROM_FPULazyStackingEnable();
      
       // Set the clocking to run directly from the crystal.
       ROM_SysCtlClockSet(
         SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN
           | SYSCTL_XTAL_16MHZ);
      
       // Initialize the display driver.
       CFAL96x64x16Init();
      
       // Initialize the graphics context.
       GrContextInit(&sContext, &g_sCFAL96x64x16);
      
       // Fill the top part of the screen with blue to create the banner.
       sRect.sXMin = 0;
       sRect.sYMin = 0;
       sRect.sXMax = GrContextDpyWidthGet(&sContext) - 1;
       sRect.sYMax = 9;
       GrContextForegroundSet(&sContext, ClrDarkBlue);
       GrRectFill(&sContext, &sRect);
      
       // Change foreground for white text.
       GrContextForegroundSet(&sContext, ClrWhite);
      
       // Put the application name in the middle of the banner.
       GrContextFontSet(&sContext, g_pFontFixed6x8);
       GrStringDrawCentered(&sContext, "uart-echo", -1,
         GrContextDpyWidthGet(&sContext) / 2, 4, 0);
      
       // Initialize the display and write some instructions.
       GrStringDrawCentered(&sContext, "Connect a", -1,
         GrContextDpyWidthGet(&sContext) / 2, 20, false);
       GrStringDrawCentered(&sContext, "terminal", -1,
         GrContextDpyWidthGet(&sContext) / 2, 30, false);
       GrStringDrawCentered(&sContext, "to UART1.", -1,
         GrContextDpyWidthGet(&sContext) / 2, 40, false);
       GrStringDrawCentered(&sContext, "115000,N,8,1", -1,
         GrContextDpyWidthGet(&sContext) / 2, 50, false);
      
       // Enable the peripherals used by this example.
       ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
       ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
      
       // Enable processor interrupts.
       ROM_IntMasterEnable();
      
       // Set GPIO C4 and C5 as UART pins.
       ROM_GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5);
      
       // Extra setting for UART1
       // Because UART1 can be routed to either PC4/PC5 or PB0/PB1
       // So you have to select where to route it to
       ROM_GPIOPinConfigure(GPIO_PC4_U1RX);
       ROM_GPIOPinConfigure(GPIO_PC5_U1TX);
      
       // Configure the UART for 115,200, 8-N-1 operation.
       ROM_UARTConfigSetExpClk(UART1_BASE, ROM_SysCtlClockGet(), 115200,
         (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
      
       // Enable the UART interrupt.
       ROM_IntEnable(INT_UART1);
       ROM_UARTIntEnable(UART1_BASE, UART_INT_RX | UART_INT_RT);
      
       // Prompt for text to be entered.
       UARTSend((unsigned char *) "Enter text: ", 12);
      
       // Loop forever echoing data through the UART.
       while (1) {
       }
      }
      
      If you compare this main.c with the uart_echo code supplied with the kit, you will notice two extra lines of code other than the obvious modifications for changing from UART0 to UART1. These are:
      ROM_GPIOPinConfigure(GPIO_PC4_U1RX);
      ROM_GPIOPinConfigure(GPIO_PC5_U1TX);

      These are for telling the microcontroller that we want to use PC4/PC5 for UART1 instead PB0/PB1
    10. Replace the contents for lm4f232h5qd.cmd with the following lines of code:
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      46
      --retain=g_pfnVectors
      
      /* The following command line options are set as part of the CCS project.    */
      /* If you are building using the command line, or for some reason want to    */
      /* define them here, you can uncomment and modify these lines as needed.     */
      /* If you are using CCS for building, it is probably better to make any such */
      /* modifications in your CCS project and leave this file alone.              */
      /*                                                                           */
      /* --heap_size=0                                                             */
      /* --stack_size=256                                                          */
      /* --library=rtsv7M3_T_le_eabi.lib                                           */
      
      /* The starting address of the application.  Normally the interrupt vectors  */
      /* must be located at the beginning of the application.                      */
      #define APP_BASE 0x00000000
      #define RAM_BASE 0x20000000
      
      /* System memory map */
      
      MEMORY
      {
          /* Application stored in and executes from internal flash */
          FLASH (RX) : origin = APP_BASE, length = 0x00040000
          /* Application uses internal RAM for data */
          SRAM (RWX) : origin = 0x20000000, length = 0x00008000
      }
      
      /* Section allocation in memory */
      
      SECTIONS
      {
          .intvecs:   > APP_BASE
          .text   :   > FLASH
          .const  :   > FLASH
          .cinit  :   > FLASH
          .pinit  :   > FLASH
          .init_array : > FLASH
      
          .vtable :   > RAM_BASE
          .data   :   > SRAM
          .bss    :   > SRAM
          .sysmem :   > SRAM
          .stack  :   > SRAM
      }
      
      __STACK_TOP = __stack + 512;
      
    11. Right click the project "uart1_echo" (in Project Explorer view) and select New>Source File and create a file named "startup_ccs.c"
    12. Replace the content of startup_ccs.c with the following lines of code. This file contains the interrupt vector table. Note that  we have moved the UART Interrupt Function from vector location of UART0 to that of UART1 .
        1
        2
        3
        4
        5
        6
        7
        8
        9
       10
       11
       12
       13
       14
       15
       16
       17
       18
       19
       20
       21
       22
       23
       24
       25
       26
       27
       28
       29
       30
       31
       32
       33
       34
       35
       36
       37
       38
       39
       40
       41
       42
       43
       44
       45
       46
       47
       48
       49
       50
       51
       52
       53
       54
       55
       56
       57
       58
       59
       60
       61
       62
       63
       64
       65
       66
       67
       68
       69
       70
       71
       72
       73
       74
       75
       76
       77
       78
       79
       80
       81
       82
       83
       84
       85
       86
       87
       88
       89
       90
       91
       92
       93
       94
       95
       96
       97
       98
       99
      100
      101
      102
      103
      104
      105
      106
      107
      108
      109
      110
      111
      112
      113
      114
      115
      116
      117
      118
      119
      120
      121
      122
      123
      124
      125
      126
      127
      128
      129
      130
      131
      132
      133
      134
      135
      136
      137
      138
      139
      140
      141
      142
      143
      144
      145
      146
      147
      148
      149
      150
      151
      152
      153
      154
      155
      156
      157
      158
      159
      160
      161
      162
      163
      164
      165
      166
      167
      168
      169
      170
      171
      172
      173
      174
      175
      176
      177
      178
      179
      180
      181
      182
      183
      184
      185
      186
      187
      188
      189
      190
      191
      192
      193
      194
      195
      196
      197
      198
      199
      200
      201
      202
      203
      204
      205
      206
      207
      208
      209
      210
      211
      212
      213
      214
      215
      216
      217
      218
      219
      220
      221
      222
      223
      224
      225
      226
      227
      228
      229
      230
      231
      232
      233
      234
      235
      236
      237
      238
      239
      240
      241
      242
      243
      244
      245
      //*****************************************************************************
      // Forward declaration of the default fault handlers.
      //*****************************************************************************
      void ResetISR(void);
      static void NmiSR(void);
      static void FaultISR(void);
      static void IntDefaultHandler(void);
      
      //*****************************************************************************
      // External declaration for the reset handler that is to be called when the
      // processor is started
      //*****************************************************************************
      extern void _c_int00(void);
      
      //*****************************************************************************
      // Linker variable that marks the top of the stack.
      //*****************************************************************************
      extern unsigned long __STACK_TOP;
      
      //*****************************************************************************
      // External declaration for the interrupt handler used by the application.
      //*****************************************************************************
      extern void UARTIntHandler(void);
      
      //*****************************************************************************
      // The vector table.  Note that the proper constructs must be placed on this to
      // ensure that it ends up at physical address 0x0000.0000 or at the start of
      // the program if located at a start address other than 0.
      //*****************************************************************************
      #pragma DATA_SECTION(g_pfnVectors, ".intvecs")
      void (* const g_pfnVectors[])(void) =
      {
       (void (*)(void))((unsigned long)&__STACK_TOP),
       // The initial stack pointer
        ResetISR,// The reset handler
        NmiSR,// The NMI handler
        FaultISR,// The hard fault handler
        IntDefaultHandler,// The MPU fault handler
        IntDefaultHandler,// The bus fault handler
        IntDefaultHandler,// The usage fault handler
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        IntDefaultHandler,// SVCall handler
        IntDefaultHandler,// Debug monitor handler
        0,// Reserved
        IntDefaultHandler,// The PendSV handler
        IntDefaultHandler,// The SysTick handler
        IntDefaultHandler,// GPIO Port A
        IntDefaultHandler,// GPIO Port B
        IntDefaultHandler,// GPIO Port C
        IntDefaultHandler,// GPIO Port D
        IntDefaultHandler,// GPIO Port E
        IntDefaultHandler,// UART0 Rx and Tx
        UARTIntHandler,// UART1 Rx and Tx
        IntDefaultHandler,// SSI0 Rx and Tx
        IntDefaultHandler,// I2C0 Master and Slave
        IntDefaultHandler,// PWM Fault
        IntDefaultHandler,// PWM Generator 0
        IntDefaultHandler,// PWM Generator 1
        IntDefaultHandler,// PWM Generator 2
        IntDefaultHandler,// Quadrature Encoder 0
        IntDefaultHandler,// ADC Sequence 0
        IntDefaultHandler,// ADC Sequence 1
        IntDefaultHandler,// ADC Sequence 2
        IntDefaultHandler,// ADC Sequence 3
        IntDefaultHandler,// Watchdog timer
        IntDefaultHandler,// Timer 0 subtimer A
        IntDefaultHandler,// Timer 0 subtimer B
        IntDefaultHandler,// Timer 1 subtimer A
        IntDefaultHandler,// Timer 1 subtimer B
        IntDefaultHandler,// Timer 2 subtimer A
        IntDefaultHandler,// Timer 2 subtimer B
        IntDefaultHandler,// Analog Comparator 0
        IntDefaultHandler,// Analog Comparator 1
        IntDefaultHandler,// Analog Comparator 2
        IntDefaultHandler,// System Control (PLL, OSC, BO)
        IntDefaultHandler,// FLASH Control
        IntDefaultHandler,// GPIO Port F
        IntDefaultHandler,// GPIO Port G
        IntDefaultHandler,// GPIO Port H
        IntDefaultHandler,// UART2 Rx and Tx
        IntDefaultHandler,// SSI1 Rx and Tx
        IntDefaultHandler,// Timer 3 subtimer A
        IntDefaultHandler,// Timer 3 subtimer B
        IntDefaultHandler,// I2C1 Master and Slave
        IntDefaultHandler,// Quadrature Encoder 1
        IntDefaultHandler,// CAN0
        IntDefaultHandler,// CAN1
        IntDefaultHandler,// CAN2
        IntDefaultHandler,// Ethernet
        IntDefaultHandler,// Hibernate
        IntDefaultHandler,// USB0
        IntDefaultHandler,// PWM Generator 3
        IntDefaultHandler,// uDMA Software Transfer
        IntDefaultHandler,// uDMA Error
        IntDefaultHandler,// ADC1 Sequence 0
        IntDefaultHandler,// ADC1 Sequence 1
        IntDefaultHandler,// ADC1 Sequence 2
        IntDefaultHandler,// ADC1 Sequence 3
        IntDefaultHandler,// I2S0
        IntDefaultHandler,// External Bus Interface 0
        IntDefaultHandler,// GPIO Port J
        IntDefaultHandler,// GPIO Port K
        IntDefaultHandler,// GPIO Port L
        IntDefaultHandler,// SSI2 Rx and Tx
        IntDefaultHandler,// SSI3 Rx and Tx
        IntDefaultHandler,// UART3 Rx and Tx
        IntDefaultHandler,// UART4 Rx and Tx
        IntDefaultHandler,// UART5 Rx and Tx
        IntDefaultHandler,// UART6 Rx and Tx
        IntDefaultHandler,// UART7 Rx and Tx
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        IntDefaultHandler,// I2C2 Master and Slave
        IntDefaultHandler,// I2C3 Master and Slave
        IntDefaultHandler,// Timer 4 subtimer A
        IntDefaultHandler,// Timer 4 subtimer B
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        0,// Reserved
        IntDefaultHandler,// Timer 5 subtimer A
        IntDefaultHandler,// Timer 5 subtimer B
        IntDefaultHandler,// Wide Timer 0 subtimer A
        IntDefaultHandler,// Wide Timer 0 subtimer B
        IntDefaultHandler,// Wide Timer 1 subtimer A
        IntDefaultHandler,// Wide Timer 1 subtimer B
        IntDefaultHandler,// Wide Timer 2 subtimer A
        IntDefaultHandler,// Wide Timer 2 subtimer B
        IntDefaultHandler,// Wide Timer 3 subtimer A
        IntDefaultHandler,// Wide Timer 3 subtimer B
        IntDefaultHandler,// Wide Timer 4 subtimer A
        IntDefaultHandler,// Wide Timer 4 subtimer B
        IntDefaultHandler,// Wide Timer 5 subtimer A
        IntDefaultHandler,// Wide Timer 5 subtimer B
        IntDefaultHandler,// FPU
        IntDefaultHandler,// PECI 0
        IntDefaultHandler,// LPC 0
        IntDefaultHandler,// I2C4 Master and Slave
        IntDefaultHandler,// I2C5 Master and Slave
        IntDefaultHandler,// GPIO Port M
        IntDefaultHandler,// GPIO Port N
        IntDefaultHandler,// Quadrature Encoder 2
        IntDefaultHandler,// Fan 0
        0,// Reserved
        IntDefaultHandler,// GPIO Port P (Summary or P0)
        IntDefaultHandler,// GPIO Port P1
        IntDefaultHandler,// GPIO Port P2
        IntDefaultHandler,// GPIO Port P3
        IntDefaultHandler,// GPIO Port P4
        IntDefaultHandler,// GPIO Port P5
        IntDefaultHandler,// GPIO Port P6
        IntDefaultHandler,// GPIO Port P7
        IntDefaultHandler,// GPIO Port Q (Summary or Q0)
        IntDefaultHandler,// GPIO Port Q1
        IntDefaultHandler,// GPIO Port Q2
        IntDefaultHandler,// GPIO Port Q3
        IntDefaultHandler,// GPIO Port Q4
        IntDefaultHandler,// GPIO Port Q5
        IntDefaultHandler,// GPIO Port Q6
        IntDefaultHandler,// GPIO Port Q7
        IntDefaultHandler,// GPIO Port R
        IntDefaultHandler,// GPIO Port S
        IntDefaultHandler,// PWM 1 Generator 0
        IntDefaultHandler,// PWM 1 Generator 1
        IntDefaultHandler,// PWM 1 Generator 2
        IntDefaultHandler,// PWM 1 Generator 3
        IntDefaultHandler// PWM 1 Fault
      };
      
      //*****************************************************************************
      //
      // This is the code that gets called when the processor first starts execution
      // following a reset event.  Only the absolutely necessary set is performed,
      // after which the application supplied entry() routine is called.  Any fancy
      // actions (such as making decisions based on the reset cause register, and
      // resetting the bits in that register) are left solely in the hands of the
      // application.
      //
      //*****************************************************************************
      void ResetISR(void) {
       // Jump to the CCS C initialization routine.  This will enable the
       // floating-point unit as well, so that does not need to be done here.
       __asm("    .global _c_int00\n"
         "    b.w     _c_int00");
      }
      
      //*****************************************************************************
      //
      // This is the code that gets called when the processor receives a NMI.  This
      // simply enters an infinite loop, preserving the system state for examination
      // by a debugger.
      //
      //*****************************************************************************
      static void NmiSR(void) {
       // Enter an infinite loop.
       while (1) {
       }
      }
      
      //*****************************************************************************
      //
      // This is the code that gets called when the processor receives a fault
      // interrupt.  This simply enters an infinite loop, preserving the system state
      // for examination by a debugger.
      //
      //*****************************************************************************
      static void FaultISR(void) {
       // Enter an infinite loop.
       while (1) {
       }
      }
      
      //*****************************************************************************
      //
      // This is the code that gets called when the processor receives an unexpected
      // interrupt.  This simply enters an infinite loop, preserving the system state
      // for examination by a debugger.
      //
      //*****************************************************************************
      static void IntDefaultHandler(void) {
       // Go into an infinite loop.
       while (1) {
       }
      }
      
    13. Now we need to perform some project settings. Right click on the "uart1_echo" project and select "Project Properties" and perform the following configurations:
      1. Build>ARM Compiler>Include Options. Add the following two paths to the "#include search path":
             "C:\StellarisWare"
             "C:\StellarisWare\boards\ek-lm4f232"
      2. Build>ARM Linker>File Search Paths Options. Add the following three paths to the "Include Library File" (in this order):
             "libc.a"
             "C:\StellarisWare\grlib\ccs-cm4f\Debug\grlib-cm4f.lib"
             "C:\StellarisWare\driverlib\ccs-cm4f\Debug\driverlib-cm4f.lib"
      3. Build>ARM Compiler>Advanced Options>Predefined symbols. Add the following 3 lines to Pre-define NAME (in this order):
             ccs="ccs"
             PART_LM4F232H5QD
             TARGET_IS_BLIZZARD_RA1
      4. ARM Compiler>Advanced Options>Language Options: Enable Support for GCC Extensions.
      5. ARM Compiler>Advanced Options>Assembler Options: Use unified assembly language must be checked.
      6. ARM Compiler>Advanced Options>Runtime Model Options: Place each function in separate subsection must be "on"
      7. ARM Linker>Basic Options: C System Stack size must be set to 512 bytes.
    14. Right click the project "uart1_echo" (in Project Explorer view) and select New>Folder and create a folder named "drivers"
    15. Right click on this newly created "drivers" folder and select "Import"
    16. Select "General>File System"
    17. Browse to C:\StellarisWare\boards\ek-lm4f232\drivers
    18. Check only the box next to cfal96x64x16.c
    19. Click Advanced and tick "Create links in workspace"
    20. Click Finish
    21. Right click the project and select Build
    22. After the build is done, right click the project and select Debug As>Code Composer Debug Session
    23. Press F8 on your keyboard to begin executing the program on the Eval board.
    24. Switch to the serial terminal, you will be able to type the characters there which will be echoed back to you.