Post Go back to editing

Cache of 21569

Hi,

ADI example code are all based on DMA.I want to know how to config 21569 to using cache automatically?could you please give me corresponding example?

I mean let the core automatically using I-cache,D-cache,P-cache while it is running.

Best regards,

Binge

Parents Reply Children
  • while cache is enabled,place breakpoints or add printf statements will result errors?

  • Hi,

    Yes, that is expected behavior as the use of breakpoints influences execution flow. For instance, as stated in EE-400, during debug, if the CCES debugger transitions into halt mode via breakpoint or single-step, all of the L1/L2 caches are flushed (including the SHARC L1 caches); hence, the captured cache data is no longer meaningful. The printf functionality also flushes the SHARC+ L1 cache. Consider this functionality while benchmarking code with L1 cache enabled.

    Please refer EE-400 for more details about cache:
    www.analog.com/.../EE-400.pdf

    Regards,
    Anand Selvaraj.

  • Hi,

    Is there any simple way to place all code/data into L2 ram?

    Best regards,

    Binge.

  • Hi Binge,

    Apologies for the delayed response.

    Yes, you can place your entire code in to L2 memory based on the memory.Please refer the simple example project attached.

    By default, functions in the 'Test.c' file mapped in the output section 'L1_data_b_prio2' with in the l1 memory section 'MEM_L1_DATA_B'. If you want to map the whole object file(Test.doj) in different memory section(L2 memory),this can be done by simply adding the following line to an appropriate section in the app.ldf(LDF file ):

    INPUT_SECTIONS( Test.doj(seg_swco) )

    Your LDF should then be roughly of the form:

    PROCESSOR SC584_CORE_1
      {
        ...
        l2_sw_code SW
        {
           INPUT_SECTION_ALIGN(2)
           FILL(0x1)                             // fill gaps in memory with NOPs
           INPUT_SECTIONS( Test.doj(seg_swco) )
        } > MY_L2_CACHED_MEM
        ...
      }


    Any hand-edits you make within the LDF file in a Source Window should be made within the generated $VDSG sections, to preserve them if/when the LDF is automatically regenerated by the tools. Below is an example:
    /*$VDSG<insert-......>                            */
    /* Text inserted between these $VDSG comments will be preserved */
    /*$VDSG<insert-.....>

    If you are encountering problems modifying the LDF to control the placement of your code, it is recommended that you make use of the "#pragma section" and "#pragma default_section" qualifiers. For example, if you are trying to place the code from 'Test_pragma.doj' into MY_L2_CACHED_MEM, you could use the default_section pragma in the global scope of the source to control the placement of data:

    ===file Test_pragma.c===
    /*includes*/
    ...
    #pragma default_section(CODE, "seg_l2_swco") /*the rest of your code*/ ====EOF====

    This pragma remains in force for a section category until its next use with that particular category, or the end of the file.

    Please refer in CCES help for more information:
    CrossCore(r) Embedded Studio 2.10.0 > SHARC(r) Development Tools Documentation > C/C++ Compiler Manual for SHARC(r) Processors > Compiler > C/C++ Compiler Language Extensions > Pragmas > Linking Control Pragmas > #pragma section/#pragma default_section

    Test_l2_map_21569.zip

    Regards,
    Anand Selvaraj.