Porting a Keil uVision project to the GNU tool chain

13个帖子/ 0新
最后一篇
mohit3112
Offline
最后一次露面:7 months 2 weeks ago
Expert
加入:2014-08-04 13:45
Porting a Keil uVision project to the GNU tool chain

我正在使用应用笔记B-24,在一些编辑之后,我才能完成链接阶段,但在此之后我得到了这个错误

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.odj:未识别的文件:未识别文件格式
collect2: error: ld returned 1 exit status
制作:*** [out / full_emb_sysram.axf]错误1

因此,GCC-ARM-None-EABI无法识别基本的补丁代码

我可能会做什么或者说是任何评论ong ?

Thank you
Mohit Maheshwari

JE_Dialog
Offline
最后一次露面:1 day 8 hours ago
Staff
加入:2013-12-05 14:02
Hello Mohit,

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

mohit3112
Offline
最后一次露面:7 months 2 weeks ago
Expert
加入:2014-08-04 13:45
Thanks for relpy , I got new

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“你能把我指向资源,我可以得到兼容的编译器

cverdier
Offline
最后一次露面:5 years 5 months ago
加入:2014-09-25 14:54
Hi,

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.
我还可以确认UART驱动程序无法使用该工具链。我使用转换脚本来生成makefile。我也用DA14580_Beacon_3.40-2.6的样本代码进行了一些测试,没有运气。

无论我将CMD-> Channel_Map设置为零但零的任何东西,我似乎都崩溃了...

任何的想法 ?

cverdier
Offline
最后一次露面:5 years 5 months ago
加入:2014-09-25 14:54
I can confirm that -fplugin

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.)

cverdier
Offline
最后一次露面:5 years 5 months ago
加入:2014-09-25 14:54
Here is my Makefile for

Here is my Makefile for further info :

#makefile必须定义以下变量,该变量由common.mk使用:
#O: output directory
#stack_size:为堆栈保留的字节数
#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:要编译和链接的对象文件列表
#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.

#启动代码
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 -funding-sections -fdata-sections编译代码大小
#CFLAGS += -flto
cflags + = -ffunction-sections -fdata-sections -wno-mackic-function-ocomation
#Link for code size
GC:= -WL, - GC-部分

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)模块/ app / src / app_sec_task.c \
$(SRC)modules/app/src/app_task.c

boot_src:= plf / scip / src / arch / boot / rvds / system_armc0.c \
PLF / RECIP / 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 / RWBER / RWBE.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))

标题_DIR:=对话框/包括\
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 / BLE / HL / SRC / HOST / GAP \
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 \
模块/ app / src \
模块/ app / src / app_utils / app_console \
模块/ app / src / app_utils / app_multi_bond \
modules/app/src/app_utils/app_stream_queue \
模块/ app / src / app_profiles / ancc \
模块/ app / src / app_profiles / basc \
模块/ 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 \
模块/ 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 \
模块/ app / src / app_profiles / scppc \
模块/ app / src / app_profiles / spotar \
模块/ app / src / app_profiles / stree \
modules/app/src/app_profiles/streamdatad \
modules/app/src/app_profiles/streamdatah \
modules/common/api \
modules/dbg/api \
modules/gtl/api \
modules/gtl/src \
模块/ ke / api \
模块/ 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 / RECIP / 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))
包括:= $(addprefix -i,$(addprefix $(src),$(headers_dir)))-i./app -i./app/system

#optimisation flags
#cflags + = -os-fplugin=tree_switch_shortcut_elf
cflags + = -os
cflags + = $(包括)
CFLAGS += -include da14580_config.h

打印-% : ;@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
#“使用2字节WCHOR_T但输出是使用4字节WCH1_T;
#使用对象的WCHAR_T值可能会失败“
#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_ell:= full_emb_sysram

include common.mk

---------------------

And my common.mk


#Common variables and recipies used by Makefiles.
#定义了以下变量:
#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_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 " $@;
别的
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

#创建地图文件
MAP = -Wl,-Map=$(O)/lst/$(TARGET_ELF).map

ARCH_FLAGS = -MTHUMB -MCPU = Cortex-M $(Cortex_m)

#常规编译标志
CFLAGS += $(ARCH_FLAGS) $(STARTUP_DEFS) -std=gnu99

IFEQ($(v),2)
cflags + = - 鼠标
LDFLAGS += -Wl,--verbose
endif

ROM_SYMDEF := rom.symdef
ROM_SYMBOLS := rom.symbols
LINK_SCRIPT := 580.lds
LDSCRIPTS := -L. -T $(LINK_SCRIPT)

全部:$(o)/ $(target_elf).hex $(o)/ $(target_elf).bin

干净的:
$(v_clean)以$(obj)为文件;do rm -f $(v_opt)“$$文件”;完毕
@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:$()/ $(rom_symbols)$(link_script)$(obj)
$(V_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) $(patch_objs) -o $@

#如何创建最终的十六进制文件
(O) /美元(TARGET_ELF)。十六进制:$ (O) / (TARGET_ELF) .axf美元
$(V_OBJCOPY)$(OBJCOPY) -O ihex $< $@

#如何创建最终的二进制文件
$(o)/ $(target_elf).bin:$()/ $(target_elf).axf
$(v_objcopy)$(objcopy)-o二进制$ <$ @

#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 $ *。天。*
@$(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 $ @

mohit3112
Offline
最后一次露面:7 months 2 weeks ago
Expert
加入:2014-08-04 13:45
Hi cverdier,

Hi cverdier,

我还编译了我的Mac上的文件,我认为甚至Ubuntu-version的工具链没有这个--fplugin = tree_switch_shortcut_elf选项(至少在我拥有的版本中)。我确信没有'tree_switch_elf'选项的编译代码将无法运行,因为该选项用于优化由Riviera波实现的FSM。一个疯狂的选项是通过启用Tree_Switch_EFP插件构建我们的ARM-None-GCC版本(在返回的ARM-Linux-GNUEABI的情况下尝试,但它将在调试和编译GCC中采用。会很快更新

Mohit Maheshwari

cverdier
Offline
最后一次露面:5 years 5 months ago
加入:2014-09-25 14:54
I managed to compile with the

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

在我使用cmd-> channel_map时,在模块上没有运气,在模块上相同的崩溃,选择一个广播频道..

Ankitdaf.
Offline
最后一次露面:2 years 7 months ago
加入:2015-09-03 20:14
tree-switch-shortcut is no

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

cverdier
Offline
最后一次露面:5 years 5 months ago
加入:2014-09-25 14:54
Is there any chance to have

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 ?

对这一主题的任何帮助都非常感谢!

谢谢:)

CoreyWilliamson
Offline
最后一次露面:4 years 9 months ago
加入:2014-10-10 06:29
Hi,

Hi,

Has there been any update yet?

阅读App Note B-024似乎暗示该项目构建和作品,有人有人遇到了与GCC工具链一起使用吗?

Thanks

paul.deboer
Offline
最后一次露面:1 year 1 month ago
加入:2014-06-03 10:57
The solution is to use this

The solution is to use this toolchain:
https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update
并将-fplugin = tree_switch_shortcut_ELF更改为-Ftree-Switch-快捷方式

可能您将获得关于__weak的下一个错误,通过添加-d__weak =“__属性__((弱))”在compar中的cflags来解决。
And an error about __nop(), solve that by adding -D"__nop()"="asm(\"NOP\")"

mohit3112
Offline
最后一次露面:7 months 2 weeks ago
Expert
加入:2014-08-04 13:45
can you confirm the hexfile

can you confirm the hexfile you generated worked ?