How To debug M4 on IMX6SX

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

How To debug M4 on IMX6SX

How To debug M4 on IMX6SX

Purpose:  Introduce how to debug M4 using trace32 and the difference with general debug case.If you are using other jtag debug tools, maybe you need to do the similar configuration.

Debug tools: Trace32 – you can refer to http://www.lauterbach.cn/ for more information about this tool.

Firmware: Here we using Freertos as the example, but not limited to this.

There is one small difference with general debug case to M4 in 6sx, which when you attach M4 and break M4, it may impact the peripheral that A9 is using. You may have found when you break M4, A9 uart console also was frozen at the same time.

  • This is caused by that when M4 enter debug mode, the debug_req will also assert in the peripherals which you are using on the A9 system.
  • So,need configure the peripherals to keep running when the debug_req is assert when do the M4/A9 debug separately.
  • Need configure the DBGEN (*) register in the related peripherals to allow the eripherals not going into debug mode and keep running even if debug_req is HIGH.
  • The peripherals we need take care are: CAN, UART, EPIT,GPT, ENET, PWM.
  • Note: For the CAN, the register bit is called FRZ

Here is the details of uart dbgen in the RM:

pastedImage_1.png

pastedImage_2.png

So if we want debug M4 separately,we should disable this bit, as A9 was using this peripheral.

Here we take Freertos as the example to illuminate how to debug M4 step by step:

Enable DBGEN case:

  • Load M4 image into memory and kick off M4. (You can refer to  for the details)

          =>fatload mmc 2:1 0x9ff00000 hello_world_ddr.bin

               reading hello_world_ddr.bin 18748 bytes read in 30 ms (609.4 KiB/s)

          =>dcache flush

          =>bootaux 0x9ff00000

              ##Starting auxiliary core at 0x9FF00000
               ...

  • Attach M4 using the m4.cmm file(attached):

pastedImage_6.png

Note:  You can find the elf file at the same folder of binary:

pastedImage_9.png

So now you can debug your code step by step.If you go back to A9 side uart console, you would find the console have been frozen.

Disable DBGEN case at A9 side:

  • Load M4 image into memory and kick off M4. (You can refer to  for imx6sx user guide  the details)

          =>mm 0x20200b4              

               020200b4:00000020 ? 0x820

          =>fatload mmc 2:1 0x9ff00000 hello_world_ddr.bin

               reading hello_world_ddr.bin 18748 bytes read in 30 ms (609.4 KiB/s)

          =>dcache flush

          =>bootaux 0x9ff00000

               ##Starting auxiliary core at 0x9FF00000
               ...

  • Attach M4 using the m4.cmm file(attached)

In this case you will the A9 uart console still can work, after you break M4.

Disable DBGEN case at M4 side:

  • Load M4 image into memory and kick off M4.
     
    =>fatload mmc 2:1 0x9ff00000 hello_world_ddr.bin

                    reading hello_world_ddr.bin 18748 bytes read in 30 ms (609.4 KiB/s)

          =>dcache flush

          =>bootaux 0x9ff00000

         ##Starting auxiliary core at 0x9FF00000

  • Attach M4 using the m4_disable_dbgen.cmm  file(attached)

In this case you will the A9 uart console still can work, after you break M4.

 

Notes: For more trace32 usage, please refer to http://www.lauterbach.cn/

          For more imx6sx information, please refer to i.MX 6SoloX Family of Applications Processors|NXP.

Labels (1)
Attachments
No ratings
Version history
Last update:
‎07-19-2016 01:57 AM
Updated by: