Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I do this in rpi 4 with 1gb or Not? Or only in rpi4 with 4gb and/or 8gb #1

Closed
neuberfran opened this issue Oct 18, 2022 · 96 comments

Comments

@neuberfran
Copy link

Hi,

Can I do this in rpi 4 with 1gb or Not? Or only in rpi4 with 4gb and/or 8gb.

I'm trying to put ubuntu 22.04.1 on rpi4 1gb and I'm not getting it.

I've been playing with iot for 8 years now.

I've done RPMsg (no remoteproc, bootloader only) on imx7d_pico using Yocto(hardknott) and FreeRtos.

My project dream is to Blink a led using Push utton Switch on the a7 part and the led on the m4 part,
Or, in the case of rpi4 1gb, use pushbutton switch in Core 0/Linux and Led in Core 3/FreeRtos
image

@TImada
Copy link
Owner

TImada commented Oct 19, 2022

Can I do this in rpi 4 with 1gb or Not? Or only in rpi4 with 4gb and/or 8gb.

Yes, this RPMSG sample should work on 1GB RAM version of Raspi4B.

My project dream is to Blink a led using Push utton Switch on the a7 part and the led on the m4 part, Or, in the case of rpi4 1gb, use pushbutton switch in Core 0/Linux and Led in Core 3/FreeRtos

This porting does not include any device driver other than that for PL011 UARTs. Therefore, you will need to implement a GPIO driver to manipulate buttons and LEDs on Raspi4B.
Using i.MX7D seems better in reducing implementation cost as NXP provides a variety of device drivers on their processors. :-)

@neuberfran
Copy link
Author

@TImada I prefer Rpi4 because I prefer remoteproc of the your project. I stay trying RPMsg in Linux/RTOS after boot. I prefer use remoteproc

@neuberfran
Copy link
Author

@TImada

This is my config.txt in rpi4 1gb


kernel=u-boot.bin
arm_64bit=1
init_uart_clock=3000000
enable_uart=1
core_freq=250
disable_overscan=1

My issue now is:

bcmgenet: PHY startup failed+Retrieving file: pxelinux.cfg/00000000 ethernet@7d580000 Waiting for PHY auto negotiation to complete

I couldn't install ubuntu core or debian on this rpi4 1gb. Just installed the latest official raspbian version

please help me

@TImada
Copy link
Owner

TImada commented Oct 21, 2022

bcmgenet: PHY startup failed+Retrieving file: pxelinux.cfg/00000000 ethernet@7d580000 Waiting for PHY auto negotiation to complete

