On Sun, Jan 29, 2023 at 10:08:14PM +0100, Mark Kettenis wrote:
> > Date: Sun, 22 Jan 2023 20:47:03 +0900
> > From: SASANO Takayoshi <[email protected]>
> >
> > Hi,
> >
> > Two issues.
> >
> > 1. I am trying to build ATF v2.8 with modified ports' Makefile.
> >
> > Only A64's ATF fails to build with follwing errors:
> >
> > aarch64-none-elf-ld.bfd: address 0x500dd of /usr/ports/pobj/arm-trusted-fir
> > mware-2.8.0/arm-trusted-firmware-2.8.0/build/sun50i_a64/debug/bl31/bl31.elf
> > section `.data' is not within region `RAM'
> > aarch64-none-elf-ld.bfd: /usr/ports/pobj/arm-trusted-firmware-2.8.0/arm-tru
> > sted-firmware-2.8.0/build/sun50i_a64/debug/bl31/bl31.elf section `.rela.dyn
> > ' will not fit in region `RAM'
> > aarch64-none-elf-ld.bfd: address 0x500dd of /usr/ports/pobj/arm-trusted-fir
> > mware-2.8.0/arm-trusted-firmware-2.8.0/build/sun50i_a64/debug/bl31/bl31.elf
> > section `.data' is not within region `RAM'
> > aarch64-none-elf-ld.bfd: BL31 image has exceeded its limit.
> > aarch64-none-elf-ld.bfd: region `RAM' overflowed by 224 bytes
> >
> > I found workaround for something errata wastes RAM area.
> > /usr/ports/pobj/arm-trusted-firmware-2.8.0/arm-trusted-firmware-2.8.0/build
> > /sun50i_a64/debug/bl31/bl31.map says that:
> >
> > .text.psci_system_off
> > 0x0000000000049fc4 0x5c /usr/ports/pobj/arm-trusted-f
> > irmware-2.8.0/arm-trusted-firmware-2.8.0/build/sun50i_a64/debug/bl31/psci_s
> > ystem_off.o
> > 0x0000000000049fc4 psci_system_off
> > .text.psci_system_off.stub
> > 0x000000000004a020 0x10 linker stubs
> > .text.psci_system_reset
> > 0x000000000004b020 0x5c /usr/ports/pobj/arm-trusted-f
> > irmware-2.8.0/arm-trusted-firmware-2.8.0/build/sun50i_a64/debug/bl31/psci_s
> > ystem_off.o
> > 0x000000000004b020 psci_system_reset
> >
> > It looks dangerous to disable workaround. Is there any good idea to
> > build ATF v2.8 for A64?
>
> This might need a newer gcc version that generates slightly smaller
> code, or maybe a newer binutils version that packs it tighter.
>
> > 2. Allwinner H6 PMIC issue
> >
> > (repost from ports@, same as
> > https://marc.info/?l=openbsd-ports&m=167133709916806&w=2)
> >
> > Some Allwinner H6 based board does not work ethernet and HDMI
> > (currently not used) due to improper setting of AXP805 PMIC.
> >
> > To avoid this issue, Armbian uses old ATF (v2.2). Our ATF ports cannot
> > downgrade, so using SUNXI_SETUP_REGULATORS=0 option to disable PMIC
> > handling in ATF.
> >
> > This option is discussed at ATF's code review, see
> > https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/12676
> >
> > To reduce side-effect of this change, it is the best that compiling both
> > (SUNXI_SETUP_REGULATORS=0 and 1) bl31 object separately, but looks
> > difficult.
> >
> > So this suggestion is fixed to 0, please tell me if there is better idea.
>
> Maybe jsg@ has a good idea how to build both?
I agree codesize may change with a newer toolchain.
Not sure about the other part.
>
>
> > Index: Makefile
> > ===================================================================
> > RCS file: /cvs/ports/sysutils/arm-trusted-firmware/Makefile,v
> > retrieving revision 1.19
> > diff -u -p -r1.19 Makefile
> > --- Makefile 8 Aug 2022 15:27:59 -0000 1.19
> > +++ Makefile 18 Dec 2022 02:15:39 -0000
> > @@ -35,9 +35,15 @@ PLATFORMS=\
> >
> > do-build:
> > .for P in ${PLATFORMS}
> > +. if "$P" == "sun50i_h6"
> > + cd ${WRKSRC} && \
> > + ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \
> > + V=1 PLAT=${P} DEBUG=1 SUNXI_SETUP_REGULATORS=0 bl31
> > +.else
> > cd ${WRKSRC} && \
> > ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \
> > V=1 PLAT=${P} DEBUG=1 bl31
> > +. endif
> > .endfor
> >
> > do-install:
> >
> > --
> > SASANO Takayoshi (JG1UAA) <[email protected]>
> >
> >
>