This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PROCESSOR-SDK-AM335X: NAND Booting Timings and BCH requirement

Part Number: PROCESSOR-SDK-AM335X
Other Parts Discussed in Thread: AM3358

Hi!

I am using sitara am3358 processor on custom board with sdk rto am335x_6_01_00_08. I configured NAND Flash Writer tool as per our NAND. 

My NAND Bootloader .bin file is approx 51KB and application .bin file is 2MB. NAND Flash writer is taking approx 30 mins to write application binary file to NAND via XDS 110 debug probe. 2MB file requires approx 8 blocks and one block has 64 pages of 4096 bytes each. This is too much time. What are the possible ways to reduce the flashing time?

Our NAND has 224 spare bytes per page. Which BCH is expecting by RBL code? Currently I performed BCH 8 while flashing using NAND Flash Writer and configured SYSBOOT[9] =0 (ECC is done by RBL). But it is not booting from NAND.

Then I configured  SYSBOOT[9] =1 (ECC is handled by NAND or disable ECC) and processor is booting in this scenario but it took approx 23 sec to boot. I have configured SYSBOOT[4:0] = 00100b. First priority is UART and last priority is NAND. My requirement is approx 6 sec to boot. What are possible ways to reduce this booting time? 

I have to implement ECC also, so please confirm which BCH I need to implement as per RBL expectations.

Is there any NAND Flash Writer tool available which can perform BCH 16?

NAND P/N is MT29F8G08ABACAH4-IT:C TR 

Regards,