This seems a log during IP address requesting from a DHCP client for PXEBOOT. Wrong OS image for netboot ?
(This error should be discussed at https://www.raspbian.org/RaspbianForums as it is not related to FreeRTOS porting at all.)

@neuberfran
Copy link
Author

neuberfran commented Oct 21, 2022

@TImada
https://hechao.li/2021/12/20/Boot-Raspberry-Pi-4-Using-uboot-and-Initramfs/

This is my option to put u-boot/Linux in my Rpi4

But I have problem in the mentioned tutorial:

My linux in crosstol-ng is 6.0.2. But in your tutorial in 5.1 part (5.1 Download the Kernel Source) "Also note that the kernel version must be higher than the kernel version configured for the toolchain."

I can't find linux higher than 5.15 in this site:

https://github.com/raspberrypi/linux

How can I solve it?

Pls

If you can help resolve this issue of this tutorial, I would appreciate it.

@neuberfran
Copy link
Author

@TImada

There is another strange error here in u-boot which is as follows:

I get to the part: Hit any key to stop autoboot: 2 where I try to stop u-boot to type the envimoments and arguments (as pictured below), but it doesn't stop, I don't know why.

photo01
photo02

@TImada
Copy link
Owner

TImada commented Oct 24, 2022

@TImada https://hechao.li/2021/12/20/Boot-Raspberry-Pi-4-Using-uboot-and-Initramfs/

This is my option to put u-boot/Linux in my Rpi4
...
...
If you can help resolve this issue of this tutorial, I would appreciate it.

I've never tried a Busybox-based OS image for my FreeRTOS porting to Raspi4B. Any useful comment from me cannot be expected unfortunately.
(This repository assumes that you use a Ubuntu-based (or Debian-based) OS image)

I get to the part: Hit any key to stop autoboot: 2 where I try to stop u-boot to type the environments and arguments (as pictured below), but it doesn't stop, I don't know why.

Check the followings below:

  • your UART cabling between your Raspi4B board and your PC
  • UART connection configuration on your PC (baud rate, data bits, ..., and etc.)

@neuberfran
Copy link
Author

neuberfran commented Oct 25, 2022

@TImada my device is raspberry pi 4 1gb(Being 1gb means I have little memory for ubuntu 20.04 core and/or debian)
I bought ftdi with ci cp2102, and Now I have at least i have u-boot
Captura de tela de 2022-10-25 16-13-26
Captura de tela de 2022-10-25 16-19-00

@TImada
Copy link
Owner

TImada commented Oct 26, 2022

You will need to cross-compile a linux side RPMSG sample on your PC if you still use the Busybox-based OS image which does not have build tools such as gcc, make or cmake.
(The Linux sample is assumed to be built on your Raspi4 as I mentioned in [1])

[1] https://github.com/TImada/raspi4_freertos_rpmsg/blob/master/docs/linux_build.md

@neuberfran
Copy link
Author

@TImada Could you answer two specific questions:

  1. Can I run ubuntu and/or debian on rpi4 1gb and that the system is functional?

  2. If (and I've already seen that it will be) the answer above is No, what are the steps to follow to get around the problem?

@TImada
Copy link
Owner

TImada commented Oct 27, 2022

  1. Can I run ubuntu and/or debian on rpi4 1gb and that the system is functional?

This depends on what you want to do on your Raspi4B. For my use case not requiring GUI at all, 1GB RAM is quite enough.

  1. If (and I've already seen that it will be) the answer above is No, what are the steps to follow to get around the problem?

Use gcc-aarch64-linux-gnu and related tools as described in [1]. Compiling the RPMSG sample with the -static option is recommended to avoid unexpected errors due to missing dynamic libraries.

[1] https://jensd.be/1126/linux/cross-compiling-for-arm-or-aarch64-on-debian-or-ubuntu

@neuberfran
Copy link
Author

@TImada

I managed to climb Rpi4 with u-boot 2021, using buildroot for rpi4_64 and two more commands in the u-boot cli.

I'm going to RPMsg now and I have a question on this line below (see photo, I already got an error in the test for /mnt folder)

sudo ./u-boot.bin /path/to/sd_boot_partition/kernel8.img

What is the function of this command above in the RPMsg project of rpi4_64? What is the correct way to run it?

Screenshot from 2022-10-29 23-37-02

@TImada
Copy link
Owner

TImada commented Oct 30, 2022

That should be sudo cp ./u-boot.bin /path/to/sd_boot_partition/kernel8.img.
Thanks!

@neuberfran
Copy link
Author

@TImada Why I need transform u-boot.bin in kernel8.img

@TImada
Copy link
Owner

TImada commented Oct 31, 2022

@neuberfran
Copy link
Author

neuberfran commented Oct 31, 2022

@TImada Up until this point in the tutorial I haven't seen anything on the screen.

Notes: 1) I'm using fatload, because ext4load it didn't work. 1.1) ls mmc 0:2/tmp didn't work either.

  1. I only have ttyUSB0 open. It's wrong? Should I have already opened ttyUSB1? As?

Captura de tela de 2022-10-31 18-38-45

@neuberfran
Copy link
Author

@TImada issue in cmake .. command:

Captura de tela de 2022-10-31 19-15-11

@TImada
Copy link
Owner

TImada commented Nov 1, 2022

  1. I only have ttyUSB0 open. It's wrong? Should I have already opened ttyUSB1? As?

You are wrong. The UART sample uses two different UARTs. (as described in https://github.com/TImada/raspi4_freertos#uart-configuration )

issue in cmake .. command:

Why don't you check the error log?
It indicates a failure in repository cloning. Did you add --recursive at the git clone invocation?

@neuberfran
Copy link
Author

neuberfran commented Nov 1, 2022

@TImada

Before answering the above question, I should tell you that I'm having problems with the new device tree that the raspi4_rpmsg project requires:

There are several things to say and demand your attention (please):

https://stackoverflow.com/questions/59580877/raspberry-pi-4-u-boot-on-booting-hanging-in-starting-kernel

On this site above you have the answer of Mr. marc_s:

setenv bootargs 8250.nr_uarts=1 console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait rw

fatload mmc 0:1 ${kernel_addr_r} Image
booti ${kernel_addr_r} - ${fdt_addr}

Why didn't I put the dtb on the site above?
Because if I put linux on it doesn't go up

In the file below are the 2 dts. Yours and mine. I need your help to make a merge

https://github.com/neuberfran/dts

When I generated the file using dtc it gave the screen error issue99 below

My intention is to put the merged dts file in the dts folder of the buildroot and it will generate a new dtb. Then I can follow the steps of stackoverflow, normally

Note: As per screenshot issue100, I was able to evolve in the command ls mmc 0:2 tmp and I can use ext4load

issue100
issue99

@TImada
Copy link
Owner

TImada commented Nov 2, 2022

Unfortunately, I do not have knowledge on how to modify the original *.dts files for this aim.
I modified a dts file disassembled from the bcm2711-rpi-4-b.dtb binary file (= this is a final output dtb).

What I have done on the dts file is as follows:

(Remove serial1 and uart0 aliases from the aliases block)

    aliases {
        ...
        // serial1 = "/soc/serial@7e201000";
        ...
        // uart0 = "/soc/serial@7e201000";
        ...
     }

(Add the rtos@20000000 block to the reserved-memory block)

    reserved-memory {
        ...
        ...
        rtos@20000000 {
            compatible = "shared-dma-pool";
            size = <0xA00000>;
            no-map;
            alloc-ranges = <0x0 0x0 0x20000000>;
        };
    };

(Add the shm@20600000, armlocal_uio@ff800000 and gic_uio@40041000 blocks at the same level as the reserved-memory block is located)

    reserved-memory {
        ...
        ...
    };

    shm@20600000 {
        compatible = "generic-uio";
        status = "okay";
        reg = <0x0 0x20600000 0x200000>;
    };

    armlocal_uio@ff800000 {
        compatible = "generic-uio";
        status = "okay";
        reg = <0x0 0xff800000 0x1000>;
        interrupt-parent = <0x1>;
        interrupts = <0x0 0x0 0x4>;
    };

    gic_uio@40041000 {
        compatible = "generic-uio";
        status = "okay";
        reg = <0x0 0x40041000 0x7000>;
    };

@neuberfran
Copy link
Author

@TImada

https://forums.raspberrypi.com/viewtopic.php?t=315662
https://www.youtube.com/watch?v=Rp8K0lML4k8

Really, there was a crash here in the tutorial on the issue of device tree deployment (dtb file) on rpi4 through u-boot

As per the links above (my rpi4 is revision 1.2 or higher) there was a change in the dtb file call in u-boot.

Your tutorial is suitable for rpi4 revision 1.1

@TImada
Copy link
Owner

TImada commented Nov 3, 2022

In my understanding, you will need to modify the original *.dts files based on what I have mentioned above, then to build a boot partition in an official manner.

If the error occurs due to the EMMC2 specification change [1] and you can get the dtc command on your Raspi4B Linux, the following workaround may work.
(however, I guess that you will have another problem on how to install the dtc command in a busybox environment ...)

  1. Create a final dts file by executing dtc -I fs -O dts -q /proc/device-tree -o bcm2711-rpi-4-b-rtos.dts on your Raspi4B Linux.
  2. Change the final dts file with the modification which I have mentioned above.
  3. Compile the changed dts file and obtain bcm2711-rpi-4-b-rtos.dtb.
  4. Copy bcm2711-rpi-4-b-rtos.dtb to the SD card for Raspi4B (and modifiy config.txt so that your Raspi4B can boot with bcm2711-rpi-4-b-rtos.dtb).

[1] https://forums.raspberrypi.com/viewtopic.php?t=315662#p1888661

@neuberfran
Copy link
Author

neuberfran commented Nov 3, 2022

@TImada

Steps 1 and 4 are the ones that make it unfeasible (I've already tried that here). Since there are some #includes in bcm2711-rpi-4-b.dts from buildroot to rpi4. It's not messing with config.txt or the 2 commands I already do in u-boot that will solve (I think)

Friend,

I've been working on this project for two weeks. I tried seadog-gaia (from my friend, link below) and tried yocto on rpi4, but that stopped early on as Noobs for rpi4 didn't work.
https://www.youtube.com/watch?v=GUqcxiw_BsE
https://lancesimms.com/RaspberryPi/HackingRaspberryPi4WithYocto_Introduction.html

What I suggest, for you to help me in the device tree part is the following:

Pull the buildroot, as shown in the video below and apply the following commands (super easy):

https://www.youtube.com/watch?v=9vsu67uMcko&t=827s

  1. git clone git://git.buildroot.net/buildroot
  2. cd buildroot
  3. make raspberrypi4_defconfig
  4. make all
    4.1) put u-boot.in in boot sdcard partition and change config.txt to kernel=u-boot.bin
    https://stackoverflow.com/questions/59580877/raspberry-pi-4-u-boot-on-booting-hanging-in-starting-kernel
    4.2) in u-boot cli:
  5. setenv bootargs 8250.nr_uarts=1 console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait rw
  6. fatload mmc 0:1 ${kernel_addr_r} Image
  7. booti ${kernel_addr_r} - ${fdt_addr}

I'm having trouble changing bcm2711-rpi-4-b.dts inside the buildroot folder. Not only because there are several (sudo find. -name bcm2711-rpi-4-b.dts), but after making the changes, How to compile ?

@TImada
Copy link
Owner

TImada commented Nov 4, 2022

Steps 1 and 4 are the ones that make it unfeasible (I've already tried that here). Since there are some #includes in bcm2711-rpi-4-b.dts from buildroot to rpi4. It's not messing with config.txt or the 2 commands I already do in u-boot that will solve (I think)

Let me check what you have done in the step 1 and 4, before moving to building a modified boot partition.

  • How did you get a dts file for compiling by the dtc command in the step 1? Is it a dts file which I provided on github?
  • How did you load the modified dtb file on your Raspi4B? by the fatload or ext4load command on the u-boot prompt?

@neuberfran
Copy link
Author

neuberfran commented Nov 5, 2022

@TImada

I use the cp2102 here connected to 5v, otherwise (with the other serial converter) I typed and nothing comes out in uboot.

Today I was without internet and when I came back I had weird characters problems on the screen. It wasn't productive today.

Although I can put noobs on rpi4 and I'll follow the yocto tutorial, mentioned above.

I don't know if the problem is in the converter or in the rpi4 (I hope not)

Config.txt

[pi4]
kernel=u-boot.bin
max_framebuffers=2

[all]
arm_64bit=1
enable_uart=1
dtparam=i2c=on
dtparam=spi=on
dtparam=act_led_trigger=heartbeat

dtparam=pwr_led_trigger=mmc0
dtparam=audio=on
device_tree_address=0x02000000
dtoverlay=disable-bt
dtoverlay=vc4-fkms-v3d,cma-128

cmdline.txt
root=/dev/mmcblk0p2 rootwait console=tty1 console=ttyAMA0,115200
Screenshot from 2022-11-05 01-15-31

20221105_011601

@TImada
Copy link
Owner

TImada commented Nov 7, 2022

config.txt seems correct for UART setting, so I cannot say something about what's wrong on your environment.

@neuberfran
Copy link
Author

@TImada

Unfortunately my rpi4 died:

https://forums.raspberrypi.com/viewtopic.php?t=342649

While the other is not enough, I want to see how to access the Uart of the gpio14/15 without having to connect the 5v of the cp2102

https://www.youtube.com/watch?v=68DNY0_yxwU&t=312s

@TImada
Copy link
Owner

TImada commented Nov 10, 2022

Which CP2102 board did you use?

@neuberfran
Copy link
Author

neuberfran commented Feb 20, 2023

@TImada

You said "Why don't you do that by yourself?"

_I still don't have enough knowledge for that my friend.

It would be really nice if you did that.

@TImada
Copy link
Owner

TImada commented Feb 21, 2023

I still don't have enough knowledge for that

I did not have enough knowledge on FreeRTOS and Raspi4B at the start point of this porting too.

It would be really nice if you did that.

Unfortunately, I cannot spare time to help your work as I have many other things to do.

@TImada
Copy link
Owner

TImada commented Feb 21, 2023

My business work. Do not disturb me any more. :-)

@TImada
Copy link
Owner

TImada commented Jan 18, 2024

Closed due to inactive status.

@neuberfran
Copy link
Author

@TImada

Yesterday I went to redo the project to learn OpenAMP with FreeRTOS and got two errors (as shown in the photos below):

  1. The first when creating the app on the U-boot side (syslog.h is missing) I didn't find this file in the toolchain. Previously, this error did not occur.

  2. The second was that the make command instead of cmake is not working:
    Screenshot from 2024-01-18 16-56-47
    photo_121

@TImada
Copy link
Owner

TImada commented Jan 19, 2024

Using cmake, not make, should solve the two problems.

Try the following:

$ cd ${RASPI4_BASE}/libmetal
$ mkdir build && cd build
$ cmake ../ -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/raspi4-freertos.cmake -DCMAKE_C_FLAGS="-I${RASPI4_BASE}/raspi4_freertos/FreeRTOS/Source/include -I${RASPI4_BASE}/raspi4_freertos/FreeRTOS/Source/portable/GCC/ARM_CA72_64_BIT -I${RASPI4_BASE}/raspi4_freertos_rpmsg/samples/freertos/rpmsg_ping/src -O2 -g3"
$ make VERBOSE=1

@neuberfran
Copy link
Author

@TImada
I command sudo ldconfig
before I command echo $LD_LIBRARY_PATH
:/usr/local/lib
And
command Works Ok. But make VERBOSE=1 have issue missing FreeRTOS.h lib

Screenshot from 2024-01-19 20-57-48
Screenshot from 2024-01-19 20-58-04

@TImada
Copy link
Owner

TImada commented Jan 20, 2024

${RASPI4_BASE} is missing (empty) in your environment. cmake generates a wrong path to search header files in that case.

See https://github.com/TImada/raspi4_freertos_rpmsg/blob/master/docs/freertos_build.md#1-create-a-dedicated-directory to set it.

@neuberfran
Copy link
Author

@TImada
Sorry
But now I have issue in open-amp build:
Could not find toolchain file: ../cmake/platforms/raspi4_a72_generic.cmake
Screenshot from 2024-01-20 14-42-47

@TImada
Copy link
Owner

TImada commented Jan 21, 2024

I have updated libmetal/open-amp submodules.

Try the entire build process again from https://github.com/TImada/raspi4_freertos_rpmsg/blob/master/docs/freertos_build.md#3-clone-freertos-rpmsg-sample

@neuberfran
Copy link
Author

neuberfran commented Jan 23, 2024

@TImada
[1] https://www.youtube.com/watch?v=mFgiIXv7b5U
[2] https://groups.google.com/g/open-amp/c/muD2nZayhAM
[3] https://embeddeduse.com/2017/06/03/cmake-cross-compilation-based-on-yocto-sdk/
[4] https://www.reddit.com/r/embeddedlinux/comments/o0eou2/comment/h24pfgd/?rdt=46336

Everything works ok. But....
I have the project of packaging your project in Yocto (before migrating your entire project to my imx7d-pico by technexion, we already talked about deploying OpenAMP/RPMsg/Remoteproc in this device=imx7d-pico)

I already have Yocto Kirskstone [4] running on my rpi4 (& ONLY Yocto in imx7d-pico) and I can run rpmsg_echo but I have already placed the executable (rpmsg_echo) directly there. I want to build it together[1] with Yocto and use meta-openamp[2] from this repository:
https://github.com/OpenAMP/meta-openamp

In Video [1] At minute 7 and 31 seconds, the author mentions some things I would like to ask him before using:

  1. What version of FreeRTOS did you use in your project with rpi4?
    1.1) Can I use FreeRTOS 10.2.1 (8",10s in video) as the video author used in this Yocto/OpenAMP/RPMsg project on rpi4?
    1.2) Can I use TCLIB = "newlib"?

  2. What do you think about the libmetal and openamp libs generated (according to ls command) via direct build of meta-openamp [2] on Yocto? Could the different numbering cause an error in FreeRTOS/Linux in the end?

