This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to simulate special registers in ARM Core

Hi all,

I have a problem.

I can simulate my application (C and Keil uVision5). Target: LPC824
But, simulator stopped at one line: wait for PLL Locked.

After change PLL control register (SYSPLLCTRL), application must wait while bit LOCK in SYSPLLSTAT register is zero. In realtime debugging in target working fine, but in simulator don't work - SYSPLLSTAT don't changed.

Please, How to simulate changes in SYSPLLSTAT register (this is read-only register)?

LPC82x User's manual: www.nxp.com/.../UM10800.pdf - see 5.6.4 on page 35

Thank you.

peter

Parents
  • Hmm,

    I cannot change source code due to simulation... :-)

    Ok, after very quick study I found solution.

    - Create file simulation.ini with this content:

    FUNC void Setup (void) {
    _WDWORD(0x4004800C, 0x00000000);                        // PLL not Locked - default value
    SP = _RDWORD(0x00000000);
    PC = _RDWORD(0x00000004);
    }
    
    LOAD %L INCREMENTAL                                     // Download
    
    Map 0x4004800C , 0x4004800f READ WRITE;                 // map this location (reg SYSPLLSTAT) as R/W
    define button "Toggle PLL Lock bit",  "_WDWORD(0x4004800C, 0x00000001 & (!_RDWORD(0x4004800C)))" ;          // click will toglle value of SYSPLLSTAT
    
    Setup();                                   // Setup for Running
    g, main
    


    - select this file in dialog "Options for Target '...'" -> Debug Tab -> initialization file for simulator
    - now start debug (Simulation)
    - Go MENU->VIEW->TOOLBOX WINDOWS, and now You can see toolbox with new button. Try to press it...

    This is only quick solution for today (maybe not ideal, but sufficient for me).... :-)

Reply
  • Hmm,

    I cannot change source code due to simulation... :-)

    Ok, after very quick study I found solution.

    - Create file simulation.ini with this content:

    FUNC void Setup (void) {
    _WDWORD(0x4004800C, 0x00000000);                        // PLL not Locked - default value
    SP = _RDWORD(0x00000000);
    PC = _RDWORD(0x00000004);
    }
    
    LOAD %L INCREMENTAL                                     // Download
    
    Map 0x4004800C , 0x4004800f READ WRITE;                 // map this location (reg SYSPLLSTAT) as R/W
    define button "Toggle PLL Lock bit",  "_WDWORD(0x4004800C, 0x00000001 & (!_RDWORD(0x4004800C)))" ;          // click will toglle value of SYSPLLSTAT
    
    Setup();                                   // Setup for Running
    g, main
    


    - select this file in dialog "Options for Target '...'" -> Debug Tab -> initialization file for simulator
    - now start debug (Simulation)
    - Go MENU->VIEW->TOOLBOX WINDOWS, and now You can see toolbox with new button. Try to press it...

    This is only quick solution for today (maybe not ideal, but sufficient for me).... :-)

Children
No data