# linking error, while compiling lwip baremetal code

Hello,

I am trying to compile ethernet lwip program.I got some linker error

The error i got mentioned below,

[Error li1040] "C:\Users\Teclever\Desktop\test\lwip_Core0\system\startup_ldf\app.ldf":351 Out of memory in output section 'L1_code' in processor 'CORE_0'
Total of 0x31d4 word(s) were not mapped.
For more details, see 'linker_log.xml' in the output directory.

[Error li1040] "C:\Users\Teclever\Desktop\test\lwip_Core0\system\startup_ldf\app.ldf":473 Out of memory in output section 'L1_data_b_bsz_prio2' in processor 'CORE_0'
Total of 0x3c814 word(s) were not mapped.
For more details, see 'linker_log.xml' in the output directory.

[Error li1040] "C:\Users\Teclever\Desktop\test\lwip_Core0\system\startup_ldf\app.ldf":507 Out of memory in output section 'L1_data_b_bsz_prio3' in processor 'CORE_0'
Total of 0x3c814 word(s) were not mapped.
For more details, see 'linker_log.xml' in the output directory.

[Error li1040] "C:\Users\Teclever\Desktop\test\lwip_Core0\system\startup_ldf\app.ldf":640 Out of memory in output section 'L1_data_a_bsz_prio2' in processor 'CORE_0'
Total of 0x3c814 word(s) were not mapped.
For more details, see 'linker_log.xml' in the output directory.

[Error li1040] "C:\Users\Teclever\Desktop\test\lwip_Core0\system\startup_ldf\app.ldf":674 Out of memory in output section 'L1_data_a_bsz_prio3' in processor 'CORE_0'
Total of 0x3c814 word(s) were not mapped.
For more details, see 'linker_log.xml' in the output directory.

[Error li1040] "C:\Users\Teclever\Desktop\test\lwip_Core0\system\startup_ldf\app.ldf":795 Out of memory in output section 'L2_bsz_prio3' in processor 'CORE_0'
Total of 0x3c814 word(s) were not mapped.
For more details, see 'linker_log.xml' in the output directory.

[Error li1040] "C:\Users\Teclever\Desktop\test\lwip_Core0\system\startup_ldf\app.ldf":817 Out of memory in output section 'L2_prio3' in processor 'CORE_0'
Total of 0x31d4 word(s) were not mapped.
For more details, see 'linker_log.xml' in the output directory.

[Error li1040] "C:\Users\Teclever\Desktop\test\lwip_Core0\system\startup_ldf\app.ldf":844 Out of memory in output section 'L2_general_uncached' in processor 'CORE_0'
Total of 0x31d4 word(s) were not mapped.
For more details, see 'linker_log.xml' in the output directory.

[Error li1040] "C:\Users\Teclever\Desktop\test\lwip_Core0\system\startup_ldf\app.ldf":855 Out of memory in output section 'L2_bsz_uncached' in processor 'CORE_0'
Total of 0x3c814 word(s) were not mapped.
For more details, see 'linker_log.xml' in the output directory.

Can anyone help me to solve this

Thank you

Regards,

sravanthi

• Hi,

As you are hitting the li1040 error, we would first recommend ensuring two Linker Optimization options are enabled.

The first is to enable Linker Elimination via Project->Properties->C/C++ Build->Settings->CrossCore Blackfin Linker->Elimination->Eliminate Unused Objects. When elimination is enabled, the Linker discards any objects (*.doj) within the library that do not contain any relevant code or data (i.e. the application makes no reference to any of the data or code symbols within that object). The linker can then examine the objects that are required for the link, and extract only those symbols required to resolve references from the application code, further stripping out unused data.

Another option is enabling 'Individually map functions and data items' via 'General' tab of the CrossCore Blackfin Linker options. When enabled, directs the linker to fill in fragmented memory with individual data objects that fit. When this option is selected, the default behavior of the linker (to place data blocks in consecutive memory addresses) is overridden.

Another cause of the li1040 Out of memory error, you have eventually exhaust all the available memory.

If you eventually exhaust the available internal memory, you would need to look at making use of SDRAM - if your target has external memory. Select Use external memory (SDRAM) to enable the size and partitioning controls under system.svc > Startupcode/LDF > LDF > External Memory

By enabling the 'Generate symbol Map' option under the 'General' options for the Linker. If you enabled the option to "Generate Symbol Map", the Linker will also generated a project_name.map.xml file which can be viewed in Internet Explorer to view a map of your project. It shows the memory sections declared in the LDF, their start and end bounds and - most importantly - their free/used space. Using this map file you can determine whether there is perhaps a memory section that is being under-used that you could place more data into.

CrossCore® Embedded Studio 2.x.x > Blackfin® Development Tools Documentation > Linker and Utilities Manual > Linker and Archiver Messages > Linker Messages > Errors > li1040

Furthermore we recommend the EngineerZone as a resource for Linker Errors such as this. We have assisted a number of customers with similar queries which can be found through the EngineerZone Search: http://ez.analog.com/

Also, Controlling the placement of the function or data is then a case of adding appropriate output section in LDF.

You can use #pragma section("section_name") directive to force your data into specific memory. Use this before each function that you want to place in the section. This pragma will only affect the next symbol and if you use this pragma right before a function, that function alone will be placed in the section.

For example:

#pragma section("mydata") //custom_section_name
unsigned char Image_BUFF1[76800];

Also, add the appropriate INPUT_SECTIONS commands to your LDF in a suitable place in app.ldf, like below.

custom_section_name //Output section
{
INPUT_SECTIONS( $OBJS_LIBS(custom_section_name) ) // Input section } > > mem_section_name // Memory section For eg: sdram { INPUT_SECTION_ALIGN(4) INPUT_SECTIONS($OBJS_LIBS(mydata) ) // Input section
} > MEM_SDRAM_BANK0

For more information, take a look at the "#pragma section/#pragma default_section" in the CCES help:
CrossCore® Embedded Studio <version> > Blackfin® Development Tools Documentation > C/C++ Compiler and Library Manual for Blackfin® Processors > Compiler > C/C++ Compiler Language Extensions > Pragmas > Linking Control Pragmas > #pragma section/#pragma default_section

If you are still facing issues, can you please share us your example project along with the screenshot of the error that you are facing and also the steps to reproduce to replicate your issue. This will help us to assist you better.

Regards,
Santhakumari.K

• Hi santha,

Thankyou for your response, i cleared that error as per ur suggestions.

I got some assertion with some lwip port size issue.I am using the lwip-2.1.2 baremetal code for ADSP-bf609

Output:

TDO <-----+
|
[0] - [ADSP-BF609 rev 0.2 from Analog Devices]
|
TDI >-----+
size of packed_struct_test is 8
Assertion "Struct packing not implemented correctly. Check your lwIP port." failed at line 342 in ..\src\core\init.c

If i will change  the size in the \src\core\int.c  #define PACKED_STRUCT_TEST_EXPECTED_SIZE 5 as

#define PACKED_STRUCT_TEST_EXPECTED_SIZE 8

showing runtime error

Output:

Auto-detecting devices on the JTAG chain...

TDO <-----+
|
[0] - [ADSP-BF609 rev 0.2 from Analog Devices]
|
TDI >-----+
size of packed_struct_test is 8

A non-recoverable error or exception has occurred.
Description: Attempted misaligned data memory or data cache access (Exception with EXCAUSE=0x24).
General Type: UnhandledException
Specific Type: DataMisalignedAccessViolation
Error PC: 0xffa0df3e