I have MATLAB / Simulink working with BeagleBone Black. I’m posting the instructions here in case anyone else might find it useful.
I’m using it with the audio cape, so these instructions include how to make the alsa sound Simulink blocks work. I haven’t tried using HDMI audio; if you want to do that it might require a different alsa configuration.
BeagleBone Black Configuration:
You’ll need to boot your BeagleBone to Ubuntu with a current image, anything prior to kernel 3.8.13-bone31 won’t work with the Audio Cape.
I used this one for uSD card:
and this one for eMMC:
decompress with 7zip, and write to uSD card with Win32 Disk Imager:
Boot to the SD card (requires holding down the button near the uSD card slot while applying power).
If you use the eMMC flasher, wait 10 minutes until LEDs all come on steady, then reboot without the uSD card.
create a swap file (I used 512MB for booting from internal eMMC, use larger if booting from uSD card)
mkdir -p /var/cache/swap/
dd if=/dev/zero of=/var/cache/swap/swapfile bs=1M count=512
chmod 0600 /var/cache/swap/swapfile
set the swap file to load on boot by adding an entry to /etc/fstab:
/var/cache/swap/swapfile none swap sw 0 0
install required packages
apt-get install build-essential libsdl1.2-dev mplayer espeak alsa-utils
wget -P /var/lib/alsa http://beagleboardtoys.info/files/BeagleBoneAudio/asound.state
set up build environment
mv /usr/include/sys/asoundlib.h /usr/include/arm-linux-gnueabihf/sys
ln -s /usr/include/arm-linux-gnueabihf/sys /usr/include/sys
ln -s /usr/include/arm-linux-gnueabihf/asm /usr/include/asm
ln -s /usr/include/arm-linux-gnueabihf/bits /usr/include/bits
ln -s /usr/include/arm-linux-gnueabihf/gnu /usr/include/gnu
test sound output if using the audio cape
run alsamixer, and crank up the levels on “PCM” and “HP DAC”, or you won’t hear anything
test that sound comes out, run 2X because sound ramp-up is delayed
test with mp3 file if you have one
install the BeagleBoard target. For R2012A/B, run “targetinstaller”.
For R2012B, set “Template” to “gmake_remotebuild” & “Configuration” to “LinuxRemoteBuild”
For R2012A, set “Template” to “beagleboardgmake” and “Configuration” to “BeagleBoard”
On the “Compiler” tab, set “Arguments” to “-c -mfloat-abi=hard”
- in your Simulink model, select “Tools → Run On Target Hardware → Options”
Select “Run On Target Hardware”, then:
“Target Hardware” is “BeagleBoard”
“Enable External mode” should be checked, and port set to “17725”
For “Host name”, enter the IP address of your BeagleBone
For “User name”, enter “Ubuntu”
For “Password”, enter “temppwd” (or current password if you changed it)
For “Build Directory”, enter “/home/Ubuntu”
In your Simulink model, if you use the ALSA audio blocks, leave the device name set to ‘default’
Run your model using “Tools → Run On Target Hardware → Run”
MATLAB will generate C code from your Simulink model, send it to the BeagleBone, build the code on the BeagleBone, then run the code on the BeagleBone. You can adjust parameters in your model while it runs (i.e. move a slider or type in a new value), and the new values will be sent to the BeagleBone.