Subject: [PATCH 1/1] ARM:lib32: add architected timer

Sascha Hauer sha at pengutronix.de
Sat Mar 4 06:14:42 PST 2023


On Fri, Mar 03, 2023 at 06:31:27PM +0100, Ahmad Fatoum wrote:
> Hi,
> 
> On 03.03.23 18:05, Renaud Barbier wrote:
> > In preparation for the introduction of the LS1021A support,
> > add a specific timer support based on the LS1046A support so
> > that delays can be used in the PBL.
> > 
> > Signed-off-by: Renaud Barbier <renaud.barbier at ametek.com>
> > ---
> >  arch/arm/lib32/Makefile                |  2 ++
> >  arch/arm/lib32/arm_architected_timer.c | 17 +++++++++++++++++
> >  include/clock.h                        |  2 ++
> >  3 files changed, 21 insertions(+)
> >  create mode 100644 arch/arm/lib32/arm_architected_timer.c
> > 
> > diff --git a/arch/arm/lib32/Makefile b/arch/arm/lib32/Makefile
> > index 82507fffc0..d54fb7644c 100644
> > --- a/arch/arm/lib32/Makefile
> > +++ b/arch/arm/lib32/Makefile
> > @@ -31,6 +31,8 @@ extra-y += barebox.lds
> >  pbl-y	+= lib1funcs.o
> >  pbl-y	+= ashldi3.o
> >  pbl-y	+= div0.o
> > +pbl-$(CONFIG_CPU_32v7)	+= arm_architected_timer.o
> > +CFLAGS_arm_architected_timer.o := -march=armv7-a
> 
> Sorry, I should have been clearer before. Once you only build the
> file for ARMv7, you don't need to mess with -march=armv7-a anymore,
> see arch/arm/Makefile:
>   
>   arch-$(CONFIG_CPU_32v7) :=-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a)

You still need to add -march=armv7-a. CONFIG_CPU_32v7 means support for
that CPU is enabled, but that isn't necessarily the only CPU supported.
arch/arm/Makefile continues with:

arch-$(CONFIG_CPU_32v6)         :=-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6)
arch-$(CONFIG_CPU_32v5)         :=-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t)
arch-$(CONFIG_CPU_32v4T)        :=-D__LINUX_ARM_ARCH__=4 -march=armv4t

That means when you build barebox with CONFIG_CPU_32v7 and
CONFIG_CPU_32v4T enabled you'll end up with -march=armv4t. In that case
you still have to explicitly pass -march=armv7-a for compilation of
arm_architected_timer.c.

It's perfectly fine how Renaud did it here.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list