How to extend .bss section to SRAM1 in MCUXPresso

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to extend .bss section to SRAM1 in MCUXPresso

1,167 次查看
finalargasio
Contributor II

Dear all,

I have a project on a MKW38 board which has 48k SRAM section and 15k SRAM1 section.

I have come to have a lot of static data and the build fails because the .bss section exceeds the limits of SRAM size

finalargasio_1-1647015839293.png

 

finalargasio_0-1647015802508.png

I would like to make use of the SRAM1 section of 15k and allow the exceeding bytes of the bss to be placed there ( so bss is both on SRAM and SRAM1), but I couldn't figure out a way to do it in MCUXpresso,

can anyone help me?

 

0 项奖励
回复
2 回复数

1,142 次查看
bobpaddock
Senior Contributor III

To move BSS the linker script needs modified and then given the address of SRAM1.

I don't use MCUXPresso so I can not help with that.
There may be someplace in there already that will simply assign the BSS address.

Failing that, I do know someplace there will be a .ld file that is currently being used.

Find that .ld file, make a copy, change MCUXpresso to use the new file.

Look for this section and modify accordingly.
It may be a simple as changing the final SRAM to SRAM1 as shown here:

SRAM and SRAM1 will be giving addresses at the top of the linker file in the section called MEMORY.
What you start with my not have the SORT_BY directives, feel free to add them.

/* Uninitialized data section */
. = ALIGN(4); /* Align the .bss output section */

/*
* SORT_BY_ALIGNMENT is very similar to SORT_BY_NAME. The
* difference is SORT_BY_ALIGNMENT will sort sections into descending
* order by alignment before placing them in the output file. Larger
* alignments are placed before smaller alignments in order to reduce
* the amount of padding necessary.
*/
.bss :
{
__bss_start__ = .; /* Standard newlib definition */

*(.bss)
*(SORT_BY_ALIGNMENT(.bss*)) /* Sort the input sections from largest alignment to the smallest */

/*
* A special notation is needed for common symbols, because in many
* object file formats common symbols do not have a particular input
* section. The linker treats common symbols as though they are in an
* input section named COMMON.
*/
*(COMMON)

. = ALIGN(4);
__bss_end__ = .; /* Standard newlib definition */
} > SRAM1
__bss_size__ = (__bss_end__ - __bss_start__);

1,144 次查看
finalargasio
Contributor II

bump

0 项奖励
回复