Debugging FreeRTOS example for VF61 with DS-5

— Updated question due to new insight —

I am trying to debug the cortex-m4 using ds-5 and ARM Keil ULINKpro D debug adapter. I followed this tutorial Using ARM DS-5 IDE with Cortex-M4 of a Colibri iMX7 with the help of posts from the community as well as the toradex video tutorial (link text).

I am now able to debug the cortex-m4 processor sometimes. The following observations were made:

Intercepting the boot process

U-Boot 2016.11-2.8.4+g07edca0 (Oct 11 2018 - 12:24:31 +0000)

CPU: Freescale Vybrid VF610 at 500 MHz
Reset cause: WDOG A5
DRAM:  256 MiB
NAND:  512 MiB
MMC:   FSL_SDHC: 0
In:    serial
Out:   serial
Err:   serial
Model: Toradex Colibri VF61 256MB IT V1.2B, Serial# 08396019
Net:   FEC
Hit any key to stop autoboot:  0 
Colibri VFxx # 

I am not able to connect to the vf61, getting the following error message:
1258-connectionfailed-vf61.png

If I start the m4 processor manually:

Colibri VFxx # ubi part ubi
ubi0: default fastmap pool size: 200
ubi0: default fastmap WL pool size: 100
ubi0: attaching mtd1
ubi0: attached by fastmap
ubi0: fastmap pool size: 200
ubi0: fastmap WL pool size: 100
ubi0: attached mtd1 (name "mtd=3", size 510 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi0: good PEBs: 4070, bad PEBs: 10, corrupted PEBs: 0
ubi0: user volume: 4, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 8/2, WL threshold: 4096, image sequence number: 0
ubi0: available PEBs: 0, total reserved PEBs: 4070, PEBs reserved for bad PEB handling: 70
Colibri VFxx # ubi read ${loadaddr} m4firmware
No size specified -> Using max size (173243)
Read 173243 bytes from volume m4firmware to 80008000
Colibri VFxx # bootaux ${loadaddr}
## Starting auxiliary core at 0x1F0002E1 ...
Colibri VFxx # 

I am then able to debug the cortex-m4 processor.

I have set the variables “defargs” and “ubiboot” as described here FreeRTOS on the Cortex-M4 of a Colibri VF61. If I now reset and start the normal bootup:

U-Boot 2016.11-2.8.4+g07edca0 (Oct 11 2018 - 12:24:31 +0000)

CPU: Freescale Vybrid VF610 at 500 MHz
Reset cause: WDOG A5
DRAM:  256 MiB
NAND:  512 MiB
MMC:   FSL_SDHC: 0
In:    serial
Out:   serial
Err:   serial
Model: Toradex Colibri VF61 256MB IT V1.2B, Serial# 08396019
Net:   FEC
Hit any key to stop autoboot:  0
Booting from NAND...
ubi0: default fastmap pool size: 200
ubi0: default fastmap WL pool size: 100
ubi0: attaching mtd1
ubi0: attached by fastmap
ubi0: fastmap pool size: 200
ubi0: fastmap WL pool size: 100
ubi0: attached mtd1 (name "mtd=3", size 510 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi0: good PEBs: 4070, bad PEBs: 10, corrupted PEBs: 0
ubi0: user volume: 4, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 8/2, WL threshold: 4096, image sequence number: 0
ubi0: available PEBs: 0, total reserved PEBs: 4070, PEBs reserved for bad PEB handling: 70
No size specified -> Using max size (173243)
Read 173243 bytes from volume m4firmware to 80008000
## Starting auxiliary core at 0x1F0002E1 ...
No size specified -> Using max size (4776584)
Read 4776584 bytes from volume kernel to 81000000
No size specified -> Using max size (27599)
Read 27599 bytes from volume dtb to 82000000
Kernel image @ 0x81000000 [ 0x000000 - 0x48e288 ]
## Flattened Device Tree blob at 82000000
   Booting using the fdt blob at 0x82000000
   Using Device Tree in place at 82000000, end 82009bce
   Updating MTD partitions...

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.4.158-2.8.4 ....

I can see that the m4 is started due to the entry “## Starting auxiliary core at 0x1F0002E1 …” as well my led blinking on my board. But I am no longer able to debug the m4 processor. The error message is the same as the snapshot above.

It should be possible to debug the cortex m4 while running linux on the a5?

Why do I have to start the m4 processor manually in uboot? In the toradex video tutorial this should not be necessary.

Please let me know if you need additional documents. Thanks.

Dear @janinest

On the VF61 CPU, the JTAG TMS signal is also used to communicate with the on-module audio codec. In order to make JTAG work, you need to disable the audio codec in your Linux build. There are some more details described in the the developer page article

About the second error:
If I remember correctly, the M4-clock needs to be activated in software, before the M4 can be accessed even through JTAG. U-Boot does this when it loads and runs a firmware on the M4.
I assume you tried to connect the JTAG debugger before the required clock was enabled, when you got the error

1259-connectionfailed-vf61-uboot.png

Regards, Andy

Dear @andy.tx,

thanks for your reply!

About the second error: Okay, I will always load the program manually in uboot before debugging. That is fine.

I disabled the CONFIG_SND_SOC_FSL_SAI_WM9712 as described in your link. I do not see any entries regarding the wm9712 now during boot up of the linux system. However, I am still not able to connect to the m4 core when linux is running on the a5. I attached my kenel configuration.

Did I miss something? I also attached the boot-log in case that might help.

Thanks again for your help. Let me know if you need any additional files.

Regards,
Janine

Dear @andy.tx,
any update on why I am unable to connect to the m4 while linux is running on the a5? Or is this not possible?
Thanks in advance for your help!
Regards, Janine

hi @janinest

We could not try it out till now. We will come back to you during this week.

hi @janinest, sorry I did not have time to look on this issue. Did you have any progress?

Hi @jaski.tx,

any new insight on this question? Thanks in advance for your feedback. Regards, Janine

hi @janinest, Sorry I did not have time to look into this. I will have a look next week and let you know my findings.

Hi @janinest

Finally I was able to reproduce the issue and to find a solution. Beside disabling the codec wm9712 in the kernel config, the pinmuxing for sai2 has also to be deactivated. Please find here the changes in the device tree needs to be done. With deactivated pinmuxing for SAI2, the connection to M4 with JTAG was working fine when Linux is running.

Best regards, Jaski