2019-09-01 01:39 AM
Hi!
I am trying to build an application for STM32F429 written under Nuttx OS with touchgfx. I made stubs for oswrappers and hal to check the build. I have my own makefile and ld-script. The project compiles, but errors occur at the linking stage:
arm-none-eabi-ld: ./obj/display_main.o: in function `touchgfx :: HAL & touchgfx :: touchgfx_generic_init <NuttxHAL> (touchgfx :: DMA_Interface &, touchgfx :: LCD &, touchgfx :: TouchController &, short, short, unsigned short *, unsigned int, unsigned int) ': ./lib/touchgfx/framework/include/common/TouchGFXInit.hpp:89: undefined reference to `touchgfx :: Bitmap :: registerBitmapDatabase (touchgfx :: Bitmap :: BitmapData const *, unsigned short, unsigned short *, unsigned int, unsigned int) '
arm-none-eabi-ld: ./obj/NuttxHAL.o:(.rodata._ZTV8NuttxHAL+0x3c): undefined reference to `touchgfx :: HAL :: blockCopy (void *, void const *, unsigned int) '
arm-none-eabi-ld: ./obj/NuttxHAL.o:(.rodata._ZTV8NuttxHAL+0x60): undefined reference to `touchgfx :: HAL :: copyFBRegionToMemory (touchgfx :: Rect, unsigned short *, unsigned int) '
arm-none-eabi-ld: ./obj/NuttxHAL.o:(.rodata._ZTV8NuttxHAL+0x9c): undefined reference to `touchgfx :: HAL :: touch (int, int) '
arm-none-eabi-ld: ./lib/touchgfx/lib/core/cortex_m4f/gcc/libtouchgfx-float-abi-hard.a(AbstractPartition.o): in function `touchgfx :: AbstractPartition :: indexOf (void const *) ':
(.text._ZN8touchgfx17AbstractPartition7indexOfEPKv + 0x30): undefined reference to `__assert_func '
arm-none-eabi-ld: ./lib/touchgfx/lib/core/cortex_m4f/gcc/libtouchgfx-float-abi-hard.a(AbstractPartition.o): in function `touchgfx :: AbstractPartition :: allocate (unsigned short ) ':
(.text._ZN8touchgfx17AbstractPartition8allocateEt + 0x18): undefined reference to `__assert_func '
arm-none-eabi-ld: ./lib/touchgfx/lib/core/cortex_m4f/gcc/libtouchgfx-float-abi-hard.a(AbstractPartition.o): in function `touchgfx :: AbstractPartition :: allocateAt (unsigned short , unsigned short) ':
(.text._ZN8touchgfx17AbstractPartition10allocateAtEtt + 0x1a): undefined reference to `__assert_func '
arm-none-eabi-ld: ./lib/touchgfx/lib/core/cortex_m4f/gcc/libtouchgfx-float-abi-hard.a(CircleProgress.o): in function `touchgfx :: CircleProgress :: setStartEndAngle (int, int) ':
(.text._ZN8touchgfx14CircleProgress16setStartEndAngleEii + 0xe): undefined reference to `__assert_func '
arm-none-eabi-ld: ./lib/touchgfx/lib/core/cortex_m4f/gcc/libtouchgfx-float-abi-hard.a(AbstractProgressIndicator.o): in function `touchgfx :: AbstractProgressIndicator :: setRange (short, short, unsigned short, unsigned short) ':
(.text._ZN8touchgfx25AbstractProgressIndicator8setRangeEsstt + 0x1c): undefined reference to `__assert_func '
arm-none-eabi-ld: ./lib/touchgfx/lib/core/cortex_m4f/gcc/libtouchgfx-float-abi-hard.a(Container.o):(.text._ZN8touchgfx9Container3addERNS_8DrawableE+0 references `__assert_func 'follow
In this case, the rest of the touchgfx library is normally linked.
I use ld for linking with the following flags:
LD_FLAGS = --entry = __ start
LD_FLAGS + = -nostartfiles -nodefaultlibs
LD_FLAGS + = -Map = "$ (MAP)" --cref
LD_FLAGS + = --gc-sections
LD_FLAGS + = -T $ (LIBDIR) /nuttx-export/build/ld.script
LD_FLAGS + = -L $ (LIBDIR) / touchgfx / lib / core / cortex_m4f / gcc
LD_FLAGS + = -L $ (LIBDIR) / nuttx-export / libs
LD_FLAGS + = --start-group
LD_FLAGS + = -ltouchgfx-float-abi-hard
LD_FLAGS + = -lnuttx -lapps "$ (GCCLIB) /thumb/v7e-m/fpv4-sp/hard/libgcc.a"
LD_FLAGS + = --end-group
$ (LD) $ (OBJS) $ (LD_FLAGS) -o "$ (ELF)"
ld-script is as follows:
MEMORY
{
flash (rx) : ORIGIN = 0x08000000, LENGTH = 2048K
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K
}
OUTPUT_ARCH(arm)
EXTERN(_vectors)
ENTRY(_stext)
SECTIONS
{
.text : {
_stext = ABSOLUTE(.);
*(.vectors)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
KEEP (*(.init))
KEEP (*(.fini))
KEEP (*(.dtors))
. = ALIGN(4);
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
_etext = ABSOLUTE(.);
} > flash
. = ALIGN(4);
.init_section : {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > flash
. = ALIGN(4);
.ARM.extab : {
*(.ARM.extab*)
} > flash
. = ALIGN(4);
.ARM.exidx : {
__exidx_start = ABSOLUTE(.);
*(.ARM.exidx*)
__exidx_end = ABSOLUTE(.);
} > flash
_eronly = ABSOLUTE(.);
/* The RAM vector table (if present) should lie at the beginning of SRAM */
.ram_vectors : {
*(.ram_vectors)
} > sram
. = ALIGN(4);
.data : AT( _eronly ) {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
} > sram
.bss : {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
} > sram
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
}
I tried using g++ for linking, but the result is the same.
Have you any ideas why this happens? I'm sure I forget to add something, but can't understand what exactly it should be.
Thanks.
2019-09-02 01:05 AM
Hi @DShti,
Anything else in that build log? Sure, definitely a linker issue, primarily related to HAL methods (Base HAL is closed source), while containers, widgets, etc, are in the lib but also present as source code.
I'm a bit concerned about the spaces in the following expression.
LD_FLAGS + = -L $ (LIBDIR) / touchgfx / lib / core / cortex_m4f / gcc
/Martin
2019-09-03 12:52 PM
Hi, Martin. There are no spaces in actual makefile in LD_FLAGS, they were inserted when i pasted it as code snippet.
I added --trace and --no-demangle to ld flags and took a look at touchgfx.a contents. There is an interesting thing i found:
when ld works it is waitng for _ZN8touchgfx6Bitmap22registerBitmapDatabaseEPKNS0_10BitmapDataEtPtjj
but in touchgfx.a it see _ZN8touchgfx6Bitmap22registerBitmapDatabaseEPKNS0_10BitmapDataEtPtmm
The key of this problem is that when you built this lib uint32_t was defined as unsigned long, but when I compile my app I use <cstdint> from nuttx export, where it been defined as unsigned int. So mangling did his dirty deed.
Thanks for reply, i think this post may be closed.
2019-09-04 03:06 AM
Ahaaa, nice catch.
/Martin
2020-01-05 09:30 AM
Hi, DShti.
Could you share the steps you have taken to port your TouchGFX application to NuttX?
I want to create a STM32F746g-disco project running NuttX and there aren't many graphical frameworks available besides Nx and Lvgl that seem inferior to me compared to TouchGFX.
Thanks.
2020-06-08 09:32 AM
Hi,
The latest version of LVGL (7.0) was recently released. You can see some of the new demos here: https://lvgl.io/demos
What features in TouchGFX are important to you that you weren't able to find in NX or LVGL? We'd be happy to hear about them on our forum: https://forum.lvgl.io/