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.

OMAP-L138: switching ARM to the privileged mode leads to falling into an exception handler

Other Parts Discussed in Thread: OMAP-L138, OMAPL138, SYSCONFIG

I try to switch ARM core wich works with SYS/BIOS into the privileged mode by instruction:

_call_swi(ARM_PRIV_MODE_KEY);

but it leads to falling into an exception handler. The problem is that there is an address of the subroutine of exception situated in the appropriate vector of SWI #0x50000. Why do it situated there? How to switch ARM core into the the privileged mode?

There are some screenshots which can help to understand the problem:

  • Dear Tankist,
    Can you please comment the "_call_swi(ARM_PRIV_MODE_KEY);" and test ?
    I hope its not required since newer chips does not require PRIVILEGE ACCESS for accessing the MMR registers.
    You can also enable privilege access by accessing the KICK registers.
    Please refer to the TRM. (technical reference manual)
  • Ok. I found out some information. My ARM core is running on SYSTEM mode. I can access to some registers through memory, but can't to another ones. I still can see them and can change their value in a 'Registers' view of CCS. When I try to watch them in a 'Memory Browser' view of CCS I've got an array of '?'.

    There are some screenshots:

    1) ARM is in the SYSTEM mode:

    2) I have an easy access to registers through the 'Registers' panel

    3) There is a part of OMAP-L138 datasheet which shows the memory map of PSC0 and PSC1 modules:

    4) This is a memory view of PSC0 registers:

    5) This is a memory view of PSC1 registers:

    6) This is a screenshot of the memory map in my CCS project:

    It looks equally for PSC0 and PSC1 parts of memory. If the processor tries to write in PSC1 registers it falls into a trap.

  • Yes, you van access the MMR registers in memory browser and register window of CCS.
    Which register do you want to access?
  • Of course, I need all of them. For example, to work with GPIO I need an access to PSC1 and GPIO registers set. But I haven't got it!

  • Hi Tankist,
    In OMAPL138 starterware, we have "system_config.lib" to enable the privilege access for accessing the registers.
    You can refer to the following e2e post and add the library into your project, then try to modify any MMR registers in your code and check.
    I hope this helps.

    e2e.ti.com/.../1331618
  • I've tried to do it before and I found out that this library is incompatible with SYS/BIOS (I didn't get into main() function and even couldn't stop an execution of the code).

    So I guess the right way is the injection into my project the source file boot.asm from bios_6_42_03_35\packages\ti\targets\arm\rtsarm\ location and correction it.

    I tried to do that but it was unsuccessful: the project has its own definitions from thr same file which was included as SYS/BIOS library.

    As you can see, the problem is a library from SYS/BIOS which is called boot.oe9.

    I hope if I can remove it from my project (or even exclude it from the build) I'll reach success, but I can't understand how to do it. Any ideas?

  • Hi Tankist,

    You have to enable the KICK registers before going to access the SYSCONFIG registers.

    C:\ti\OMAPL138_StarterWare_1_10_04_01\system_config\armv5\omapl138\startup.c

    /* Disable write-protection for registers of SYSCFG module. */
    SysCfgRegistersUnlock();

    //Shankari : Access all the required registers here

    /* Enable write-protection for registers of SYSCFG module. */
    SysCfgRegistersLock();

  • Fortunately, I realized what the problem was. It wasn't a problem with ARM privilege! It was just a problem with MMU module - it wasn't configured right.

    There is a piece of advice how to configure MMU in a right manner:

    https://e2e.ti.com/support/embedded/tirtos/f/355/t/193050#pi317008filter=answers&pi317008scroll=true

  • Hi Tankist,
    Glad to hear that you were able to solve the problem.
    Thanks for sharing the solution.