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.

TDA4VM: MCU R5F benchmark and CPU load measurement

Part Number: TDA4VM

Hi,

I'm trying  to write benchmark forcing given CPU load (defined based on idle time) and power consumption.

Currently benchmark creates a task containing Task_sleep() function which holds it’s execution and switches processor to idle. Then CPU load is measure by Load_getCPULoad() function.

When I run this benchmark in no boot mode CPU load equals about 12%, but when I run it in SD boot mode (via u-boot) the CPU load equals about 85%.

I wondering what is the reason of different results depending on boot mode?

After suggestions from Vishal Mahaveer I measured if task holding caused by Task_sleep() is the same in each boot modes. I set Task_sleep() function argument to reach 10s hold. As a reasult I reached 10s task holding in no boot mode and about 1s holding in SD boot mode.

Do you have ony other ideas what to do to get the same benchmark results regardless of the boot mode?

  • Attaching the cfg file used by customer
    3034.app.cfg

  • Hi,

    Regrading the CPU load, I think it could be related to the way prints are handled in CCS (no-boot mode) and UART (SD-Boot). For the Task_Sleep() anomaly, I think you the timers might be configured differently in CCS GELs and in SPL UBoot. Can you provide your timer.xs file? I will ask an expert to comment on this.

  • Hi,

    thanks for response.

    Attaching my timer .xs file. I could not upload .xs file so I changed extension to .txt.

    /*
     * Copyright (c) 2019, Texas Instruments Incorporated
     * All rights reserved.
     *
     * 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.
     */
    /*
     *  ======== event_MPU.xs ========
     *  MPU Settings for J721E device's Cortex-R5F
     */
    
    /*
     *  -------------------------------------------------------------------------------------------------------------
     * | Id | Base Address | Size | En | Cacheable                                 | XN | AccPerm             | Mask |
     * |----|--------------|------|----|-------------------------------------------|----|---------------------|------|
     * | 0  | 0x00000000   | 4GB  | T  | uncacheable, Shareable                    | F  | RW at PL 1 & PL 2   | 0x0  |
     * |----|--------------|------|----|-------------------------------------------|----|---------------------|------|
     * | 1  | 0 (local TCM)| 32K  | T  | Write-Back, Write-Allocate, Non-Shareable | F  | RW at PL 1          | 0x0  |
     * |----|--------------|------|----|-------------------------------------------|----|---------------------|------|
     * | 2  | 0x41000000   | 32K  | T  | Write-Back, Write-Allocate, Non-Shareable | F  | RW at PL 1          | 0x0  |
     * |----|--------------|------|----|-------------------------------------------|----|---------------------|------|
     * | 3  | 0x41010000   | 32K  | T  | Write-Back, Write-Allocate, Non-Shareable | F  | RW at PL 1          | 0x0  |
     * |----|--------------|------|----|-------------------------------------------|----|---------------------|------|
     * | 4  | 0x41C00000   | 1MB  | T  | Write-Back, Write-Allocate, Non-Shareable | F  | RW at PL 1          | 0x0  |
     *  -------------------------------------------------------------------------------------------------------------
     * | 5  | 0x70000000   | 8MB  | T  | MSMC Ram - Cachable                       | F  | RW at PL 1          | 0x0  |
     *  -------------------------------------------------------------------------------------------------------------
     * | 6  | 0x80000000   | 2GB  | T  | DDR - Strongly Ordered, Shareable         | F  | RW at PL 1 & PL 3   | 0x0  |
     *  -------------------------------------------------------------------------------------------------------------
     * | 7  | 0xAA000000   | 32MB | T  | DDR (VRing Buffer) - Uncacheble           | F  | RW at PL 1 & PL 3   | 0x0  |
     * |-------------------------------------------------------------------------------------------------------------|
     */
    
    /*
     * Note: Marking a region as shareable will cause the region to behave as outer shareable with write through
     *       no write-allocate caching policy irrespective of the actual cache policy set. Therefore, only select
     *       regions that are actually shared outside the R5 CPUSS must be marked as shared.
     */
    
    var MPU = xdc.useModule('ti.sysbios.family.arm.MPU');
    MPU.enableMPU = true;
    MPU.enableBackgroundRegion = true;
    
    var attrs = new MPU.RegionAttrs();
    MPU.initRegionAttrsMeta(attrs);
    
    /* This entry covers the whole 32 bit memory range
       Address: 0x00000000-0xffffffff */
    attrs.enable = true;
    attrs.bufferable = false;
    attrs.cacheable = false;
    attrs.shareable = true;
    attrs.noExecute = true;
    attrs.accPerm = 1;          /* RW at PL1 */
    attrs.tex = 0;
    attrs.subregionDisableMask = 0;
    MPU.setRegionMeta(0, 0x00000000, MPU.RegionSize_4G, attrs);
    
    /* This entry covers the ATCM mapped to 0 */
    attrs.enable = true;
    attrs.bufferable = true;
    attrs.cacheable = true;
    attrs.shareable = true;
    attrs.noExecute = false;
    attrs.accPerm = 1;          /* RW at PL1 */
    attrs.tex = 1;
    attrs.subregionDisableMask = 0;
    MPU.setRegionMeta(1, 0x00000000, MPU.RegionSize_32K, attrs);
    
    /* This entry covers ATCM if mapped to 0x41000000 */
    attrs.enable = true;
    attrs.bufferable = true;
    attrs.cacheable = true;
    attrs.shareable = false;
    attrs.noExecute = false;
    attrs.accPerm = 1;          /* RW at PL1 */
    attrs.tex = 1;
    attrs.subregionDisableMask = 0;
    MPU.setRegionMeta(2, 0x41000000, MPU.RegionSize_32K, attrs);
    
    /* This entry covers BTCM if mapped to 0x41010000 */
    attrs.enable = true;
    attrs.bufferable = true;
    attrs.cacheable = true;
    attrs.shareable = false;
    attrs.noExecute = false;
    attrs.accPerm = 1;          /* RW at PL1 */
    attrs.tex = 1;
    attrs.subregionDisableMask = 0x0;
    MPU.setRegionMeta(3, 0x41010000, MPU.RegionSize_32K, attrs);
    
    /* This entry covers RAM0 */
    attrs.enable = true;
    attrs.bufferable = true;
    attrs.cacheable = true;
    attrs.shareable = false;
    attrs.noExecute = false;
    attrs.accPerm = 1;          /* RW at PL1 */
    attrs.tex = 1;
    attrs.subregionDisableMask = 0;
    MPU.setRegionMeta(4, 0x41C00000, MPU.RegionSize_1M, attrs);
    
    /* This entry covers MSMC SRAM */
    attrs.enable = true;
    attrs.bufferable = true;
    attrs.cacheable = true;
    attrs.shareable = false;
    attrs.noExecute = false;
    attrs.accPerm = 1;          /* RW at PL1 */
    attrs.tex = 1;
    attrs.subregionDisableMask = 0;
    MPU.setRegionMeta(5, 0x70000000, MPU.RegionSize_8M, attrs);
    
    /* This entry covers DDR memory */
    attrs.enable = true;
    attrs.bufferable = true;
    attrs.cacheable = true;
    attrs.shareable = false;
    attrs.noExecute = false;
    attrs.accPerm = 0x3;          /* RW at PL1 & PL2 */
    attrs.tex = 1;
    attrs.subregionDisableMask = 0;
    MPU.setRegionMeta(6, 0x80000000, MPU.RegionSize_2G, attrs);
    
    /* Ring Buffer uncached.... */
    attrs.enable = true;
    attrs.bufferable = false;
    attrs.cacheable = false;
    attrs.shareable = true;
    attrs.noExecute = true;
    attrs.accPerm = 3;          /* RW at PL1 */
    attrs.tex = 0;
    attrs.subregionDisableMask = 0;
    MPU.setRegionMeta(7, 0xAA000000, MPU.RegionSize_32M, attrs);
    

    Regards,
    Łukasz

  • Hi Lukasz,

    A few questions -

    1. When you are using no-boot mode, you should be using the GEL files. Which CCS version are you on?

    2. When in SD boot, using u-boot are you booting linux? If yes, then there is a tool (k3conf) using which you can get the frequency of the timer you are using.

    3. Which SDK, BIOS version and u-boot are you using?

    So there could be a possibility that the BIOS timer which is used by BIOS to keep track of time is being configured differently by the GELs vs the u-boot.

    From the bios cfg file which Vishal has posted you can see which timer you are using, look at the base address. Eg - if you are running on mcu2_1 then you are using DMTIMER#13 with base address - 0x023D0000.

    We can look for the frequency of the bios timer in both cases - CCS (GELs) vs u-boot. If there is a delta in these two then that is the problem.

    Please provide answers to the above questions and we can proceed from there.

    Regards,

    Karan

  • Hi Lukasz,

    I haven't heard back from you, I'm assuming you were able to resolve your issue. If yes, can you please share your findings?

    Regards,

    Karan

  • Hi Karan,

    I will take over the topic from Lukasz.

    Answering your questions:

    1. CCS version is 9.1.0.00010.

    2. We are booting with Linux, CPU frequency reported by k3conf is 2 GHz.

    3. SDK 06_01_00_15, BIOS 6_76_03_01, U-BOOT SPL 2019.01-ga280dd38e1

    Regarding "you can see which timer you are using, look at the base address" - we have not checked that yet.

    Best regards,

    Peter

  • Hi Peter,

    Can you please check the frequency the BIOS timer is being configured to?

    Also, which core are you running the bios application on? You can use this info to get the name of the timer your BIOS is using. You can see that in the BIOS config file. The only explanation can be that GELs and U-boot are configuring that timer differently.

    The following section in you cfg file will give you the information about which timer -

    if(coreId=="mcu1_0")
    {
        Core.id = 0;
        /* DM timer cfg */
        Clock.timerId = 1;
    }
    if(coreId=="mcu1_1")
    {
        Core.id = 1;
        /* DM timer cfg */
        Clock.timerId = 2;
    }
    if(coreId=="mcu2_0")
    {
        Core.id = 0;
        Clock.timerId = 0;
        /* DMTimer #12 - in general, address is 0x024x0000 where x is timer # */
        DMTimer.timerSettings[0].baseAddr = 0x024c0000;
        DMTimer.timerSettings[0].intNum = 168;
    }
    if(coreId=="mcu2_1")
    {
        Core.id = 1;
        Clock.timerId = 1;
        /* DMTimer #13 - in general, address is 0x024x0000 where x is timer # */
        DMTimer.timerSettings[1].baseAddr = 0x024d0000;
        DMTimer.timerSettings[1].intNum = 169;
    }
    if(coreId=="mcu3_0")
    {
        Core.id = 0;
        Clock.timerId = 2;
        /* DMTimer #14 - in general, address is 0x024x0000 where x is timer # */
        DMTimer.timerSettings[2].baseAddr = 0x024e0000;
        DMTimer.timerSettings[2].intNum = 170;
    }
    if(coreId=="mcu3_1")
    {
        Core.id = 1;
        Clock.timerId = 3;
        /* DMTimer #15 - in general, address is 0x024x0000 where x is timer # */
        DMTimer.timerSettings[3].baseAddr = 0x024f0000;
        DMTimer.timerSettings[3].intNum = 171;
    }

    Base on the Timer.xs file of BIOS, the BIOS timers should be set to 19.2MHz - please verify this.

    I expect that the GELs are configuring the TIMER to the correct frequency as you see expected 10s sleep in case of no-boot/CCS mode.

    name: "DMTimer12",                                      
    baseAddr: 0x024c0000,                                   
    intNum:  168,                                           
    eventId: -1,                                            
    intFreq: {                                              
    lo: 19200000,                                       
    hi: 0

    Regards,
    Karan

  • Hi Piotr,

    Were you able to do the steps mentioned by Karan?

    Regards,
    Vishal