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

some queries regarding MMU & TCM

Note: This was originally posted on 20th May 2009 at http://forums.arm.com

Hi All,

         I want to make use of MMU,TCM & I/D Cache features in ARM.But i got blocked :(  with the following doubts and not able to get clear information from the documents available in net.
 
    -> Is compact OS(like WINCE/Linux) needed to configure MMU in ARM ?
    -> From my application(user mode),can i enter supervisor mode using SWI to configure MMU,       TCM,I/D cache?
    -> In ARM1136J-S,can we use DMA in application, else DMA is used only by the processor to    transfer data from external memory to TCM?
    -> Compared to ARM926EJ-S, in ARM1136J-S is there any improvement in MMU,TCM,I/D Cache  functionalities?

Thanks In Advance :) ,
satish
  • Note: This was originally posted on 20th May 2009 at http://forums.arm.com

    Thanks for the early reply.......

    You don't _need_ an OS to configure the MMU, but the processors that have an MMU are generally applications processors and will usually run an OS of some kind.


    Think about the implications of giving user-mode applications the ability to enter supervisor mode!

    so,you mean to say,not to enter supervisor mode from user mode?
    Is MMU should be configured before entering application?

    You _can_ execute a SWI instruction to enter supervisor mode, but the call will be handled by the processor's SWI handler. In an environment with an OS, this is typically used for system calls.

    If you are running on an OS, it should configure the MMU and caches for you. If you have specific requirements (such as the ability to execute the contents of some memory or flush the caches), the OS may provide you with a library function to do that, but there is no generic way to do that from user space and the OS may not allow you to do it.

    If you are not running on an OS, you will want to turn on the MMU anyway, even if it has a flat memory map, as the I cache cannot be enabled without it. However, if you are not running on an OS you can have privileged access to whatever part of the processor you want.


    As you said Supervisor mode will be used by OS(if any),so if  i am not running any OS then which priviliged mode i should use to configure MMU?
    how can i switch from user mode to priviliged mode and vice versa?

    Yes, but the operations will need to be performed by some privileged code. You will need OS support, usually in the form of a driver. If there is no driver available for your system, you will need to write one.


    Suppose if DMA is implemented with a driver,then it will add some overhead to application.So,in this case, is DMA implementation faster enough than memcpy?


    Thanks In Advance,
    satish
  • Note: This was originally posted on 21st May 2009 at http://forums.arm.com

    Thanks for your reply....... :(
    The OS will configure it for you early in its boot process. It will adjust it often whilst it is running, but if you're writing a typical application you won't need to know about what it is doing.

    However, if you're hoping to use DMA, you will need to know the physical address of your memory, but typically only drivers can do that (depending on the OS).


    Any mode other than user mode is considered privileged, so in theory you can configure the MMU from any other mode. However, system mode is probably the most suitable mode for normal OS execution.


    Yes, there will be an overhead. If your memory block is 128B long, I'd use memcpy. If your memory block is 40MB, DMA will be faster. However, there are many factors involved so it really depends on what you're doing and how you're doing it. If in doubt (and you have the time), try doing both and running some benchmarks.

    where can i get information to configure DMA in application?
    any example code available?

    Thanks In Advance,
    satish
  • Note: This was originally posted on 20th May 2009 at http://forums.arm.com

    -> Is compact OS(like WINCE/Linux) needed to configure MMU in ARM ?

    You don't _need_ an OS to configure the MMU, but the processors that have an MMU are generally applications processors and will usually run an OS of some kind.

    -> From my application(user mode),can i enter supervisor mode using SWI to configure MMU, TCM,I/D cache?

    Think about the implications of giving user-mode applications the ability to enter supervisor mode!

    You _can_ execute a SWI instruction to enter supervisor mode, but the call will be handled by the processor's SWI handler. In an environment with an OS, this is typically used for system calls.

    If you are running on an OS, it should configure the MMU and caches for you. If you have specific requirements (such as the ability to execute the contents of some memory or flush the caches), the OS may provide you with a library function to do that, but there is no generic way to do that from user space and the OS may not allow you to do it.

    If you are not running on an OS, you will want to turn on the MMU anyway, even if it has a flat memory map, as the I cache cannot be enabled without it. However, if you are not running on an OS you can have privileged access to whatever part of the processor you want.

    -> In ARM1136J-S,can we use DMA in application, else DMA is used only by the processor to transfer data from external memory to TCM?

    Yes, but the operations will need to be performed by some privileged code. You will need OS support, usually in the form of a driver. If there is no driver available for your system, you will need to write one.

    Thanks,
    Jacob
  • Note: This was originally posted on 20th May 2009 at http://forums.arm.com

    so,you mean to say,not to enter supervisor mode from user mode?
    Is MMU should be configured before entering application?

    The OS will configure it for you early in its boot process. It will adjust it often whilst it is running, but if you're writing a typical application you won't need to know about what it is doing.

    However, if you're hoping to use DMA, you will need to know the physical address of your memory, but typically only drivers can do that (depending on the OS).

    As you said Supervisor mode will be used by OS(if any),so if  i am not running any OS then which priviliged mode i should use to configure MMU?
    how can i switch from user mode to priviliged mode and vice versa?

    Any mode other than user mode is considered privileged, so in theory you can configure the MMU from any other mode. However, system mode is probably the most suitable mode for normal OS execution.

    Suppose if DMA is implemented with a driver,then it will add some overhead to application.So,in this case, is DMA implementation faster enough than memcpy?

    Yes, there will be an overhead. If your memory block is 128B long, I'd use memcpy. If your memory block is 40MB, DMA will be faster. However, there are many factors involved so it really depends on what you're doing and how you're doing it. If in doubt (and you have the time), try doing both and running some benchmarks.