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

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

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

Jump to solution
1,076 Views
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.

Labels (3)
1 Solution
922 Views
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

View solution in original post

2 Replies
923 Views
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

922 Views
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 Kudos