I am using application note B-24 ,after some editing i got it working till linking stage but after that i get this error
CC ../../../src/modules/app/src/app_project/template_fh/app_template_proj.o
CC startup_ARMCM0.o
LINK out/full_emb_sysram.axf
../../../patch_code/obj/ch_map.obj: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
make: *** [out/full_emb_sysram.axf] Error 1
so basically patch code is not recognised by gcc-arm-none-eabi
我可能会做什么或者说是任何评论ong ?
Thank you
Mohit Maheshwari
Hello Mohit,
our GNU expert is OOO this week and admittedly I dont have much experience of GNU myself. I did a quick search online : can .obj files be linked in GNU ? this thread belwo implies not.
BR JE_Dialog
http://www.delorie.com/djgpp/v2faq/faq17_5.html
Thanks for relpy , I got new sdk 3.0.6 , .obj files in this one has elf format and i was able to compile the project and generate hex file, but there is one optimisation option -fplugin=tree_switch_shortcut_elf that my arm-none-eabi compiler does not support , it's for optimization of R.W. FSM that is implemeted in code. i compiled removing that option and hex file is generated and i used JLinkGDBServer and gdb to upload hex file but device is not advertising i used compiler binaries from launchpad project 'https://launchpad.net/gcc-arm-embedded/+download' can you point me to resource where i can get compatible compiler
Hi,
I ve got the same result, can not advertise when I compile with this toolchain gcc-arm-none-eabi-4_8-2014q3. However I can run come code (ie. led blinking) and its working.
I can also confirm that the uart driver is not working with that tool chain. I used the conversion script to generate the Makefile. I did also some test with the DA14580_BEACON_3.40-2.6 sample code with no luck.
Whatever sample code I use when I set cmd->channel_map to anything but zero I seems to crash the module...
Any idea ?
I can confirm that -fplugin=tree_switch_shortcut_elf is not compatible with windows & mac version of gcc-arm-none-eabi-4_8-2014q3, but only on linux. I did not try on a linux box with with option (I'm compiling on a mac.)
Here is my Makefile for further info :
#
# The Makefile must define the following variables, which are used by common.mk:
# O: output directory
# STACK_SIZE: number of bytes to reserve for the stack
# HEAP_SIZE: number of bytes to reserve for the heap
# CORTEX_M: the Cortex-M model to target
# STARTUP_DEFS: define's that configure the start-up code
# CFLAGS: flags used for compilation AND linking
# LDFLAGS: flags used for linking
# ROM_MAP_FILE:ROM map file
# OBJ: list of object files to compile and link
# TARGET_ELF: name of the target (used in the generated images)
#
# output directory
O ?= out
# stack size
STACK_SIZE = 0x0600
# heap size
HEAP_SIZE = 0x0100
# Startup code
CORTEX_M := 0
STARTUP = startup_ARMCM$(CORTEX_M).S
# startup configuration
STARTUP_DEFS += -D__STACK_SIZE=$(STACK_SIZE) -D__HEAP_SIZE=$(HEAP_SIZE)
#STARTUP_DEFS += -D__START=main
#STARTUP_DEFS += -D__STARTUP_COPY_MULTIPLE
STARTUP_DEFS += -D__STARTUP_CLEAR_BSS_MULTIPLE
# -Os -flto -ffunction-sections -fdata-sections to compile for code size
#CFLAGS += -flto
CFLAGS += -ffunction-sections -fdata-sections -Wno-implicit-function-declaration
# Link for code size
GC := -Wl,--gc-sections
SRC := src/
BUILD := build/
TOP ?= $(shell pwd)
APP_SRC := ./app/B4S.c \
./app/system/periph_setup.c \
./app/system/b4s_uart.c \
$(SRC)modules/app/src/app.c \
$(SRC)modules/app/src/app_sec.c \
$(SRC)modules/app/src/app_sec_task.c \
$(SRC)modules/app/src/app_task.c
BOOT_SRC := plf/refip/src/arch/boot/rvds/system_ARMCM0.c \
plf/refip/src/arch/main/ble/hardfault_handler.c
#BOOT_SRC_S := plf/refip/src/arch/boot/rvds/boot_vectors.s
BOOT_SRC_S :=
ARCH_SRC := plf/refip/src/arch/main/ble/arch_main.c \
plf/refip/src/arch/main/ble/jump_table.c \
plf/refip/src/arch/main/ble/arch_sleep.c \
plf/refip/src/arch/main/ble/nmi_handler.c \
plf/refip/src/arch/main/ble/arch_system.c
NVDS_SRC := modules/nvds/src/nvds.c
RWBLE_SRC := modules/rwip/src/rwip.c \
ip /ble/ll/src/rwble/rwble.c
HOST_SRC := ip/ble/hl/src/host/gap/gapm/gapm.c
DRIVER_SRC := modules/rf/src/rf_580.c \
plf/refip/src/driver/gpio/gpio.c
PROFILE_SRC :=
SRCS_C := $(APP_SRC) $(addprefix $(SRC), $(BOOT_SRC)) \
$(addprefix $(SRC), $(ARCH_SRC)) \
$(addprefix $(SRC), $(NVDS_SRC)) \
$(addprefix $(SRC), $(RWBLE_SRC)) \
$(addprefix $(SRC), $(DRIVER_SRC)) \
$(addprefix $(SRC), $(PROFILE_SRC))
SRCS_S := $(addprefix $(SRC), $(BOOT_SRC_S))
HEADERS_DIR := dialog/include \
ip /ble/hl/src/hcih \
ip /ble/hl/src/host/att \
ip /ble/hl/src/host/att/attc \
ip /ble/hl/src/host/att/attm \
ip /ble/hl/src/host/att/atts \
ip /祝福/ hl \ / src /主机/差距
ip /ble/hl/src/host/gap/gapc \
ip /ble/hl/src/host/gap/gapm \
ip /ble/hl/src/host/gatt \
ip /ble/hl/src/host/gatt/gattc \
ip /ble/hl/src/host/gatt/gattm \
ip /ble/hl/src/host/i2c \
ip /ble/hl/src/host/i2c/i2cc \
ip /ble/hl/src/host/i2c/i2cm \
ip /ble/hl/src/host/l2c/l2cc \
ip /ble/hl/src/host/smp \
ip /ble/hl/src/host/smp/smpc \
ip /ble/hl/src/host/smp/smpm \
ip /ble/hl/src/rwble_hl \
ip /ble/ll/src/controller/em \
ip /ble/ll/src/controller/llc \
ip /ble/ll/src/controller/lld \
ip /ble/ll/src/controller/llm \
ip /ble/ll/src/hcic \
ip /ble/ll/src/rwble \
modules/app/api \
modules/app/src \
modules/app/src/app_utils/app_console \
modules/app/src/app_utils/app_multi_bond \
modules/app/src/app_utils/app_stream_queue \
modules/app/src/app_profiles/ancc \
modules/app/src/app_profiles/basc \
modules/app/src/app_profiles/bass \
modules/app/src/app_profiles/disc \
modules/app/src/app_profiles/diss \
modules/app/src/app_profiles/findme \
modules/app/src/app_profiles/ht \
modules/app/src/app_profiles/ieu \
modules/app/src/app_profiles/mpu \
modules/app/src/app_profiles/neb \
modules/app/src/app_profiles/prox_reporter \
modules/app/src/app_profiles/pru \
modules/app/src/app_profiles/scppc \
modules/app/src/app_profiles/spotar \
modules/app/src/app_profiles/stream \
modules/app/src/app_profiles/streamdatad \
modules/app/src/app_profiles/streamdatah \
modules/common/api \
modules/dbg/api \
modules/gtl/api \
modules/gtl/src \
modules/ke/api \
modules/ke/src \
modules/nvds/api \
modules/rf/api \
modules/rwip/api\
plf/refip/src/arch \
plf/refip/src/arch/boot/rvds \
plf/refip/src/arch/compiler/rvds \
plf/refip/src/arch/ll/rvds \
plf/refip/src/arch/main/ble \
plf/refip/src/driver/accel \
plf/refip/src/driver/adc \
plf/refip/src/driver/battery \
plf/refip/src/driver/bme280 \
plf/refip/src/driver/coex \
plf/refip/src/driver/emi \
plf/refip/src/driver/gpio \
plf/refip/src/driver/i2c_core \
plf/refip/src/driver/i2c_eeprom \
plf/refip/src/driver/intc \
plf/refip/src/driver/inv \
plf/refip/src/driver/led \
plf/refip/src/driver/pwm \
plf/refip/src/driver/rc5 \
plf/refip/src/driver/reg \
plf/refip/src/driver/spi \
plf/refip/src/driver/spi_flash \
plf/refip/src/driver/spi_hci \
plf/refip/src/driver/syscntl \
plf/refip/src/driver/timer \
plf/refip/src/driver/wkupct_quadec
BUILD_DIR := $(addprefix $(BUILD),$(MODULES))
OBJ := $(patsubst src/%.c,build/%.o,$(SRCS_C)) $(patsubst src/%.s,build/%.o,$(SRCS_S))
INCLUDES := $(addprefix -I,$(addprefix $(SRC),$(HEADERS_DIR))) -I./app -I./app/system
# optimisation flags
#CFLAGS += -Os -fplugin=tree_switch_shortcut_elf
CFLAGS += -Os
CFLAGS += $(INCLUDES)
CFLAGS += -include da14580_config.h
print-% : ; @echo $* = $($*)
# global configuration
ROM_MAP_FILE := ./misc/rom_symdef.txt
LDFLAGS += $(USE_NANO) $(USE_NOHOST) $(LDSCRIPTS) $(GC) $(MAP)
# don't complain about unknown attributes (i.e. zero_init)
CFLAGS += -Wno-attributes -Wno-unused
# CHECK: this flag prevents the warning
# "uses 2-byte wchar_t yet the output is to use 4-byte wchar_t;
# use of wchar_t values across objects may fail"
# revisit if things don't work as expected with wchar_t strings.
LDFLAGS += -Wl,--no-wchar-size-warning
src_cfiles := $(SRCS_C)
src_Sfiles := $(SRCS_S)
obj_cfiles := $(src_cfiles:.c=.o)
obj_Sfiles := $(src_Sfiles:.s=.o)
# patch objects
patch_objs := ./patch_code/obj/gapm_util.obj \
./patch_code/obj/smpc_task.obj \
./patch_code/obj/smpc.obj \
./patch_code/obj/atts_task.obj \
./patch_code/obj/ch_map.obj \
./patch_code/obj/ke_task.obj
startup_obj := $(STARTUP:.S=.o)
OBJ := $(obj_cfiles) $(obj_Sfiles) $(startup_obj)
# target
TARGET_ELF := full_emb_sysram
include common.mk
-----------------------
And my common.mk
#
# Common variables and recipies used by Makefiles.
# The following variables are defined:
# CC: C cross-compiler
# CPP: cross-preprocessor
# OBJCOPY: cross-objcopy
# USE_NANO: link flags to select newlib-nano
# USE_SEMIHOST: link flags to enable semihosting
# USE_NOHOST: link flags to disable semihosting
# MAP: link flags to create a map file
# LDSCRIPTS: link flags to use a custom link script, generated from $(LINK_SCRIPT).S
#
CROSS_COMPILE = ../toolschain/gcc-arm-none-eabi-4_8-2014q3/bin/arm-none-eabi-
CC = $(CROSS_COMPILE)gcc
CPP = $(CROSS_COMPILE)cpp
OBJCOPY = $(CROSS_COMPILE)objcopy
# verbosity switch
V ?= 0
ifeq ($(V),0)
V_CC = @echo " CC " $@;
V_CPP = @echo " CPP " $@;
V_LINK = @echo " LINK " $@;
V_OBJCOPY = @echo " OBJCPY" $@;
V_CLEAN = @echo " CLEAN ";
V_SED = @echo " SED " $@;
V_GAWK = @echo " GAWK " $@;
else
V_OPT = '-v'
endif
# Use newlib-nano. To disable it, specify USE_NANO=
USE_NANO := --specs=nano.specs
# Use semihosting or not
USE_SEMIHOST := --specs=rdimon.specs
USE_NOHOST := --specs=nosys.specs
# Create map file
MAP = -Wl,-Map=$(O)/lst/$(TARGET_ELF).map
ARCH_FLAGS = -mthumb -mcpu=cortex-m$(CORTEX_M)
# general compilation flags
CFLAGS += $(ARCH_FLAGS) $(STARTUP_DEFS) -std=gnu99
ifeq ($(V),2)
CFLAGS += --verbose
LDFLAGS += -Wl,--verbose
endif
ROM_SYMDEF := rom.symdef
ROM_SYMBOLS := rom.symbols
LINK_SCRIPT := 580.lds
LDSCRIPTS := -L. -T $(LINK_SCRIPT)
all: $(O)/$(TARGET_ELF).hex $(O)/$(TARGET_ELF).bin
清洁:
$(V_CLEAN)for file in $(OBJ); do rm -f $(V_OPT) "$$file"; done
@rm -rf $(V_OPT) $(O)
@rm -f $(V_OPT) $(ROM_SYMDEF) $(ROM_SYMBOLS) $(LINK_SCRIPT)
@rm -f $(V_OPT) $(OBJ:.o=.d)
run: $(O)/$(TARGET_ELF).bin
@(cd $(O) && JLinkExe ../loadbin.txt)
$(O)/ :
@mkdir -p $(V_OPT) $(O)/lst
# how to create the main ELF target
(O) /美元(TARGET_ELF)。axf: $(O)/ $(ROM_SYMBOLS) $(LINK_SCRIPT) $(OBJ)
$(V_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) $(patch_objs) -o $@
# how to create the final hex file
(O) /美元(TARGET_ELF)。十六进制:$ (O) / (TARGET_ELF) .axf美元
$(V_OBJCOPY)$(OBJCOPY) -O ihex $< $@
# how to create the final binary file
(O) /美元(TARGET_ELF)。bin: $(O)/$(TARGET_ELF).axf
$(V_OBJCOPY)$(OBJCOPY) -O binary $< $@
# how to create the linker script
$(LINK_SCRIPT): $(LINK_SCRIPT).S
$(V_CPP)$(CPP) $(CFLAGS) -I./app -P $< -o $@
# how to create a clean, sorted list of known symbols, used by ROM code
$(ROM_SYMDEF): $(ROM_MAP_FILE)
$(V_SED)sed -n -e 's/ */ /g p' $< | sed -e '/^[;#]/d' | \
sort | dos2unix > $@
# how to create a file with the known symbols, to be used in the linker script
$(ROM_SYMBOLS): $(ROM_SYMDEF)
$(V_GAWK)gawk '{printf "%s = %s ;\n", $$3, $$1}' $< > $@
-include $(OBJ:.o=.d)
# how to compile C files
%.o : %.c
$(V_CC)$(CC) $(CFLAGS) -c $< -o $@
@rm -f $*.d.*
@$(CC) -MM $(CFLAGS) $*.c > $*.d
@mv -f $*.d $*.d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
@rm -f $*.d.tmp
# how to compile assembly files
%.o : %.S
$(V_CC)$(CC) $(CFLAGS) -c $< -o $@
Hi cverdier,
I also compiled files on my mac and i think even ubuntu-version of toolchain does not have this -fplugin=tree_switch_shortcut_elf option (at least in the version that i have) . I am sure that compiling code without 'tree_switch_elf' option will not work because that option is used for optimisation of FSM implemented by riviera waves. One crazy option is to build our on version of arm-none-gcc with tree_switch_elf plugin enabled ( tried that in case of arm-linux-gnueabi while back , but it will take at-least one week to debug and compile gcc ). will update on same soon
Mohit Maheshwari
I managed to compile with the 'tree_switch_elf' option using GCC 4.9 for mac,https://launchpad.net/gcc-arm-embedded/4.9. I make this change in the Makefile :
# optimisation flags
CFLAGS += -Os -ftree-switch-shortcut
没有路ck, same crash on the module as soon as I use cmd->channel_map to select one channel for broadcast..
tree-switch-shortcut is no longer a plugin if I understood correctly, it happens by default and is a feature of gcc now. The file is a part of the gcc source as well in the gcc/gcc folder, you can have a look
Is there any chance to have an update on this project like having a full configured working project using the radio (including Makefile & updated linker script) using GNU GCC please ?
Any help on this subject will be much appreciated !
谢谢:)
Hi,
Has there been any update yet?
Reading the App note B-024 seems to imply that the project builds and works, has someone gotten the radio to work with the gcc tool chain yet?
Thanks
The solution is to use this toolchain:
https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update
and change the -fplugin=tree_switch_shortcut_elf into -ftree-switch-shortcut
Possibly you'll get the next error about __weak, solve that by adding -D__weak="__attribute__((weak))" to the CFLAGS in common.mk
And an error about __nop(), solve that by adding -D"__nop()"="asm(\"NOP\")"
can you confirm the hexfile you generated worked ?