AW: Problems running RTEMS on Raspberry Pi2

Jan.Sommer at dlr.de Jan.Sommer at dlr.de
Fri Jul 26 06:36:35 UTC 2019


Hi Chris,

> -----Ursprüngliche Nachricht-----
> Von: Chris Johns [mailto:chrisj at rtems.org]
> Gesendet: Freitag, 26. Juli 2019 02:26
> An: Nils Hölscher
> Cc: Sebastian Huber; Sommer, Jan; users at rtems.org
> Betreff: Re: Problems running RTEMS on Raspberry Pi2
> 
> Hi Nils,
> 
> Many thanks for taking the time to review the code, it is appreciated.
> 
> On 25/7/19 10:17 pm, Nils Hölscher wrote:
> > Hi,
> >
> > I think r7 no longer holds the expected value in line 242
> >
> <https://git.rtems.org/rtems/tree/bsps/arm/shared/start/start.S?id=bdec
> 62c4d5aa25e5a98b9fafe78936a7beb96a6e#n242> and
> > that is why it breaks.
> 
> The RPi2 does not support SMP and this instruction is in in an RTEMS_SMP
> block.
> 

I thought the RPi2 (the first version with ARMv7) would support SMP.
There was a GSoC for this at some time. Is this not correct anymore?
 
Cheers,

   Jan

> On an SMP build the process index is checked and left in r7. It looks ok to
> me.
> 
> > In the old file r7 was holding the value after this
> >
> <https://git.rtems.org/rtems/tree/bsps/arm/shared/start/start.S?id=af80b
> 0a3406bef73dc6550421947a981c939da27#n155> instruction.
> > however this not he case in the newer version.
> > r7 is used as destination register in more instructions and not only for
> holding
> > the stack sizes.
> >
> https://git.rtems.org/rtems/tree/bsps/arm/shared/start/start.S?id=bdec6
> 2c4d5aa25e5a98b9fafe78936a7beb96a6e#n164
> >
> https://git.rtems.org/rtems/tree/bsps/arm/shared/start/start.S?id=bdec6
> 2c4d5aa25e5a98b9fafe78936a7beb96a6e#n172
> 
> The issue is r3 is a poor choice for holding the stack address. On ARMs low
> number registers are arguments or local scratch registers when calling C
> code.
> The call to `bsp_start_arm_drop_hyp_mode` trashes r3.
> 
> I will post a patch to devel with a tested fix ...
> 
> $ sudo rtems-run --rtems-bsp=raspberrypi2 \
>      --user-config=/home/chris/.rtemstesterrc `find . -name hello.exe`
> Password:
> RTEMS Testing - Run, 5.0.not_released
>  Command Line: /opt/work/rtems/5/bin/rtems-run --rtems-
> bsp=raspberrypi2
> --user-config=/home/chris/.rtemstesterrc
> ./arm-rtems5/c/raspberrypi2/testsuites/samples/hello.exe
>  Host: FreeBSD ruru 12.0-RELEASE-p3 FreeBSD 12.0-RELEASE-p3 GENERIC
> amd64
>  Python: 3.6.6 (default, Oct  2 2018, 01:22:29) [GCC 4.2.1 Compatible
> FreeBSD
> Clang 6.0.0 (tags/RELEASE_600/final 326565)]
> Host: FreeBSD-12.0-RELEASE-p3-amd64-64bit-ELF (FreeBSD ruru 12.0-
> RELEASE-p3
> FreeBSD 12.0-RELEASE-p3 GENERIC amd64 amd64)
> 
> 
> U-Boot 2016.09-rc2-00067-gb615267-dirty (Sep 07 2016 - 17:12:15 +1000)
> 
> DRAM:  128 MiB
> RPI 2 Model B (0xa01041)
> MMC:   bcm2835_sdhci: 0
> reading uboot.env
> In:    serial
> Out:   serial
> Err:   serial
> Net:   Net Initialization Skipped
> No ethernet found.
> Hit any key to stop autoboot:  0
> starting USB...
> USB0:   Core Release: 2.80a
> scanning bus 0 for devices... 3 USB Device(s) found
>        scanning usb for storage devices... 0 Storage Device(s) found
>        scanning usb for ethernet devices... 1 Ethernet Device(s) found
> Waiting for Ethernet connection... done.
> BOOTP broadcast 1
> DHCP client bound to address 10.10.5.147 (8 ms)
> Waiting for Ethernet connection... done.
> Using sms0 device
> TFTP from server 10.10.5.2; our IP address is 10.10.5.147
> Filename '/rpi2/rtems.img'.
> Load address: 0x1000000
> Loading: ##################################################
> 53.8 KiB
>          2.8 MiB/s
> done
> Bytes transferred = 55081 (d729 hex)
> CACHE: Misaligned operation at range [01000000, 0100d729]
> ## Booting kernel from Legacy Image at 01000000 ...
>    Image Name:   RTEMS
>    Image Type:   ARM RTEMS Kernel Image (gzip compressed)
>    Data Size:    55017 Bytes = 53.7 KiB
>    Load Address: 00008000
>    Entry Point:  00008000
>    Verifying Checksum ... OK
>    Uncompressing Kernel Image ... OK
> ## Transferring control to RTEMS (at address 00008000) ...
> 
> 
> *** BEGIN OF TEST HELLO WORLD ***
> *** TEST VERSION:
> 5.0.0.6eae5860507aa19d30b8ad1464896a5e9208a7bd-modified
> *** TEST STATE: EXPECTED-PASS
> *** TEST BUILD: RTEMS_DEBUG RTEMS_POSIX_API
> *** TEST TOOLS: 7.4.0 20181206 (RTEMS 5, RSB
> 0956a2c089faf2600047577bb153afcaaba22288, Newlib 1d35a003f)
> Hello World
> 
> *** END OF TEST HELLO WORLD ***
> 
> 
> *** FATAL ***
> fatal source: 5 (RTEMS_FATAL_SOURCE_EXIT)
> fatal code: 0 (0x00000000)
> RTEMS version: 5.0.0.6eae5860507aa19d30b8ad1464896a5e9208a7bd-
> modified
> RTEMS tools: 7.4.0 20181206 (RTEMS 5, RSB
> 0956a2c089faf2600047577bb153afcaaba22288, Newlib 1d35a003f)
> executing thread ID: 0x08a010001
> executing th
> 
> U-Boot 2016.09-rc2-00067-gb615267-dirty (Sep 07 2016 - 17:12:15 +1000)
> 
> DRAM:  128 MiB
> RPI 2 Model B (0xa01041)
> MMC:   bcm2835_sdhci: 0
> reading uboot.env
> In:    serial
> Out:   serial
> Err:   serial
> Net:   Net Initialization Skipped
> No ethernet found.
> Hit any key to stop autoboot:  0
> starting USB...
> USB0:   Core Release: 2.80a
> scanning bus 0 for devices... 3 USB Device(s) found
>        scanning usb for storage devices... 0 Storage Device(s) found
>        scanning usb for ethernet devices... 1 Ethernet Device(s) found
> Run time     : 0:00:20.535828
> 
> Chris


More information about the users mailing list