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.

2,353 Responses to Compiling CMEM for the Beagleboard…

  1. Pingback: bill printing services

  2. Pingback: de gournay wallpaper cost

  3. Pingback: pastoral wallpaper

  4. Pingback: cheap wall murals

  5. Pingback: hand painted murals on walls

  6. Pingback: design steel buildings

  7. Pingback: bill mail service

  8. Pingback: Click This

  9. Pingback: Affordable Basement Finishing Company

  10. Pingback: Click Here

  11. Pingback: grisaille mural wallpaper

  12. Pingback: basement remodeling denver co

  13. Pingback: bill printing services

  14. Pingback: zuber wallpaper reproductions

  15. Pingback: handpainted murals

  16. Pingback: mural paper

  17. Pingback: reproduction french scenic wallpaper

  18. Pingback: basement remodel denver

  19. Pingback: de gournay wallpaper ebay

  20. Pingback: Susan Harter Murals

  21. Pingback: basement contractor denver

  22. Pingback: mail printing services

  23. Pingback: Susan Harter Murals

  24. Pingback: wall mural paper

  25. Pingback: grisaille mural wallpaper

  26. Pingback: de gournay wallpaper cost

  27. Pingback: church building construction

  28. Pingback: statement printing services

  29. Pingback: lawn doctor fort collins

  30. Pingback: denver basements

  31. Pingback: Susan Harter Muralpapers

  32. Pingback: View Here

  33. Pingback: Power raking Greeley co

  34. Pingback: Susan Harter Mural Papers

  35. Pingback: griffin and wong wallpaper

  36. Pingback: hand painted mural

  37. Pingback: Susan Harter Wallpaper

  38. Pingback: bill mail service

  39. Pingback: Susan Harter Mural Papers

  40. Pingback: yard work fort collins

  41. Pingback: basement finishing parker co

  42. Pingback: de gournay wallpaper knock off

  43. Pingback: See This

  44. Pingback: lechman lawn service

  45. Pingback: business invoice printing

  46. Pingback: Susan Harter Muralpapers

  47. Pingback: reproduction french scenic wallpaper

  48. Pingback: hand painted murals

  49. Pingback: gracie wallpaper

  50. Pingback: metal building erector

Leave a Reply