Loading RTEMS applications from u-boot on Raspberry Pi 2

Cláudio Maia (clrrm) CLRRM at isep.ipp.pt
Thu Feb 20 23:26:28 UTC 2020


Hi Jan,

I tried your solution and it does not work in my case. The following is an example of the output that I get:

—————————————————————
U-Boot> fatload mmc 0 0x30000000 hello.exe
reading hello.exe
3456844 bytes read in 269 ms (12.3 MiB/s)

U-Boot> bootelf 0x30000000
CACHE: Misaligned operation at range [00200000, 002004d8]
CACHE: Misaligned operation at range [0020ea00, 0020ea0c]
CACHE: Misaligned operation at range [0020ea0c, 0020ea18]
CACHE: Misaligned operation at range [0020ea18, 002506df]
CACHE: Misaligned operation at range [002506e0, 002506e8]
CACHE: Misaligned operation at range [002506e8, 002506ec]
CACHE: Misaligned operation at range [002506ec, 002506f0]
CACHE: Misaligned operation at range [002506f0, 002506f4]
CACHE: Misaligned operation at range [002506f4, 00250734]
CACHE: Misaligned operation at range [00250734, 00300000]
CACHE: Misaligned operation at range [00300000, 00301a6c]
CACHE: Misaligned operation at range [00301a80, 00303f68]
## Starting application at 0x00200080 ...
data abort
pc : [<002006ce>]          lr : [<00200160>]
reloc pc : [<c4ec26ce>]    lr : [<c4ec2160>]
sp : 00305b74  ip : 00000010     fp : 3b348850
r10: 00000002  r9 : 3af41ee8     r8 : 00000000
r7 : 00000001  r6 : 0020ecf8     r5 : 3af42694  r4 : 600001da
r3 : 0041d710  r2 : 0020ea18     r1 : 00000000  r0 : 00000006
Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...
 
resetting …
—————————————————————

Regardless of the address where I load the ELF file I get alignment issues, even if I try to load “hello.exe” at 0x200000. 

I realised that my board version is different than yours by looking to your output. Yours is “RTEMS RPi 2B 1.1 (1GB) [00a01041]” and mine is more recent “RTEMS RPi 2B 1,2 (with BCM2837) (1GB) [00a22042]” (obtained by following Niteesh's solution). So, besides the difference in versions, I don’t see any other reason for not getting the same output as you.
 
For your information, the solution provided by Niteesh works for me without problems.

Regards,
Cláudio

> On 18 Feb 2020, at 16:31, Jan.Sommer at dlr.de wrote:
> 
> Hi Cláudio,
> 
> I build a current BSP for the raspberry pi 2 recently (atm without SMP though).
> 
>> -----Ursprüngliche Nachricht-----
>> Von: devel [mailto:devel-bounces at rtems.org] Im Auftrag von Cláudio Maia
>> Gesendet: Montag, 17. Februar 2020 21:19
>> An: devel at rtems.org
>> Betreff: Loading RTEMS applications from u-boot on Raspberry Pi 2
>> 
> 
> [...]
> 
>> 
>> -------------------
>> For approach #2, I do the following:
>> 
> 
> I skip the whole mkimage step entirely and boot the elf-files directly.
> So my u-boot commands look like this:
> 
> U-Boot> fatload mmc 0 0x30000000 ticker.exe
> 4043404 bytes read in 169 ms (22.8 MiB/s)
> U-Boot> bootelf 0x30000000
> ## Starting application at 0x00200080 ...
> 
> RTEMS RPi 2B 1.1 (1GB) [00a01041]
> 
> *** BEGIN OF TEST CLOCK TICK ***
> 
> Note, that I load the file quite far at the end of the RAM to avoid conflicts with the sections loaded by the elf-file.
> When I used lower values (below 0x10000000), my application got stuck at transfer to RTEMS as well.
> Maybe that is also the problem with your image loading?
> 
>> $ arm-rtems5-objcopy -R -S -O binary hello.exe hello.bin
>> $ mkimage -A arm -O rtems -T kernel -C none -a 0x200000 -e 0x200080 -d
>> hello.bin hello-rtems.img
>> 
>> Image Name:
>> Created:      Mon Feb 17 13:59:50 2020
>> Image Type:   ARM RTEMS Kernel Image (uncompressed)
>> Data Size:    1055340 Bytes = 1030.61 kB = 1.01 MB
>> Load Address: 00200000
>> Entry Point:  00200080
>> 
>> Then, after u-boot loads on the target, I do the following:
>> 
>> U-Boot> fatload mmc 0:1 0x200000 hello-rtems.img
>> reading hello-rtems.img
>> 1055404 bytes read in 103 ms (9.8 MiB/s)
>> 
>> U-Boot> iminfo
>> 
>> ## Checking Image at 00200000 ...
>>   Legacy image found
>>   Image Name:
>>   Image Type:   ARM RTEMS Kernel Image (uncompressed)
>>   Data Size:    1055340 Bytes = 1 MiB
>>   Load Address: 00200000
>>   Entry Point:  00200080
>>   Verifying Checksum ... OK
>> 
>> U-Boot> bootm 0x200000
>> ## Booting kernel from Legacy Image at 00200000 ...
>>   Image Name:
>>   Image Type:   ARM RTEMS Kernel Image (uncompressed)
>>   Data Size:    1055340 Bytes = 1 MiB
>>   Load Address: 00200000
>>   Entry Point:  00200080
>>   Verifying Checksum ... OK
>>   Loading Kernel Image ... OK
>> ## Transferring control to RTEMS (at address 00200080) ...
>> 
>> After this point, nothing happens on the board.
>> -------------------
>> 
>> Thank you in advance. Regards
>> Cláudio Maia
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel



More information about the devel mailing list