Link Information output in CW 10.1.8

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

Link Information output in CW 10.1.8

Jump to solution
5,612 Views
ITCO00
Contributor III

Hi,

 

I'm working on MSC8156 ADS, and I've migrated my project to CW version 10.1.8, from version 10.1.3.

I've followed the instructions in the PDF document, and I've managed to build the project without errors and no warnings.

But I've receive Linker Info on the output as follows:

 

[LNK,0,6999,-1]: Information: Could not locate stack section for core c0.Stack not set. It must be set by user.
[LNK,0,6999,-1]: Information: Could not locate stack section for core c1.Stack not set. It must be set by user.
[LNK,0,6999,-1]: Information: Could not locate stack section for core c2.Stack not set. It must be set by user.
[LNK,0,6999,-1]: Information: Could not locate stack section for core c3.Stack not set. It must be set by user.
[LNK,0,6999,-1]: Information: Could not locate stack section for core c4.Stack not set. It must be set by user.
[LNK,0,6999,-1]: Information: Could not locate stack section for core c5.Stack not set. It must be set by user.
I've built also a demo application from the Demos folder, and received the same Info output.

What is missing in my project ?

 

Thanks.

Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
4,118 Views
CrasyCat
Specialist III

Hello

 

Memory allocation, wide character management, file management local management functions are using RTlib Heap.

Some string management function like strcoll, strxfrm are also using RTlib Heap.

 

If you are programming in C++, new operator will also use RTLIB heap.

 

CrasyCat

View solution in original post

0 Kudos
Reply
13 Replies
4,118 Views
CrasyCat
Specialist III

Hello

 

Are you building a SmartDSP OS project or a bare board project?

 

CrasyCat

0 Kudos
Reply
4,118 Views
ITCO00
Contributor III

Hi,

 

I'm using SDOS in my project.

 

ITCO.

0 Kudos
Reply
4,118 Views
CrasyCat
Specialist III

Hello

 

This is the expected behavior, as the stack section is not explicitly specified in the linker command files for SDOS applications. 

 

To remove these messages, add definitions for the stack section the .l3k files.

 

To define a real stack section, apply the following modifications to the project:

 1. In file msc815x_init.c, define the symbol StackStart as follows:

 

uint8_t  StackStart[ALIGN_SIZE(OS_STACK_SIZE,8)] attribute ((section("stack")));#pragma align StackStart 8

 

 

 2. In the local_map.l3k file, add the stack section to descriptor_local_data as follows:

 

        descriptor_local_data {             .oskernel_local_data             .data              ramsp_0             .oskernel_rom             .rom             .exception             .exception_index             .ramsp_0             .init_table             .rom_init             .rom_init_tables             .staticinit             LNK_SECTION(att_mmu, "rw", 0x200, 4, ".att_mmu");             .bsstab             reserved_crt_tls             .oskernel_local_data_bss             .bss             stack        } > local_data_descriptor;

There is one constraint though.

The section that contains the symbol _g_heap_nocache must be allocated in the same MMU segment as the startup stack.

That means the section .oskernel_local_data must be allocated in same MMU segment as stack.

     

CrasyCat

0 Kudos
Reply
4,118 Views
ITCO00
Contributor III

Hi,

 

I've added the Stack definitions as you wrote, but I still reveive the information remarks ([LNK,0,6999,-1] 3 per core x 2):

 

 Information: Could not locate stack section for core c0.Stack not set. It must be set by user.
Information: Could not locate heap section for core c0. Heap not set. It must be set by user. 
Information: Could not locate heap section for core c0. Heap not set. It must be set by user.

 

In the code it seems like the following (msc815x_init.c):

 

uint8_t  StackStart[ALIGN_SIZE(OS_STACK_SIZE,8)]/* attribute ((section("stack")))*/;

#pragma align StackStart 8

...

 

#if defined(OS_HEAP_NONCACHEABLE_SIZE) && (OS_HEAP_NONCACHEABLE_SIZE > 0)

uint8_t   g_heap_nocache[OS_HEAP_NONCACHEABLE_SIZE] = { 0 };

#pragma align g_heap_nocache OS_HEAP_NONCACHEABLE_SIZE

uint32_t g_heap_nocache_size=OS_HEAP_NONCACHEABLE_SIZE;

#else

#define OS_HEAP_NONCACHEABLE_SIZE 0

uint8_t *g_heap_nocache=0;

uint32_t g_heap_nocache_size=0;

#endif

In local_map_link.l3k I've added the stack:
        descriptor_local_data {
             .oskernel_local_data
             .data
              ramsp_0
             .oskernel_rom
             .rom
             .exception_index
             .ramsp_0
             .init_table
             .rom_init
             .rom_init_tables
             .staticinit
             LNK_SECTION(att_mmu, "rw", 0x200, 4, ".att_mmu");
             .bsstab
             reserved_crt_tls
             .oskernel_local_data_bss
             .bss
             stack
        } > local_data_descriptor;

 

 

0 Kudos
Reply
4,118 Views
CrasyCat
Specialist III

Hello

 

stack definition should look as follows in msc815x_init.c:

 

 uint8_t  StackStart[ALIGN_SIZE(OS_STACK_SIZE,8)] __attribute__ ((section("stack")));
#pragma align StackStart            8

 

CrasyCat

0 Kudos
Reply
4,118 Views
ITCO00
Contributor III

Hi,

 

I've  added the StartStack declaration and the build is OK. Now, I receive the following info about HEAP (for all cores):

Information: Could not locate heap section for core c0. Heap not set. It must be set by user

In OS config header file the Heaps are declared (by defining their size). What is missing in the configuration?

0 Kudos
Reply
4,118 Views
CrasyCat
Specialist III

Hello

 

This one refers to the run time library heap. This heap is used when you are using malloc (instead of osMalloc) for dynamic memory allocation.

 

Not sure you even need this one in your application.

 

CrasyCat

0 Kudos
Reply
4,118 Views
ITCO00
Contributor III

Hi,

 

I'm using only osMalloc and also USING_RTLIB is set to 0 (my project is embedded). Is there any other API that might case this Info (printf()...)?

 

ITCO

0 Kudos
Reply
4,119 Views
CrasyCat
Specialist III

Hello

 

Memory allocation, wide character management, file management local management functions are using RTlib Heap.

Some string management function like strcoll, strxfrm are also using RTlib Heap.

 

If you are programming in C++, new operator will also use RTLIB heap.

 

CrasyCat

0 Kudos
Reply
4,118 Views
ITCO00
Contributor III

Hello,

 

Thanks, but I'm not using RTLIB (USING_RTLIB is set to 0) nor C++. Is there anything else that might cause this Info?  

 

ITCO

0 Kudos
Reply
4,118 Views
CrasyCat
Specialist III

The message is generated because the linker does not find any explicit definition for a section called heap.

 

If you do not need memory allocation in RTLib Heap, either you should ignore this message or you define a dummy heap section in your .l3k file.

 

For example add following line to one of your local data descriptor:

    LNK_SECTION(heap, "rw", 8, 0x8, "heap");

 

CrasyCat

0 Kudos
Reply
4,118 Views
ITCO00
Contributor III

Hi,

 

Thanks, it is working OK !

 

ITCO

0 Kudos
Reply
4,117 Views
ITCO00
Contributor III

Hi,

 

I've tried that at the first by I received error/warning, it means that something else is missing.

I simply put the attribute in comment to have the same declaration as _g_heap_nocache as you've recommended.

 

ITCO

0 Kudos
Reply