ADSP-21489 Adding Memory to app.ldf

Hello, 

I am getting the below linker error when trying to compile my project in CCES:

[Error li1040] "system\startup_ldf\ADSP-21489\app.ldf":230 Out of memory in output section 'dxe_block0_sw_code_prio3' in processor 'p0'
Total of 0x14961 word(s) were not mapped.
For more details, see 'linker_log.xml' in the output directory.

I understand this is a linker error due to running out of memory in the output section mem_block0_sw16:

mem_iv_code { TYPE(PM RAM) START(0x0008C000) END(0x0008C0A7) WIDTH(48) }
mem_block0_nwco { TYPE(PM RAM) START(0x0008C0A8) END(0x0008C0FF) WIDTH(48) }
mem_block0_sw16 { TYPE(SW RAM) START(0x00124300) END(0x0013BFFF) WIDTH(16) }

Could someone please advise a solution as to how to assign more memory to mem_block0_sw16 and accommodate the 0x14961 words which were not mapped

Possible solutions I have looked into:

- Assign the extra memory to Block 1 instead of Block 0?

- Decrease the amount of words assigned to mem_iv_code or mem_block0_nwco?

Thanks and regards,

Calum

Parents
  • +1
    •  Analog Employees 
    on May 24, 2021 1:52 PM

    Hello Calum,

    As you are hitting li1040 error, we would first recommend ensuring two Linker Optimization options are enabled.

    The first is to enable Linker Elimination via Project->Properties->C/C++ Build->Settings->CrossCore Blackfin Linker->Elimination->Eliminate Unused Objects. When elimination is enabled, the Linker discards any objects (*.doj) within the library that do not contain any relevant code or data (i.e. the application makes no reference to any of the data or code symbols within that object). The linker can then examine the objects that are required for the link, and extract only those symbols required to resolve references from the application code, further stripping out unused data.

    Another option is enabling 'Individually map functions and data items' via 'General' tab of the CrossCore Blackfin Linker options. When enabled, directs the linker to fill in fragmented memory with individual data objects that fit. When this option is selected, the default behavior of the linker (to place data blocks in consecutive memory addresses) is overridden.

    As you suspect, another cause of the li1040 Out of memory error, you have eventually exhaust all the available memory.

    Should you eventually exhaust the available internal memory, you would need to look at making use of SDRAM - if your target has external memory. Select Use external memory (SDRAM) to enable the size and partitioning controls under system.svc > Startupcode/LDF > LDF > External Memory

    By enabling the 'Generate symbol Map' option under the 'General' options for the Linker. If you enabled the option to "Generate Symbol Map", the Linker will also generated a project_name.map.xml file which can be viewed in Internet Explorer to view a map of your project. It shows the memory sections declared in the LDF, their start and end bounds and - most importantly - their free/used space. Using this map file you can determine whether there is perhaps a memory section that is being under-used that you could place more data into.

    Please refer the below CCES help path for more information about li1040 linker error:
    CrossCore® Embedded Studio <version> > SHARC® Development Tools Documentation > Linker and Utilities Manual > Linker and Archiver Messages > Linker Messages > Errors > li1040

    Also, Could please try mapping some of your data to external memory and let us know how you gets on.

    Controlling the placement of the function or data is then a case of adding appropriate output section in LDF.

    You can use #pragma section("section_name") directive to force your data into specific memory. Use this before each function that you want to place in the section.This pragma will only affect the next symbol and if you use this pragma right before a function, that function alone will be placed in the section.

    For example:

    #pragma section("mydata") //custom_section_name
    unsigned char Image_BUFF1[76800];

    Also, add the appropriate INPUT_SECTIONS commands to your LDF in a suitable place in app.ldf, like below.

    custom_section_name //Output section
    {
    INPUT_SECTIONS( $OBJS_LIBS(custom_section_name) ) // Input section
    } > > mem_section_name // Memory section

    For eg:

    sdram
    {
    INPUT_SECTION_ALIGN(4)
    INPUT_SECTIONS( $OBJS_LIBS(mydata) ) // Input section
    } > mem_sdram_dmda

    For more information, take a look at the "#pragma section/#pragma default_section" in the CCES help:
    CrossCore® Embedded Studio <version> > SHARC® Development Tools Documentation > C/C++ Compiler Manual for SHARC® Processors > Compiler > C/C++ Compiler Language Extensions > Pragmas > Linking Control Pragmas > #pragma section/#pragma default_section

    If the above information does not helps, if possible can you please share us your example project along with the screenshot of the error that you are facing and also the steps to reproduce to replicate your issue. This will help us to assist you better.

    Best Regards,
    Santhakumari.K

  • Hi Santhakumari, 

    Thanks for your comprehensive and helpful response, I have gone through your suggestions which seem to have uncovered some further issues with my project which I require your continued help to address.

    Changing/Enabling Linker options: 

    I am running a custom project (not an example) which does not have the above menus you mention in the project properties, this possibly due to the alterations done to the layout of the .cproject file by various predecessors who worked on the project .

    In the first screenshot attached you can see I do not have the Tool Settings menu available in the C/C++ Build->Settings menu. 

    First Screenshot of Project Properties Menu

    Is there a simple solution to get these menus back?

    Mapping Data to external memory:

    I also have the same issue when trying to utilise the SDRAM in system.svc where the tab is blank in CCES. please refer to second screenshot attached.  

    These issues are also preventing me from generating the symbol map for the linker which you mention above.

    Could you please advise how I should proceed further and let me know if there specific files from my project you wish me to attach.

    Thanks and Regards,

    Calum

  • 0
    •  Analog Employees 
    on Jun 3, 2021 1:36 PM in reply to CalumJ

    Hi Calum,

    Please find the details below:

    Regarding missing tabs in project setting>>>

    Could you please try resizing (maximized) the Properties Window, either make it bigger or smaller. Do you notice the tabs re-appearing? If not click OK and reload the Properties window and go back to the Settings Page. Do the tabs appear now?

    Also please let us know how are you accessing the Properties window, is it by directly right clicking on the project and selecting Properties, or are you selecting Properties from the Project drop down menu? Please try both ways and let us know how you gets on.

    If you are still facing the issue can you please try to uninstall and reinstall the CCES and see if it resolves the issue. Before uninstalling take a backup of the license.dat file.
    License.dat file is located at C:\ProgramData\Analog Devices\CrossCore Embedded Studio

    Before you re-install CrossCore Embedded Studio, could you try

    1. Using a brand new workspace - File | New | Other | Workspace: < a directory of your choosing >
    2. Creating a brand new project in your new workspace
    3. Visit C/C++ Build and let us know if you see the tabs.

    Then try importing your project into new workspace.

    To import a project into the workspace (Project Explorer), you should select File | Import | General | Existing Projects into Workspace.

    Regarding issue with system.svc>>>

    Unfortunately your second screenshot is not clear, so we are unable to see the exact error your are facing.Also we could not simulate behavior (blank system.svc) here with simple/example project.

    Therefore please confirm whether you are able to resolve this by changing workspace or re-installing CCES.Before that, you can try deleting the project from workspace and then importing project again.

    Also you could try deleting the existing "system.svc" file form your project and then restoring it.

    To restore "system.svc", right-click on your project and choose "New -> File". In the dialog, input the file name as "system.svc" and click "Finish".
    However, the "system.svc" file will be empty and you will be unable to configure the Add-ins that you have added to your project; the "System Configuration Overview" will be empty when you double-click the "system.svc" file.

    Then you can add Startup Code/LDF tab by opening the system.svc file in your project and, on the overview page, clicking 'Add', then choosing the Startup Code/LDF option under 'Recommended Add-Ins' and select 'Finish'.

    If you are still facing issue, Do you notice the same behavior in all projects? Can you try one of our Example projects. Note you can browse available example by selecting 'Browse Examples' from the Help drop down menu.

    If you discover that it is only with your project you are encountering this problem please provide a copy of it along with a clear screenshot of error message so that we can assist you further.

    Also it would be useful if you could create a .zip file with the .metadata directory that's located in your work space directory and share to us.

    Lastly, can you provide a copy of your ProductInfo file, which is available from the Help file menu in CCES.

    Best Regards,
    Santhakumari.K

  • Hi Santhakumari, 

    My project has removed the Eclipse interface and uses a custom makefile to configure the build however I have been able to optimize and eliminate unused objects using the linker flags (-e) in my custom Makefile. This however does allow for all my words to be allocated to internal memory.

    I have been able to customize the allocation of SDRAM memory by manually changing the LDF file:

       /*
       ** ------------------------- External memory --------------------------------
       ** This LDF defines the memory configuration for the 256Mb/32MB SDRAM
       ** on the ADSP-21489.
       **
       ** 0x0020 0000 0x009F FFFF SDRAM (bank 0)
       ** 0x0400 0000 0x043F FFFF Flash memory (bank 1)
       ** 0x0C00 0000 0x0C0F FFFF SRAM for 16-bit address space (bank 3)
       ** 0x0C00 0000 0x0C07 FFFF SRAM for 32-bit address space (bank 3)
       **
       ** Notes:
       ** 1) Instruction execution is only supported from bank 0 (SDRAM here)
       ** in the following memory range:
       **   - For VISA code (i.e 16bit accesses)     : 0x00600000 - 0x00FFFFFF
       **   - For NonVISA code (i.e 48 bit accesses) : 0x00200000 - 0x005FFFFF
       ** 2) Memory locations 0x5FFFFD-0x5FFFFF (NW) and 0x600000-0x600008 (SW)
       ** are not used for instructions as required by "ADSP-214xx SHARC Processor
       ** Hardware Reference" revision 1.0 pages 4-45 and 4-46.
       */
       mem_sdram_swco          { TYPE(SW RAM SYNCHRONOUS) START(0x00600009) END(0x0065FFFF) WIDTH(16) }
       mem_sdram_nwco          { TYPE(PM RAM SYNCHRONOUS) START(0x00220000) END(0x0043FFFF) WIDTH(16) }
       mem_sdram_dmda          { TYPE(DM RAM SYNCHRONOUS) START(0x00660000) END(0x008FFFFF) WIDTH(16) }
       mem_sdram_pmda          { TYPE(DM RAM SYNCHRONOUS) START(0x00900000) END(0x009FFFFF) WIDTH(16) }
       

    The problem I have now is whenever I allocate memory to the SDRAM (using #pragma section) my program hangs in the rebooting stage. Does the SDRAM peripheral need to be initialised before allocating external memory and what are the rules for setting it up? Can you send over an example project for initialisng the SDRAM peripheral for ADSP-21489?

    Thanks and regards,

    Calum  

  • 0
    •  Analog Employees 
    on Jun 17, 2021 2:44 PM in reply to CalumJ

    Hi,

    Yes. As you are placing code or data in SDRAM the EBIU must be configured before the application is loaded, or the behaviour will be unpredictable.Please check your EBIU configuration is appropriate for your target.

    If you are using custom board, please refer the below link to configuring external memory:
    ez.analog.com/.../faq-my-application-behaves-incorrectly-when-using-sdram

    Please refer the below link which might be helpful to you.
    ez.analog.com/.../unable-to-access-data-from-sdram

    Also, We recommend to refer the below given EE note and its associated examples, which might be helpful for you:
    EE-286 Interfacing SDRAM Memories to SHARC® Processors
    www.analog.com/.../EE286_rev5.pdf
    www.analog.com/.../EE286v05.zip

    Regards,
    Santhakumari.K

Reply Children
No Data