#26 Linker error compiling stm32f4discovery/usbnsh

arm
closed
nobody
None
1
2014-04-28
2014-04-25
Anonymous
No

I am trying to compile the usbnsh configuration on the f4discovery board. I am using buildroot toolchain and config copied by cd tools/; ./configure.sh stm32f4discovery/usbnsh. I got two errors compiling it:

  • the compiler is hardfp, trying to compile softfp, linker complains about VFP registers

I 'fixed' by adding ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard to the Make.defs file. I found the string by grepping the sources.

It was in README.txt for stm32f4discovery. According to it:

You will see the following lines in each Make.defs file:

ifeq ($(CONFIG_ARCH_FPU),y)
ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
else
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif

Those lines did not exist.




  • Another linker error:

/home/esa/nuttx-code/nuttx/lib/libarch.a(stm32_otgfsdev.o): In function up_usbinitialize': stm32_otgfsdev.c:(.text+0x1410): undefined reference toup_prioritize_irq'

the function is surrounded by:

#ifdef CONFIG_ARCH_IRQPRIO
...
#endif

By default in the stm32f4discovery/usbnsh CONFIG_ARCH_IRQPRIO is not defined

Discussion

  • Gregory Nutt
    Gregory Nutt
    2014-04-25

    I 'fixed' by adding ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard to the Make.defs file. ...

    I believe that this change is incorrect. The ARCHCPUFLAGS must be set in arch/arm/src/armv7-m/Toolchain.defs, never explicitly in the Make.defs file. The Make.defs file should, instead include the Toolchain.defs file.

    CONFIG_ARCH_IRQPRIO should never be defined since nested interrupts are not supported in the usual case. I just recently changed the default so that IRQ priorities are not supported by default. (This only worked before because the default priorities were all the same.

    So yes this is a problem and it is fixed with commit: ec8c32f99f5639dbd7b58a03cc4be561d61d1a1a

     
  • Librae
    Librae
    2014-04-28

    Greg,

    I can still see such build error if we don't make the up_prioritize_irq enclosed in a #ifdef/#endif.
    Seems it happens in each place we call up_prioritize_irq.

    (Tried with current latest version: nuttx-7.1-279-ged8c667)

    LD: nuttx
    /home/yrliao/workspace/nuttx-git/nuttx/lib/libarch.a(stm32_usbdev.o): In function usbdev_register': stm32_usbdev.c:(.text+0x12e2): undefined reference toup_prioritize_irq'
    stm32_usbdev.c:(.text+0x12ea): undefined reference to up_prioritize_irq' make[1]: *** [nuttx] Error 1 make[1]: Leaving directory/home/yrliao/workspace/nuttx-git/nuttx/arch/arm/src'
    make: *** [pass2] Error 2

     
  • Gregory Nutt
    Gregory Nutt
    2014-04-28

    Okay... I think I have the rest of them now with commit 9811576dddf0a9a7300e35174d291c9ece70bd12. Let me know if you see more problems.

     


Anonymous


Cancel   Add attachments