I am using a pocket beagle with bela cape and I am trying to build a xenomai kernel, but every time I install the kernel the /sys/class/remoteproc/remoteproc1 and /sys/class/remoteproc/remoteproc2 vanish.

I tried with the debian image and the kernels from RobertCNelson.
Is there a way to get xenomai and the PRUs working.

Is there some configuration I am missing which disables the PRUs when building with xenomai?

    I need at least on PRU to do some calculations before a can continue inside a xenomai task.
    As I also need to read data from the bela, I asume that at least one PRU is used by bela.

    When installing the bela image only remoteproc0 is available, which makes sense if the other is used by bela, but is remoteproc0 even a PRU?

    But why is only remoteproc0 available when patching the default Debian image of the beagle bone with xenomai?
    Normally on Debian the PRUs are available on remoteproc1 and remoteproc2 while the remoteproc0 interface is not a PRU.

    I am basic trying trying to read some analogue data as fast as possible and do some calculations on these samples.

      I never used remoteproc.

      IAbWywUP but is remoteproc0 even a PRU?

      On the Bela image, this:

      cat /sys/class/remoteproc/remoteproc0/device/modalias

      gives:

      of:Nwkup_m3T<NULL>Cti,am3352-wkup-m3

      so remoteproc0 seems to be the Cortex M3 core that is used for power management.

      IAbWywUP Is there a way to get xenomai and the PRUs working.

      We use the uio_pruss driver to interface with the PRU instead of remoteproc.
      If you want to use another PRU alongside the Bela environment, the easiest way is to run one of the examples Extra/second-pru or Extra/pru-pwm. We write in PRU assembly and use pasm to build the code. I know C compilers for the PRU exist, but I never used one. Happy to have a look if you have one to share though!

      IAbWywUP every time I install the kernel the /sys/class/remoteproc/remoteproc1 and /sys/class/remoteproc/remoteproc2 vanish.

      I think you may have to load one of the relevant PRU device overlays. Not sure where they would be on a regular beagleboard image (the online repo is here). On a Bela image they are in /opt/bb.org-overlays/:

      AM335X-PRU-RPROC-4-14-TI-00A0.dts
      AM335X-PRU-RPROC-4-4-TI-00A0.dts
      AM335X-PRU-RPROC-4-4-TI-PRUCAPE-00A0.dts
      AM335X-PRU-RPROC-4-9-TI-00A0.dts

      I am not sure if it is possible to have one PRU managed with remoteproc (for your use) and one with uio_pruss (as required by Bela): you may have to modify the overlay.

        Ok, thank you.
        Then i probably will just also use the uio_pruss driver, maybe I get remoteproc working but if not it should also be fine.

        giuliomoro so remoteproc0 seems to be the Cortex M3 core that is used for power management.

        This makes sense and explains why cat /sys/class/remoteproc/remoteproc0/firmware returns am335x-pm-firmware.elf.

        I think using Code Composer Studio (eclipse) and writing in C is somewhat nicer as pure assembly + you can always embed assembly. But anyhow the result should be similar enough for my use case.

        giuliomoro I think you may have to load one of the relevant PRU device overlays. Not sure where they would be on a regular beagleboard image (the online repo is here). On a Bela image they are in /opt/bb.org-overlays/

        I already looked into the overlays, at first glance it seams I got them successfully loaded, but I have seen no change.
        Maybe have done something wrong. I will try again.

        There are also some kernel configuration differences between the kernel from the bela image and the beagle bone Debian image for example CONFIG_PRU_REMOTEPROC=m but applying then to the RobertCNelson/ti-linux-kernel-dev xenomai kernel did not solve it for some reason (loading the modules does not create /sys/class/remoteproc/remoteproc 1 and to).
        But I have not looked into the kernel sources, maybe these options doesn’t work at the moment.

        The uio_pruss driver seams to be the easiest solution to get going.

          IAbWywUP There are also some kernel configuration differences between the kernel from the bela image and the beagle bone Debian image for example CONFIG_PRU_REMOTEPROC=m

          you are right, on our image we have:

          # grep REMOTEPROC /boot/config-4.14.108-ti-xenomai-r135
          CONFIG_REMOTEPROC=y
          # CONFIG_PRUSS_REMOTEPROC is not set

          IAbWywUP I already looked into the overlays, at first glance it seams I got them successfully loaded, but I have seen no change.

          You should load them by adding them to uEnv.txt and not using the capemgr (the latter has been discontinued). But again, without the kernel module, it won't work. If you recompile the kernel, always double check in dmesg to see if the module is actually loaded. It may well conflict with the Bela overlay.

          IAbWywUP I think using Code Composer Studio (eclipse) and writing in C is somewhat nicer as pure assembly + you can always embed assembly.

          Do you have a guide you can refer me to?

            This is a good tip, I will try to add them to /boot/uEnv.txt. I Think I tried this but back then I had maybe not build the modules probably.

            giuliomoro Do you have a guide you can refer me to?

            I have to see, I think I have some sumumary on how to set everthing up.
            But in essence you just download the Code Composer Studio (CCS) installer and extract the AM335X SDK.
            The SDK Packages then contains example projects. For non PRU programs I just copied one of them, changed the project Makefile and name (searched for the old name inside the project xml file). Because I was to layzy to configure a new Project. But for PRU programs is just create a new Project (there is PRU tab on the new project wizard) but I then copy the empty or not empty resource table over, depending on if I need timers and stuff or not. Not sure how I would create a resource table form scratch.
            After that you can create release or debug builds by clicking the build button inside CCS.
            If you need some includes just click on the top level element in the project tree and add them in the includes setting just as always when using eclipse.

            I did not try to debug or simulate the created PRU Firmware inside the IDE if this is even possible, i just copied them over to the PocketBone.

            There exists a version for Windows , Linux an Mac. I tried the Linux version first and it worked.
            Therefore I used this SDK version.
            But have seen people using the Windows version the same way just fine.

            I don't now where I downloaded CCS as a had installed it a while ago. I used CCS 9.3 but newer versions exist.
            You will probably find them on TIs website.

            I think i got it working now, that is xenomai with remoteproc PRU support.
            In short it was the disabled kernel configuration in combination with the device tree overlay.

            I will thest it now, thanks a lot for helping me get it working.

            22 days later

            @IAbWywUP what changes did you make to your kernel config? I can probably add them to the main image's next release