Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Is is possible to do a native build of arm trusted firmware?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 721
Location: Oslo, Norway

PostPosted: Fri Dec 08, 2023 9:31 am    Post subject: Is is possible to do a native build of arm trusted firmware? Reply with quote

Or is cross compiling the only option?

Code:

$ git checkout v2.10.0
HEAD is now at b6c094840 Merge "docs(changelog): changelog for v2.10 release" into integration
$ git rev-parse --short HEAD
b6c094840
$ git clean -dxf
$ make PLAT=rk3399 CC=gcc HOSTCC=gcc
  CC      lib/libfdt/fdt.c
  CC      lib/libfdt/fdt_addresses.c
...
  CC      plat/rockchip/rk3399/drivers/pmu/pmu.c
make[1]: Entering directory '/home/user/projects/arm-trusted-firmware/plat/rockchip/rk3399/drivers/m0'
  CC      src/dram.c
arm-none-eabi-gcc -g -mcpu=cortex-m0 -mthumb -Wall -O3 -nostdlib -mfloat-abi=soft -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-common -Iinclude/ -I../../include/shared/ -MMD -MT /home/user/projects/arm-trusted-firmware/build/rk3399/release/m0/dram.o -c src/dram.c -o /home/user/projects/arm-trusted-firmware/build/rk3399/release/m0/dram.o
make[1]: arm-none-eabi-gcc: No such file or directory
make[1]: *** [Makefile:125: /home/user/projects/arm-trusted-firmware/build/rk3399/release/m0/dram.o] Error 127
make[1]: Leaving directory '/home/user/projects/arm-trusted-firmware/plat/rockchip/rk3399/drivers/m0'
make: *** [plat/rockchip/rk3399/platform.mk:110: /home/user/projects/arm-trusted-firmware/build/rk3399/release/m0/rk3399m0.bin] Error 2
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 721
Location: Oslo, Norway

PostPosted: Fri Dec 08, 2023 10:31 am    Post subject: Reply with quote

This seem to be related to the rk3399 as I tried the same on a Pi5 with "make PLAT=rpi4 CC=gcc HOSTCC=gcc" (as there is no rpi5 defined yet) and it resulted in a build/rpi4/release/bl31.bin.
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Fri Dec 08, 2023 3:46 pm    Post subject: Reply with quote

pgu,

you will need to share more context if you need help. It is unclear what repo you are using. the error "make[1]: arm-none-eabi-gcc: No such file or directory" seems indicate something is missing but without context there is no way to understand what it is.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22649

PostPosted: Fri Dec 08, 2023 3:47 pm    Post subject: Reply with quote

Your output suggests to me that cross-compiling is at least somewhat supported, since it tried to use a qualified gcc name. You have no such gcc. If you install the required gcc, what happens?
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 721
Location: Oslo, Norway

PostPosted: Sat Dec 09, 2023 9:50 am    Post subject: Reply with quote

pingtoo wrote:
It is unclear what repo you are using.


I'm sorry, I should have included the URL: https://github.com/ARM-software/arm-trusted-firmware
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 721
Location: Oslo, Norway

PostPosted: Sat Dec 09, 2023 10:06 am    Post subject: Reply with quote

It seems like I need a cross compiler for the cortex-m0. If I try to use the regular arm gcc on the host I get an error that the thumb/float-abi=soft is not supported:

Code:

$ make PLAT=rk3399 bl31 M0_CROSS_COMPILE=""
make -C plat/rockchip/rk3399/drivers/m0 BUILD=/home/user/projects/arm-trusted-firmware/build/rk3399/release/m0
make[1]: Entering directory '/home/user/projects/arm-trusted-firmware/plat/rockchip/rk3399/drivers/m0'
  CC      src/dram.c
