#3903 closed defect (fixed)

raspberrypi2 libbsd 5-freebsd-12 does not build

Reported by: Chris Johns Owned by: Christian Mauderer <christian.mauderer@…>
Priority: high Milestone: 5.1
Component: network/libbsd Version: 5
Severity: blocker Keywords:
Cc: Blocked By:

Description (last modified by Chris Johns)

The build is failing with ...

/opt/work/rtems/5/lib/gcc/arm-rtems5/7.5.0/../../../../arm-rtems5/bin/ld: ./libbsd.a(rtems-kernel-nexus.c.18.o): in function `nexus_ofw_map_intr':
/opt/work/chris/rtems/rsb/rtems-source-builder.git/rtems/build/rtems-libbsd-v2b9172c9d42d056b6fb16d667091e2ee3ac64009-arm-rtems5-1/rtems-libbsd-2b9172c9d42d056b6fb16d667091e2ee3ac64009/build/arm-rtems5-raspberrypi2-default/../../rtemsbsd/rtems/rtems-kernel-nexus.c:359: undefined reference to `bsp_fdt_map_intr'
collect2: error: ld returned 1 exit status

Is something on master that needs to be back ported to the 5-freebsd-12 branch?

Attachments (1)

0001-bsp-raspberry-Add-a-bsp_fdt_map_intr.patch (1.8 KB) - added by Christian Mauderer on Mar 10, 2020 at 7:52:10 AM.
Untested patch for the problem.

Download all attachments as: .zip

Change History (9)

comment:1 Changed on Mar 8, 2020 at 12:39:59 AM by Chris Johns

Description: modified (diff)

comment:2 Changed on Mar 8, 2020 at 9:34:03 AM by Sebastian Huber

The bsp_fdt_map_intr() must be provided by the BSP, e.g. bsps/arm/beagle/start/bspstart.c.

comment:3 Changed on Mar 8, 2020 at 9:16:06 PM by Christian Mauderer

The same bug happens for libbsd master. Niteesh recently enabled FDT support for this BSP (following my suggestion) to be able to support the console for Pi2 and Pi3. It seems that I missed that libbsd doesn't build anymore when reviewing the patches. So the bug is not in libbsd but in RTEMS.

comment:4 Changed on Mar 8, 2020 at 9:50:56 PM by Christian Mauderer

And of course - like everything else on this chip family - the interrupts can't be simple on RPi. There are at least two groups. Interrupts from the GPU and ones from the normal system.

See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt?id=791d3ef2e11100449837dc0b6fe884e60ca3a484
and https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm2836-l1-intc.txt?id=36464580e658019ac7be26a08c4679bee0454d2c

The interrupts in the device tree look like this:

    // GPIO - 49 to 52 in RTEMS
    interrupts = <2 17>, <2 18>, <2 19>, <2 20>;
    // USB - 9 in RTEMS
    interrupts = <1 9>;
    // Mailbox - most likely 65 in RTEMS
    interrupts = <0 1>;

So I assume it should be a mapping like follows (in pseudo code):


    switch(first_number) {
    case 0:
        return second_number + BCM2835_IRQ_ID_BASIC_BASE_ID;
    case 1:
        return second_number;
    case 2:
        return second_number + MAGIC_OFFSET_FOR_SECOND_LEVEL;
        /* Handle invalid interrupt */

comment:5 Changed on Mar 9, 2020 at 6:27:45 AM by Sebastian Huber

At least it looks like the API can handle this.

comment:6 Changed on Mar 10, 2020 at 7:51:33 AM by Christian Mauderer

I created a patch that should work. But I didn't have the time to test it yet. I'll test it in the next few days.

Changed on Mar 10, 2020 at 7:52:10 AM by Christian Mauderer

Untested patch for the problem.

comment:7 Changed on Apr 4, 2020 at 10:55:45 AM by Christian Mauderer

Sorry for the long delay: The patch works and delivers the correct results (tested for the three cases GPIO0, USB and MBOX mentioned above). I'll send it to the mailing list.

comment:8 Changed on Apr 4, 2020 at 5:49:17 PM by Christian Mauderer <christian.mauderer@…>

Owner: set to Christian Mauderer <christian.mauderer@…>
Resolution: fixed
Status: newclosed

In bb8ae78/rtems:

bsp/raspberry: Add a bsp_fdt_map_intr().

Fixes #3903

Note: See TracTickets for help on using tickets.