root@raspberrypi4-64:/usr/lib# ls libme*.*
libmetal.so.0      libmetal.so.1      libmetal.so.1.5.0
root@raspberrypi4-64:/usr/lib# ls libopen*.*
libopen_amp.so.0      libopen_amp.so.1      libopen_amp.so.1.5.0
root@raspberrypi4-64:/usr/lib# pwd
/usr/lib
root@raspberrypi4-64:/usr/lib# uname -a
Linux raspberrypi4-64 5.15.92-v8 #1 SMP PREEMPT Wed Feb 8 16:47:50 UTC 2023 aarch64 GNU/Linux
  1. Do you think that by implementing meta-freertos [1] and meta-openamp[2] I will be able to package your project in Yocto ? (Look: Observation-01 - local.conf (Yocto Kirsktone build))

Observation-01 - local.conf (Yocto Kirsktone build)

MACHINE ?= "raspberrypi4-64"

DISTRO ?= "poky"
PACKAGE_CLASSES ?= "package_rpm"
EXTRA_IMAGE_FEATURES = "debug-tweaks ssh-server-dropbear package-management"
IMAGE_INSTALL:append = "libmetal open-amp kernel-modules "

USER_CLASSES ?= "buildstats"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS ??= "\
    STOPTASKS,${TMPDIR},1G,100K \
    STOPTASKS,${DL_DIR},1G,100K \
    STOPTASKS,${SSTATE_DIR},1G,100K \
    STOPTASKS,/tmp,100M,100K \
    HALT,${TMPDIR},100M,1K \
    HALT,${DL_DIR},100M,1K \
    HALT,${SSTATE_DIR},100M,1K \
    HALT,/tmp,10M,1K"
