How to assign functions to specific address when generating binary files?

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

How to assign functions to specific address when generating binary files?

ソリューションへジャンプ
1,329件の閲覧回数
kbj
Contributor IV

Hi

I want to assign functions to specific address when generating binary files.

So I use #pragma arm section . But Warning is occured and Don't process it.

How to assign functions to specific address?

Like below :

------ Linker file-----------

MEMORY
{
  m_flash               (RX)  : ORIGIN = 0x00010410, LENGTH = 0x0006FBF0
}

SECTIONS

{
   .flash :
  {
    . = ALIGN(4);
    KEEP (*(.flash))
    . = ALIGN(4);
  } > m_flash

}

----- C file. ----------------

#pragma arm section code="flash"

FuncA();

FuncB();

FuncC();

#pragma arm section

1.PNG

Best regards,

Byungju.

ラベル(3)
1 解決策
1,175件の閲覧回数
BlackNight
NXP Employee
NXP Employee

Hello,

you can use the following attribute for functions:

__attribute__((section (".flash")))

See the examples at the end of Execute-Only Code with GNU and gcc

or Putting Code of Files into Special Section with the GNU Linker

I hope this helps,

Erich

元の投稿で解決策を見る

2 返答(返信)
1,176件の閲覧回数
BlackNight
NXP Employee
NXP Employee

Hello,

you can use the following attribute for functions:

__attribute__((section (".flash")))

See the examples at the end of Execute-Only Code with GNU and gcc

or Putting Code of Files into Special Section with the GNU Linker

I hope this helps,

Erich

1,175件の閲覧回数
kbj
Contributor IV

Hi Erich,

Thanks for your help.

Like as your mention, The function is writted at the address I want in binary.

1.PNG

Best regards,

Byugnju.

0 件の賞賛
返信