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.

Debugging problem

Other Parts Discussed in Thread: SYSBIOS, AM3359

Equipment:
ICEv2 board,
CCSv6 vs 6.0.1.00040,
TI XDS100v2 USB Emulator,
Windows7,
am335x_sysbios_ind_sdk_1.1.0.6
NDK 2.24.1.18
NDK's NSP 1.10.2.09 not activated
SYSBIOS 6.40.3.39
Compiler TI v5.1.9

Hi everybody,

I have got a problem with debugging.

I recently updated to bios_6_41_02_41, the result was that I could not step through the program any longer or stop at breakpoints.
Instead the program counter stopped at
   static void loader_exit(void)
{
and registers were displayed like this
  [CortxA8] 0x6000019f R8 = 0x83fa1878
  R1 = 0x00000000 R9 = 0x8003afda
  R2 = 0x00000000 R10 = 0x83fa8434
  R3 = 0x00000000 R11 = 0x0000000e
  R4 = 0x83fa836c R12 = 0x4804a000
  R5 = 0x6000019f SP(R13) = 0x83fa8324
  R6 = 0x00000005 LR(R14) = 0x8003574c
  R7 = 0x00000000 PC(R15) = 0x8002f5e4
  PSR = 0x6000019f
  DFSR = 0x00001808 IFSR = 0x00000005
  DFAR = 0x4804a038 IFAR = 0x00000000
  ti.sysbios.family.arm.exc.Exception: line 180: E_dataAbort: pc = 0x8002f5e4, lr = 0x8003574c.
  xdc.runtime.Error.raise: terminating execution


As bios_6_40_03_39 was ok I wanted to get rid of bios_6_41_02_41.
I started removing
  SYS/BIOS(IDE Client) 6.41.02.41
from within CCSv6.
Then I run 'uninstall' from the folders bios_6_41_02_41 and bios_6_40_03_39.
But reinstallation of bios_6_40_03_39 did not lead to the installation of a
  SYS/BIOS(IDE Client) 6.40.03.39
in CCSv6.
I could prove that a .out file that had been compiled before behaved correctly (stepping, reaching breakpoints).
But after recompilation it did not.
I suppose that
  SYS/BIOS(IDE Client) 6.40.03.39
is the program I am missing.

How can I install SYS/BIOS(IDE Client) for the previous bios version?

Does anybody know how to get out of that misery?

Thank you.

Regards,
Martin H.

  • Hi Martin,

    To un/install products in CCS go to the top menu and select "Window->Preferences".  A window like the following should appear:

    The installed products can be seen by selecting "Code Composer Studio -> RTSC -> Products".  If a version of SYS/BIOS appears, feel free to uninstall it.  Restart CCS and you should get a pop-up window asking you to install some products.  If that window does not appear, you can return to this window and click "Search New".

    Hope this helps,

    -- Emmanuel

  • Hi Emmanuel,

    thanks to your advice I am back now to
        SYS/BIOS(IDE Client) 6.40.03.39 and
        SYS/BIOS(Target Content) 6.40.03.39
    But the proble remains. When the .out file is loaded the program counter stops in loader_exit() in exit.c and the registers are displayed. The next step is an infinite loop in abort().

    Debugging is possible
    - if 'Add the clock support module' in app.cfg is NOT selected
    - if 'Add the clock support module' in app.cfg IS selected and the timer id is set to ANY
      Choosing another timer id  - like 1 or 5 for instance - leads to the same behavior.

    Also with the clock timer id set to ANY and an additional timer instance created in app.cfg (SYS/BIOS-->Scheduling-->Timer) leads to the same result.

    I don't know what to do.
    Reinstall CCSv6? Create timers dynamically?

    Regards,

    Martin H.

  • Meanwhile I tried to create a dynamic timer instance for timer3.
    All timers in app.cfg have been deleted except for the clock with timer id ANY.

    This is the code:
        Error_Block eb3;
       Timer_Params_init(&timerParams3);
       timerParams3.period = 2500;
       timerParams3.periodType = Timer_PeriodType_MICROSECS;
       Error_init(&eb3);
        hTimerT3 = Timer_create(3, (Timer_FuncPtr)TimingIsr, &timerParams3, &eb3);
       if(hTimerT3 == NULL) {
       ...}
    The last line with the if-statement is never reached.
    Instead an exception is thrown:
        [CortxA8] 0x6000019f R8 = 0x83fa1058
        R1 = 0x00000000 R9 = 0x00000000
        R2 = 0x83f95798 R10 = 0x00000000
        R3 = 0x83f955c8 R11 = 0x83fa1040
        R4 = 0x83e44370 R12 = 0x48046000
        R5 = 0x6000011f SP(R13) = 0x83f955b8
        R6 = 0x83f95798 LR(R14) = 0x800363f4
        R7 = 0x83f95798 PC(R15) = 0x8002ff54
        PSR = 0x6000019f
        DFSR = 0x00001808 IFSR = 0x00000000
        DFAR = 0x48046038 IFAR = 0x00000000
        ti.sysbios.family.arm.exc.Exception: line 180: E_dataAbort: pc = 0x8002ff54, lr = 0x800363f4.
        xdc.runtime.Error.raise: terminating execution

    I don't know if this behavior has something to do with the problems I got when the timer instances were created in the app.cfg, but somehow it looks similar.

    Any suggestions?

    Regards,
    Martin H.

  • Hi Martin,

    I was able to reproduce your problem, the exception is due to code trying to configure a Timer which has not yet been enabled.  Usually, the GEL file initializes 1 or 2 Timers during the initialization process and the rest are left disabled.  SYS/BIOS does not enable these clocks either, so we need to add code to do so.

    There are a couple of steps required to get this working:

    • Map timer peripheral registers in MMU:  configure the MMU to not cache peripheral registers.  Add the code below to your .cfg file.  
    var Mmu = xdc.useModule('ti.sysbios.family.arm.a8.Mmu');
    Mmu.enableMMU = true;
    
    /* MAP CM_PER Register Space in MMU */
    /* Force peripheral section to be NON cacheable */
    var peripheralAttrs = {
        type : Mmu.FirstLevelDesc_SECTION, /* SECTION descriptor */
        bufferable : false,
        cacheable  : false,
        shareable  : false,
        noexecute  : true,
    };
    
    /* Define the base addresses in which the peripherals reside. */
    /* Clock Module, GPIO0, UART0, I2C0 */
    var peripheral0BaseAddr = 0x44E00000
    /* GPIO1, UART1, UART2, I2C1, McSPI0, McASP0 CFG, McASP1 CFG */
    var peripheral1BaseAddr = 0x48000000
    /* GPIO2, GPIO3, UART3, UART4, UART5, I2C2, McSPI1 */
    var peripheral2BaseAddr = 0x48100000
    
    /* Configure the corresponding MMU page descriptor */
    Mmu.setFirstLevelDescMeta(peripheral0BaseAddr, peripheral0BaseAddr, peripheralAttrs);
    Mmu.setFirstLevelDescMeta(peripheral1BaseAddr, peripheral1BaseAddr, peripheralAttrs);
    Mmu.setFirstLevelDescMeta(peripheral2BaseAddr, peripheral2BaseAddr, peripheralAttrs);

    (NOTE: this is just some example code I had stored.  The base addresses can be found in the device TRM.  You may need to add additional entries if you want to use other peripherals not already included (or maybe remove some).  See SYS/BIOS cdoc for more details: ti.sysbios.family.arm.a8.mmu).

    • Create a FirstFxn: these are functions which execute after .c_int00.  We will create one to set the timer enable bits.  Add the code below to your .cfg file:
    // get handle to xdc Startup module
    var Startup = xdc.useModule('xdc.runtime.Startup');
    // install a "first function"
    var len = Startup.firstFxns.length
    Startup.firstFxns.length++;
    Startup.firstFxns[len] = '&dmTimerClkInitialization';

    (NOTE: &dmTimerClkInitialization is the name of the function we must define in our application which will enable timers.  See ti.sysbios.BIOS for more info on FirstFxns)

    Determine Timer config register: the mapping from SYS/BIOS timer numbers to actual device timers is found in the Timer Mapping Tables (see cdoc ti.sysbios.timers.dmtimer.Timer).  Timer config register addresses can be found in the TRM.  Here are a few:

      • Timer 2 = 0x44e00080
      • Timer 3 = 0x44e00084
      • Timer 4 = 0x44e00088

      • Timer 5 = 0x44e000ec
      • Timer 6 = 0x44e000f0
      • Timer 7 = 0x44e0007c

    • Define the FirstFxn in your application: add code to enable the Timers used.  Something similar to the code below:
    Void dmTimerClkInitialization() {
    	/* Set DMTimer 4 clock enable bit */
    	*((volatile uint32_t *) 0x44E00088) = (uint32_t) 2;

    /* Poll until timer is enabled */ while (*((volatile uint32_t *) 0x44E00088) == 0x30000) ; }

    You should be able to compile and run the example.  I have attached my project for your reference (7536.i2c_led_example.zip).

    Hope this helps,

    -- Emmanuel

  • Hi Emmanuel,

     

    thanks for your very detailed response and the attached project which was very helpful.

    I followed your procedure and enabled Timer3 (DMTimer5) and then created the timer manually (not with  XGCONFIG). The exception is gone and the ISR is called periodically.

    However, the period is not yet correct. It is much too short (microseconds).

    With your example the time between 2 interrupts also is only 11.6µs. I would have expected 10ms.

    Did I forget to set a prescaler? Or would I have to select a different clock source somewhere?  BIOS_getCpuFreq(&cpuFreq) returns 550MHz.

     

    One difference I noticed is that in my app.cfg there is no Clock.period set. Is that correct? I have attached app.cfg.

     

    It is very convenient to create timer instances using XGCONFIG. But how would I access the parameter structure of such a timer dynamically? How would I make it global? Using

    #include <xdc/cfg/global.h> 

    in the .c file does not seem to work.

     

    Regards,

    Martin H.

     

     0743.Debugging Problem_app.zip

  • Hi Emmanuel,

    one issue - the one regarding the period - could be solved:

    Obviously the input signal for the timer must be CLK_32KHZ (32,768kHz). But by default it is set to CLK_M_OSC.

    Adding

    #define CM_DPLL 0x44E00500	// Baseaddr. f. Clock Module PLL Registers
    #define CLKSEL_TIMER5_CLK 0x18
    HWREG(CM_DPLL + CLKSEL_TIMER5_CLK) = 2; // 0x2 Select CLK_32KHZ clock

    to dmTimerClkInitialization()  selects that clock of 32,768kHz for TimerId3 (=DMTimer5).

    Details can be found at 8.1.12.3.6 CLKSEL_TIMER5_CLK Register in the TRM for AM3359.

    Now the period is as expected.

    Regards,

    Martin H.

  • Hi Martin,

    Sorry for the delayed response.  Glad to see you solved the clock source problem.  

    Martin H. said:

    It is very convenient to create timer instances using XGCONFIG. But how would I access the parameter structure of such a timer dynamically? How would I make it global? Using

    #include <xdc/cfg/global.h> 

    in the .c file does not seem to work.

    Timer params are only used when the timer is being created, so if you want to dynamically modify your timer you have to delete and then create it again.  If you will be modifying your timers frequently, I would recommend doing timer creation within your application (instead of XGCONF).  Just ensure the timer is enabled before your code tries to open it (use the FirstFxn like mentioned above). 

    Regards,

    -- Emmanuel