PACKAGECONFIG:append:pn-qemu-system-native = " sdl"
CONF_VERSION = "2"
ENABLE_UART = "1"
RPI_USE_U_BOOT = "1"

@TImada
Copy link
Owner

TImada commented Jan 24, 2024

  1. What version of FreeRTOS did you use in your project with rpi4?
    1.1) Can I use FreeRTOS 10.2.1 (8",10s in video) as the video author used in this Yocto/OpenAMP/RPMsg project on rpi4?
    1.2) Can I use TCLIB = "newlib"?

v10.3.0 is used. I don't know what is different between v10.3.0 and v10.2.1, but v10.2.1 would work if it has compatible APIs with APIs provided by v10.3.0.
newlib would work if you use it instead of musl_libc found at https://github.com/TImada/raspi4_freertos/tree/master/FreeRTOS/Demo/CORTEX_A72_64-bit_Raspberrypi4/musl_libc.

  1. What do you think about the libmetal and openamp libs generated (according to ls command) via direct build of meta-openamp [2] on Yocto? Could the different numbering cause an error in FreeRTOS/Linux in the end?

libmetal/open-amp version (git tag name) used for this repository is v2020.04.0.
I'm not sure what happens if you use another version of libmetal/open-amp.

  1. Do you think that by implementing meta-freertos [1] and meta-openamp[2] I will be able to package your project in Yocto ? (Look: Observation-01 - local.conf (Yocto Kirsktone build))

