loic-fejoz / beaglebone-ai64-tutorial

A step by step introduction to the programming of BeagleBone AI 64 board.
Other
6 stars 0 forks source link

C6x example not working on BB-AI64 #1

Open MarcoSpano opened 4 months ago

MarcoSpano commented 4 months ago

Good job with this repo, it helped me a lot digging on how to boot even a simple code like 'Hello World' on the C6x core of the BeagleBone AI-64, thank you!

BTW even if examples 0 and 1 (PRU) are working fine out of the box, the same does not apply for the C6x core, at least on my configuration of the BB-AI64. I first tried to check inside the device tree, as you suggested, and I saw only DMA addresses between core 0 and 1 that in my case are swapped (don't know why, but that was not the issue). Digging a bit more, the system during the boot phase already start the C6x cores, so if I launch: cat /sys/class/remoteproc/remoteproc12/firmware I get: vision_apps_eaik/vx_app_rtos_linux_c6x_1.out

And after reading the sections of the binary you can spot the difference: readelf -a /lib/firmware/vision_apps_eaik/vx_app_rtos_linux_c6x_1.out

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x001000 0xa8100000 0xa8100000 0x0008c 0x0008c R   0x1000
  LOAD           0x001400 0xa8200400 0xa8200400 0x00000 0x8a2094 RW  0x400
  LOAD           0x001400 0xa8aa24a0 0xa8aa24a0 0x12e020 0x12e020 R E 0x20
  LOAD           0x12f420 0xa8bd04c0 0xa8bd04c0 0x00000 0x01000 RW  0x8
  LOAD           0x12f420 0xa8bd14c0 0xa8bd14c0 0x00700 0x00700 R   0x4
  LOAD           0x12fb20 0xa8bd1bc0 0xa8bd1bc0 0x00000 0x00310 RW  0x8
  LOAD           0x12fb20 0xa8bd1ed0 0xa8bd1ed0 0x00000 0x00008 R   0x4
  LOAD           0x12fb20 0xa8bd1ed8 0xa8bd1ed8 0x00000 0x00120 RW  0x8
  LOAD           0x130000 0xa8bd2000 0xa8bd2000 0x00000 0x190000 RW  0x2000
  LOAD           0x130000 0xa8d62000 0xa8d62000 0x313e2 0x313e2 R   0x8
  LOAD           0x1613e8 0xa8d933e8 0xa8d933e8 0x00000 0x06488 RW  0x8
  LOAD           0x161400 0xa8d99880 0xa8d99880 0x00020 0x00020 R E 0x20
  LOAD           0x161800 0xa8d99c00 0xa8d99c00 0x00200 0x00200 R E 0x400
  LOAD           0x161c00 0xa8d9a000 0xa8d9a000 0x023f8 0x023f8 R E 0x400

So apparently the base address in my case starts from 0xa8100000 and not at 0xa6100000, as stated in the device tree.. Changing your .cmd file accordingly solved the issue. This can be seen also in this file: cat /opt/source/dtb-5.10-ti/src/arm64/k3-j721e-rtos-memory-map.dtsi

I don't know if the configuration I'm using is unusual, anyway I wanted to pointed this issue out if also other people got my same problem.

loic-fejoz commented 2 months ago

Thanks @MarcoSpano for pointing out this issue. It could indeed help other in the future. I should really take time to continue this project to get to the point where the main cpu can be helped by the DSP processors...