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.

Problem with code composer using a c5535.



I based on a sample program to create this algorithm and some errors were found. Would you like tips to solve the problem. Thanked.

SET.c:

#include "stdio.h"
#include "ezdsp5535.h"
#include "ezdsp5535_gpio.h"
#include "ezdsp5535_i2c.h"
#include "ezdsp5535_i2s.h"
#include "csl_i2s.h"
#define AIC3204_I2C_ADDR 0x18
extern Int16 AIC3204_rset( Uint16 regnum, Uint16 regval);

void setagem(void){
     /* Configure AIC3204 */
    AIC3204_rset( 0,  0x00 );  // Select page 0
    AIC3204_rset( 1,  0x01 );  // Reset codec
    EZDSP5535_waitusec(1000);  // Wait 1ms after reset
    AIC3204_rset( 0,  0x01 );  // Select page 1
    AIC3204_rset( 1,  0x08 );  // Disable crude AVDD generation from DVDD
    AIC3204_rset( 2,  0x01 );  // Enable Analog Blocks, use LDO power
    AIC3204_rset( 123,0x05 );  // Force reference to power up in 40ms
    EZDSP5535_waitusec(50000); // Wait at least 40ms
    AIC3204_rset( 0,  0x00 );  // Select page 0
    
    /* PLL and Clocks config and Power Up  */
    AIC3204_rset( 27, 0x0d );  // BCLK and WCLK are set as o/p; AIC3204(Master)
    AIC3204_rset( 28, 0x00 );  // Data ofset = 0
    AIC3204_rset( 4,  0x03 );  // PLL setting: PLLCLK <- MCLK, CODEC_CLKIN <-PLL CLK
    AIC3204_rset( 6,  0x07 );  // PLL setting: J=7
    AIC3204_rset( 7,  0x06 );  // PLL setting: HI_BYTE(D=1680)
    AIC3204_rset( 8,  0x90 );  // PLL setting: LO_BYTE(D=1680)
    AIC3204_rset( 30, 0x88 );  // For 32 bit clocks per frame in Master mode ONLY
                               // BCLK=DAC_CLK/N =(12288000/8) = 1.536MHz = 32*fs
    AIC3204_rset( 5,  0x91 );  // PLL setting: Power up PLL, P=1 and R=1
    EZDSP5535_waitusec(10000); // Wait for PLL to come up    
    AIC3204_rset( 13, 0x00 );  // Hi_Byte(DOSR) for DOSR = 128 decimal or 0x0080 DAC oversamppling
    AIC3204_rset( 14, 0x80 );  // Lo_Byte(DOSR) for DOSR = 128 decimal or 0x0080
    AIC3204_rset( 20, 0x80 );  // AOSR for AOSR = 128 decimal or 0x0080 for decimation filters 1 to 6
    AIC3204_rset( 11, 0x82 );  // Power up NDAC and set NDAC value to 2
    AIC3204_rset( 12, 0x87 );  // Power up MDAC and set MDAC value to 7
    AIC3204_rset( 18, 0x87 );  // Power up NADC and set NADC value to 7
    AIC3204_rset( 19, 0x82 );  // Power up MADC and set MADC value to 2
    
    /* DAC ROUTING and Power Up */
    AIC3204_rset( 0,  0x01 );  // Select page 1
    AIC3204_rset( 12, 0x08 );  // LDAC AFIR routed to HPL
    AIC3204_rset( 13, 0x08 );  // RDAC AFIR routed to HPR
    AIC3204_rset( 0,  0x00 );  // Select page 0
    AIC3204_rset( 64, 0x02 );  // Left vol=right vol
    AIC3204_rset( 65, 0x00 );  // Left DAC gain to 0dB VOL; Right tracks Left
    AIC3204_rset( 63, 0xd4 );  // Power up left,right data paths and set channel
    AIC3204_rset( 0,  0x01 );  // Select page 1
    AIC3204_rset( 16, 0x00 );  // Unmute HPL , 0dB gain
    AIC3204_rset( 17, 0x00 );  // Unmute HPR , 0dB gain
    AIC3204_rset( 9 , 0x30 );  // Power up HPL,HPR
    EZDSP5535_waitusec(100 );  // Wait
    
    /* ADC ROUTING and Power Up */
    AIC3204_rset( 0,  0x01 );  // Select page 1
    AIC3204_rset( 52, 0x30 );  // STEREO 1 Jack
                               // IN2_L to LADC_P through 40 kohm
    AIC3204_rset( 55, 0x30 );  // IN2_R to RADC_P through 40 kohmm
    AIC3204_rset( 54, 0x03 );  // CM_1 (common mode) to LADC_M through 40 kohm
    AIC3204_rset( 57, 0xc0 );  // CM_1 (common mode) to RADC_M through 40 kohm
    AIC3204_rset( 59, 0x00 );  // MIC_PGA_L unmute
    AIC3204_rset( 60, 0x00 );  // MIC_PGA_R unmute
    AIC3204_rset( 0,  0x00 );  // Select page 0
    AIC3204_rset( 81, 0xc0 );  // Powerup Left and Right ADC
    AIC3204_rset( 82, 0x00 );  // Unmute Left and Right ADC
    AIC3204_rset( 0,  0x00 );  // Select page 0
    EZDSP5535_waitusec(100 );  // Wait
}
RSET.c :

