This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to make Ethos-U NPU work on an ARM Cortex-A + Cortex-M processor?

I have a question about how to make Ethos-U NPU work on a ARM Cortex-A + Cortex-M processor. First, I found ethos-u-linux-driver-stack and ethos-u-core-software on https://git.mlplatform.org/.

1. I know ethos-u-linux-driver-stack is Ethos-U kernel driver. Should it be integrated into the Linux OS running on Cortex-A or be integrated into the Linux OS running on Cortex-M? I am nor clear about which core it need to perform on.

2. For ethos-u-core-software, how to run it? I did't find the detail steps to run it. Does it run on NPU or any core?

3. Except the above two repos, is there any other repo necessory to make Ethos-U NPU work on an ARM Cortex-A + Cortex-M processor?

Thanks for your suggestion in advance.

Parents
  • We have tried to mimic what Linux does and abstract the Mailbox driver behind a Mailbox API. The APIs can be found in <ethos-u-core-software>/drivers/mailbox/include/mailbox.hpp and should allow developers to use any mailbox IP they prefer.

    We have a driver implementation for the Arm MHU v2, but it has not yet reach upstream.

    For a bare metal application instantiation could for example look like this:

    // Use section attributes to allow the linker script to place the queues at given addresses in memory
    __attribute__((section("ethosu_core_in_queue"))) MessageProcess::Queue<1000> inQueue;
    __attribute__((section("ethosu_core_out_queue"))) MessageProcess::Queue<1000> outQueue;
    Mailbox::YourCustomMailboxDriver mailbox;
    InferenceProcess::InferenceProcess inferenceProcess;
    MessageProcess::MessageProcess messageProcess(*inQueue.toQueue(), *outQueue.toQueue(), mailbox, inferenceProcess);

    // You need to implement this class for your custom mailbox driver
    class YourCustomMailboxDriver : public Mailbox {
    public:
        YourCustomMailboxDriver();
        virtual ~YourCustomMailboxDriver();

        // Trigger an IRQ on the remote CPU
        virtual bool sendMessage() final;

        // This function should be called from the IRQ routine
        // It should clear the IRQ and call notify() to inform registered clients about the received message
        virtual void handleMessage() final;
    };

Reply
  • We have tried to mimic what Linux does and abstract the Mailbox driver behind a Mailbox API. The APIs can be found in <ethos-u-core-software>/drivers/mailbox/include/mailbox.hpp and should allow developers to use any mailbox IP they prefer.

    We have a driver implementation for the Arm MHU v2, but it has not yet reach upstream.

    For a bare metal application instantiation could for example look like this:

    // Use section attributes to allow the linker script to place the queues at given addresses in memory
    __attribute__((section("ethosu_core_in_queue"))) MessageProcess::Queue<1000> inQueue;
    __attribute__((section("ethosu_core_out_queue"))) MessageProcess::Queue<1000> outQueue;
    Mailbox::YourCustomMailboxDriver mailbox;
    InferenceProcess::InferenceProcess inferenceProcess;
    MessageProcess::MessageProcess messageProcess(*inQueue.toQueue(), *outQueue.toQueue(), mailbox, inferenceProcess);

    // You need to implement this class for your custom mailbox driver
    class YourCustomMailboxDriver : public Mailbox {
    public:
        YourCustomMailboxDriver();
        virtual ~YourCustomMailboxDriver();

        // Trigger an IRQ on the remote CPU
        virtual bool sendMessage() final;

        // This function should be called from the IRQ routine
        // It should clear the IRQ and call notify() to inform registered clients about the received message
        virtual void handleMessage() final;
    };

Children
No data