Porting from Keil to gcc

8 posts / 0 new
Last post
ankitdaf
Offline
Last seen:2 years 5 months ago
加入: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 :

./../../../../../sdk/ble_stack/profiles/prf_utils.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
../../../../../sdk/app_modules/src/app_sec/app_security.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
./../../../../../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

Device:
ankitdaf
Offline
Last seen:2 years 5 months ago
加入: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.

然而,可执行文件大小是离that generated by Keil. The hex file generated by Keil is 78.9 KB whereas the one by gcc is only 6.4 KB. I am guessing a lot of stuff is missing (because of some missing configuration lines somewhere ?)

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

ankitdaf
Offline
Last seen:2 years 5 months ago
加入:2015-09-03 20:14
I did some more digging,and I

I did some more digging,and I realise that the symbol definition file provided with the SDK won't work, and that the symbol table will need to be generated again dynamically for the project.

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

Please help, thanks !

ankitdaf
Offline
Last seen:2 years 5 months ago
加入: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.

Is there a Link time optimisation or some such messing with this ?
I tried to remove the -ffunction-sections and -fdata-sections but it did not help, it only showed overflow errors.

Could it be that the link file is missing something for the 583, causing the linker to ignore all the user code ?

I think having the correct 583.lds.S file which includes the rom symbols as well as memory capacity specific to the 583 might be the final thing needed to make the application work

ankitdaf
Offline
Last seen:2 years 5 months ago
加入:2015-09-03 20:14
I spent some more time on

I spent some more time on this.

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

Thanks

raohuaming
Offline
Last seen:4 years 2 months ago
加入: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:2 years 8 months 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.

After removing the duplicated files, I was able to eliminate the multiple definition errors.

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:2 years 8 months 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.

I was looking for the missing plugin, which led me to version 6.2.1 of arm-none-eabi-gcc, packaged as gcc-arm-embedded: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.

I have a python script now for converting the Keil project files to makefiles. It works better but it's not quite fully automated.