c - GCC ARM linker error - undefined reference to 'strcmp' -


i have tiva-c microcontroller project, compiled arm-none-eabi-gcc , although added string.h i'm getting 'undefined reference strcmp' linker error. i'm using precompiled toolchain: gcc-arm-none-eabi-4_8-2014q3-20140805-linux.tar.bz2 here: https://launchpad.net/gcc-arm-embedded/+download. makefile switches:

# define flags cflags = -g -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp cflags +=-os -ffunction-sections -fdata-sections -md -std=c99 -wall cflags += -pedantic -dpart_$(mcu) -c -i$(tivaware_path) cflags += -dtarget_is_blizzard_ra1 ldflags = -t $(ld_script) --entry resetisr --gc-sections 

there others same problem they've -nostd switch on in ldflags apparently don't have. i'm out of ideas now, tip great.

the problem happens because use -ld linking directly. multilib toolchain, arm-none-eabi has multiple variants of libc.a (which contains function need) , other standard libraries. -ld cannot find right libraries.

to solve problem, modify makefile in following places:

replace:

# define flags cflags = -g -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp cflags +=-os -ffunction-sections -fdata-sections -md -std=c99 -wall cflags += -pedantic -dpart_$(mcu) -c -i$(tivaware_path) cflags += -dtarget_is_blizzard_ra1 ldflags = -t $(ld_script) --entry resetisr --gc-sections 

with:

# define flags coreflags = -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp cflags = -g $(coreflags) cflags +=-os -ffunction-sections -fdata-sections -md -std=c99 -wall cflags += -pedantic -dpart_$(mcu) -c -i$(tivaware_path) cflags += -dtarget_is_blizzard_ra1 ldflags = $(coreflags) -t$(ld_script) -wl,--entry=resetisr,--gc-sections 

replace:

ld = arm-none-eabi-ld 

with:

ld = arm-none-eabi-g++ 

the idea simple - linking stage pass options relevant architecture (everything starts -m), , options linker prefixed -wl,, multiple linker options can concatenated commas, without need repeat -wl, prefix. no prefix needed -t, -l , -l.

you can check out example arm projects, include quite nice makefile - never had library issues that. on website (link in profile) go download > arm > examples, , pick 1 - there's no example tiva, 1 stm32f4 closest match.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -