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.

Symbol to Unallocated Memory

Other Parts Discussed in Thread: CCSTUDIO

Using the DSK 5510 board (and Code Composer Studio v4 with DSP/BIOS 5), I am needing access to the "unallocated" portion of memory. I am needing to write this section of unallocated memory to all zeros, and I am also needing periodically verify that it is still set to all , so I need a symbol that points to the beginning of this empty memory space, and I need to know how long this memory space will be.  The symbol seems necessary since this memory spaces location and size will essentially change anytime the code/memory/variables change, so is there a way to attain such a symbol in C++, and how would I go about doing this?

Let me know if this question is not clear enough.  Thanks in advance for your help!

 

 

  • Alex,

    Take a look at the Assembly Language Tools User Guide (http://www-s.ti.com/sc/techlit/spru280, section 8.10.3 - 8.10.5.  Is this what you are looking for?  There is also a way to preinitialize unallocated memory using the linker command file, but makes your .out file bigger, see section 8.16.

    Regards.

  • Alex,

    Did those sections in the documentation help you?  I understand how it's trickier since in your case BIOS is generating a linker command file.  What's the current status?

    Best regards,
    Brad

  • Brad,

    I was on vacation last week, so sorry for not replying sooner.  I took a look at the documentation, and while it is helpful in understanding linker sections and labels, I don't see a specific label for unallocated memory that I can use.  I'm needing to essentially use a loop to walk through the entire memory section in C++ to ensure it is all set to a non-executable pattern (and set it to that pattern if it is not), so a specific label and/or example would be extremely beneficial.

  • I can think of two notions of unallocated memory.  I'm not sure which one is under discussion here.  You may be talking about pieces of memory that are defined in the MEMORY directive of the linker command file, but the linker does not allocate any section into those pieces.  Or, you may be talking about pieces of memory that are not defined in the MEMORY directive.  I think you mean the first one.  Is that right?

    Thanks and regards,

    -George

     

  • This is my first real experience with the DSP/BIOS, so my apologize if what I'm asking is unclear.

    When I look at my .map file, for instance, I see memory allocations for .bss, .text, .const, etc. with a specific memory address and length next to them.  These are portions of memory that is allocated.  What I'd like to have is an additional tag of some kind, something like .spare, that I can access from C++ that points to the portions of memory that the linker did not allocate anything to.

    If you're suggesting that it is possible to access this unallocated portion of memory without using the linker directive, that way seems like it would be significantly easier.  Either way, whether we use the linker directive or not to access this portion of memory, I'm not sure how to go about implementing this.   Does this help you to better understand my question?

  • For the records I followed up off-line with Alex and wanted to post an update.

    • In this specific scenario this is not easily accomplished because BIOS generates the linker command file so we do not have control.
    • Alex primarily wants to grab "the main chunk of unused memory", i.e. if there is a hole in memory due to alignment, etc he can skip it.

    Here's the not-so-pretty solution we came up with.

    1. Turn on the --xml_link_info linker option to generate an output xml file.
    2. Write a perl script that parses the xml output.
      1. Determine the end "the main block" of memory in each of the defined memory areas.
      2. Generates a simple C file that contains variables/structures containing the needed address info.
    3. Write a top-level build script.
      1. Does a first pass build in order to get an accurate xml file.
      2. Builds one more time after the C file has been re-generated with updated addresses.

    Alex, let us know how it comes along.  This is a pretty interesting thing you're doing!  Good luck!

    Best regards,
    Brad

  • Brad Griffis said:
    1. Turn on the --xml_link_info linker option to generate an output xml file.
    2. Write a perl script that parses the xml output.
      1. Determine the end "the main block" of memory in each of the defined memory areas.
      2. Generates a simple C file that contains variables/structures containing the needed address info.

    To make this part easier, install http://processors.wiki.ti.com/index.php/Code_Generation_Tools_XML_Processing_Scripts and start with one of the scripts in the "map" directory.

    Hope this helps ...

    -George

     

     

  • Brad,

    I have done most of what we discussed on the phone on  Friday.  Enabled the XML output, wrote a Perl script to parse through the file efficiently and write back into my conants header file the memory location pointers and sizes for the unallocated memory space.  I have tested my implementation code now reading over that unused memory space, and it works perfectly.

    The one hitch I'm having, and this is likely just due to my inexperience with Batch files, is that I am not certain how to call the same build options that CCS calls.  I would like to outline my Batch file to call CCS build options, perl myScript.pl %1%, CCS build options again.  I am passing the arguments "Debug" or "Release" into my Perl script, and I would like the build to use these associated arguments from the batch file as well.  Can you offer me any guidance in this area?  Thanks.

  • Alex,

    Sounds like you're making great progress!  Glad to hear it!  Have you seen this wiki article:

    http://processors.wiki.ti.com/index.php/Projects_-_Command_Line_Build/Create#Build_a_Project

    If that doesn't help please give some snippets of what you've tried and the corresponding output.

    Best regards,
    Brad

  • Thank, that was the article I was looking for.

    When I try to execute the command for a default build given in that article, however, the prompt says "the system cannot find the specified path."  My batch file first does the proper navigation

    cd C:\Program Files\Texas Instruments\CCSv4\eclipse

    Before actually executing the command

    jre\bin\java -jar startup.jar -data "C:\myWorkspace" -application com.ti.ccstudio.apps.projectBuild -ccs.projects myProject -ccs.configuration %1

    Since this is a long command, it's slightly ambiguous what part of this command the prompt is getting lost in.  I have verified that jre/bin/java does exist in my eclipse folder, and startup.jar exists at the top-level of the eclipse folder.  Additionally, I executed the command from the Command Prompt and it worked just fine, so it must be something I'm misunderstanding about batch files.

  • Alex,

    I got this working using the following batch file:

    test.bat said:

    set CCS4_DIR=C:\Program Files\Texas Instruments\ccsv4\eclipse\
    set WORKSPACE_DIR=C:\Documents and Settings\a0193370\My Documents\My Projects\64x+\CCS4_tryout
    set PROJECT_NAME=new_v2

    cd %CCS4_DIR%
    jre\bin\java -jar startup.jar -data "%WORKSPACE_DIR%" -application com.ti.ccstudio.apps.projectBuild -ccs.projects %PROJECT_NAME% -ccs.configuration %1

    I was able to run "test Debug" and "test Release" to make it build the corresponding configurations.

    Brad

     

  • Brad,

    Strangely, I still had to tweak your file to get it to execute a build.  It seems I have to put absolute paths in for every command, probably because the repository is on one drive and the JAR is on another--I don't know enough about batch to know if this is a true statement, but it seems logical.  So I ended up with the following code:

    set CCS4_DIR=C:\Program Files\Texas Instruments\ccsv4\eclipse
    set WORKSPACE_DIR=U:\My Program\My Workspace
    set PROJECT_NAME=myProject

    "%CCS4_DIR&\jre\bin\java" -jar "%CCS4_DIR%\startup.jar" -data "%WORKSPACE_DIR%" -application com.ti.ccstudio.apps.projectBuild -ccs.projects %PROJECT_NAME% -ccs.configuration %1

    While the build now starts, as soon as it begins, I now get a Java exception saying that there were "errors during build."  It's a org.eclipse.core.internal.resources.ResourceException, if that helps explain anything at all.  Last instance of the exception is seen at org.eclipse.core.internal.resources.Project.build(Project.java:91).

  • Alex,

    I modified my batch file to look like yours but it worked fine, i.e. no odd errors.  Since this has now become a CCS issue I recommend starting a new thread in the CCS forum so we can get help from them.  Please be sure to post your complete build output.

    Thanks,
    Brad

  • Alex,

    Would it be possible to provide the project (or a test case) that can reproduce the error?

    Thanks

    ki

  • Ki,

    I have moved this dicussion into the Code Composer forum as Brad suggested.
    http://e2e.ti.com/support/dsp/tms320c5000_power-efficient_dsps/f/109/t/58790.aspx

    I cannot release the code or the project--I'll see what I can do about producing it on a sample project.