How to locate third party libraries in external flash

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to locate third party libraries in external flash

ソリューションへジャンプ
1,352件の閲覧回数
deniscollis
Contributor V

I have a large third party library (example: libTLV.a) currently located and running on the K8x's Internal Flash.  I do not have any source code, just a header file (example: libTLV.h) and the library archive containing a number of .o objects.

Within MCUXpresso, how do I locate it on external QSPI XiP flash?

(Note1: I can locate my own code easily enough using the __TEXT macro after including cr_section_macros.h)

(Note2: I know how to locate .o objects in a specific memory section using a standard gcc linker script, but I would like to know how to do this in MCUXpresso)

ラベル(1)
0 件の賞賛
1 解決策
1,133件の閲覧回数
BlackNight
NXP Employee
NXP Employee

Hi Denis,

in the linker file, you can put code sections of specific files into dedicated memory ranges. An example for object files is described in Putting Code of Files into Special Section with the GNU Linker | MCU on Eclipse, but it should work the same for your library too. I would check the linker map file to see what names it is using.

I hope this helps,

Erich

元の投稿で解決策を見る

4 返答(返信)
1,133件の閲覧回数
deniscollis
Contributor V

Revisiting this...  How to locate entire library archives in specific a memory section, here are example excerpts from the .ld scripts.  

-------- snip --------

MEMORY
{
  /* Define each memory region */
  PROGRAM_FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x40000 /* 256K bytes (alias Flash)  */
  SRAM_LOWER   (rwx) : ORIGIN = 0x1fff0000, LENGTH = 0x10000 /*  64K bytes (alias RAM2)   */
  SRAM_UPPER   (rwx) : ORIGIN = 0x20000000, LENGTH = 0x30000 /* 192K bytes (alias RAM)    */
  EXT_PGM_FLASH (rx) : ORIGIN = 0x68000000, LENGTH = 0x80000 /* 512K bytes (alias Flash2) */
}

-------- snip --------‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

-------- snip --------

SECTIONS
{
   /* EXTERNAL QSPI XiP FLASH */
   .text_Flash2 : ALIGN(4)
   {
       FILL(0xff)
       *(.text_Flash2*)
       *(.text_EXT_PGM_FLASH*)
       *(.text.$Flash2*)
       *(.text.$EXT_PGM_FLASH*)
       *(.rodata.$Flash2*)
       *(.rodata.$EXT_PGM_FLASH*)
 
       /* Place lib archives in external flash */ 
       *libTLV.a:*  
   } > EXT_PGM_FLASH

/* MAIN TEXT SECTION */
   .text : ALIGN(4)
   {
       FILL(0xff)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

-------- snip --------‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 件の賞賛
1,134件の閲覧回数
BlackNight
NXP Employee
NXP Employee

Hi Denis,

in the linker file, you can put code sections of specific files into dedicated memory ranges. An example for object files is described in Putting Code of Files into Special Section with the GNU Linker | MCU on Eclipse, but it should work the same for your library too. I would check the linker map file to see what names it is using.

I hope this helps,

Erich

1,133件の閲覧回数
deniscollis
Contributor V

Hi Erich,

I thought there may be something more automatic already built into MCUXpresso, but sadly, not.   Looks like I need to fix it for the old-school way:

  1. Use Freemarker to generate .ld files from .ldt templates  (edit: Not necessary, this is automatically done by MCUXpresso - see reply below)
  2. Disable managed linker scrips in MCUXpresso
  3. Edit the .ld files as required

 

Thanks for your help,

Denis

0 件の賞賛
1,133件の閲覧回数
deniscollis
Contributor V

Just noticed that the .ld files are already created by MCUXpresso.  One simply needs to copy them from the build configuration output folder (e.g. Debug/MyProject_Debug*.ld) to the the startup/ folder, and then in project Properties -> C/C++ Build -> Settings -> Tool Settings -> Managed Linker Script  -- uncheck 'Manage linker script' and enter the 'Linker script' name, (e.g. 'MyProject.ld')  and the  'Script path' (e.g. '../startup/').

0 件の賞賛