Introduction to Bela

Bela provides ultra-low latency, high quality audio, analog and digital I/O in a tiny self-contained package. It also features an on-board IDE that launches right in the browser. </br> Bela has

  • 8 channels of 16-bit analog I/O,
  • 16 digital I/O, stereo audio I/O, and
  • 2 built-in speaker amplifiers.

Bela runs a custom audio processing environment based on the Xenomai real-time Linux extensions.

Xenomai Kernel

Xenomai 3 is the new architecture of the Xenomai real-time framework, which can run seamlessly side-by-side Linux as a co-kernel system, or natively over mainline Linux kernels. The dual kernel core is codenamed Cobalt, the native Linux implementation is called Mercury .

  • cross-compiling
  • Robert Nelson's Source for xenomai kernel for the BBAI.
  • script on bbai that allows to install pre-built kernels. use parameter: --ti-xenomai-kernel, for xenomai kernel.
  • .deb images (linux-headers-4.19.94-ti-xenomai-r60_1bullseye_armhf.deb onwards… look like a list of xenomai kernels) Remarks:
    • scheduler can preempt non-preemptable kernel operations.
    • audio-thread can be set at a higher priority than the kernel.
    • mode switches into kernel mode need to be avoided in the audio thread.

PRU

The current Bela core code uses pasm to build the PRU assembly pru/pru_rtaudio.p. However both pasm and libprussdrv are now deprecated. They are replaced by clpru toolchain and remoteproc driver respectively.

CLPRU

  • The compiler accepts C/C++ source code and assembly code.It produces object code
  • The linker combines object files to create object file. The link step is optional,so you can compile and assemble many modules independently and link them later. Invoking the C/C++Compiler
     clpru [options] [filenames] [--run_linker [link_options] object files]]
    

    Explanation:

  • clpru: Command that runs the compiler and the assembler
  • options: ref pg 18 of this

Alternative to CLPRU is gcc itself that is available upstream, and has PRU compiler as well built in in the latest release. If gcc works well then we can go ahead with gcc, or else will use clpru.

References

  • Beaglebone PRU ADC
  • https://www.embeddedrelated.com/showarticle/603.php
  • https://beagleboard.org/static/prucookbook/#_compiling_with_clpru_and_lnkpru
  • https://github.com/alexanderhiam/PRU-stuffs
  • https://www.ti.com/lit/ug/spruhv7c/spruhv7c.pdf?ts=1621601881422&ref_url=https%253A%252F%252Fduckduckgo.com%252F