Post Go back to editing

Not able to program SHARCs through remoteproc utility after doing and upgrade from buildroot (kernel 4.0.0) to yocto (5.15.168) based build.

Category: Software
Product Number: ADSP-SC573

Hello Everyone,

I am working on migrating an adsp-sc573 project from previous buildroot based build system to a yocto based build system as mentioned in this documentation: Getting Started with ADSP‐SC573 (Linux for ADSP‐SC5xx Processors 3.1.2) · analogdevicesinc/lnxdsp-adi-meta Wiki

I have the kernel and most applications and services up and running, but there is a change in the sharc firmware loading mechanism as I can see from notable changes section here: Yocto Linux for ADSP-SC5xx Processors - Release 1.0.0: Release Notes [Analog Devices Wiki], that the corectrl utility has been replaced with remoteproc utility. This means that I am not able to use the earlier loadSharc-sc573 application to load the firmwares in SHARC (EE-399).

So, I tried using the remoteproc utility in the way as described here: Remoteproc Drivers [Analog Devices Wiki], i.e.

1. add the firmware to /lib/firmware/, with name matching the .dts

2. echo start > /sys/class/remoteproc/remoteproc0/state

I see that once this command is given, I get the following error:
remoteproc remoteproc0: powering up core1-rproc 

remoteproc remoteproc0: Booting fw image SHARC_Core1.ldr, size 152020 

adi-dma 3109b000.dma: DMA error on channel 43, stat = 0x3b400

I suspected that this error might be coming from some memory mismatch between my SHARC images and the region that is defined in the remoteproc dts entry, which defines the same L2 region for both the cores:

adi,l1-da = <0x240000 0x3a0000>;
adi,l2-da = <0x20080000 0x200C0000>;

And the legacy image that I am working with expects different banks for the two, i.e:
Core1: <0x200C0000 0x20100000>

Core2: <0x20080000 0x200C0000>

But even on changing the dts entries to match that did not work.

Also, there was an entry for the resource table, which is not present in my legacy image, but from the kernel source it looks like it is only required for rpmsg, which my legacy image doesn't seem to use.

So, I had basically two questions:

1. Can I go back to using the loadSharc_sc573 with the upgraded kernel, simply by adding a device tree node?

2. How can I figure out and resolve the issue with remoteproc as stated above? 

Thread Notes

  • Any reason to upgrade to 3.1.2 rather then latest 5.0.1?

  • None in particular. It's just that when this migration activity was started last year, 3.1.2 was the latest available, I believe.

  • An Update on the above:
    I tried the upgrade with 5.0.1 and still face the same remoteproc issue. Let me know if any further details are needed.

    If anyone has any more sugggestions or fixes that I can try, those are most welcome and appreciated.

    Thanks

  • you need to go over the your device-tree and mark what peripherals are used and configured, in this case what is on DMA channel 43? Are you using it from SHARC or its configured in Linux or u-boot?

    Are you using rpmsg ? MCAPI not supported. 

    What addresses in L2 you allocated for SHARC? 

  • Thanks for your response. Here are the details and some follow up questions I have:

    I see in the linux device tree that DMA channel 43 is configured as mdma, which the kernel driver identifies as dma with memcpy. It is being used from kernel driver for remoteproc to load the sharc code, as per my understanding (I haven't deviated from the adi settings here).

    The legacy SHARCs use MCAPI. Do you suggest that they should be migrated to use rpmsg, in order for communication between the A5 and SHARCs to work, once the loading is successful?
    I see that there is a device tree node in the default .dts file for the adsp-sc573, with the following headers:

    &tru {
    mcapi_to_a5: channel@0 {
    ...
    };
    mcapi_to_sharc0: channel@1 {
    ...
    };
    mcapi_to_sharc1: channel@2 {
    ...
    };
    };

    Is there any way to utilise that for communication? And could this cause the loading issue mentioned earlier?

    These are the L2 addresses allocated for SHARCs in my legacy image:
    Core1: <0x200C0000 0x20100000>

    Core2: <0x20080000 0x200C0000>

    Let me know if any further details are needed.

    Thanks

  • So default ADSP Linux release moved from MCAPI to RPMsg as its supported by kernel by default. And addresses that are in current device tree are default fro vring's that Linux RPMsg and SHARC side rpmsg-lite could communicated. Unfortunately you must have rpmsg-lite initialised on SHARC-side that remoteproc can complete load of firmware. It will wait till rpmsg vring structure on SHARC side is initialised. The addresses where you map memories should be in sync in device-tree and in SHARC baremetal code.

    So verify that values you mentioned, not colliding with vrings in device-tree on SHARC side. And those addresses not utilised for anything else. 

    Core1: <0x200C0000 0x20100000>

    Core2: <0x20080000 0x200C0000>


    This is simple baremetal example with simple echo example that utilises RPMsg github.com/.../echo_example
     

  • Hi,
    Thanks for the suggestion.
    I tried using the example code, you suggested, for echo test, to get a minimal communication between Arm and SHARCs.
    But even with that I got the above mentioned dma issue:

    remoteproc remoteproc0: powering up core1-rproc 

    remoteproc remoteproc0: Booting fw image SHARC_Core1.ldr, size 152020 

    adi-dma 3109b000.dma: DMA error on channel 43, stat = 0x3b400


    I did a small change in the remoteproc kernel driver file (adi_remoteproc.c) to bypass the dma memcpy in the ldr_load function and do a memcpy_toio to the SHARC addresses. This got rid of the dma issue. And after that I got test rpmsg using the test steps mentioned in the documentation at: RPMsg · analogdevicesinc/lnxdsp-adi-meta Wiki

    I am not sure if that is a proper solution, but the problem looks like the dma is somehow not able to access the SHARC addresses for the hardware I'm using (adsp-sc573). Any clarifications or suggestions regarding this are highly appreciated.

    Let me know if any other details are needed.

    Thanks