Gaurav



  • Hi Gaurav,

    I'm looking into these questions and will get back with you by the end of the week.

    Regards,
    Frank

  • Hi Gaurav,

    Gaurav Aggarwal1 said:
    What are the possible ways to reduce the flashing time?

    I suggest investigating whether most of the time is spent in the flash writer. If so then perhaps the flash writer can be optimized.

    Gaurav Aggarwal1 said:
    Which BCH is expecting by RBL code?

    Please see the AM335x TRM, 26.1.8.4.2 Initialization and Detection. The RBL will use BCH8 or BCH16 depending on the NAND device parameters.

    Gaurav Aggarwal1 said:
    What are possible ways to reduce this booting time? 

    Have you tried changing the SYSBOOT pins so NAND is first in the boot sequence? Have you investigated how much time is spent in the SBL?

    Gaurav Aggarwal1 said:
    Is there any NAND Flash Writer tool available which can perform BCH 16? 

    It appears only BCH8 is supported by the flash writer tool. Please see:

    Regards,
    Frank

  • Frank,

    If I perform BCH16 then will it contribute in reducing booting time?

    Can you check my other thread :

    Regards,

    Gaurav

  • Hi Gaurav,

    Gaurav Aggarwal1 said:
    If I perform BCH16 then will it contribute in reducing booting time?

    Have you checked whether the RBL supports ECC BCH16 with your NAND? Please this in the AM335x TRM, ECC Correction:

    The default ECC correction applied is BCH 8b/sector using the GPMC and ELM hardware.

    For device ID codes D3h, C3h, D5h, C5h, D7h, C7h, DEh, CEh when manufacturer code (first ID byte) is
    98h the Cell type information is checked in the 4th byte of ID data. If it is equal to 10b then the ECC
    correction applied is BCH 16b/sector.

    Gaurav Aggarwal1 said:
    Can you check my other thread :

    I see this is being handled by a colleague. I'll ask him to follow up.

    Regards,
    Frank

  • Frank,

    While Booting from NAND, it is taking too much time to copy application binary from NAND to DDR3. How can I reduce this copying time. My client requirement is 3 sec to boot.

    My application binary size is approx 2.5MB.

    There is lot of difference is size of .out file and .bin file. Why is it so?

    .out file is approx 600 Kb and .bin file is 2.5MB. Can I flash .out file instead of .bin file?

    Regards,

    Gaurav

  • Hi Gaurav,

    Gaurav Aggarwal1 said:
    There is lot of difference is size of .out file and .bin file. Why is it so?

    Gaurav Aggarwal1 said:
    .out file is approx 600 Kb and .bin file is 2.5MB.

    Typically the size of the boot file is much less than the size of the .out file.

    I see two possible reaons mentioned in the PRSDK docs. Please see these sections in      https://software-dl.ti.com/processor-sdk-rtos/esd/docs/06_03_00_106/AM335X/rtos/index_Foundational_Components.html#usage-notes

    • Boot image creation tools generates a large boot image if load sections are fragmented 
    • Removing Heap section from application binary to speed up boot times

    Gaurav Aggarwal1 said:
    How can I reduce this copying time. My client requirement is 3 sec to boot.

    I suggest determining if the large binary file size is caused by either of the above mentioned issues.

    What is the boot time for the 2.5 MB file? Assuming the boot time scales linearly, what would the boot time be for 600 kB?

    Gaurav Aggarwal1 said:
    Can I flash .out file instead of .bin file?

    No, the _ti.bin file must be used.

    Regards,
    Frank

  • Frank,

    You are trying to say that size of my "application.bin" file should be less than "application.out" file, right?

    But right now, size of application.bin is far quite large than application.out file.

    I will check the boot time with 600KB file and will let you know.

    Regards,

    Gaurav

  • Hi Gaurav,

    Gaurav Aggarwal1 said:
    You are trying to say that size of my "application.bin" file should be less than "application.out" file, right?

    Yes, I shared two reasons the .bin size can be larger for the reasons I shared above.

    Regards,
    Frank

  • Frank,

    I will check  and will let you know.

    Could you please tell me what is minimum booting time of this processor?

    Currenlty I made booting sequence as follows:

    1. UART

    2. XIP

    3. NANDI2C

    4. NAND

    What is the booting time and time out of Ethernet in case of 1st priority is EMAC?

    Another thing is that, in case if bootloader code exceeds the size of internal RAM of processor then how will it boot in that scenario. My one requirement is of VxWorks booting also.

    Regards,

    Gaurav

  • Hi Gaurav,

    I'm not clear on what you're trying to achieve. Are you using PRSDK for boot? If so, the supported boot modes are mentioned here:

    https://software-dl.ti.com/processor-sdk-rtos/esd/docs/06_03_00_106/AM335X/rtos/index_Foundational_Components.html#boot-modes

    Please let me know if you aren't using PRSDK to boot so I can re-direct your queries to a colleague.

    Gaurav Aggarwal1 said:
    Could you please tell me what is minimum booting time of this processor?

    I don't have any information minimum boot time. Boot time depends on a variety of factors, including the boot sequence, the first boot source identified,
    the hardware configuration of the boot source, the size (bytes) of the Seconary Boot Loader (SBL) for that source, and the size of the application.

    Please see the TRM (spruh73q.pdf), 26.1.7 Fast External Booting. Perhaps you could use this boot mode, but my understanding is this would require you to create your own boot code.

    Gaurav Aggarwal1 said:
    What is the booting time and time out of Ethernet in case of 1st priority is EMAC?

    There is some information regarding RBL timeouts in the TRM, please see 26.1.9.4 EMAC Boot Procedure. Note Ethernet is not a supported boot mode using PRSDK.

    Gaurav Aggarwal1 said:
    Another thing is that, in case if bootloader code exceeds the size of internal RAM of processor then how will it boot in that scenario.

    The SBL code size shouldn't be larger than the internal memory used for boot. Have you observed such a case?

    Gaurav Aggarwal1 said:
    My one requirement is of VxWorks booting also.

    I don't have any experience booting VxWorks, so I can't provide any help.

    Regards,
    Frank

  • Frank,

    Sorry for no response. I am quite busy with some another stuff. Give me some time around 4 - 5 days so please don't close this thread. Still this booting timing issue is not solved.

    Regards,

    Gaurav

  • Hi Gaurav,

    Thanks for the update, I won't close the thread.

    Regards,
    Frank

  • Frank,

    Could you please check at your end about size of binary file? I will share files whichever you want for testing.

    Can I use .hex file instead of .bin file?

    One more thing, When I started this project in August that time size of app.out file was 397KB and app.bin was 65KB. As per your advice  it is absolutely correct. I don't know how it went wrong as project goes on.

    Now, in same project as functionality increases size of app.out is approx 1MB and app.bin is 1.5MB. Is there any way to check at your end?

    I am attaching .cmd file for your reference. If any other file you required to check please let me know. I have converted .cmd file in .c file to attached so don't get confuse.

    In app.bin file , there are bunch of zeros. I feel because of this size is increasing. Could you please elaborate how to eliminate this? I didn't get much info on elimination.

    Could you please tell me where I will get the option "--remove-section="stack"" in CCS?

    AM335x_cmd.c
    /*
    * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
    */
    /*
    *  Redistribution and use in source and binary forms, with or without
    *  modification, are permitted provided that the following conditions
    *  are met:
    *
    *    Redistributions of source code must retain the above copyright
    *    notice, this list of conditions and the following disclaimer.
    *
    *    Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in the
    *    documentation and/or other materials provided with the
    *    distribution.
    *
    *    Neither the name of Texas Instruments Incorporated nor the names of
    *    its contributors may be used to endorse or promote products derived
    *    from this software without specific prior written permission.
    *
    *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    *
    */
    
    /****************************************************************************/
    /* LNK32.CMD - v4.5.0 COMMAND FILE FOR LINKING TMS470 32BIS C/C++ PROGRAMS  */
    /*                                                                          */
    /*   Usage:  lnk470 <obj files...>    -o <out file> -m <map file> lnk32.cmd */
    /*           cl470 <src files...> -z -o <out file> -m <map file> lnk32.cmd  */
    /*                                                                          */
    /*   Description: This file is a sample command file that can be used       */
    /*                for linking programs built with the TMS470 C/C++          */
    /*                Compiler.   Use it as a guideline; you may want to change */
    /*                the allocation scheme according to the size of your       */
    /*                program and the memory layout of your target system.      */
    /*                                                                          */
    /*   Notes: (1)   You must specify the directory in which run-time support  */
    /*                library is located.  Either add a "-i<directory>" line to */
    /*                this file, or use the system environment variable C_DIR   */
    /*                to specify a search path for libraries.                   */
    /*                                                                          */
    /*          (2)   If the run-time support library you are using is not      */
    /*                named below, be sure to use the correct name here.        */
    /*                                                                          */
    /****************************************************************************/
    -stack  0x0008                             /* SOFTWARE STACK SIZE           */
    -heap   0x2000                             /* HEAP AREA SIZE                */
    -e Entry
    /*  Since we used 'Entry' as the entry-point symbol the compiler issues a   */
    /*  warning (#10063-D: entry-point symbol other than "_c_int00" specified:  */
    /*  "Entry"). The CCS Version (5.1.0.08000) stops building from command     */
    /*  line when there is a warning. So this warning is suppressed with the    */
    /*  below flag. */
    
    --diag_suppress=10063
    
    /* SPECIFY THE SYSTEM MEMORY MAP */
    
    MEMORY
    {
            DDR_MEM     : org = 0x80000000  len = 0x7FFFFFF /* RAM */
    }
    
    /* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */
    
    SECTIONS
    {
        .text:Entry : load > 0x80000000
    
        .text    : load > DDR_MEM              /* CODE                          */
        .data    : load > DDR_MEM              /* INITIALIZED GLOBAL AND STATIC VARIABLES */
        .bss     : load > DDR_MEM              /* UNINITIALIZED OR ZERO INITIALIZED */
                                               /* GLOBAL & STATIC VARIABLES */
                        RUN_START(bss_start)
                        RUN_END(bss_end)
        .const   : load > DDR_MEM              /* GLOBAL CONSTANTS              */
        .stack   : load > 0x87FFFFF0           /* SOFTWARE SYSTEM STACK         */
    
    }
    
    

    Regards,

    Gaurav

  • Hi Guarav,

    Gaurav Aggarwal1 said:
    Can I use .hex file instead of .bin file?

    No, this isn't possible.

    Gaurav Aggarwal1 said:
    In app.bin file , there are bunch of zeros. I feel because of this size is increasing. Could you please elaborate how to eliminate this? I didn't get much info on elimination.

    Can you check the .map file and confirm the executable contains large uninitialized or zero initialized global / static variables?

    You should be able to load the .out file from CCS/JTAG and observe the loader writes 0s to these memory regions before any code is executed. Make sure your target configuration isn't set to automatically run to main() on program load.

    Is this an RTOS application?

    Gaurav Aggarwal1 said:
    Could you please tell me where I will get the option "--remove-section="stack"" in CCS?

    This option should be supplied to obj-copy during the .out to .bin format conversion.

    I see this in the command-line usage help for obj-copy (location in gcc-arm-none-eabi-7-2018-q2-update\bin\arm-none-eabi-objcopy.exe):

    -R --remove-section <name>       Remove section <name> from the output

    Regards,
    Frank

  • Frank,

    Somehow I have reduced the size of binary file by making some global variables to local variables. Now, size of .out file is same but .bin file is less than .out file.

    How is it so? Earlier global variable was uninitialized so it is taking memory in .bss segment. Now I have to check booting time. Now hardware is not available due to some technical issue so once it will come then I will test and will let you know.

    Please don't close this thread till then.

    Another thing is that my client needs to flash the code through Ethernet. For this, processor has to boot through Ethernet. Could you help me in this matter?

    Is there any GUI required or any Ethernet Bootloader is there?

    Secondly, client wants to control the booting either through RS422 or Ethernet to flash the code. As I can see in TRM there is no option available in which all booting devices(UART, Ethernet, NAND) are available. We can't put switches to the unit due to some safety standards. Is there any solution for this?

    Regards,

    Gaurav

  • Hi Gaurav,

    Gaurav Aggarwal1 said:

    Somehow I have reduced the size of binary file by making some global variables to local variables. Now, size of .out file is same but .bin file is less than .out file.

    How is it so? Earlier global variable was uninitialized so it is taking memory in .bss segment.

    I suspect the GCC tools are including 0s to initialize the global variables in the .bss section. A larger .bss section will result in more 0s, and a large image size.

    Gaurav Aggarwal1 said:
    Please don't close this thread till then.

    Sure, I'll leave it open.

    Please open other e2e threads for other questions/concerns which are unrelated to this original boot time issue.

    Regards,
    Frank

  • Frank,

    Ok.

    Pleas check .

    Regards,

    Gaurav

  • Gaurav,

    Ok, thanks.

    Regards,
    Frank

  • Frank,

    Earlier in my project some variables I have declared as global to assign memory for graphics. Those variables are creating big binary so I declared them as local in main function and pass the address of those variables to initialization function but now display is not working correctly. Same variables used in Stellaris Graphics Library  provided by TI. In that graphics example also they have declared as global so I also declared as global. List of variables is given below.

    unsigned int Palette_32b[PALETTE_SIZE/sizeof(unsigned int)] ={0x4000u, 0x0000u, 0x0000u, 0x0000u, 0x0000u, 0x0000u, 0x0000u,0x0000u};

    // Memory that is used as the local frame buffer.
    unsigned char g_pucBuffer[GrOffScreen24BPPSize(LCD_WIDTH, LCD_HEIGHT, PIXEL_24_BPP_UNPACKED)];

    volatile unsigned int slider = FALSE;

    // The graphics library display structure.
    tDisplay g_s35_480x272x24Display;

    unsigned long g_ulButtonState;

    If I declared these variables as global, again size of binary is increasing more than .out file which is affecting booting time.

    Please give any solution.

    Regards,

    Gaurav

  • Hi Gaurav,

    Can you please share a simple example which demonstrates the problem? Ideally the code would be written so a macro can switch between the small and large image sizes. I think this would be the fastest way to resolve the problem.

    Regards,
    Frank

  • Frank,

    I am attaching two .c files. In main_global_variable.c whatever variables mentioned in my previous post, all those variables are global variables and these variables are used in LCD_Init_controller function. 

    In another main_local_variable.c file all those variables are local variables and I have passed the address to the LCD_Init_controller function.

    When I declare these variables LCD Display has initialized properly and displaying correctly. But when I have used these variables as local then it is creating some effect in initialization of LCD display. 

    In case of main_global_variable, after initialization of LCD display, LCD backlight will turn on and it will not display anything until unless I will not send any data. But in case of main_local_variable, after initialization of LCD display, green vertical lines are displaying.

    LCD_Initialize is the function to initialize the LCD display.

    Other drivers functions used in LCD_Init_controller are standard and will available in graphics library by TI. If any other information required please let me know.

    My client is pressurizing me because this problem has taken too much time. If there is another way to solve this problem please let me know.

    main_global_variable.c
    #include "DU_APP.h"
    //#include "image.h"
    
    unsigned int Palette_32b[PALETTE_SIZE/sizeof(unsigned int)] =
                {0x4000u, 0x0000u, 0x0000u, 0x0000u, 0x0000u, 0x0000u, 0x0000u,
                 0x0000u};
    
    // Memory that is used as the local frame buffer.
    unsigned char g_pucBuffer[GrOffScreen24BPPSize(LCD_WIDTH, LCD_HEIGHT,
                                                   PIXEL_24_BPP_UNPACKED)];
    
    volatile unsigned int slider = FALSE;
    
    
    
    // The graphics library display structure.
    tDisplay g_s35_480x272x24Display;
    
    unsigned long g_ulButtonState;
    
    /* Page tables start must be aligned in 16K boundary */
    #ifdef __TMS470__
    #pragma DATA_ALIGN(pageTable, MMU_PAGETABLE_ALIGN_SIZE);
    static volatile unsigned int pageTable[MMU_PAGETABLE_NUM_ENTRY];
    
    /*
    #elif defined(__IAR_SYSTEMS_ICC__)
    #pragma data_alignment=MMU_PAGETABLE_ALIGN_SIZE
    static volatile unsigned int pageTable[MMU_PAGETABLE_NUM_ENTRY];
    
    #elif defined(gcc)
    static volatile unsigned int pageTable[MMU_PAGETABLE_NUM_ENTRY]
     __attribute__((aligned(MMU_PAGETABLE_ALIGN_SIZE)));
    
    #else
    #error "Unsupported Compiler. \r\n"
    */
    #endif
    
    
    /******************************************************************************
    **              FUNCTION DEFINITIONS
    ******************************************************************************/
    
    /*
    ** This function will setup the MMU. The function maps three regions -
    ** 1. DDR
    ** 2. OCMC RAM
    ** 3. Device memory
    ** The function also enables the MMU.
    */
    void MMUConfigAndEnable(void)
    {
        /*
        ** Define DDR memory region of AM335x. DDR can be configured as Normal
        ** memory with R/W access in user/privileged modes. The cache attributes
        ** specified here are,
        ** Inner - Write through, No Write Allocate
        ** Outer - Write Back, Write Allocate
        */
        REGION regionDdr = {
                            MMU_PGTYPE_SECTION, START_ADDR_DDR, NUM_SECTIONS_DDR,
                            MMU_MEMTYPE_NORMAL_NON_SHAREABLE(MMU_CACHE_WT_NOWA,
                                                             MMU_CACHE_WB_WA),
                            MMU_REGION_NON_SECURE, MMU_AP_PRV_RW_USR_RW,
                            (unsigned int*)pageTable
                           };
        /*
        ** Define OCMC RAM region of AM335x. Same Attributes of DDR region given.
        */
        REGION regionOcmc = {
                             MMU_PGTYPE_SECTION, START_ADDR_OCMC, NUM_SECTIONS_OCMC,
                             MMU_MEMTYPE_NORMAL_NON_SHAREABLE(MMU_CACHE_WT_NOWA,
                                                              MMU_CACHE_WB_WA),
                             MMU_REGION_NON_SECURE, MMU_AP_PRV_RW_USR_RW,
                             (unsigned int*)pageTable
                            };
    
        /*
        ** Define Device Memory Region. The region between OCMC and DDR is
        ** configured as device memory, with R/W access in user/privileged modes.
        ** Also, the region is marked 'Execute Never'.
        */
        REGION regionDev = {
                            MMU_PGTYPE_SECTION, START_ADDR_DEV, NUM_SECTIONS_DEV,
                            MMU_MEMTYPE_DEVICE_SHAREABLE,
                            MMU_REGION_NON_SECURE,
                            MMU_AP_PRV_RW_USR_RW  | MMU_SECTION_EXEC_NEVER,
                            (unsigned int*)pageTable
                           };
    
        /* Initialize the page table and MMU */
        MMUInit((unsigned int*)pageTable);
    
        /* Map the defined regions */
        MMUMemRegionMap(&regionDdr);
        MMUMemRegionMap(&regionOcmc);
        MMUMemRegionMap(&regionDev);
    
        /* Now Safe to enable MMU */
        MMUEnable((unsigned int*)pageTable);
    }
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: main
    DESCRIPTION  : Performs main operation
    PARAMETERS   : None
    RETURN       : int
    -------------------------------------------------------------------------------------------*/
    int main(void)
    {
        /* Store the current TimerTick value and check for periodicity of 10 sec*/
        uint32_t CBITTick=0;
    
       // uint8_t key_status[2];
       // key_status[0]=0x01;
       // key_status[1]=0x01;
    
       // uint32_t Key_Tick=0;
    
        
    
        /* Setup the MMU and do necessary MMU configurations. */
        //MMUConfigAndEnable();
    
        /* Enable all levels of CACHE. */
        CacheEnable(CACHE_ALL);
    
        /* Initialize the UART console */
        ConsoleUtilsInit();
    
        /*Select the console type based on compile time check*/
        ConsoleUtilsSetType(CONSOLE_UART);
    
        // Enabling IRQ in CPSR of ARM processor.
        IntMasterIRQEnable();
    
        /* Initialize the ARM Interrupt Controller(AINTC) */
        IntAINTCInit();
    
        
    	/*Initialise the LCD controller*/
    	LCD_Init_controller();
    
        /* Initialize LCD */
        LCD_Initialize();
     
    
       
    
        Test_Disp_Flag=0;
    
        /*Store Present TimerTick value to CBITTICK*/
        CBITTick=TimerTick;
    
      //  Bezel_Clear_Event();
    
        //Key_Tick=TimerTick;
    
       
    
    
        while(1)
        {
    
            
    
    
        }//End of While Loop
    }//End of Main Function
    
    
    
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: CleanUpInterrupts
    DESCRIPTION  : To Clear the ADC interrupts
    PARAMETERS   : None
    RETURN       : Void
    -------------------------------------------------------------------------------------------*/
    void CleanUpInterrupts(void)
    {
            TSCADCIntStatusClear(TSC_ADC_INSTANCE, 0x7FF);
            TSCADCIntStatusClear(TSC_ADC_INSTANCE ,0x7FF);
            TSCADCIntStatusClear(TSC_ADC_INSTANCE, 0x7FF);
    }
    
    void DHA_Clear(void)
    {
            tRectangle sRect;
    
            sRect.sXMin = 0;
            sRect.sYMin = 0;
            sRect.sXMax = 480;
            sRect.sYMax = 480;
    
            GrContextForegroundSet(&sContext, ClrBlack);
            GrRectFill(&sContext, &sRect);
    }
    
    
    
    
    
    
    
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: LCD_Init_controller
    DESCRIPTION  : To initialise LCD controller
    PARAMETERS   : None
    RETURN       : Void
    -------------------------------------------------------------------------------------------*/
    void LCD_Init_controller(void)
    {
        unsigned long i = 0;
                unsigned char *dest;
                unsigned char *src;
    
           /*Configure LCD interface*/
            SetUpLCD();
    
            /* configuring the base ceiling */
              RasterDMAFBConfig(SOC_LCDC_0_REGS,
                                (unsigned int)(g_pucBuffer+PALETTE_OFFSET),
                                (unsigned int)((g_pucBuffer+PALETTE_OFFSET) +
                                 sizeof(g_pucBuffer) - 2 - PALETTE_OFFSET),
                                FRAME_BUFFER_0);
    
              RasterDMAFBConfig(SOC_LCDC_0_REGS,
                                (unsigned int)(g_pucBuffer+PALETTE_OFFSET),
                                (unsigned int)((g_pucBuffer+PALETTE_OFFSET) +
                                 sizeof(g_pucBuffer) - 2 - PALETTE_OFFSET),
                                FRAME_BUFFER_1);
    
              src = (unsigned char *) Palette_32b;
              dest = (unsigned char *) (g_pucBuffer+PALETTE_OFFSET);
    
              /* Copy palette info into buffer */
              for( i = PALETTE_OFFSET; i < (PALETTE_SIZE+PALETTE_OFFSET); i++)
              {
                   *dest++ = *src++;
              }
    
              GrOffScreen24BPPInit(&g_s35_480x272x24Display, g_pucBuffer, LCD_WIDTH,
                                   LCD_HEIGHT);
    
              /* Initialize a drawing context.*/
              GrContextInit(&sContext, &g_s35_480x272x24Display);
    
              /* enable raster */
              RasterEnable(SOC_LCDC_0_REGS);
    }
    
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: KeyPad_IC_Test
    DESCRIPTION  : Read KeyPad IC Revision ID and Manufacturer ID
    PARAMETERS   : None
    RETURN       : uint8_t
    -------------------------------------------------------------------------------------------*/
    uint8_t KeyPad_IC_Test(void)
    {
        /*Variable to store Keypad Decoder ID*/
        uint8_t Keypad_ID=0x00;
    
        /*Read Keypad Decoder IC*/
        I2CReceive(SOC_I2C_1_REGS,KEYPAD_DECODER_ADDR,1,1,&Keypad_ID);
    
        /*Return Keypad Decoder IC*/
        return Keypad_ID;
    }
    
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: Peripheral_Initialization
    DESCRIPTION  : To initialize all the peripherals
    PARAMETERS   : None
    RETURN       : Void
    -------------------------------------------------------------------------------------------*/
    void Peripheral_Initialization(void)
    {
                   
                    LCD_Init_controller();
                  //  Bezel_Config();
                   // Light_Sensor_Config();
                   
    }
    
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: SetUpLCD
    DESCRIPTION  : To initialize LCD controller
    PARAMETERS   : None
    RETURN       : Void
    -------------------------------------------------------------------------------------------*/
    void SetUpLCD(void)
    {
        // Enable clock for LCD Module
        LCDModuleClkConfig();   //read
    
        LCDPinMuxSetup();     //read
    
    
       /**Clock for DMA,LIDD and for Core(which encompasses
        ** Raster Active Matrix and Passive Matrix logic)
        ** enabled. */
    
        RasterClocksEnable(LCDC_INSTANCE);
    
         //Disable raster
        RasterDisable(LCDC_INSTANCE);
    
    
        RasterClkConfig(LCDC_INSTANCE, 15200000, 30400000);
    
    
    
         //Configuring DMA of LCD controller
        RasterDMAConfig(LCDC_INSTANCE, RASTER_DOUBLE_FRAME_BUFFER,
                        RASTER_BURST_SIZE_16, RASTER_FIFO_THRESHOLD_8,
                        RASTER_BIG_ENDIAN_DISABLE);
    
         //Configuring modes(ex:tft or stn,color or monochrome etc) for raster controller
        RasterModeConfig(LCDC_INSTANCE, RASTER_DISPLAY_MODE_TFT_UNPACKED,
                         RASTER_PALETTE_DATA, RASTER_COLOR, RASTER_RIGHT_ALIGNED);
    
    
        RasterTiming2Configure(LCDC_INSTANCE,   RASTER_FRAME_CLOCK_LOW |
                                                RASTER_LINE_CLOCK_LOW  |
                                                RASTER_PIXEL_CLOCK_LOW|
                                                RASTER_SYNC_EDGE_FALLING|
                                                RASTER_SYNC_CTRL_ACTIVE|
                                                RASTER_AC_BIAS_HIGH, 0, 255);
    
        //Configuring horizontal timing parameters
       RasterHparamConfig(LCDC_INSTANCE, 480, 8, 16, 10);
    
       //Configuring verticals timing parameters
       RasterVparamConfig(LCDC_INSTANCE, 480, 4, 5, 3);
    
    }
    
    
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: Symbology_Filled
    DESCRIPTION  : To Display Filled Symbols
    PARAMETERS   : None
    RETURN       : Void
    -------------------------------------------------------------------------------------------*/
    void Symbology_Filled(void)
    {
    
        tRectangle sRect;
    
        uint32_t x1,y1,x2,y2,x3,y3,i;
    
        sRect.sXMin = 0;
        sRect.sYMin = 0;
        sRect.sXMax = 480;
        sRect.sYMax = 480;
    
        GrContextForegroundSet(&sContext, ClrBlack);
        GrRectFill(&sContext, &sRect);
    
        sRect.sXMin = 20;
        sRect.sYMin = 20;
        sRect.sXMax = 180;
        sRect.sYMax = 180;
    
        GrContextForegroundSet(&sContext, ClrRed);
        GrRectFill(&sContext, &sRect);
    
        GrContextForegroundSet(&sContext, ClrBlue);
        GrCircleFill(&sContext,100, 350, 80);
    
    
            x1= 300;
            x2= 375;
            x3= 450;
            y1= 180;
            y2= 30;
    
    
            GrContextForegroundSet(&sContext, ClrLime);
            for(i=0;i<75;i++)
            {
                GrLineDraw(&sContext, x1, y1, x3,y1);
                GrLineDraw(&sContext, x1, y1, x2,y2);
                GrLineDraw(&sContext, x3, y1, x2,y2);
                x1++;
                x3--;
                y1--;
                y2++;
    
            }
    
            x1=450;
            x2=375;
            x3=300;
            y1=340;
            y2=440;
            y3=240;
    
            GrContextForegroundSet(&sContext, ClrWhite);
            for(i=0;i<78;i++)
            {
                GrLineDraw(&sContext, x1, y1, x2,y2);
                GrLineDraw(&sContext, x2, y2, x3,y1);
                GrLineDraw(&sContext, x3, y1, x2,y3);
                GrLineDraw(&sContext, x2, y3, x1,y1);
                x1--;
                y2--;
                x3++;
                y3++;
            }
            GrContextFontSet(&sContext, &g_sFontCm30);
            GrContextForegroundSet(&sContext, ClrWhite);
            GrStringDraw(&sContext, "Display Unit", -1,150,200, 0);
            GrStringDraw(&sContext, "S.No. 1", -1,200,240, 0);
    
    
    }
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: Symbology_No_Filled
    DESCRIPTION  : To Display unfilled Symbols
    PARAMETERS   : None
    RETURN       : Void
    -------------------------------------------------------------------------------------------*/
    void Symbology_No_Filled(void)
    {
    
        tRectangle sRect;
    
        uint32_t x1,y1,x2,y2,x3,y3;
    
        sRect.sXMin = 0;
        sRect.sYMin = 0;
        sRect.sXMax = 480;
        sRect.sYMax = 480;
    
        GrContextForegroundSet(&sContext, ClrBlack);
        GrRectFill(&sContext, &sRect);
    
        sRect.sXMin = 20;
        sRect.sYMin = 20;
        sRect.sXMax = 180;
        sRect.sYMax = 180;
    
        GrContextForegroundSet(&sContext, ClrRed);
        GrRectDraw(&sContext, &sRect);
    
        GrContextForegroundSet(&sContext, ClrBlue);
        GrCircleDraw(&sContext,100, 350, 80);
    
    
        x1= 300;
        x2= 375;
        x3= 450;
        y1= 180;
        y2= 30;
    
        GrContextForegroundSet(&sContext, ClrGreen);
        GrLineDraw(&sContext, x1, y1, x3,y1);
        GrLineDraw(&sContext, x1, y1, x2,y2);
        GrLineDraw(&sContext, x3, y1, x2,y2);
    
        x1=450;
        x2=375;
        x3=300;
        y1=340;
        y2=440;
        y3=240;
    
        GrContextForegroundSet(&sContext, ClrWhite);
        GrLineDraw(&sContext, x1, y1, x2,y2);
        GrLineDraw(&sContext, x2, y2, x3,y1);
        GrLineDraw(&sContext, x3, y1, x2,y3);
        GrLineDraw(&sContext, x2, y3, x1,y1);
    
        GrContextFontSet(&sContext, &g_sFontCm36);
        GrContextForegroundSet(&sContext, ClrWhite);
        GrStringDraw(&sContext, "Display Unit", -1,150,200, 0);
        GrStringDraw(&sContext, "S.No. 1", -1,200,240, 0);
    
    }
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: SetupIntc
    DESCRIPTION  : To configure ADC Interrupt
    PARAMETERS   : none
    RETURN       : Void
    -------------------------------------------------------------------------------------------*/
    void SetupIntc(void)
    {
        IntRegister(SYS_INT_ADC_TSC_GENINT, ADCIsr);
    
        IntPrioritySet(SYS_INT_ADC_TSC_GENINT, 1, AINTC_HOSTINT_ROUTE_IRQ);
    
        IntSystemEnable(SYS_INT_ADC_TSC_GENINT);
    }
    
    
    
    /******************************* End of file *********************************/
    

    main_local_variable.c
    #include "DU_APP.h"
    //#include "image.h"
    
    
    
    /* Page tables start must be aligned in 16K boundary */
    #ifdef __TMS470__
    #pragma DATA_ALIGN(pageTable, MMU_PAGETABLE_ALIGN_SIZE);
    static volatile unsigned int pageTable[MMU_PAGETABLE_NUM_ENTRY];
    
    /*
    #elif defined(__IAR_SYSTEMS_ICC__)
    #pragma data_alignment=MMU_PAGETABLE_ALIGN_SIZE
    static volatile unsigned int pageTable[MMU_PAGETABLE_NUM_ENTRY];
    
    #elif defined(gcc)
    static volatile unsigned int pageTable[MMU_PAGETABLE_NUM_ENTRY]
     __attribute__((aligned(MMU_PAGETABLE_ALIGN_SIZE)));
    
    #else
    #error "Unsupported Compiler. \r\n"
    */
    #endif
    
    
    /******************************************************************************
    **              FUNCTION DEFINITIONS
    ******************************************************************************/
    
    /*
    ** This function will setup the MMU. The function maps three regions -
    ** 1. DDR
    ** 2. OCMC RAM
    ** 3. Device memory
    ** The function also enables the MMU.
    */
    void MMUConfigAndEnable(void)
    {
        /*
        ** Define DDR memory region of AM335x. DDR can be configured as Normal
        ** memory with R/W access in user/privileged modes. The cache attributes
        ** specified here are,
        ** Inner - Write through, No Write Allocate
        ** Outer - Write Back, Write Allocate
        */
        REGION regionDdr = {
                            MMU_PGTYPE_SECTION, START_ADDR_DDR, NUM_SECTIONS_DDR,
                            MMU_MEMTYPE_NORMAL_NON_SHAREABLE(MMU_CACHE_WT_NOWA,
                                                             MMU_CACHE_WB_WA),
                            MMU_REGION_NON_SECURE, MMU_AP_PRV_RW_USR_RW,
                            (unsigned int*)pageTable
                           };
        /*
        ** Define OCMC RAM region of AM335x. Same Attributes of DDR region given.
        */
        REGION regionOcmc = {
                             MMU_PGTYPE_SECTION, START_ADDR_OCMC, NUM_SECTIONS_OCMC,
                             MMU_MEMTYPE_NORMAL_NON_SHAREABLE(MMU_CACHE_WT_NOWA,
                                                              MMU_CACHE_WB_WA),
                             MMU_REGION_NON_SECURE, MMU_AP_PRV_RW_USR_RW,
                             (unsigned int*)pageTable
                            };
    
        /*
        ** Define Device Memory Region. The region between OCMC and DDR is
        ** configured as device memory, with R/W access in user/privileged modes.
        ** Also, the region is marked 'Execute Never'.
        */
        REGION regionDev = {
                            MMU_PGTYPE_SECTION, START_ADDR_DEV, NUM_SECTIONS_DEV,
                            MMU_MEMTYPE_DEVICE_SHAREABLE,
                            MMU_REGION_NON_SECURE,
                            MMU_AP_PRV_RW_USR_RW  | MMU_SECTION_EXEC_NEVER,
                            (unsigned int*)pageTable
                           };
    
        /* Initialize the page table and MMU */
        MMUInit((unsigned int*)pageTable);
    
        /* Map the defined regions */
        MMUMemRegionMap(&regionDdr);
        MMUMemRegionMap(&regionOcmc);
        MMUMemRegionMap(&regionDev);
    
        /* Now Safe to enable MMU */
        MMUEnable((unsigned int*)pageTable);
    }
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: main
    DESCRIPTION  : Performs main operation
    PARAMETERS   : None
    RETURN       : int
    -------------------------------------------------------------------------------------------*/
    int main(void)
    {
    	
    	unsigned int Palette_32b[PALETTE_SIZE/sizeof(unsigned int)] =
                {0x4000u, 0x0000u, 0x0000u, 0x0000u, 0x0000u, 0x0000u, 0x0000u,
                 0x0000u};
    
    // Memory that is used as the local frame buffer.
    unsigned char g_pucBuffer[GrOffScreen24BPPSize(LCD_WIDTH, LCD_HEIGHT,
                                                   PIXEL_24_BPP_UNPACKED)];
    
    volatile unsigned int slider = FALSE;
    
    
    
    // The graphics library display structure.
    tDisplay g_s35_480x272x24Display;
    
    unsigned long g_ulButtonState;
        
        
    
        /* Setup the MMU and do necessary MMU configurations. */
        //MMUConfigAndEnable();
    
        /* Enable all levels of CACHE. */
        CacheEnable(CACHE_ALL);
    
        /* Initialize the UART console */
        ConsoleUtilsInit();
    
        /*Select the console type based on compile time check*/
        ConsoleUtilsSetType(CONSOLE_UART);
    
        // Enabling IRQ in CPSR of ARM processor.
        IntMasterIRQEnable();
    
        /* Initialize the ARM Interrupt Controller(AINTC) */
        IntAINTCInit();
    
       
    	/*Initialise the LCD controller*/
    	LCD_Init_controller(Palette_32b,g_pucBuffer,&g_s35_480x272x24Display);
    
        /* Initialize LCD */
        LCD_Initialize();
     
    
       
    
        Test_Disp_Flag=0;
    
        /*Store Present TimerTick value to CBITTICK*/
        CBITTick=TimerTick;
    
      //  Bezel_Clear_Event();
    
        //Key_Tick=TimerTick;
    
       
    
    
        while(1)
        {
    
            
    
    
        }//End of While Loop
    }//End of Main Function
    
    
    
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: CleanUpInterrupts
    DESCRIPTION  : To Clear the ADC interrupts
    PARAMETERS   : None
    RETURN       : Void
    -------------------------------------------------------------------------------------------*/
    void CleanUpInterrupts(void)
    {
            TSCADCIntStatusClear(TSC_ADC_INSTANCE, 0x7FF);
            TSCADCIntStatusClear(TSC_ADC_INSTANCE ,0x7FF);
            TSCADCIntStatusClear(TSC_ADC_INSTANCE, 0x7FF);
    }
    
    void DHA_Clear(void)
    {
            tRectangle sRect;
    
            sRect.sXMin = 0;
            sRect.sYMin = 0;
            sRect.sXMax = 480;
            sRect.sYMax = 480;
    
            GrContextForegroundSet(&sContext, ClrBlack);
            GrRectFill(&sContext, &sRect);
    }
    
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: LCD_Init_controller
    DESCRIPTION  : To initialise LCD controller
    PARAMETERS   : None
    RETURN       : Void
    -------------------------------------------------------------------------------------------*/
    void LCD_Init_controller(unsigned int *Palette_32b,unsigned char g_pucBuffer,tDisplay *g_s35_480x272x24Display)
    {
        unsigned long i = 0;
                unsigned char *dest;
                unsigned char *src;
    
           /*Configure LCD interface*/
            SetUpLCD();
    
            /* configuring the base ceiling */
              RasterDMAFBConfig(SOC_LCDC_0_REGS,
                                (unsigned int)(g_pucBuffer+PALETTE_OFFSET),
                                (unsigned int)((g_pucBuffer+PALETTE_OFFSET) +
                                 sizeof(g_pucBuffer) - 2 - PALETTE_OFFSET),
                                FRAME_BUFFER_0);
    
              RasterDMAFBConfig(SOC_LCDC_0_REGS,
                                (unsigned int)(g_pucBuffer+PALETTE_OFFSET),
                                (unsigned int)((g_pucBuffer+PALETTE_OFFSET) +
                                 sizeof(g_pucBuffer) - 2 - PALETTE_OFFSET),
                                FRAME_BUFFER_1);
    
              src = (unsigned char *) Palette_32b;
              dest = (unsigned char *) (g_pucBuffer+PALETTE_OFFSET);
    
              /* Copy palette info into buffer */
              for( i = PALETTE_OFFSET; i < (PALETTE_SIZE+PALETTE_OFFSET); i++)
              {
                   *dest++ = *src++;
              }
    
              GrOffScreen24BPPInit(g_s35_480x272x24Display, g_pucBuffer, LCD_WIDTH,
                                   LCD_HEIGHT);
    
              /* Initialize a drawing context.*/
              GrContextInit(&sContext, g_s35_480x272x24Display);
    
              /* enable raster */
              RasterEnable(SOC_LCDC_0_REGS);
    }
    
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: KeyPad_IC_Test
    DESCRIPTION  : Read KeyPad IC Revision ID and Manufacturer ID
    PARAMETERS   : None
    RETURN       : uint8_t
    -------------------------------------------------------------------------------------------*/
    uint8_t KeyPad_IC_Test(void)
    {
        /*Variable to store Keypad Decoder ID*/
        uint8_t Keypad_ID=0x00;
    
        /*Read Keypad Decoder IC*/
        I2CReceive(SOC_I2C_1_REGS,KEYPAD_DECODER_ADDR,1,1,&Keypad_ID);
    
        /*Return Keypad Decoder IC*/
        return Keypad_ID;
    }
    
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: Peripheral_Initialization
    DESCRIPTION  : To initialize all the peripherals
    PARAMETERS   : None
    RETURN       : Void
    -------------------------------------------------------------------------------------------*/
    void Peripheral_Initialization(void)
    {
                   
                    
                  //  Bezel_Config();
                   // Light_Sensor_Config();
                   
    }
    
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: SetUpLCD
    DESCRIPTION  : To initialize LCD controller
    PARAMETERS   : None
    RETURN       : Void
    -------------------------------------------------------------------------------------------*/
    void SetUpLCD(void)
    {
        // Enable clock for LCD Module
        LCDModuleClkConfig();   //read
    
        LCDPinMuxSetup();     //read
    
    
       /**Clock for DMA,LIDD and for Core(which encompasses
        ** Raster Active Matrix and Passive Matrix logic)
        ** enabled. */
    
        RasterClocksEnable(LCDC_INSTANCE);
    
         //Disable raster
        RasterDisable(LCDC_INSTANCE);
    
    
        RasterClkConfig(LCDC_INSTANCE, 15200000, 30400000);
    
    
    
         //Configuring DMA of LCD controller
        RasterDMAConfig(LCDC_INSTANCE, RASTER_DOUBLE_FRAME_BUFFER,
                        RASTER_BURST_SIZE_16, RASTER_FIFO_THRESHOLD_8,
                        RASTER_BIG_ENDIAN_DISABLE);
    
         //Configuring modes(ex:tft or stn,color or monochrome etc) for raster controller
        RasterModeConfig(LCDC_INSTANCE, RASTER_DISPLAY_MODE_TFT_UNPACKED,
                         RASTER_PALETTE_DATA, RASTER_COLOR, RASTER_RIGHT_ALIGNED);
    
    
        RasterTiming2Configure(LCDC_INSTANCE,   RASTER_FRAME_CLOCK_LOW |
                                                RASTER_LINE_CLOCK_LOW  |
                                                RASTER_PIXEL_CLOCK_LOW|
                                                RASTER_SYNC_EDGE_FALLING|
                                                RASTER_SYNC_CTRL_ACTIVE|
                                                RASTER_AC_BIAS_HIGH, 0, 255);
    
        //Configuring horizontal timing parameters
       RasterHparamConfig(LCDC_INSTANCE, 480, 8, 16, 10);
    
       //Configuring verticals timing parameters
       RasterVparamConfig(LCDC_INSTANCE, 480, 4, 5, 3);
    
    }
    
    
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: Symbology_Filled
    DESCRIPTION  : To Display Filled Symbols
    PARAMETERS   : None
    RETURN       : Void
    -------------------------------------------------------------------------------------------*/
    void Symbology_Filled(void)
    {
    
        tRectangle sRect;
    
        uint32_t x1,y1,x2,y2,x3,y3,i;
    
        sRect.sXMin = 0;
        sRect.sYMin = 0;
        sRect.sXMax = 480;
        sRect.sYMax = 480;
    
        GrContextForegroundSet(&sContext, ClrBlack);
        GrRectFill(&sContext, &sRect);
    
        sRect.sXMin = 20;
        sRect.sYMin = 20;
        sRect.sXMax = 180;
        sRect.sYMax = 180;
    
        GrContextForegroundSet(&sContext, ClrRed);
        GrRectFill(&sContext, &sRect);
    
        GrContextForegroundSet(&sContext, ClrBlue);
        GrCircleFill(&sContext,100, 350, 80);
    
    
            x1= 300;
            x2= 375;
            x3= 450;
            y1= 180;
            y2= 30;
    
    
            GrContextForegroundSet(&sContext, ClrLime);
            for(i=0;i<75;i++)
            {
                GrLineDraw(&sContext, x1, y1, x3,y1);
                GrLineDraw(&sContext, x1, y1, x2,y2);
                GrLineDraw(&sContext, x3, y1, x2,y2);
                x1++;
                x3--;
                y1--;
                y2++;
    
            }
    
            x1=450;
            x2=375;
            x3=300;
            y1=340;
            y2=440;
            y3=240;
    
            GrContextForegroundSet(&sContext, ClrWhite);
            for(i=0;i<78;i++)
            {
                GrLineDraw(&sContext, x1, y1, x2,y2);
                GrLineDraw(&sContext, x2, y2, x3,y1);
                GrLineDraw(&sContext, x3, y1, x2,y3);
                GrLineDraw(&sContext, x2, y3, x1,y1);
                x1--;
                y2--;
                x3++;
                y3++;
            }
            GrContextFontSet(&sContext, &g_sFontCm30);
            GrContextForegroundSet(&sContext, ClrWhite);
            GrStringDraw(&sContext, "Display Unit", -1,150,200, 0);
            GrStringDraw(&sContext, "S.No. 1", -1,200,240, 0);
    
    
    }
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: Symbology_No_Filled
    DESCRIPTION  : To Display unfilled Symbols
    PARAMETERS   : None
    RETURN       : Void
    -------------------------------------------------------------------------------------------*/
    void Symbology_No_Filled(void)
    {
    
        tRectangle sRect;
    
        uint32_t x1,y1,x2,y2,x3,y3;
    
        sRect.sXMin = 0;
        sRect.sYMin = 0;
        sRect.sXMax = 480;
        sRect.sYMax = 480;
    
        GrContextForegroundSet(&sContext, ClrBlack);
        GrRectFill(&sContext, &sRect);
    
        sRect.sXMin = 20;
        sRect.sYMin = 20;
        sRect.sXMax = 180;
        sRect.sYMax = 180;
    
        GrContextForegroundSet(&sContext, ClrRed);
        GrRectDraw(&sContext, &sRect);
    
        GrContextForegroundSet(&sContext, ClrBlue);
        GrCircleDraw(&sContext,100, 350, 80);
    
    
        x1= 300;
        x2= 375;
        x3= 450;
        y1= 180;
        y2= 30;
    
        GrContextForegroundSet(&sContext, ClrGreen);
        GrLineDraw(&sContext, x1, y1, x3,y1);
        GrLineDraw(&sContext, x1, y1, x2,y2);
        GrLineDraw(&sContext, x3, y1, x2,y2);
    
        x1=450;
        x2=375;
        x3=300;
        y1=340;
        y2=440;
        y3=240;
    
        GrContextForegroundSet(&sContext, ClrWhite);
        GrLineDraw(&sContext, x1, y1, x2,y2);
        GrLineDraw(&sContext, x2, y2, x3,y1);
        GrLineDraw(&sContext, x3, y1, x2,y3);
        GrLineDraw(&sContext, x2, y3, x1,y1);
    
        GrContextFontSet(&sContext, &g_sFontCm36);
        GrContextForegroundSet(&sContext, ClrWhite);
        GrStringDraw(&sContext, "Display Unit", -1,150,200, 0);
        GrStringDraw(&sContext, "S.No. 1", -1,200,240, 0);
    
    }
    /*-----------------------------------------------------------------------------------------
    FUNCTION NAME: SetupIntc
    DESCRIPTION  : To configure ADC Interrupt
    PARAMETERS   : none
    RETURN       : Void
    -------------------------------------------------------------------------------------------*/
    void SetupIntc(void)
    {
        IntRegister(SYS_INT_ADC_TSC_GENINT, ADCIsr);
    
        IntPrioritySet(SYS_INT_ADC_TSC_GENINT, 1, AINTC_HOSTINT_ROUTE_IRQ);
    
        IntSystemEnable(SYS_INT_ADC_TSC_GENINT);
    }
    
    
    
    /******************************* End of file *********************************/
    

    Regards,

    Gaurav

  • Gaurav,

    Can you please provide a complete working example project with linker command file, build settings, etc. Also provide PRSDK version, GCC version & other relevant tools versions.

    Regards,
    Frank

  • Frank,

    Due to security reason I can't send complete project here. Please share me your mail id. I will mail you project.

    Regards,

    Gaurav

  • Hi Gaurav,

    I'm not asking for your complete project. Instead, I'm asking for a small and simple example that demonstrates the problem. Is it possible?

    Regards,
    Frank

  • Frank,

    Please check your private message box for example.

    Regards,

    Gaurav

  • Hi Gaurav,

    Thanks much, I'll take a look.

    Regards,
    Frank

  • Gaurav,

    I've been delayed into checking into this. I'll investigate further and have a response by Monday. Sorry for the delay.

    Regards,
    Frank

  • Frank,

    Ok thanks for update.

  • Hi Gaurav,

    Thanks for providing the example code. I see you're using the TI ARM codegen tools without TI-RTOS.

    The issue is caused by the large .bss section being linked between the .text:Entry and .text sections. The .bin file doesn't include the .bss section (or any extra 0 initializers), but includes this gap between the data for the .text:Entry and .text sections. Changing .bss to link after all the initialized sections resolves problem.

    Please try moving .bss load address in the .cmd file as follows:

                SECTIONS
                {
                    .text:Entry : load > 0x80000000
    
                    .text    : load > DDR_MEM              /* CODE                          */
                    .data    : load > DDR_MEM              /* INITIALIZED GLOBAL AND STATIC VARIABLES */
                    .const   : load > DDR_MEM              /* GLOBAL CONSTANTS              */
    
                    .bss     : load > 0x80100000
                                    RUN_START(bss_start)
                                    RUN_END(bss_end)
                    .stack   : load > 0x87FFFFF0           /* SOFTWARE SYSTEM STACK         */
                }
    

    A few tips to help you confirm these findings:

    • Generate section headers for .out file (GCC tools): arm-none-eabi-objdump.exe -h <.out>
    • Generate disassembly for .out file: arm-none-eabi-objdump.exe -D <.out>
    • Manually inspect .bin file using a hex editor

    Regards,
    Frank