#include "stdio.h"
#include "ezdsp5535.h"
#include "ezdsp5535_gpio.h"
#include "ezdsp5535_i2c.h"
#include "ezdsp5535_i2s.h"
#include "csl_i2s.h"
#define AIC3204_I2C_ADDR 0x18
Int16 AIC3204_rset( Uint16 regnum, Uint16 regval )
{
    Uint16 cmd[2];
    cmd[0] = regnum & 0x007F;       // 7-bit Device Register
    cmd[1] = regval;                // 8-bit Register Data

    EZDSP5535_waitusec( 300 );
    return EZDSP5535_I2C_write( AIC3204_I2C_ADDR, cmd, 2 );
}

RGET.c:

#include "stdio.h"
#include "ezdsp5535.h"
#include "ezdsp5535_gpio.h"
#include "ezdsp5535_i2c.h"
#include "ezdsp5535_i2s.h"
#include "csl_i2s.h"
#define AIC3204_I2C_ADDR 0x18
Int16 AIC3204_rget(  Uint16 regnum, Uint16* regval )
{
    Int16  retcode = 0;
    Uint16 cmd[2];

    cmd[0] = regnum & 0x007F;       // 7-bit Device Register
    cmd[1] = 0;

    retcode |= EZDSP5535_I2C_write( AIC3204_I2C_ADDR, cmd, 1 );
    retcode |= EZDSP5535_I2C_read( AIC3204_I2C_ADDR, cmd, 1 );

    *regval = cmd[0];
    EZDSP5535_wait( 10 );
    return retcode;
}
main.c:

#include "stdio.h"
#include "ezdsp5535.h"
#include "ezdsp5535_gpio.h"
#include "ezdsp5535_i2c.h"
#include "ezdsp5535_i2s.h"
#include "csl_i2s.h"
#include "math.h"

extern void read();

int main(){
    //Int16 d1[240000],d2[240000];
    while (1) {
      read();
      //processing();
    }
    return 0;
}

The console showed that:

<Linking>
warning: creating ".stack" section with default size of 0x3e8; use the -stack
   option to change the default size
warning: creating ".sysstack" section with default size of 0x3e8; use the
   -sysstack option to change the default size
error: run placement fails for object ".bss", size 0x20010 (page 0).  Available
   ranges:
   ROM          size: 0xffff       unused: 0xffff       max hole: 0xffff    
error: section ".bss" (0x0) spans page boundary: not allowed before CPU
   revision 3.0

 undefined                                                             first referenced
  symbol                                                                   in file     
 ---------                                                             ----------------
 EZDSP5535_I2C_init()                                                  ./READ.obj      
 EZDSP5535_I2C_read(unsigned short, unsigned short *, unsigned short)  ./RGET.obj      
 EZDSP5535_I2C_write(unsigned short, unsigned short *, unsigned short) ./RSET.obj      
 EZDSP5535_I2S_close()                                                 ./READ.obj      
 EZDSP5535_I2S_init()                                                  ./READ.obj      

 EZDSP5535_I2S_readLeft(short *)                                       ./READ.obj      
>> Compilation failure
 EZDSP5535_I2S_readRight(short *)                                      ./READ.obj      
 EZDSP5535_I2S_writeLeft(short)                                        ./READ.obj      
 EZDSP5535_I2S_writeRight(short)                                       ./READ.obj      
 EZDSP5535_init()                                                      ./READ.obj      
 EZDSP5535_wait(unsigned long)                                         ./RGET.obj      
 EZDSP5535_waitusec(unsigned long)                                     ./SET.obj       

