K02F Linker script contains USB section

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

K02F Linker script contains USB section

Jump to solution
767 Views
MartinHo
Contributor IV

I'm new to Kinetis (but I'm coming from LPC, so I know Cortex and Eclipse), I'm using the MK02FN64VLF10. Building my first Application with FreeRTOS, I noticed that there was very little RAM free for the RTOS HEAP (I'm using heap2.c), so I checked the linker script (MK02FN64xxx10_flash.ld):

 

1) The Linker script contains a section (in .bss)

     . = ALIGN(512);

    USB_RAM_START = .;

    . += USB_RAM_GAP;

with USB_RAM_GAP resulting in 0x800 (__usb_ram_size__ is not defined).

This section is clearly not used for the K02F (there is now USB controller!) so we can free 2K of ram.

 

2) The linker script dived the ram in m_data and m_data_2, I understand that m_data is faster then m_data_2, but in a RTOS environment I prefer to have a HEAP as big as possible, so I think it's preferibile to have only 1 data section, even if this means that I can not decide if specific data is place in the fast RAM or not.

Ar there any problems when I define:

  m_data                (RW)  : ORIGIN = 0x1FFFE000, LENGTH = 0x00004000

And remove the m_data_2 section?

 

thanks

Martin

Labels (1)
0 Kudos
1 Solution
475 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Martin,

Answering your questions:

1) You are correct, that section should not be present in the linker file. I have already reported this issue to the developers.

2) You can merge both data sections in one but you have to make sure that the processor will not attempt a misaligned access across the 0x2000_0000 boundary. I think that the following post created by our colleague Erich Styger might be helpful for you, it explains how to use the upper memory area for the RTOS heap:

FreeRTOS Heap with Segmented Kinetis K SRAM | MCU on Eclipse

You can take a look to this document for a detailed explanation of how to relocate data in RAM:

Relocating Code and Data Using the KDS GCC Linker File for Kinetis

Hope it helps!

Best Regards,

Carlos Mendoza

Technical Support Engineer

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

View solution in original post

1 Reply
476 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Martin,

Answering your questions:

1) You are correct, that section should not be present in the linker file. I have already reported this issue to the developers.

2) You can merge both data sections in one but you have to make sure that the processor will not attempt a misaligned access across the 0x2000_0000 boundary. I think that the following post created by our colleague Erich Styger might be helpful for you, it explains how to use the upper memory area for the RTOS heap:

FreeRTOS Heap with Segmented Kinetis K SRAM | MCU on Eclipse

You can take a look to this document for a detailed explanation of how to relocate data in RAM:

Relocating Code and Data Using the KDS GCC Linker File for Kinetis

Hope it helps!

Best Regards,

Carlos Mendoza

Technical Support Engineer

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------