Compiling CMEM for the Beagleboard…

Since I tend to forget these things, here’s a little tutorial how to compile the Texas Instruments CMEM and SDMA kernel-modules for the beagleboard. I don’t like the codec-engine build process, therefore I’ll compile the kernels by hand.

So what’s CMEM all about?

In a nutshell CMEM is a kernel-module that allows you to allocate contiguous memory on the OMAP3, map this memory it into the address-space of a user-mode program so you can read and write to it.

CMEM also gives you the physical address of these memory-blocks.

This is important if you want to share some memory with the C64x+ DSP as the DSP has no idea what the memory manager of the Cortex-A8 is doing. It also allows linux user-mode programs to allocate memory that can be used with DMA.

Things you need:

  • The sources of the libutils from the TI website (registration is required but free). I’ve used release 2.24 which works fine with my 2.6.29-omap1 kernel image.
  • The linux kernel-sources for the beagleboard. If you use OpenEmbedded and you have already compiled an image you’ll most likey find them at $OE_HOME/tmp/staging/beagleboard-angstrom-linux-gnueabi/kernel/.
  • A cross-compiler toolchain for ARM. I still use the CodeSourcery 2007q3 light release. Works for me.
  • A beagleboard. Also not strictly required it makes perfect sense to have one.

Howto compile CMEM:

  1. Untar the linuxutils package. The place where to untar them is not important.
  2. Go into the CMEM subfolder. For the 2.24 release it’s the ./packages/ti/sdo/linuxutils/cmem/ folder.
  3. Take a look at the Rules.make file. Messy, ain’t it?  Remove the write protection.. chmod +w Rules.make will do that. You now have to adjust the pathes in that file or if you’re like me – delete it and write it from scratch:Here is my copy with everything not needed removed:
    # path to your toolchain. Yes, you need to set it twice (don't ask...)
    MVTOOL_PREFIX=/opt/CodeSourcery/bin/arm-none-linux-gnueabi-
    UCTOOL_PREFIX=/opt/CodeSourcery/bin/arm-none-linux-gnueabi-
    
    # path to the kernel-sources:
    LINUXKERNEL_INSTALL_DIR=${OE_HOME}/tmp/staging/beagleboard-angstrom-linux-gnueabi/kernel
    
    # some config things:
    USE_UDEV=1
    MAX_POOLS=128
  4. That’s it.. If all pathes are correct “make release” should build the kernel module and some test applications.

Howto test CMEM:

  1. Copy the kernel-module to the beagleboard. For the test I’ve just copied it into /home/root/. You’ll find the kernel-module at ./src/module/cmemk.ko
  2. On the board, check your U-Boot boot-parameters. Since CMEM manages physical memory you have to restrict the amount of memory managed by linux. To put aside some memory add the  mem=80M directive to the bootargs. You can of course use a different setting if you want to, but the following examples assume 80M for the linux-kernel and the rest for DSP and CMEM.
  3. Boot the beagle and login as root.
  4. Load the kernel-module. Let’s keep things simple. We create a single 16mb memory pool. To do so load the module like this:
    /sbin/insmod cmemk.ko pools=1x1000000 phys_start=0x85000000 phys_end=0x86000000

    If everything worked as expected you’ll find the following line in the kernel-log (type dmesg to get it):

    cmem initialized 1 pools between 0x85000000 and 0x86000000

    If not – well – CMEM will give you a bunch of hints in the kernel-log if it had problems during initialization. Most likely you’ve got the addresses wrong. As the start-address you should pass 0x80000000 plus the size you’ve specified in the u-boot bootargs. Add the sizes of all of your CMEM-pools and use this as the end address.

  5. While the module is loaded you’ll find a file under /proc/cmem with some statistics.
  6. If everything worked so far you can run some of the demo-applications like apitest. They’re are located in the ./apps/apitest/ folders.

Compile an ARM program that uses CMEM:

This is easy. Copy ./src/interface/cmem.h to a place where the cross-compiler will find it and add one of the cmem.a libraries to your project. Since I like to keep things simple I’ve just added the interface source to my project. It’s  ./src/interface/cmem.c.

Now you can allocate contiguous memory and get the physical address of it. Big deal, eh? Honestly, like I said CMEM only makes sense if you want to make use of the C64x+ DSP or the SDMA of the OMAP3.

This entry was posted in Beagleboard, DSP, Linux, OMAP3530 and tagged . Bookmark the permalink.

1,629 Responses to Compiling CMEM for the Beagleboard…

  1. Pingback: Organic Aroma Sense

  2. Pingback: fire glass pit

  3. Pingback: internet marketing firm

  4. Pingback: fire glass vs lava rock

  5. Pingback: seo outsource

  6. Pingback: See All

  7. Pingback: Organic Aroma Sense

  8. Pingback: essential oil recipes for anxiety

  9. Pingback: how to build a propane fire pit in your backyard

  10. Pingback: Warming trends

  11. Pingback: clock parts manufacturing

  12. Pingback: what essential oils are good for anxiety

  13. Pingback: best essential oils for depression

  14. Pingback: parts for clocks

  15. Pingback: build your own fire pit

  16. Pingback: fire pit ignition systems

  17. Pingback: essential oils for relaxation

  18. Pingback: visit website here

  19. Pingback: clock repair videos

  20. Pingback: best essential oil for anxiety

  21. Pingback: best essential oil for anxiety

  22. Pingback: affiliate marketing

  23. Pingback: build your own fire pit

  24. Pingback: fire pit cover

  25. Pingback: View Now

  26. Pingback: video production

  27. Pingback: natural gas fire pit insert

  28. Pingback: essential oil blend for anxiety

  29. Pingback: USA Made clock movements

  30. Pingback: relaxing essential oils

  31. Pingback: crossfire burner system

  32. Pingback: Organic Aroma Sense

  33. Pingback: crossfire fire pit

  34. Pingback: essential oil recipes for anxiety

  35. Pingback: public address transmitters

  36. Pingback: best motor for clocks

  37. Pingback: essential oils for anxiety in children

  38. Pingback: fire pit rings

  39. Pingback: DIY clock replacement parts

  40. Pingback: natural anxiety

  41. Pingback: outdoor clocks for business

  42. Pingback: gas fire pit burner design

  43. Pingback: gas fire pit burner design

  44. Pingback: read more

  45. Pingback: time synchronazation clocks

  46. Pingback: essential oils for anxiety

  47. Pingback: natural gas fire pit glass

  48. Pingback: cure anxiety

  49. Pingback: GPS Receiver

  50. Pingback: Montana Firepits

Leave a Reply