Coresight on iMX6Q

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Coresight on iMX6Q

1,512 Views
michalkurek
Contributor I

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.

Labels (2)
0 Kudos
5 Replies

1,184 Views
DavidHollister
Contributor I

I know this is old, but I wanted to reply here for anybody who ended up here from Google, like me.

I had this exact issue, and my problem was because of CPU erratum ERR006259.  As a workaround, I used the internal pull-up / pull-down resistors on the JTAG_TCK pad to simulate 4 clock cycles on boot.

0 Kudos

1,184 Views
igorpadykov
NXP Employee
NXP Employee

Hi Michal

unfortunately I am not aware of efforts for integrating ptm,etb in

i.MX6 linux, may be recommended apply to NXP Professional Services to develop it

http://www.nxp.com/support/nxp-professional-services:PROFESSIONAL-SERVICE

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,184 Views
michalkurek
Contributor I

Hi Igor,

thanks for the answer.

PTM, ETB and other Coresight related drivers are already part of IMX6 Linux.  You mean it is not enough and there are some special adaptations needed? If so, I cannot find anything obvious in IMX6 specs.

My question is if there is anything that needs to be done before using PTM, ETB... any registry configuration, or maybe some jumpers/switches on the board?

regards,

Michal

0 Kudos

1,184 Views
igorpadykov
NXP Employee
NXP Employee

Hi Michal

these drivers are not used in nxp linux releases, supported functionality is described

in nxp official linux documentation

http://www.nxp.com/webapp/Download?colCode=L4.1.15_2.0.0-LINUX-DOCS&Parent_nodeId=133769948107170617... 

and I am afraid  PTM, ETB usage were not tested. This may be posted also on  

meta-fsl-arm mailing list, so that someone familiar with it could try to assist you.
meta-freescale Info Page 

Best regards
igor

0 Kudos

1,184 Views
michalkurek
Contributor I

thanks,

I will try with meta-freescale Info Page

regards,

Michal

0 Kudos