Porting from Keil to gcc

8个帖子/ 0新
Last post
Ankitdaf.
Offline
Last seen:2年9个月前
加入:2015-09-03 20:14
Porting from Keil to gcc

Hi

I am trying to port the build of my 583 project from Keil to GCC.

I have managed to make a lot of progress, but stuck at a point.

1. I am getting a lot of linker errors, namely :

./../../../../../.. / ... / bly_stack/profiles/prf_utils.o: (.rodata.cust_prf_funcs+0x0):多个定义`cust_prf_funcs'
./../../../../../sdk/platform/arch/main/arch_system.o:(.rodata.cust_prf_funcs+0x0): first defined here
../../../../../../../../../../../../sdk/app_modules/src/app_sec/app_security.o: (..rodata.cust_prf_funcs+0x0):worws`cust_prf_funcs'的多个定义
./../../../../../sdk/platform/arch/main/arch_system.o:(.rodata.cust_prf_funcs+0x0): first defined here
./../../../../../sdk/app_modules/src/app_common/app.o:(.rodata.cust_prf_funcs+0x0): multiple definition of `cust_prf_funcs'
./../../../../../sdk/platform/arch/main/arch_system.o:(.rodata.cust_prf_funcs+0x0): first defined here

and so on. I think there is some switch that is incorrect, but I cannot find what it is. Any tips ?
---
2. I am getting a memory overflow error

arm-none-eabi/bin/ld: out/full_emb_sysram.axf section `.constdata' will not fit in region `RAM_IROM4'
arm-none-eabi/bin/ld: region RAM overflowed with stack
arm-none-eabi/bin/ld: section ER_IROM5 loaded at [0000000020000440,0000000020006e33] overlaps section .constdata loaded at [00000000200003e4,00000000200005eb]
arm-none-eabi/bin/ld: region `RAM_IROM4' overflowed by 428 bytes
collect2: error: ld returned 1 exit status

I suspect this has something to do with the memory settings being incorrect. Is the 580.lds file still applicable ? Can you help me with a 583.lds file? Or how do I get started porting this ?
I have done the steps from the application note, but there is still some way to go to make my 583 work, as you can see :)

I intend to use the 583 in a mainstream commercial product, so this help will go a long way.

--
Best regards

设备:
Ankitdaf.
Offline
Last seen:2年9个月前
加入:2015-09-03 20:14
Hi

Hi

I managed to make some more progress and managed to get a build up. I did this by manually comparing the symbol table in the .map files , I noticed that quite a few symbols in rom_symdef.txt were commented out, that were present in the map that was generated from Keil. I uncommented them and the build succeeded.

然而,可执行大小无处可靠地接近Keil生成的。KEIL生成的十六进制文件是78.9 kB,而GCC仅为6.4 kB。我猜测很多东西丢失了(因为某处一些缺少的配置线?)

What do you think I should try ? (I am using the DA14583)

Ankitdaf.
Offline
Last seen:2年9个月前
加入:2015-09-03 20:14
I did some more digging,and I

我做了一些更多的挖掘,我意识到,随着SDK提供的符号定义文件将无法正常工作,并且需要为项目动态地生成符号表。

I have been trying various things for more than half a day now, including trying to use nm to printout the symbol table , but the most symbols are marked as undefined and don't even have an address. All the symbols have an address of 0000 0000. I am not sure if that is correct or not.
Can you please help finish the build from here ? I think I need to create a dynamic symbol table, and use it for linking.

I could share the changes I made in the makefile with you

请帮助,谢谢!

Ankitdaf.
Offline
Last seen:2年9个月前
加入:2015-09-03 20:14
Hi

Hi

I checked the .map file generated by the build, and I notice that all the application code is discarded.

In the .map file, there is a "Discarded input sections" entry below which are all the user defined functions etc.

有链接时间优化还是这样弄乱?
我试图删除-ffunction-sections和-fdata-sections,但它没有帮助,它只显示出溢出错误。

可以是链接文件缺少583的东西,导致链接器忽略所有用户代码?

我认为拥有正确的583.lds.s文件,其中包括ROM符号以及特定于583的内存容量可能是使应用程序工作所需的最终事项

Ankitdaf.
Offline
Last seen:2年9个月前
加入:2015-09-03 20:14
I spent some more time on

我花了一些时间。

Can a GCC expert from Dialog please help me here to figure out why the application code is getting discarded completely ? Does it have something to do with the 580.lds.S file ? Or does it
have something to do with the linker flags ? I am using gcc-arm-none-eabi 5.4

谢谢

Raohuaming.
Offline
Last seen:4年6个月前
加入:2016-07-01 00:49
I have been also trying to

I have been also trying to port my Keil 5 project into a gcc project too by using gcc-arm-none-wabi 5.4, but still with no luck. I first used the uvproj2Makefile to get a Makefile, then I made some changes to 580.lds.S and Makefile respectively. And I have all the files successfully compiled, but failed to link them all. I'm also seeking help to port it to gcc. Thx.

jamey.hicks.cmt
Offline
Last seen:3 years 5 days ago
加入:2017-03-03 14:21
I noticed that if the uvprojx

I noticed that if the uvprojx file contains support for multiple devices, source files will be copied into the Makefile multiple times.

删除重复的文件后,我能够消除多个定义错误。

The flags -ffunction-sections and -fdata-sections generate separate sections in the object files for each function and data so that the linker may include only the ones that are referenced.

It sounds like the code that references the application is not being included in your build.

我也遇到overlapping sections problem but have not solved it yet.

jamey.hicks.cmt
Offline
Last seen:3 years 5 days ago
加入:2017-03-03 14:21
I added this line:

I added this line:

*(。constdata *)

After the *(.rodata*) line in 580.lds.S and that resolved the problem where .constdata did not fit in ER_IROM2.

我正在寻找缺失的插件,导致我的ARM-None-EABI-GCC的6.2.1版,打包为GCC-ARM嵌入式:https://launchpad.net/~team-gcc-arm-embedded/+archive/ubuntu/ppa

This version of gcc includes the switch optimization using flag -ftree-switch-conversion and generates a smaller binary.

I have not tested any of this code yet, my dev modules are on order.

我现在有一个python脚本,用于将keil项目文件转换为makefiles。它的工作更好,但它并不完全自动化。