Closed akohlsmith closed 7 years ago
I'm an idiot.
It's important to specify the library after the object files.
arm-none-eabi-gcc -mthumb -mcpu=cortex-m0 -march=armv6-m -L ../../nrf5x-base/make/../make/ld -T ../../nrf5x-base/make/../make/ld/gcc_nrf51_s130_2.0.1_16_256.ld -Wl,--gc-sections -Wl,-Map=_build/gzl_s130.Map _build/startup_nrf51.os _build/system_nrf51.o _build/main.o _build/softdevice_handler.o _build/app_util_platform.o _build/app_error_weak.o _build/app_timer.o _build/app_error.o _build/nrf_drv_common.o _build/nrf_drv_clock.o _build/led.o ../../nrf5x-base/make/../sdk/nrf5_sdk_12.2.0/components/proprietary_rf/gzll/gcc/gzll_nrf51_sd_resources_gcc.a -o _build/gzl_s130.elf
Works fine.
Now my question (so I can send another PR) -- How should I structure this in the nrf5x-base Makefile? I don't see an existing method to specify libraries. Currently I have resolved this by creating a $(LIBS)
variable and using it during the linker phase:
LIBS += $(SDK_PATH)components/proprietary_rf/gzll/gcc/gzll_nrf51_sd_resources_gcc.a
and then lower in the Makefile, when generating the $(HEX)
target:
$(HEX): $(OBJS) $(OBJS_AS)
$(PRINT_LD)
$(Q)$(LD) $(LDFLAGS) $(OBJS_AS) $(OBJS) $(LIBS) -o $(ELF)
How would you prefer to see this for a more generic solution?
Finally, how would you recommend a cleaner/neater way to specify that the user wants to use Gazell or Enhanced ShockBurst in the application Makefile so the nrf5x-base Makefile can link in the library? I was thinking to have a USE_GZLL=1
or USE_ESB=1
and look for that.
Sorry I didn't get you feedback in a very timely manner, but I think the PR looks great.
Now that #29 is pulled, does that solve this issue?
yes, works here with #29 pulled in. Thanks!
I'm trying to use the gazell library with the s130 softdevice (s210 only works on nrf51422).
Without changing anything, I can't find the gazell header files. That's an easy fix:
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)proprietary_rf/gzll
now the application compiles, but cannot link. Specifically:
I believe this is because neither
gzll_nrf51_gcc.a
norgzll_nrf51_sd_resources_gcc.a
are being linked in.nm -a shows
nrf_gzll_init
is within the former static library:I've momentarily hacked in the following:
LDFLAGS += -L $(SDK_PATH)components/proprietary_rf/gzll/gcc -l:gzll_nrf51_gcc.a
I'm now running into an issue I don't know how to resolve:
It's finding the library (if I change the path or the name of the library, it rightfully complains) but it does not seem to be linking it in.
Any suggestions?