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.

How do I compile code for TI RM48L952ZWT target to put the code into external SDRAM?

Other Parts Discussed in Thread: HALCOGEN

Hello, we are using the HalCoGen RM48L952ZWT and I am currently running out of internal RAM to execute the code and data. I need to put these code into external SDRAM.

I follow the instructions to define and put the code into external SDRAM. But when I compile the code, I received these errors below:

'Building target: BiolasePFB_ProductionBoard.out'

'Invoking: ARM Linker'

'Flags: -mv7R4 --code_state=32 --float_support=VFPv3D16 --abi=eabi -me -g --gcc --display_error_number --diag_warning=225 --diag_wrap=off --enum_type=packed --printf_support=nofloat -z -m"BiolasePFB_ProductionBoard.map" --heap_size=0x800 --stack_size=0x800 -i"C:/ti/ccsv6/tools/compiler/arm_5.1.6/lib" -i"C:/ti/ccsv6/tools/compiler/arm_5.1.6/include" --reread_libs --warn_sections --display_error_number --diag_wrap=off --xml_link_info="BiolasePFB_ProductionBoard_linkInfo.xml" --rom_model'

"C:/ti/ccsv6/tools/compiler/arm_5.1.6/bin/armcl" -@"ccsLinker.opt" -o "BiolasePFB_ProductionBoard.out"

<Linking>

"../Drivers/HalCoGen/source/sys_link.cmd", line 102: error #10008-D: cannot

find file ".main_section"

"../Drivers/HalCoGen/source/sys_link.cmd", line 102: error #10021-D: expecting

filename, option, MEMORY, or SECTIONS instead of ":"

"../Drivers/HalCoGen/source/sys_link.cmd", line 104: error #10043-D: expecting

"";"" instead of "LOAD_START"

undefined first referenced

symbol in file

--------- ----------------

MainLoadStart ./Drivers/HalCoGen/source/sys_startup.obj

MainSize ./Drivers/HalCoGen/source/sys_startup.obj

MainStartAddr ./Drivers/HalCoGen/source/sys_startup.obj

error #10234-D: unresolved symbols remain

"../Drivers/HalCoGen/source/sys_link.cmd", line 102: error #10104: undefined symbol "SDRAM" used in expression

"../Drivers/HalCoGen/source/sys_link.cmd", line 102: error #10104: undefined symbol "FLASH0" used in expression

"../Drivers/HalCoGen/source/sys_link.cmd", line 102: error #10104: undefined symbol "FLASH1" used in expression

error #10010: errors encountered during linking; "BiolasePFB_ProductionBoard.out" not built

>> Compilation failure

gmake: *** [BiolasePFB_ProductionBoard.out] Error 1

gmake: Target `all' not remade because of errors.

**** Build Finished ****

_______________________________________

And here is my sys_link.cmd file's content:

/*----------------------------------------------------------------------------*/

/* sys_link.cmd */

/* */

/*

* Copyright (C) 2009-2015 Texas Instruments Incorporated - 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.

*

*/

/* */

/*----------------------------------------------------------------------------*/

/* USER CODE BEGIN (0) */

/* USER CODE END */

 

/*----------------------------------------------------------------------------*/

/* Linker Settings */

--retain="*(.intvecs)"

/* USER CODE BEGIN (1) */

--retain="*(.main_section)"

/* USER CODE END */

/*----------------------------------------------------------------------------*/

/* Memory Map */

MEMORY

{

VECTORS (X) : origin=0x00000000 length=0x00000020

FLASH0 (RX) : origin=0x00000020 length=0x0017FFE0

FLASH1 (RX) : origin=0x00180000 length=0x00180000

STACKS (RW) : origin=0x08000000 length=0x00000900

RAM (RW) : origin=0x08000900 length=0x0003f700

/* USER CODE BEGIN (2) */

SDRAM (RWX) : origin=0x80000000 length=0x00200000

/* USER CODE END */

}

/* USER CODE BEGIN (3) */

--heap_size 0x00200000

/* USER CODE END */

 

/*----------------------------------------------------------------------------*/

/* Section Configuration */

SECTIONS

{

.intvecs : {} > VECTORS

.text : {} > FLASH0 | FLASH1

.const : {} > FLASH0 | FLASH1

.cinit : {} > FLASH0 | FLASH1

.pinit : {} > FLASH0 | FLASH1

.bss : {} > RAM

.data : {} > RAM

.sysmem : {} > RAM

FEE_TEXT_SECTION : {} > FLASH0 | FLASH1

FEE_CONST_SECTION : {} > FLASH0 | FLASH1

FEE_DATA_SECTION : {} > RAM

/* USER CODE BEGIN (4) */

//FEE_DATA_SECTION : {} > SDRAM

// .sysmem : {} > SDRAM

/* USER CODE END */

}

/* USER CODE BEGIN (5) */

.main_section : RUN = SDRAM, LOAD = FLASH0 | FLASH1

LOAD_START(MainLoadStart), LOAD_END(MainLoadEnd), LOAD_SIZE(MainSize),

RUN_START(MainStartAddr), RUN_END(MainEndAddr)

 

/* USER CODE END */

 

/*----------------------------------------------------------------------------*/

/* Misc */

/* USER CODE BEGIN (6) */

/* USER CODE END */

/*----------------------------------------------------------------------------*/

__________________________________________________

Below is how I define my main() code to be executed in external SDRAM based on the instructions:

 

In sys_startup.c file, I have:

 

/* USER CODE BEGIN (1) */

#include "emif.h"

/* USER CODE END */

 

/* USER CODE BEGIN (2) */

extern uint32 MainLoadStart;

extern uint32 MainLoadEnd;

extern uint32 MainSize;

extern uint32 MainStartAddr;

extern uint32 MainEndAddr;

/* USER CODE END */


/* USER CODE BEGIN (26) */

emif_SDRAMInit();

int i;

uint32 size=(uint32)&MainSize;

for(i=0;i<size;i++)

{

((char *)&MainStartAddr)[i] =((char *)&MainLoadStart)[i];

}

/* USER CODE END */


/* call the application */

/*SAFETYMCUSW 296 S MR:8.6 <APPROVED> "Startup code(library functions at block scope)" */

/*SAFETYMCUSW 326 S MR:8.2 <APPROVED> "Startup code(Declaration for main in library)" */

/*SAFETYMCUSW 60 D MR:8.8 <APPROVED> "Startup code(Declaration for main in library;Only doing an extern for the same)" */

#pragma SET_CODE_SECTION(".main_section")

main();

#pragma SET_CODE_SECTION()

/* USER CODE BEGIN (76) */

/* USER CODE END */

/*SAFETYMCUSW 122 S MR:20.11 <APPROVED> "Startup code(exit and abort need to be present)" */

exit(0);

Please help and let me know how to compile and build these code without linking, or compiling errors.

Thanks for your help!

Kenneth Lai

 

 

 

  • Kenneth,

    First the output lists several errors:

    "../Drivers/HalCoGen/source/sys_link.cmd", line 102: error #10008-D: cannot

    find file ".main_section"

    "../Drivers/HalCoGen/source/sys_link.cmd", line 102: error #10021-D: expecting

    filename, option, MEMORY, or SECTIONS instead of ":"

    "../Drivers/HalCoGen/source/sys_link.cmd", line 104: error #10043-D: expecting

    "";"" instead of "LOAD_START"

    Did you try to fix these ?? I can't see the line numbers that they refer to in the code that you pasted but looks like there are at least one or two syntax errors.
  • Hello Anthony,

    Thanks for the reply.

    I believe the errors above related to these lines below in the sys_link.cmd file:

    .main_section : RUN = SDRAM, LOAD= FLASH0 | FLASH1

    LOAD_START(MainLoadStart), LOAD_END(MainLoadEnd), LOAD_SIZE(MainSize),

    RUN_START(MainStartAddr), RUN_END(MainEndAddr)

    I followed the instructions that Charles sent me for the TI RM57L project specifying variable declarations as above to move the main() code into external SDRAM and executed out of external SDRAM.

    I do not know why there are errors in the build but Charles said that these declarations should build fine in TI RM57L project.

    In my case, I built the code for TI RM48 project and I don't know if this makes any difference. Please advice.

    Thanks,

    Kenneth

  • Kenneth,

    Why is

    }
    /* USER CODE BEGIN (5) */
    .main_section : RUN = SDRAM, LOAD = FLASH0 | FLASH1
    LOAD_START(MainLoadStart), LOAD_END(MainLoadEnd), LOAD_SIZE(MainSize),
    RUN_START(MainStartAddr), RUN_END(MainEndAddr)


    Outside of the SECTIONS{} directive? That could be the issue. It's a section right?
  • Thank you for the reply.

    I think that was the issue.

    I now have another issue after I built and programed the code into the board using the USB JTAG programmer device.

    Here is the error and please advice what could be wrong in my setting. Is it not possible to use the USB JTAG programmer to download the code with a portion to be stored in flash and a portion of the data to be stored in external SDRAM. Is this model working or I am doing something not right here? Thanks for your advice.

    CortexR4: GEL Output: Memory Map Setup for Flash @ Address 0x0CortexR4: GEL Output: Memory Map Setup for Flash @ Address 0x0 due to System Reset

    CortexR4: File Loader: Verification failed: Values at address 0x000000008003D82C do not match Please verify target memory and memory map.

    CortexR4: GEL: File: C:\Users\klai\Perforce\klai_klai_3426\PFB\Raptor\BiolasePFB_ProductionBoard\Debug\BiolasePFB_ProductionBoard.out: a data verification error occurred, file load failed.

    CortexR4: GEL Output: Memory Map Setup for Flash @ Address 0x0 due to System Reset

    Dap: Power Failure on Target CPU: (Error -180 @ 0x0) The controller has detected a target power loss. The user must turn-on or connect the power supply for the target. (Emulation package 5.1.641.0)

    CortexR4: Failed to remove the debug state from the target before disconnecting. There may still be breakpoint op-codes embedded in program memory. It is recommended that you reset the emulator before you connect and reload your program before you continue debugging

    ___________________________________________________________________

     

    This is my sys_link.cmd file:

    /*----------------------------------------------------------------------------*/

    /* sys_link.cmd */

    /* */

    /*

    * Copyright (C) 2009-2015 Texas Instruments Incorporated - 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.

    *

    */

    /* */

    /*----------------------------------------------------------------------------*/

    /* USER CODE BEGIN (0) */

    /* USER CODE END */

     

    /*----------------------------------------------------------------------------*/

    /* Linker Settings */

    --retain="*(.intvecs)"

    /* USER CODE BEGIN (1) */

    --retain="*(.main_section)"

    /* USER CODE END */

    /*----------------------------------------------------------------------------*/

    /* Memory Map */

    MEMORY

    {

    VECTORS (X) : origin=0x00000000 length=0x00000020

    FLASH0 (RX) : origin=0x00000020 length=0x0017FFE0

    FLASH1 (RX) : origin=0x00180000 length=0x00180000

    STACKS (RW) : origin=0x08000000 length=0x00001700

    RAM (RW) : origin=0x08001700 length=0x0003e900

    /* USER CODE BEGIN (2) */

    SDRAM (RWX) : origin=0x80000000 length=0x00200000

    /* USER CODE END */

    }

    /* USER CODE BEGIN (3) */

    --heap_size 0x00200000

    /* USER CODE END */

     

    /*----------------------------------------------------------------------------*/

    /* Section Configuration */

    SECTIONS

    {

    .intvecs : {} > VECTORS

    .text : {} > FLASH0 | FLASH1

    .const : {} > FLASH0 | FLASH1

    .cinit : {} > FLASH0 | FLASH1

    .pinit : {} > FLASH0 | FLASH1

    .bss : {} > SDRAM

    .data : {} > SDRAM

    .sysmem : {} > SDRAM

    FEE_TEXT_SECTION : {} > FLASH0 | FLASH1

    FEE_CONST_SECTION : {} > FLASH0 | FLASH1

    FEE_DATA_SECTION : {} > SDRAM

    /* USER CODE BEGIN (4) */

    .main_section : RUN = SDRAM, LOAD = FLASH0 | FLASH1

    LOAD_START(MainLoadStart), LOAD_END(MainLoadEnd), LOAD_SIZE(MainSize),

    RUN_START(MainStartAddr), RUN_END(MainEndAddr)

    /* USER CODE END */

    }

    /* USER CODE BEGIN (5) */

    /* USER CODE END */

     

    /*----------------------------------------------------------------------------*/

    /* Misc */

    /* USER CODE BEGIN (6) */

    /* USER CODE END */

    /*----------------------------------------------------------------------------*/


  • 1) what settings do you have checked/unchecked in the project properties under "Debug" and "Flash Settings"?

    2) please scroll to the bottom of the settings page mentioned in (1) and check 'Enable Verbose Output' as this provides more debug information.


    3) assuming that your target board is powered.  the HDK target side does not get power over USB -- only the on-board emulator.   The target side needs an external DC power supply too.