I cannot have any good answer on this as I'm not a yocto guy.

@TImada
Copy link
Owner

TImada commented Mar 18, 2024

I do not have any motivation to conduct both 1. and 2. as that's your business, not mine.

@neuberfran
Copy link
Author

@TImada Hi,I'm trying this again today (with the latest versions of U-boot and kernel), in fact, I just resolved a device-tree port error in bcm2711-rpi-4-b.dtb: https://stackoverflow.com/questions/78744626/issue-in-rpi4-8gb-when-i-try-change-bcm2711-rpi-4-b-dtb-in-debian-12-64-bits

The problem now is(Resetting CPU ... resetting ...) that Uboot restarts itself (as shown in the photo below and like type this:raspberrypi/firmware#1157), making it impossible for me to go to cd ./raspi4/raspi4_freertos_rpmsg/samples/linux/rpmsg_echo/build (where everything is already ready) and command:
sudo ldconfig
sudo ./rpmsg_echo

U-Boot 2024.04-rc4-00040-gbd0aedde3e-dirty (Mar 23 2024 - 10:37:01 -0300)

DRAM:  948 MiB (effective 7.9 GiB)
RPI 4 Model B (0xd03115)
Core:  211 devices, 15 uclasses, devicetree: board
MMC:   mmcnr@7e300000: 1, mmc@7e340000: 0
Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... 
In:    serial,usbkbd
Out:   serial,vidconsole
Err:   serial,vidconsole
Net:   eth0: ethernet@7d580000
starting USB...
No working controllers found
Hit any key to stop autoboot:  0 
Card did not respond to voltage select! : -110
** Booting bootflow '[email protected]_1' with script
3371128 bytes read in 181 ms (17.8 MiB/s)
25661952 bytes read in 1158 ms (21.1 MiB/s)
Moving Image from 0x80000 to 0x200000, end=1b90000
## Flattened Device Tree blob at 2eff1e00
   Booting using the fdt blob at 0x2eff1e00
Working FDT set to 2eff1e00
   Using Device Tree in place at 000000002eff1e00, end 000000002f002f3d
Working FDT set to 2eff1e00
"Synchronous Abort" handler, esr 0x96000061, far 0x3af3901c
elr: 0000000000089eac lr : 0000000000089e50 (reloc)
elr: 000000003b355eac lr : 000000003b355e50
x0 : 0000000000000001 x1 : 0000000000000001
x2 : 0000004000000000 x3 : 0000000000000008
x4 : 000000000000000c x5 : 0000000000000008
x6 : 00000000000000b8 x7 : 0000000000000003
x8 : 000000002eff1e00 x9 : 00000000000000a8
x10: 000000003af38e8c x11: 0000000000009e9c
x12: 000000003af38f88 x13: 000000002eff1e00
x14: 00000000ffffffff x15: 000000003af39048
x16: 000000003b35904c x17: 0000000000000000
x18: 000000003af47d60 x19: 000000003af3901c
x20: 0000000000000004 x21: 0000000000000002
x22: 000000003af39060 x23: 000000003af39080
x24: 000000002eff1e00 x25: 000000003b3c8055
x26: 0000000000000000 x27: 0000000000000000
x28: 000000003af55830 x29: 000000003af38f80

Code: 5ac00842 540001c1 f8617ac2 dac00c42 (f9000262) 
Resetting CPU ...

resetting ...

My boot.scr (old cmdline.txt file that I haven't used here) is:

setenv autostart yes
dcache off
fatload mmc 0:1 0x28000000 rpmsg_ping.elf
dcache flush
bootelf 0x28000000
fatload mmc 0:1 ${kernel_addr_r} Image
setenv bootargs "8250.nr_uarts=1 console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait rw maxcpus=3"
booti ${kernel_addr_r} - ${fdt_addr}

Screenshot from 2024-07-23 19-01-02

@TImada
Copy link
Owner

TImada commented Jul 24, 2024

Your boot.scr seems wrong.

Follow https://github.com/TImada/raspi4_freertos#launching-freertos and replace uart.elf by rpmsg_ping.elf.

@neuberfran
Copy link
Author

neuberfran commented Jul 24, 2024

@TImada

I can't see anything wrong with my boot.scr. I'm making changes to U-boot 2024.04
1)
#CONFIG_USB_XHCI_HCD=y
#CONFIG_USB_XHCI_PCI=y

  1. I try with uboot 2021.04 and 2021.10
    But not solved yet

boot.scr

setenv autostart yes
dcache off
fatload mmc 0:1 0x28000000 rpmsg_ping.elf
dcache flush
bootelf 0x28000000
fatload mmc 0:1 ${kernel_addr_r} Image
setenv bootargs "8250.nr_uarts=1 console=ttyS0,115200 root=/dev/mmcblk0p2 rootw>
booti ${kernel_addr_r} - ${fdt_addr}

@neuberfran
Copy link
Author

@TImada
Copy link
Owner

TImada commented Jul 25, 2024

You should have a diff between your boot.scr and what I have introduced in #1 (comment). You will see i) a different ELF load address and ii) missing dcache on.

Considering .bin does not make sense now as your faulty boot.scr can easily cause data inconsistency on RAM.

@neuberfran
Copy link
Author

@TImada
Pls What about failed to open the GIC device: -2? -2?
You can see that I have all the files in the device-tree

sudo ./rpmsg_echo 
Starting application...
ERROR: failed to open the GIC device: -2.
ERROR: Failed to create remoteproc device.
ERROR: Failed to initialize platform.
Stopping application...
Segmentation fault
neuberfran@raspberrypi:~/raspi4/raspi4_freertos_rpmsg/samples/linux/rpmsg_echo/build$ ls /proc/device-tree/arm
armlocal_uio@ff800000/ arm-pmu/               
neuberfran@raspberrypi:~/raspi4/raspi4_freertos_rpmsg/samples/linux/rpmsg_echo/build$ ls /proc/device-tree/armlocal_uio@ff800000/
compatible  interrupt-parent  interrupts  name	reg  status
neuberfran@raspberrypi:~/raspi4/raspi4_freertos_rpmsg/samples/linux/rpmsg_echo/build$ ls /proc/device-tree/shm@20600000/
compatible  name  reg  status
neuberfran@raspberrypi:~/raspi4/raspi4_freertos_rpmsg/samples/linux/rpmsg_echo/build$ ls /proc/device-tree/gic_uio@40041000/
compatible  name  reg  status
neuberfran@raspberrypi:~/raspi4/raspi4_freertos_rpmsg/samples/linux/rpmsg_echo/build$ ls /proc/device-tree/reserved-memory/rtos@20000000/
alloc-ranges  compatible  name	no-map	size
neuberfran@raspberrypi:~/raspi4/raspi4_freertos_rpmsg/samples/linux/rpmsg_echo/build$ 

https://gist.github.com/neuberfran/421e1a1ec38f45226a4a3d37f1fc32ec
Screenshot from 2024-07-25 14-24-15

@TImada
Copy link
Owner

TImada commented Jul 26, 2024

Why don't you debug it by gdb to clarify what is wrong? I cannot imagine what have you done exactly due to less information on your raspi4.
-2 is returned at [1]. So you can start debugging with [2].

(I won't be able to reply at all until mid of August as I'll be off from several hours later.)

[1] https://github.com/TImada/open-amp/blob/fa1856e5a670298123a521d141b42ce5573d4a85/apps/machine/raspi4/raspi4_a72_rproc.c#L112
[2] https://github.com/TImada/libmetal/blob/7828b6f749aa0b7548c3033c78b97b4b6956c9af/lib/device.c#L54

@neuberfran
Copy link
Author

neuberfran commented Aug 1, 2024

@TImada I know you are very busy. I still have the same error above.
I bought an FT232H from aliexpress that only arrives in the second half of August/24. A great clue has appeared to solve my issue.

I have one system with kernel 5.15. Works

./rpmsg_echo
Starting application...
metal: info:      metal_uio_dev_open: No IRQ for device 40041000.gic_uio.
metal: info:      metal_uio_dev_open: No IRQ for device 20600000.shm.
uname -a
Linux raspberrypi4-64 5.15.92-v8 #1 SMP PREEMPT Wed Feb 8 16:47:50 UTC 2023 aarch64 GNU/Linux

I have other system with kernel 6.6. Not Works and it:

metal: info:      metal_uio_dev_open: No IRQ for device 40041000.gic_uio.
metal: info:      metal_uio_dev_open: No IRQ for device 20600000.shm.

Not appear

sudo ldconfig
neubercd ${RASPI4_BASE}/raspi4_freertos_rpmsg/samples/linux/rpmsg_echo/build^C
neuberfran@raspberrypi:~/raspi4/raspi4_freertos_rpmsg/samples/linux/rpmsg_echo/build$ sudo ./rpmsg_echo
Starting application...
Passei aki 1Passei aki 2Passei aki 10: platform
Passei aki 4ERROR: failed to open the GIC device: -2.
ERROR: Failed to create remoteproc device.
ERROR: Failed to initialize platform.
Stopping application...
Segmentation fault

On the working system I have /dev/ttyAMA0. On the non-working one, this does not appear. I am sure that changes were made to the Linux kernel (in this part of ttyAMA0, ttyAMA1) but I am not sure if this is the cause of my current issue (
raspberrypi/linux#5566

I have absences (in the kernel 6.6 image with error) of interrupts shown by the command: cat /proc/interrupts

cat /proc/interrupts
           CPU0       CPU1       CPU2       
  9:          0          0          0     GICv2  25 Level     vgic
 11:      47920      47312      46982     GICv2  30 Level     arch_timer
 12:          0          0          0     GICv2  27 Level     kvm guest vtimer
 14:       1501          0          0     GICv2  65 Level     fe00b880.mailbox
 15:          0          0          0     GICv2 114 Level     DMA IRQ
 26:          0          0          0     GICv2 175 Level     PCIe PME, aerdrv
 27:       1953          0          0     GICv2 189 Level     eth0
 28:        125          0          0     GICv2 190 Level     eth0
 29:         38          0          0  BRCM STB PCIe MSI 524288 Edge      xhci_hcd
 30:          1          0          0     GICv2  66 Level     VCHIQ doorbell
 31:          0          0          0     GICv2  48 Level     arm-pmu
 32:          0          0          0     GICv2  49 Level     arm-pmu
 33:          0          0          0     GICv2  50 Level     arm-pmu
 34:          0          0          0     GICv2  51 Level     arm-pmu
 36:       2870          0          0     GICv2 125 Level     ttyS0
 37:      39605          0          0     GICv2 158 Level     mmc1, mmc0
IPI0:      7362       7173       7207       Rescheduling interrupts
IPI1:     34873      46177      39800       Function call interrupts
IPI2:         0          0          0       CPU stop interrupts
IPI3:         0          0          0       CPU stop (for crash dump) interrupts
IPI4:         0          0          0       Timer broadcast interrupts
IPI5:       925        989        727       IRQ work interrupts
IPI6:         0          0          0       CPU wake-up interrupts

Screenshot from 2024-08-01 22-15-25

@neuberfran
Copy link
Author

@neuberfran
Copy link
Author

@TImada https://gist.github.com/tnishinaga/46a3380e1f47f5e892bbb74e55b3cf3e

Even commenting the necessary lines, this command above presents an error below

Open On-Chip Debugger 0.12.0+dev-00682-gefe902219 (2024-08-09-23:01)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'adapter speed' not 'adapter_khz'
Warn : Transport "jtag" was already selected
Warn : DEPRECATED! use '-baseaddr' not '-ctibase'
Warn : DEPRECATED! use '-baseaddr' not '-ctibase'
Warn : DEPRECATED! use '-baseaddr' not '-ctibase'
Warn : DEPRECATED! use '-baseaddr' not '-ctibase'
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 1000 kHz
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: auto0.tap: IR capture error; saw 0x0f not 0x01
Warn : Bypassing JTAG setup events due to errors
Error: Invalid ACK (7) in DAP response
Error: JTAG-DP STICKY ERROR

The only one who accepts is this one:
https://gist.github.com/neuberfran/5186f86a623187e49faf71f9ce8233d5
Maybe because my ft232h is from Aliexpress and not from Adafruit. I am not sure
https://pt.aliexpress.com/item/32814913865.html?spm=a2g0o.productlist.main.1.4a40bCqEbCqEAh&algo_pvid=d1fef58c-7997-4c14-b1e7-6c581470c1e3&algo_exp_id=d1fef58c-7997-4c14-b1e7-6c581470c1e3-0&pdp_npi=4%40dis%21BRL%2136.83%2136.83%21%21%216.39%216.39%21%402101fb0b17235868191183229ec2b2%2164641947041%21sea%21BR%21168391086%21X&curPageLogUid=v7HdIp3UtDGs&utparam-url=scene%3Asearch%7Cquery_from%3A

@neuberfran
Copy link
Author

@TImada
Copy link
Owner

TImada commented Aug 28, 2024

Report your debugging result on Linux including;

(1) values of prproc->bus_name, prproc->gic_name, prproc->armlocal_name and prproc->shm_name in raspi4_a72_proc_init()
(2) command outputs

$ hexdump -C /proc/device-tree/armlocal_uio@ff800000/*
$ hexdump -C /proc/device-tree/gic_uio@40041000/*
$ hexdump -C /proc/device-tree/shm@20600000/*
$ hexdump -C /proc/device-tree/reserved-memory/rtos@20000000/*
$ ls /sys/bus/platform/devices/40041000.gic_uio/
$ ls /sys/bus/platform/devices/20600000.shm/
$ ls /sys/bus/platform/devices/ff800000.armlocal_uio/

@neuberfran
Copy link
Author

@TImada How to Start rpmsg_echo from gdb/JTAG/openocd

@TImada
Copy link
Owner

TImada commented Aug 30, 2024

sudo -E gdb /path/to/rpmsg_echo on your Rasp4 Linux would be enough.

@neuberfran
Copy link
Author

@TImada Actually, sudo -E gdb /path/to/rpmsg_echo on your Rasp4 Linux would be enough worked, but...

As shown in the photo below, the ft232h is attached to the computer (USB) and not to the rpi4 USB.
20240830_143041

Therefore, I can only give the command below on the computer and not on the rpi4:
./src/openocd -f ~/openocd-code/tcl/interface/rpi4.cfg -f ~/openocd-code/tcl/target/bcm2711.cfg

Therefore, the commands: target extended-remote localhost:3333 and/Or target ext :3333 (from within the rpi4 gdb) do not work( Connection timed out.). Probably because openocd is running on the computer:
Screenshot from 2024-08-30 14-39-25

When I manage to run both commands from within the computer I get kernel panic and the error: "0x03047d53"
This is not a random error as this person has already reported the problem and has not resolved it.
https://sourceforge.net/p/openocd/mailman/openocd-user/thread/[email protected]/

@neuberfran
Copy link
Author

Report your debugging result on Linux including;

(1) values of prproc->bus_name, prproc->gic_name, prproc->armlocal_name and prproc->shm_name in raspi4_a72_proc_init() (2) command outputs

$ hexdump -C /proc/device-tree/armlocal_uio@ff800000/*
$ hexdump -C /proc/device-tree/gic_uio@40041000/*
$ hexdump -C /proc/device-tree/shm@20600000/*
$ hexdump -C /proc/device-tree/reserved-memory/rtos@20000000/*
$ ls /sys/bus/platform/devices/40041000.gic_uio/
$ ls /sys/bus/platform/devices/20600000.shm/
$ ls /sys/bus/platform/devices/ff800000.armlocal_uio/

https://www.youtube.com/watch?v=Fw8GwKnr_8I

@TImada
Copy link
Owner

TImada commented Aug 31, 2024

You don't need to use OpenOCD and a JTAG probe to debug rpmsg_echo.
Use SSH to log-in your Raspi4 then invoke sudo -E gdb ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants