[ABANDONED] Slowly stepping over cache maintenance

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [ABANDONED] Slowly stepping over cache maintenance

    Hi, I am working on cache on ATSAMRH71. I found debugging to be very slow when stepping over cache maintenance function SCB_EnableDCache. With SCB_EnableICache function there is no such problem. It takes about 30 seconds to step over SCB_EnableDCache. [/i]If I put a breakpoint after SCB_EnableDCache - again there is no such problem.

    Host SW and firmware freshly updated.
    Product = J-Trace PRO Cortex-M V2.0
    Nickname =
    SN = 752001805
    USB = SN 752001805
    HostFW = 2022 May 18 17:09
    EmuFW = 2022 May 18 17:09

    C Source Code

    1. /* Init routine called just after setting SP in startup */
    2. s_tcm_enable();
    3. mpu_initialize();
    4. if (0UL == (SCB->CCR & SCB_CCR_IC_Msk)) {
    5. SCB_EnableICache(); // stepping over this function is normal
    6. }
    7. if (0UL == (SCB->CCR & SCB_CCR_DC_Msk)) {
    8. SCB_EnableDCache(); // stepping over this function takes 30 seconds
    9. }
    Display All


    I found some info that debuggers sometimes have problems with cache, but I'd like to make sure that it's not a bad configuration problem.

    The post was edited 1 time, last by dsa93 ().

  • We need more info.
    What is your debug environment / debugger on the PC side?
    Usually, the debugger would resolve the step-over to setting a BP on the next line and issue a Go().
    However, sometimes the debugger comes to the conclusion that it needs to single-step the routine until its end.
    If rhe D-cache enable includes D-cache invalidate operations line by line, there may be easily hundreds of steps necessary to finish the routine. If now the debugger also reads CPU registers and refreshes local variables and a memory window, a single step can easily take 30ms or even more. So as you can see, 30ms x 100, 200, 300, … can easily get into the 30 seconds region.

    A J-Link logfile of the 30 second case would also give insight:
    wiki.segger.com/Enable_J-Link_log_file
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.