error: unresolved symbols remain
error: errors encountered during linking; "NOVO_11_12.out" not built
gmake: *** [NOVO_11_12.out] Error 1
gmake: Target `all' not remade because of errors.
Build complete for project NOVO_11_12

 

 

 

  • This is the only actual error:

    Higo Thaian said:
    error: run placement fails for object ".bss", size 0x20010 (page 0).  Available
       ranges:
       ROM          size: 0xffff       unused: 0xffff       max hole: 0xffff    

    This error says that the .bss section is very large, and will not fit in memory.  It is possible that this program is too big for the C5535.  The .bss section is for non-const global variables.  I don't see any such variables in the code you posted.  You probably have one or more very large arrays.  You'll need to find these variables and reduce their size.  The .bss section may not go in ROM, because .bss must be writable.  Please post your linker command file.

  • Hii! Thanks for the help. Im a newbie on this plataform. I forgot this last .c:

    READ.c:

    #include "stdio.h"
    #include "ezdsp5535.h"
    #include "ezdsp5535_gpio.h"
    #include "ezdsp5535_i2c.h"
    #include "ezdsp5535_i2s.h"
    #include "csl_i2s.h"

    #define AIC3204_I2C_ADDR 0x18

    extern void setagem(void);
    extern Int16 AIC3204_rset( Uint16 regnum, Uint16 regval );
    extern Int16 AIC3204_rget(  Uint16 regnum, Uint16* regval );

    #define N_SAMPLES 65536
    Int16 global_samples[N_SAMPLES];


    void  read(){
         Int16 sec, msec;
         Int16 i;
        Int16 sample, data1, data2;
            
        EZDSP5535_init( );
        EZDSP5535_I2C_init( );
        setagem();
        EZDSP5535_I2S_init();
        i = 0;
        
        /* Play Loop for 5 seconds */
        for ( sec = 0 ; sec < 5 ; sec++ )
        {
            for ( msec = 0 ; msec < 1000 ; msec++ )
            {
                for ( sample = 0 ; sample < 48 ; sample++ )
                {
                    /* Read 16-bit left channel Data */
                    EZDSP5535_I2S_readLeft(&data1);
                    
                    /* Read 16-bit right channel Data */
                    EZDSP5535_I2S_readRight(&data2);
                    
                    /* Write 16-bit left channel Data */
                    EZDSP5535_I2S_writeLeft(data1);
                    
                    /* Write 16-bit right channel Data */
                    EZDSP5535_I2S_writeRight(data2);
                    
                    global_samples[ i++ ] = (data1 + data2)/2;
                }
            }
        }
        EZDSP5535_I2S_close();    // Disble I2S
        AIC3204_rset( 1, 0x01 );  // Reset codec    
     }

  • where can i find this linker command file ?

  • The easiest place to find its name will be to look at the linker command line in the build console.  It will probably have a name ending with .cmd; if you are not sure, post your linker command line here.

  • here is the .cmd archive code :

    /******************************************************************************/
    /* LNKX.CMD - COMMAND FILE FOR LINKING C PROGRAMS IN LARGE/HUGE MEMORY MODEL  */
    /*                                                                            */
    /* Usage:                                                                     */
    /*  cl55 <src files> -z -o<out file> -m<map file> lnkx.cmd -l<RTS library>   */
    /*                                                                            */
    /* Description: This file is a sample command file that can be used for       */
    /*              linking programs built with the 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 <RTS library> is      */
    /*              located.  Either add a "-i<directory>" line to this file      */
    /*              file, or use the system environment variable C55X_C_DIR to    */
    /*              specify a search path for the libraries.                      */
    /*                                                                            */
    /******************************************************************************/

    -stack    0x2000      /* Primary stack size   */
    -sysstack 0x1000      /* Secondary stack size */
    -heap     0x2000      /* Heap area size       */

    -c                    /* Use C linking conventions: auto-init vars at runtime */
    -u _Reset             /* Force load of reset interrupt handler                */

    /* SPECIFY THE SYSTEM MEMORY MAP */

    MEMORY
    {
     PAGE 0:  /* ---- Unified Program/Data Address Space ---- */

      MMR    (RWIX): origin = 0x000000, length = 0x0000c0  /* MMRs */
      DARAM0 (RWIX): origin = 0x0000c0, length = 0x00ff40  /*  64KB - MMRs */
      SARAM0 (RWIX): origin = 0x010000, length = 0x010000  /*  64KB */
      SARAM1 (RWIX): origin = 0x020000, length = 0x020000  /* 128KB */
      SARAM2 (RWIX): origin = 0x040000, length = 0x00FE00  /*  64KB */
      VECS   (RWIX): origin = 0x04FE00, length = 0x000200  /*  512B */
      PDROM   (RIX): origin = 0xff8000, length = 0x008000  /*  32KB */

     PAGE 2:  /* -------- 64K-word I/O Address Space -------- */

      IOPORT (RWI) : origin = 0x000000, length = 0x020000
    }
     
    /* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */

    SECTIONS
    {
       .text     >> SARAM1|SARAM2|SARAM0  /* Code                        */

       /* Both stacks must be on same physical memory page               */
       .stack    >  DARAM0                /* Primary system stack        */
       .sysstack >  DARAM0                /* Secondary system stack      */

       .data     >> DARAM0|SARAM0|SARAM1  /* Initialized vars            */
       .bss      >> DARAM0|SARAM0|SARAM1  /* Global & static vars        */
       .const    >> DARAM0|SARAM0|SARAM1  /* Constant data               */
       .sysmem   >  DARAM0|SARAM0|SARAM1  /* Dynamic memory (malloc)     */
       .switch   >  SARAM2                /* Switch statement tables     */
       .cinit    >  SARAM2                /* Auto-initialization tables  */
       .pinit    >  SARAM2                /* Initialization fn tables    */
       .cio      >  SARAM2                /* C I/O buffers               */
       .args     >  SARAM2                /* Arguments to main()         */

        vectors  >  VECS                  /* Interrupt vectors           */

       .ioport   >  IOPORT PAGE 2         /* Global & static ioport vars */
    }

  • Your variable global_samples is 0x20000 bytes, which is as big as the largest MEMORY in your linker command file, SARAM1.  For this reason, it will never fit unless you make it smaller or adjust the linker command file.  If you cannot make it small, you will either need to combine SARAM0, SARAM1, and SARAM2 into a single larger section, or split global_samples out into a separate section and adjust the linker command file so that it is the only object to go into SARAM1.  Here is how to do the latter:

    In your C source code:

    #pragma DATA_SECTION(global_samples,"special")
    Int16 global_samples[N_SAMPLES];

    In your linker command file:

       .data     >> DARAM0|SARAM0  /* Initialized vars            */
       .bss      >> DARAM0|SARAM0  /* Initialized vars            */
       special   >  SARAM1         /* Global & static vars        */
       .const    >> DARAM0|SARAM0  /* Constant data               */
       .sysmem   >  DARAM0|SARAM0  /* Dynamic memory (malloc)     */
  • Hii! Thanks for the help! ...I did what you say, but shows this error:

    "badly formed pragma"

    I erased the global_samples of the pragma command and the error is gone, but the usual errors is back.

  • The biggest problem are those errors:
    <Linking>

     undefined                                                             first referenced
      symbol                                                                   in file     
     ---------                                                             ----------------
     EZDSP5535_I2C_init()                                                  ./READ.obj      
     EZDSP5535_I2C_read(unsigned short, unsigned short *, unsigned short)  ./RGET.obj      
     EZDSP5535_I2C_write(unsigned short, unsigned short *, unsigned short) ./RSET.obj      
     EZDSP5535_I2S_close()                                                 ./READ.obj      
     EZDSP5535_I2S_init()                                                  ./READ.obj      
     EZDSP5535_I2S_readLeft(short *)                                       ./READ.obj      
     EZDSP5535_I2S_readRight(short *)                                      ./READ.obj      
     EZDSP5535_I2S_writeLeft(short)                                        ./READ.obj      
     EZDSP5535_I2S_writeRight(short)                                       ./READ.obj      
     EZDSP5535_init()                                                      ./READ.obj      
     EZDSP5535_wait(unsigned long)                                         ./RGET.obj      
     EZDSP5535_waitusec(unsigned long)                                     ./SET.obj       

    error: unresolved symbols remain
    error: errors encountered during linking; "NOVO_11_12.out" not built

    >> Compilation failure
    gmake: *** [NOVO_11_12.out] Error 1
    gmake: Target `all' not remade because of errors.
    Build complete for project NOVO_11_12

  • Are you compiling in C++ mode?  Please show me the complete command line used when building this file.

  • Higo Thaian said:
     undefined                                                             first referenced
      symbol                                                                   in file     
     ---------                                                             ----------------
     EZDSP5535_I2C_init()                                                  ./READ.obj      

    You are missing the library which defines these symbols.  You need to add the library to your project.

  • which library? The include ezdsp5535.h contains this function, the error shows why? how to add the right library?