object files placement in prm

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

object files placement in prm

3,777件の閲覧回数
vijay_v
Contributor I
Hi,
 
Is there any way to place the .o files directly in the flash pages using the PRM file.
 
Cosmic compiler had this option of placing .o files directly to flash pages
 
Vijay
ラベル(1)
タグ(1)
0 件の賞賛
返信
4 返答(返信)

1,328件の閲覧回数
Lundin
Senior Contributor IV
.o is traditionally an object file. That is, the compiler output to be used by the linker, not a binary file.

To get the code at a certain place in the flash, write

#pragma CODE_SEG SOMETHING

on top of every source file, and then create "SOMETHING" as a segment in the .prm file.

Message Edited by Lundin on 2007-11-12 08:21 AM
0 件の賞賛
返信

1,328件の閲覧回数
BlackNight
NXP Employee
NXP Employee
Hello,
as an additional tip: instead modifying source files, you can put the #pragma statement (or anything else you want) into a header file, and then use the compiler option -AddIncl which then includes this header file for each file compiled. That way you do not need to change any source files.

BK

0 件の賞賛
返信

1,328件の閲覧回数
Lundin
Senior Contributor IV
How does that work, more exactly? If the code in file aaa.c should be in segment AAA, the code in file bbb.c should be in segment BBB. And what if one source file contains various code that should be put in different segments (interrupt handlers for example)?
0 件の賞賛
返信

1,328件の閲覧回数
CrasyCat
Specialist III
Hello
 
In order to specify in which code segment you want to place the functions there are two solutions:
  1- You use #pragma CODE_SEG <Segname> in the C source file.
       For example:
          #pragma CODE_SEG AAA
          void func(void) {
           /*Code Here*/
          }
     All functions until the next #pragma CODE_SEG will be placed in segment AAA.
 
  2- You define all your user defined segment in a header file, which is included in every c source file.
       You can use the option -AddIncl in that purpose. Make sure to return to DEFAULT segment at
       the end of the header file.
      For example myseg.h can be set up as follows:
          #pragma CODE_SEG AAA
          #pragma CODE_SEG BBB
          #pragma CODE_SEG CCC
          #pragma CODE_SEG DDD
         #pragma CODE_SEG DEFAULT
 
      In the C source file you can then define the function as follows:
        void func(void) @ "AAA" {
           /*Code Here*/
          }
 
CrasyCat
0 件の賞賛
返信