Gnuk with GCC >= 5

NIIBE Yutaka gniibe at fsij.org
Mon Aug 27 03:30:46 CEST 2018


Bertrand Jacquin <bertrand at jacquin.bzh> wrote:
> After doing
> the same operation on a different host where the firmware was built
> using gcc 4.9.4, the USB key was detected normally as usual.
[...]
> I build the firmware with several version of gcc
> and noticed that firmware built using gcc 5.9.4 was fine when firmwares
> build with gcc 6.4.0 or 7.3.0 produced non functional firmwares.

I think that I once (or twice) had encountered an issue in upgrading
GNU Toolchain.

What's your libc?  Is Gnuk linked correct version?

For me, when it's 6.3.1, I have following entries in
gnuk/src/build/gnuk.map:

==============================
/usr/lib/gcc/arm-none-eabi/6.3.1/thumb/v7-m/libgcc.a(_lshrdi3.o)
                              build/sha512.o (__aeabi_llsr)
/usr/lib/gcc/arm-none-eabi/6.3.1/thumb/v7-m/libgcc.a(_ashldi3.o)
                              build/sha512.o (__aeabi_llsl)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/thumb/v7-m/libc.a(lib_a-memcmp.o)
                              build/openpgp.o (memcmp)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/thumb/v7-m/libc.a(lib_a-memcpy.o)
                              build/call-rsa.o (memcpy)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/thumb/v7-m/libc.a(lib_a-memset.o)
                              build/usb_ctrl.o (memset)
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/thumb/v7-m/libc.a(lib_a-strlen-stub.o)
                              build/bignum.o (strlen)
==============================

The important point is that we need to use V7-M/Thumb implementation of
libc, while there are multiple implementations.  If it's not thumb one,
the first call memset will cause failure, IIRC.

I needed to upgrade newlib together.  It should be handled by the
gcc-arm-none-eabi package with dependency.  It seems that this problem
has been fixed by gcc-arm-none-eabi version 15:7-2018-q2-3 recently.
-- 



More information about the Gnuk-users mailing list