将Keil UVision项目移植到GNU工具链

13 posts / 0 new
Last post
mohit3112
离线
Last seen:7个月2周前
专家
加入:2014-08-04 13:45
将Keil UVision项目移植到GNU工具链

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
链接out / full_emb_sysram.axf
。。/../../patch_code/obj/ch_map.obj: file not recognized: File format not recognized
Collect2:错误:LD返回1个退出状态
make: *** [out/full_emb_sysram.axf] Error 1

so basically patch code is not recognised by gcc-arm-none-eabi

任何评论我可能做错了什么吗?

谢谢
Mohit Maheshwari

JE_Dialog
离线
Last seen:3 hours 2 min ago
Staff
加入:2013-12-05 14:02
你好莫希特,

你好莫希特,

本周我们的GNU专家是ooo,允许我自己没有多大的GNU经验。我在线快速搜索:可以在GNU中链接才能链接吗?这个线程Belwo意味着没有。

BR JE_Dialog

http://www.delorie.com/djgpp/v2faq/faq17_5.html

mohit3112
离线
Last seen:7个月2周前
专家
加入:2014-08-04 13:45
谢谢for relpy , I got new

谢谢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

cverdier
离线
Last seen:5年5个月前
加入:2014-09-25 14:54
你好,

你好,

我得到了相同的结果,当我使用这个工具链GCC-ARM-None-EABI-4_8-2014Q3编译时无法宣传。但是,我可以运行代码(即LED闪烁)及其工作。
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 ?

cverdier
离线
Last seen:5年5个月前
加入:2014-09-25 14:54
我可以确认-FPLUGIN

我可以确认-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
离线
Last seen:5年5个月前
加入:2014-09-25 14:54
Here is my Makefile for

Here is my Makefile for further info :
#
# The Makefile must define the following variables, which are used by common.mk:
#O:输出目录
# STACK_SIZE: number of bytes to reserve for the stack
# HEAP_SIZE: number of bytes to reserve for the heap
#Cortex_m:Cortex-M模型为目标
#startup_defs:define配置启动代码
#cflags:用于编译和链接的标志
# LDFLAGS: flags used for linking
#rom_map_file:rom地图文件
# OBJ: list of object files to compile and link
#target_ell:目标的名称(用于生成的图像)
#

# output directory
o?=出来

# 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)模块/ 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 / RECIP / SRC / ARCH / MAIN / BLE / ARCH_SLEEP.C \
PLF / REFIP / SRC / ARCH / MAIN / BLE / NMI_HANDLER.C \
PLF / RECIP / 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),$(profise_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 \
模块/ 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 \
模块/ app / src / app_profiles /阀瓣\
模块/ app / src / app_profiles / play \
模块/ app / src / app_profiles / findme \
模块/ app / src / app_profiles / ht \
modules/app/src/app_profiles/ieu \
模块/ app / src / app_profiles / mpu \
模块/ 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 \
模块/ gtl / src \
modules/ke/api \
modules/ke/src \
模块/ 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 /司机/电池\
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 / RECIP / 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),$(模块))
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)

#不要抱怨未知属性(即Zero_Init)
CFLAGS += -Wno-attributes -Wno-unused

#Check:此标志可防止警告
# "uses 2-byte wchar_t yet the output is to use 4-byte wchar_t;
# use of wchar_t values across objects may fail"
#重新审视如果由于WCHAR_T字符串的预期不起作用。
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

包括常见的..

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

And my common.mk

#
#makefiles使用的常见变量和谱。
# The following variables are defined:
# CC: C cross-compiler
# CPP: cross-preprocessor
# OBJCOPY: cross-objcopy
#ured_nano:链接标志选择newlib-nano
#ured_semihost:链接标志以启用半主轴
# 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

#详细转换
V ?= 0
ifeq ($(V),0)
v_cc = @echo“cc”$ @;
V_CPP = @echo " CPP " $@;
V_LINK = @echo " LINK " $@;
v_objcopy = @echo“objcpy”$ @;
v_clean = @echo“干净”;
v_sed = @echo“sed”$ @;
v_gawk = @echo“gawk”$ @;
else
v_opt ='-v'
万一

#使用newlib-nano。要禁用它,请指定dust_nano =
USE_NANO := --specs=nano.specs

#使用半主轴
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
万一

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)

运行:$(o)/ $(target_elf).bin
@(cd $(O) && JLinkExe ../loadbin.txt)

$(o)/:
@mkdir -p $(V_OPT) $(O)/lst

#如何创建主ELF目标
$(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).hex:$(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 $< $@

#如何创建链接器脚本
$(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)

#如何编译c文件
%.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 $@

mohit3112
离线
Last seen:7个月2周前
专家
加入:2014-08-04 13:45
Hi cverdier,

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

cverdier
离线
Last seen:5年5个月前
加入:2014-09-25 14:54
我设法编译了

我设法使用GCC 4.9进行“Tree_Switch_ELF”选项for Mac,https://launchpad.net/gcc-arm-embedded/4.9。我在makefile中进行了这种变化:

# optimisation flags
cflags + = -os -ftree-switch-快捷方式

没有路ck, same crash on the module as soon as I use cmd->channel_map to select one channel for broadcast..

ankitdaf
离线
Last seen:2 years 7 months ago
加入:2015-09-03 20:14
tree-switch-shortcut is no

如果我正确理解,树切换快捷方式不再是插件,默认情况下会发生这种情况,并且现在是GCC的一个功能。该文件在GCC / GCC文件夹中也是GCC源的一部分,您可以看看

cverdier
离线
Last seen:5年5个月前
加入:2014-09-25 14:54
有没有机会拥有

有没有机会拥有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 !

谢谢:)

CoreyWilliamson
离线
Last seen:4年9月前
加入:2014-10-10 06:29
你好,

你好,

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?

谢谢

paul.deboer
离线
Last seen:1你们ar 1 month ago
加入:2014-06-03 10:57
解决方案是使用它

解决方案是使用它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\")"

mohit3112
离线
Last seen:7个月2周前
专家
加入:2014-08-04 13:45
你能确认六角文件吗?

你能确认你生成的六角文件吗?