gcc -g -mcpu=cortex-m0 -mthumb -Wall -O3 -nostdlib -mfloat-abi=soft -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-common -Iinclude/ -I../../include/shared/ -MMD -MT /home/user/projects/arm-trusted-firmware/build/rk3399/release/m0/dram.o -c src/dram.c -o /home/user/projects/arm-trusted-firmware/build/rk3399/release/m0/dram.o
gcc: error: unrecognized command-line option ‘-mthumb’
gcc: error: unrecognized command-line option ‘-mfloat-abi=soft’
make[1]: *** [Makefile:125: /home/user/projects/arm-trusted-firmware/build/rk3399/release/m0/dram.o] Error 1
make[1]: Leaving directory '/home/user/projects/arm-trusted-firmware/plat/rockchip/rk3399/drivers/m0'
make: *** [plat/rockchip/rk3399/platform.mk:110: /home/user/projects/arm-trusted-firmware/build/rk3399/release/m0/rk3399m0.bin] Error 2

$ gcc -dumpspecs | grep -i cortex
%{!static|static-pie:--eh-frame-hdr} %{h*}                 %{static:-Bstatic}                              %{shared:-shared}                               %{symbolic:-Bsymbolic}         %{!static:%{!static-pie:                           %{rdynamic:-export-dynamic}                     %{!shared:-dynamic-linker %{muclibc:/lib/ld-uClibc.so.0;:%{mbionic:/system/bin/linker;:%{mmusl:/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1;:/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1}}}}}}    %{static-pie:-Bstatic -pie --no-dynamic-linker -z text}    -X                                               %{mbig-endian:-EB} %{mlittle-endian:-EL}        -maarch64linux%{mabi=ilp32:32}%{mbig-endian:b} %{mfix-cortex-a53-835769:--fix-cortex-a53-835769} %{mfix-cortex-a53-843419:--fix-cortex-a53-843419}

Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Sat Dec 09, 2023 1:20 pm    Post subject: Reply with quote

pgu wrote:
It seems like I need a cross compiler for the cortex-m0. If I try to use the regular arm gcc on the host I get an error that the thumb/float-abi=soft is not supported:

Code:

$ make PLAT=rk3399 bl31 M0_CROSS_COMPILE=""
make -C plat/rockchip/rk3399/drivers/m0 BUILD=/home/user/projects/arm-trusted-firmware/build/rk3399/release/m0
make[1]: Entering directory '/home/user/projects/arm-trusted-firmware/plat/rockchip/rk3399/drivers/m0'
  CC      src/dram.c
gcc -g -mcpu=cortex-m0 -mthumb -Wall -O3 -nostdlib -mfloat-abi=soft -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-common -Iinclude/ -I../../include/shared/ -MMD -MT /home/user/projects/arm-trusted-firmware/build/rk3399/release/m0/dram.o -c src/dram.c -o /home/user/projects/arm-trusted-firmware/build/rk3399/release/m0/dram.o
gcc: error: unrecognized command-line option ‘-mthumb’
gcc: error: unrecognized command-line option ‘-mfloat-abi=soft’
make[1]: *** [Makefile:125: /home/user/projects/arm-trusted-firmware/build/rk3399/release/m0/dram.o] Error 1
make[1]: Leaving directory '/home/user/projects/arm-trusted-firmware/plat/rockchip/rk3399/drivers/m0'
make: *** [plat/rockchip/rk3399/platform.mk:110: /home/user/projects/arm-trusted-firmware/build/rk3399/release/m0/rk3399m0.bin] Error 2

$ gcc -dumpspecs | grep -i cortex
%{!static|static-pie:--eh-frame-hdr} %{h*}                 %{static:-Bstatic}                              %{shared:-shared}                               %{symbolic:-Bsymbolic}         %{!static:%{!static-pie:                           %{rdynamic:-export-dynamic}                     %{!shared:-dynamic-linker %{muclibc:/lib/ld-uClibc.so.0;:%{mbionic:/system/bin/linker;:%{mmusl:/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1;:/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1}}}}}}    %{static-pie:-Bstatic -pie --no-dynamic-linker -z text}    -X                                               %{mbig-endian:-EB} %{mlittle-endian:-EL}        -maarch64linux%{mabi=ilp32:32}%{mbig-endian:b} %{mfix-cortex-a53-835769:--fix-cortex-a53-835769} %{mfix-cortex-a53-843419:--fix-cortex-a53-843419}

Your regular gcc seems to build for aarch64(arm64) so my guess is that you do need cross-compile.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum