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.

using external memory as RAM

Other Parts Discussed in Thread: CONTROLSUITE

I am using Matlab to program, ezDSP F28335 board.

I am trying to flash the ezDSP F28335, with *.ebss section mapped to external memory. When I power up the board after flashing, my program is not working.

But if I put the *.ebss section in RAM, it is working fine. After a search in internet, I come across a method in which they have mentioned, “XINTF_Enable” has to be uncommented in *.gel file, in order to make the F28335 to configure the external memory and make use of it, whenever it resets.

I feel the problem is because of some software initialization, hardware wise it is perfect, I have made changes in the boot switched to boot from flash.

Kindly suggest me a solution

  • Subash,

    I suspect the code is failing because you have initialized global variables or local static variables in the .ebss section.  The initial values of these vars will be initialized by the _c_int00 function (from the RTS library), which runs prior to main().  Your XINTF is not configured at that time, so the intialization fails.

    You either need to put all your initialized globals (and statics) in a seperate named section that you link to internal RAM, or you need to intialize the XINTF prior to main().  The later can be done.  You could use assembly code to setup the XINTF before calling _c_int00 (if you are using the code examples in ControlSuite as your model, the call to _c_int00 is made in the CodeStartBranch.asm file).  Alternately, you can probably get away with using C-code to init the XINTF prior to _c_int00 as long as you don't use any initialized global variables or static locals in the function.  At the end of the XINTF init function, you call _c_int00 (which in turn calls main).

    Regards,

    David

  • 1856.f28335_xbee_ticcs.zip

    Hi David,
    I tried putting the *.ebss section into the Flash memory and then loading from FLASH, running in external memory, that too dint work out.
    I don't know how to initialize the XINTF section before main, i have attached the code, kindly let me know how to do it.

  • Subash,

    Subash Chandar Athikessavan said:
    I tried putting the *.ebss section into the Flash memory and then loading from FLASH, running in external memory, that too dint work out.

    The .ebss is an uninitialized section.  It must be linked to RAM.  You cannot link it to read-only memory such as flash.

    To initialize the XINTF prior to main(), you should modify the function 'code_start' in the file DSP2833x_CodeStartBranch.asm to branch to your XINTF init function rather than _c_int00.  You can write the XINTF init function in C as long as you don't use any global variables or initialized static variables (and why would you.  The init function is nothing but assignment statements linke *MyRegister = 0x12345678;).  At the end of the init function, you should branch to _c_int00.

    - David

  • Hi David,
     I tried intializing the Xintf before _c_int00 in codestartbranch.asm(), Have a look at the code, but still the same issue

    ***********************************************************************

    WD_DISABLE    .set    1        ;set to 1 to disable WD, else set to 0

    ;    .ref _start_ebss
    ;    .ref _end_ebss
        .ref _c_int00
        .global code_start

    ***********************************************************************
    * Function: codestart section
    *
    * Description: Branch to code starting point
    ***********************************************************************

        .sect "codestart"

    code_start:
        .if WD_DISABLE == 1
            LB wd_disable       ;Branch to watchdog disable code
        .else
    ;    movl XAR0,#_start_ebss
    ;     mov AL,#0
    ;     mov AH,#(_end_ebss - _start_ebss - 1)
    ;     rpt AH || mov *XAR0++,AL
       PCLKCR3= 0x3700;                          
       GPBMUX1= 0xFFFFFFC0;   /* GPBMUX1 */
       GPAMUX2 = 0xFF000000;   /* GPAMUX2 */  
       GPCMUX2 = 0x0000AAAA;   /* GPCMUX2 */  
       GPCMUX1 = 0xAAAAAAAA;   /* GPCMUX1 */
       XTIMING0= 0x0043FFFF;    /* Zone0 */
       XTIMING6= 0x0043FFFF;    /* Zone6 */
       XTIMING7= 0x0043FFFF;    /* Zone7 */
            LB _c_int00         ;Branch to start of boot.asm in RTS library
        .endif

    ;end codestart section


    ***********************************************************************
    * Function: wd_disable
    *
    * Description: Disables the watchdog timer
    ***********************************************************************
        .if WD_DISABLE == 1

        .text
    wd_disable:
        SETC OBJMODE        ;Set OBJMODE for 28x object code
        EALLOW              ;Enable EALLOW protected register access
        MOVZ DP, #7029h>>6  ;Set data page for WDCR register
        MOV @7029h, #0068h  ;Set WDDIS bit in WDCR to disable WD
        EDIS                ;Disable EALLOW protected register access
    ;    PCLKCR3= 0x3700;                          
    ;   GPBMUX1= 0xFFFFFFC0;   /* GPBMUX1 */
    ;   GPAMUX2 = 0xFF000000;   /* GPAMUX2 */  
    ;   GPCMUX2 = 0x0000AAAA;   /* GPCMUX2 */  
    ;   GPCMUX1 = 0xAAAAAAAA;   /* GPCMUX1 */
    ;   XTIMING0= 0x0043FFFF;    /* Zone0 */
    ;   XTIMING6= 0x0043FFFF;    /* Zone6 */
    ;   XTIMING7= 0x0043FFFF;    /* Zone7 */
        LB _c_int00         ;Branch to start of boot.asm in RTS library

        .endif

    ;end wd_disable



        .end
        
    ;//===========================================================================
    ;// End of file.
    ;//===========================================================================

    My linker file is

     

    MEMORY
    {
    PAGE 0:
        BEGINRAM:     origin=0x0, length=0x2
        RAMM0:     origin=0x2, length=0x3fe
        OTP:     origin=0x380400, length=0x400
        FLASH:     origin=0x300000, length=0x3fff6
        BEGINFLASH:     origin=0x33fff6, length=0x2
        CSM_PWL:     origin=0x3f7ff8, length=0x8
        IQTABLES:     origin=0x3fe000, length=0xb50
        IQTABLES2:     origin=0x3feb50, length=0x8c
        FPUTABLES:     origin=0x3febdc, length=0x6a0
        ROM:     origin=0x3ff27c, length=0xd44
        RESET:     origin=0x3fffc0, length=0x2
        VECTORS:     origin=0x3fffc2, length=0x3e
       // RAML4L7:     origin=0xc000, length=0x4000
        RAML0L3:     origin=0x8000, length=0x8000
        ADC_CAL:     origin=0x380080, length=0x9
        ZONE7P:     origin=0x200000, length=0x10000
    PAGE 1:
       // RAML0L3:     origin=0x8000, length=0x4000
        RAMM1:     origin=0x400, length=0x400
       // PROG_RAM:     origin=0x3F8000, length=0x1000
        ZONE7D:     origin=0x210000, length=0x10000

    }
    SECTIONS
    {
        .vectors:     load = 0x000000000
        .text:     > FLASH, PAGE = 0
        .switch:     > FLASH, PAGE = 0
        .bss:     > RAML0L3, PAGE = 0
        .ebss:     > ZONE7D, PAGE = 1
        //.ebss:    > ZONE7D,       PAGE = 1, LOAD_START(_start_ebss),LOAD_END(_end_ebss)
        .far:     > RAML0L3, PAGE = 0
        .cinit:     > FLASH, PAGE = 0
        .pinit:     > FLASH, PAGE = 0
        .const:     > FLASH, PAGE = 0
        .econst:     > FLASH, PAGE = 0
        .reset:     > RESET, PAGE = 0, TYPE = DSECT
        .data:     > RAML0L3, PAGE = 0
        .cio:     > RAML0L3, PAGE = 0
        .sysmem:     > RAML0L3, PAGE = 0
        .esysmem:     > RAML0L3, PAGE = 0
        .stack:     > RAMM1, PAGE = 1
        .rtdx_text:     > FLASH, PAGE = 0
        .rtdx_data:     > RAML0L3, PAGE = 0
        IQmath:     > FLASH, PAGE = 0
        codestart:     > BEGINFLASH, PAGE = 0
        csmpasswds:     > CSM_PWL, PAGE = 0
        csm_rsvd:     > RAMM0, PAGE = 0
        ramfuncs:     LOAD = FLASH,
            RUN = RAMM0,
            LOAD_START(_RamfuncsLoadStart),
            LOAD_END(_RamfuncsLoadEnd),
            RUN_START(_RamfuncsRunStart),
            PAGE = 0
        .adc_cal:     > ADC_CAL, PAGE = 0 , TYPE = NOLOAD
        IQmathTables:     > IQTABLES, PAGE = 0 , TYPE = NOLOAD
        IQmathTables2:     > IQTABLES2, PAGE = 0 , TYPE = NOLOAD
        FPUmathTables:     > FPUTABLES, PAGE = 0 , TYPE = NOLOAD
    }
    -l "C:\Program Files\MATLAB\R2011b\toolbox\idelink\extensions\ticcs\c2000\c2833xPeripherals.cmd"

     

    The intialization part, i got it from gel file in "xintf_Enable()" function, Kindly let me know if i am wrong

  • Hi,

     I have been stuck in external memory initialization, I have put by codestartbranch.asm() code in my previous post.
    Can anybody tell me what is the issue with the code ?

  • Hello Subash,

    Subash Chandar Athikessavan said:

    WD_DISABLE    .set    1        ;set to 1 to disable WD, else set to 0

    ;    .ref _start_ebss
    ;    .ref _end_ebss
        .ref _c_int00
        .global code_start

    ***********************************************************************
    * Function: codestart section
    *
    * Description: Branch to code starting point
    ***********************************************************************

        .sect "codestart"

    code_start:
        .if WD_DISABLE == 1
            LB wd_disable       ;Branch to watchdog disable code
        .else
    ;    movl XAR0,#_start_ebss
    ;     mov AL,#0
    ;     mov AH,#(_end_ebss - _start_ebss - 1)
    ;     rpt AH || mov *XAR0++,AL
       PCLKCR3= 0x3700;                          
       GPBMUX1= 0xFFFFFFC0;   /* GPBMUX1 */
       GPAMUX2 = 0xFF000000;   /* GPAMUX2 */  
       GPCMUX2 = 0x0000AAAA;   /* GPCMUX2 */  
       GPCMUX1 = 0xAAAAAAAA;   /* GPCMUX1 */
       XTIMING0= 0x0043FFFF;    /* Zone0 */
       XTIMING6= 0x0043FFFF;    /* Zone6 */
       XTIMING7= 0x0043FFFF;    /* Zone7 */
            LB _c_int00         ;Branch to start of boot.asm in RTS library
        .endif

     

    I can see at least two flaws in what you are doing in the code.  First, CodeStartBranch.asm is an assembly code file.  The code you inserted into this file appears to be C code.  I don't see how this file would build.  You must have gotten a compile error, right?  When I said in my previous post that you could use C to configure the XINTF prior to main(), I meant you could call a C function.  You cannot just stick C code into an assembly file.

    Second, even if the code was assembly, you have WD_DISABLE set to 1.  Therefore, none of the code you inserted is going to run.  When WD_DISABLE=1, the code branches to the watchdog disable routine instead of running the code you inserted.

    Frankly, the most fool-proof method is to just use assembly to configure the XINTF.  Attached to this post is an example file I wrote several years ago.  This one just configures Zone7.  You will need to modify for your needs, but it should be pretty easy to follow and copy.  You call this function from wd_disable.  Go back to your original CodeStartBranch.asm (get rid of the C stuff you added).  Then, in wd_disable replace the line:

      LB _c_int00

    with:

      LB InitExtMemIf

    Notice that InitExtMemIf calls _c_int00 at the end.

    Also, you need to make InitExtMemIf a global symbol in CodeStartBranch.asm by adding this at the top of the file:

       .global InitExtMemIf

    Regards,

    David

     

    InitExtMemIf.asm
  • Hi David,

     Thank you very much for helping me to resolve the issue, it is working fine now, I usually use Matlab to program F28335, hence i never got exposed to programming using CCS, thats why i would have made silly mistakes. Thanks a lot