final link failed: Memory exhausted

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

final link failed: Memory exhausted

5,357 Views
DavidS
NXP Employee
NXP Employee

Hello,

Weird link issue that gives following error that I cannot figure out:

**** Build of configuration Int Flash SramData Debug for project cyassl_client_gcc ****

 

 

"C:\\Freescale\\CW MCU v10.5\\gnu\\bin\\mingw32-make" -j16 all

'Building target: cyassl_client.elf'

'Executing target #2 cyassl_client.elf'

'Invoking: ARM Ltd Windows GCC C Linker'

"C:/Freescale/CW MCU v10.5/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-gcc" @"cyassl_client.args" -o"cyassl_client.elf"

c:/freescale/cw mcu v10.5/cross_tools/arm-none-eabi-gcc-4_7_3/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/bin/ld.exe: final link failed: Memory exhausted

collect2.exe: error: ld returned 1 exit status

mingw32-make: *** [cyassl_client.elf] Error 1

 

I'm using CW10.5 for Kinetis K70, ARM GCC compiler, and MQX4.0.2.2.  I have another MQX application that does compile fine within the same build environment and its output looks like: 

**** Build of configuration Int Flash SramData Debug for project ctaocrypt_test_gcc ****

 

 

"C:\\Freescale\\CW MCU v10.5\\gnu\\bin\\mingw32-make" -j16 all

'Building file: ../Sources/main.c'

'Building file: C:/Folders/Developers/WolfSSL/cyassl-2.8.0/ctaocrypt/test/test.c'

'Executing target #1 ../Sources/main.c'

'Executing target #2 C:/Folders/Developers/WolfSSL/cyassl-2.8.0/ctaocrypt/test/test.c'

'Invoking: ARM Ltd Windows GCC C Compiler'

"C:/Freescale/CW MCU v10.5/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-gcc" "../Sources/main.c" @"Sources/main.args" -MMD -MP -MF"Sources/main.d" -o"Sources/main.o"

'Invoking: ARM Ltd Windows GCC C Compiler'

"C:/Freescale/CW MCU v10.5/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-gcc" "C:/Folders/Developers/WolfSSL/cyassl-2.8.0/ctaocrypt/test/test.c" @"Sources/ctaocrypt-test/test.args" -MMD -MP -MF"Sources/ctaocrypt-test/test.d" -o"Sources/ctaocrypt-test/test.o"

'Finished building: ../Sources/main.c'

' '

'Finished building: C:/Folders/Developers/WolfSSL/cyassl-2.8.0/ctaocrypt/test/test.c'

' '

'Building target: ctaocrypt_test.elf'

'Executing target #3 ctaocrypt_test.elf'

'Invoking: ARM Ltd Windows GCC C Linker'

"C:/Freescale/CW MCU v10.5/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-gcc" @"ctaocrypt_test.args" -o"ctaocrypt_test.elf"

'Finished building target: ctaocrypt_test.elf'

 

The error just doesn't seem to point out what the issue really is.

 

I have changed linker file to give megabytes of free space and I still get this same error so I do not think it linker file related.

 

Regards,

David

Labels (1)
0 Kudos
5 Replies

2,252 Views
trytohelp
NXP Employee
NXP Employee

Hi David,

you're using MQX and MCU V10.5.

Can you please provide me the project reproducing the issue ?

      do you created it with MQX project wizard ?

I've checked in different data base and don't find information regarding the "ld.exe: final link failed: Memory exhausted"

However I found some info under google.

Please have a look to

      Bug 43601 – Enormous increase in DLL object files size in 4.5

Pascal

0 Kudos

2,252 Views
DavidS
NXP Employee
NXP Employee

Hi Pascal,

Thank you for reply.

I registered and downloaded the WolfSSL CyaSSL Embedded SSL Library. wolfSSL - Products | CyaSSL Embedded SSL Library

It has a "mqx" folder in the root install folder and indicated that it works with MQX3.8 and CW10.2.  I ported the projects to CW10.5 and MQX4.0.2.2.  I noticed that the projects were using the Freescale ARM compiler so I ported the projects to use the ARM GCC compiler.  The new ported project folders were appended with "_gcc".

What is amazing observation is the executeable (and I assume the object files too) for ARM GCC compiler is HUGE.

Example:

Freescale ARM compiler ctaocrypt_test.afx is 1,098KBytes (or 1.098MBytes)

ARM GCC compiler ctaocrypt_test_gcc.elf is 90,018KBytes (or 90.018MBytes!!!)

Derek Snell (fellow FAE) thinks it is the linker that is dying when trying to link the WofSSL libraries with the MQX libraries and WolfSSL application object.  It could be but I cannot find a method to have IDE generate more verbose information to help find root cause.  If you can that would be awesome.

I will be happy to ZIP my WolfSSL and post a link to get it.

In summary the "cyassl_client_gcc" project is the one choking/dying with the "Memory exhausted" error.

You need to compile the "cyassll_gcc" and "util_lib_gcc" libraries first as they get linked into the "ctaocrypt_gcc" (this application works!) and "cyassl_client_gcc" applications.

Note I can compile all libraries and applications using the Freescale ARM compiler but have difficulty debugging the cyassl_client_gcc project.

Here are the paths I have for WolfSSL and MQX if you want to reproduce my environment:

C:\Folders\Developers\WolfSSL\cyassl-2.8.0

C:\Freescale\Freescale_MQX_4_0_2_GA

Lastly I like the WolfSSL distribution as it is setup to run on Windows, Linux, and CW.  Pretty cool and will be better once I can get the cyassl_client_gcc to link.

Feel free to call me if I can help answer additional questions

Regards,

David

+1-469-400-5345

0 Kudos

2,252 Views
renak
Contributor I

Hi David,

Even though this is NOT related to the problem explained by you, could you please help with an issue that we are facing currently with cyaSSL?

We have downloaded and extracted the cyassl-2.9.0. We need to implement the secured http client for MQX platform. We are currently using Kinetis-TWRK60f120m board.We build the project with Code Warrior 10.4 as IDE.We followed the steps described in the 'Read Me' file in the 'mqx' directory.When we tried to build the project in the 'mqx' folder of cyassl-2.9.0(as per the 'Read Me' file) we are getting lot of errors.

We have added the psp,bsp, rtcs, shell configurations' projects (twrk70f120m.wsd) into the Code Warrior IDE along with these projects in the 'mqx' folder and tried to build. But still havingerrors.

Are we doing anything wrong?

Any help shall be highly appreciated.

My E-mail id: renjith.ak@nestgroup.net

with warm rgds,

AK

0 Kudos

2,252 Views
DavidS
NXP Employee
NXP Employee

Hi All,

I think I found the root cause.

I first turned on GCC compiler and linker "Verbose" switches and that helped point back to several calls in the cyassl_gcc library that want to use the following define in asn.c

  #define XTIME(tl) time((tl))

#define XGMTIME(c) gmtime((c))


And one call from internal.c that did following:

return (word32)time(0);


I think I need to work with WolfSSL to determine what we should be calling as a time function from MQX.


Once I "fudged" that code I could compile.

More later but if you have something feel free to reply.

Regards,

David

0 Kudos

2,252 Views
DavidS
NXP Employee
NXP Employee

Ok...no the problem is back :-(

Along with turning on the verbose options, I had checked strip the debug information in the linker step and that seems to allowed the application to build but not be debugged.

I'm heading back to the proverbial brick wall and banging my head bloody.

Sadly Yours,

David

0 Kudos