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.

eZDSP C5502 Boot-Image programmer

Hi,

I'm trying to figure out how to burn a program in my eZDSP C5502. I've generated a .bin file using hex55.exe but I couldn't find a programming utility anywhere.

I've found a bunch of things for the C5505 and C5515 eZDSPs but nothing for the C5502 eZDSP.

Is there a programming utility available somewhere ?

Thanks for your replies...

  • Download spiflash_writer.c from Spectrum Digital support site:

    http://support.spectrumdigital.com/boards/ezdsp5502/revc/

    and all the other supporting materials.

    Regards.

  • Thanks.

    I've downloaded the files. I need to rebuild spiflash_writer as the bootImage array is too small to handle my boot image.

    I've changed the array size from bootImage[30000] to bootImage[200000] in spiflash_writer.c but then I get the following warnings :


    creating output section ".bootimg" without a SECTIONS specification
    section ".bootimg" (0x10000) spans page boundary: not allowed before CPU revision 3.0

    I think this has something to do with th lnkx.cmd file but I do not know where to start looking.

    Thanks for the help.


  • Ok so I added the following line in lnkx.cmd :

    .bootimg    >  CE0 align(32) fill = 00h

    I don't get the first message anymore (creating output section ".bootimg" without a SECTIONS specification ). I don't get why this line wasn't in lnkx.cmd for this project....

    Anyway now I have to get around the 64k page boundary issue. Is there a simple solution or do I need to modify the code to slice the boot image in multiple pieces so it can fit with 64k pages ?

    Any help will be much appreciated.

  • I've rewritten the file spiflash_writer.c so it can handle larger bin files.

    Here it is :

    //////////////////////////////////////////////////////////////////////////////
    // * File name: spiflash_test.c
    // *                                                                          
    // * Description:  SPI Flash header file.
    // *                                                                          
    // * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ 
    // * Copyright (C) 2011 Spectrum Digital, Incorporated
    // *                                                                          
    // *                                                                          
    // *  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.    
    // *                                                                          
    //////////////////////////////////////////////////////////////////////////////
    
    #include "ezdsp5502.h"
    #include "spiflash.h"
    #include "stdio.h"
    
    #pragma DATA_SECTION ( bootImage, ".bootimg" );
    #define SLICE_SIZE_MAX 32768
    
    Uint8 bootImage[SLICE_SIZE_MAX];
    
    
    Uint16 rx[256];
    Int8 fileName[256];
    
    /*
     *  spiflash_writer( )
     *      SPI Flash writer, writes the demo .bin file to SPI ROM. 
     *      Change the size of the array bootImage1[] for files 
     *      larger than 30000 bytes
     */
    Int16 spiflash_writer( )
    {
        Uint32 i, j, pages;
        Uint16* pdata;
        Uint32  fileSize = 0;
        FILE    *fPtr;
        Uint8   *ramPtr;
        Uint8	slices,k;
    	Uint32	sliceSize = SLICE_SIZE_MAX;
    	
        /* Read the filename from host */
        printf("Enter the file Name:\r\n");
        scanf("%s", fileName);
        fflush(stdin);
    
        /* Open a File from the hard drive */
        printf("Opening file...\r\n");
        fPtr = fopen(fileName, "rb");
        if(fPtr == NULL)
        {
            printf("ERROR: File %s Open failed\r\n", fileName);
            return 1;
        }
        fileSize = 0;  // Initialize size to 0
    
        /* Get file size */
        fseek(fPtr,0,SEEK_END);
        fileSize = ftell(fPtr);
        
        /* Setup pointer in RAM for temporary storage of data */
        ramPtr = (Uint8 *)bootImage;
    
    	printf("File size is %ld bytes \r\n", fileSize);
    
    	slices = (fileSize / SLICE_SIZE_MAX) + 1;
    	printf("Slices count is %i  \r\n", slices);
    	
    	/* Initialize the SPI interface */
        spiflash_init( );
        
        if(fileSize == 0)            // Check if file was found
        {
            printf("ERROR: File read failed.. Closing program.\r\n");
            fclose (fPtr);
            return 1;
        }    
    	
    	for (k = 0; k < slices ; k++){
    
        fseek(fPtr,0 + (k * sliceSize),SEEK_SET);
      
        
        if ((fileSize / (sliceSize * (k + 1))) == 0 )
        	sliceSize = fileSize - (k * sliceSize); 
    	
    	printf("Buffering slice number %i of %ld bytes \r\n", k,sliceSize);
    
        /* Read file to ram and check if read properly */
        if (sliceSize != fread(ramPtr, 1, sliceSize, fPtr)) 
        {
            printf("WARNING: Slice Size mismatch.\r\n");
            return 1;
        }
        fseek(fPtr,0,SEEK_SET);
    
        /* Calculate number of pages */
        pages = (sliceSize / spiflash_PAGESIZE) + 1;
    
        /* Erase target area in spiflash */
        printf("Erasing slice target area...\r\n");
        spiflash_erase(k * SLICE_SIZE_MAX, sliceSize);
    
        /* Write to spirom */
        printf("Burning slice number %i of %ld bytes \r\n", k,sliceSize);
        for ( i = 0 ; i < pages ; i++ )
        {
            /* Write a page */
            spiflash_write(  ((Uint32)bootImage + (i * spiflash_PAGESIZE)), (i * spiflash_PAGESIZE) + (k * SLICE_SIZE_MAX), spiflash_PAGESIZE );
        }
    
        /* Read and verify spirom */
        printf("Checking slice...\r\n");
        for ( i = 0 ; i < pages ; i++ )
        {
            /* Read a page */
            spiflash_read( (i * spiflash_PAGESIZE) + (k * SLICE_SIZE_MAX), ( Uint32 )rx, spiflash_PAGESIZE );
    
            /* Check the pattern */
            pdata = ( Uint16* )((Uint32)bootImage + (i * spiflash_PAGESIZE));
            for ( j = 0 ; j < spiflash_PAGESIZE; j++ )
            {
                if (  ((*pdata++) & 0xFF)!= (rx[j]))
                    return 1;  // Fail
            }
        }
    	}
    	fclose (fPtr);
        return 0;
    }
    

    The function spiflash_writer now cuts the bin file into multiple slices of 32768 bytes and burns them one after one in the SPI FLASH.

    I think it is working but I first need to add the GEL initializayion scripts in my program to see if it works after burning it to the SPI flash.