AnsweredAssumed Answered

Coresight on iMX6Q

Question asked by Michal Kurek on Jan 27, 2017
Latest reply on May 13, 2018 by David Hollister

Hi,

 

I would like to capture branch instructions (for example) on the IMX6 platform. The OS I am using is Linux (can be IMX version 4.1.x based or mainline one 4.8 based). I have managed already to register and initialize drivers for the coresight components:

root@imx6qsabreauto:~# ls /sys/bus/coresight/devices/
2141000.etb 2143000.tpiu 2144000.funnel 215c000.ptm replicator

however when I enable ETB ("echo 1 > 2141000.etb/enable_sink) and PTM ("echo 1 > 215c000.ptm/enable_source") I get some confirmation:

[ 182.120407] coresight-etb10 2141000.etb: ETB enabled
[ 182.125421] coresight-replicator replicator: REPLICATOR enabled
[ 182.131479] coresight-funnel 2144000.funnel: FUNNEL inport 0 enabled
[ 182.138302] coresight-etm3x 215c000.ptm: ETM tracing enabled

but nothing else. All counters are zero - on both sides PTM and ETB (RAM Write Pointer is not moving), I guess nothing is being captured. Looking at the registries, it is a "trace all" configuration, Exclude address bit is set ( ETMTECR1 bit [24], all other bits are zero) AND address range is set to 0x00 - 0x00. My understanding is that this is like "exclude nothing", so "include everything".

 

I added following entries into DT (thanks to Darius Suciu):

 

ptm@0215C000 {
        compatible = "arm,coresight-etm3x", "arm,primecell";
        reg = <0x0215C000 0x1000>;

        cpu = <&cpu0>;
        clocks = <&clks  IMX6QDL_CLK_AXI>;
        clock-names = "apb_pclk";
        port {
            ptm0_out_port: endpoint {
                remote-endpoint = <&funnel_in_port0>;
            };
        };
    };
   
    etb@02141000 {
        compatible = "arm,coresight-etb10", "arm,primecell";
        reg = <0x02141000 0x1000>;

        clocks = <&clks  IMX6QDL_CLK_AXI>;
        clock-names = "apb_pclk";
        port {
            etb_in_port: endpoint@0 {
                slave-mode;
                remote-endpoint = <&replicator_out_port0>;
            };
        };
    };

    tpiu@02143000 {
        compatible = "arm,coresight-tpiu", "arm,primecell";
        reg = <0x02143000 0x1000>;
        clocks = <&clks  IMX6QDL_CLK_AXI>;
        clock-names = "apb_pclk";

        port {
            tpiu_in_port: endpoint {
                slave-mode;
                remote-endpoint = <&replicator_out_port1>;
            };
        };
    };

    replicator {
        /*
         * non-configurable replicators don't show up on the
         * AMBA bus.  As such no need to add "arm,primecell"
         */
        compatible = "arm,coresight-replicator";

        ports {
            #address-cells = <1>;
            #size-cells = <0>;

            /* replicator output ports */
            port@0 {
                reg = <0>;
                replicator_out_port0: endpoint {
                    remote-endpoint = <&etb_in_port>;
                };
            };

            port@1 {
                reg = <1>;
                replicator_out_port1: endpoint {
                    remote-endpoint = <&tpiu_in_port>;
                };
            };

            /* replicator input port */
            port@2 {
                reg = <0>;
                replicator_in_port0: endpoint {
                    slave-mode;
                    remote-endpoint = <&funnel_out_port0>;
                };
            };
        };
    };

    funnel@02144000 {
        compatible = "arm,coresight-funnel", "arm,primecell";
        reg = <0x02144000 0x1000>;
        clocks = <&clks  IMX6QDL_CLK_AXI>;
        clock-names = "apb_pclk";

        ports {
            #address-cells = <1>;
            #size-cells = <0>;

            /* funnel output port */
            port@0 {
                reg = <0>;
                funnel_out_port0: endpoint {
                    remote-endpoint =
                            <&replicator_in_port0>;
                };
            };

            /* funnel input ports */
            port@1 {
                reg = <0>;
                funnel_in_port0: endpoint {
                    slave-mode;
                    remote-endpoint = <&ptm0_out_port>;
                };
            };

            /* the other input ports are not connect to anything */
        };
    };

 

 

Any ideas why it does not work as expected?

 

[UPDATE]: just to add, I am not interested in uploading captured data via JTAG to some PC running tool, I would like to digest it locally on Linux. So there is no external debugger connected to the board.

Outcomes