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.

Force specific functions to be located in AM335x CPU-cache?

Genius 5820 points

Hi,

is there a possibility to mark some functions as "time-critic" or "often used" so that they are preferred to be loaded into AM335x cache? Means some kind of cache-prefetch-hint that is done in code directly?

Thanks!

  • I lack knowledge of how the AM335x cache works.  But I can give you one useful hint, then move this thread into the Sitara forum, where those device experts are available.

    You probably need to collect all those functions together into one section.  The first step is, in C code. to arrange for the critical functions to go into a section you name.  There are two ways to do that: the CODE_SECTION pragma or the section function attribute. This example shows both methods.  The functions are placed in the section named for_cache.

    /* pragma method */
    #pragma CODE_SECTION(critical1, "for_cache")
    int critical1()
    {
       /* code here */
    }
    
    /* section function attribute method */
    int critical2() __attribute__ ((section ("for_cache")));
    int critical2()
    {
       /* code here */
    }

    In your linker command file, you create the output section for_cache from the input sections of the same name, and place it in particular range of memory like this ...

        for_cache > SPECIAL_CACHE_MEMORY_RANGE
    

    Hope this helps ...

    -George