How can I set up a section that the initialization code leaves alone? (on MCF521100)

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

How can I set up a section that the initialization code leaves alone? (on MCF521100)

1,728件の閲覧回数
mhahn12419
Contributor I

This is for a coldfile MCF52110 processor. Developing code with Codewarrior 5.9.0.

 

I figured out how to set up a section, by modifying the linker control file.

 

In memory section:

 

MEMORY {
  interrupts  (RX) : ORIGIN = 0x20000000, LENGTH = 0x00000500
  code        (RX) : ORIGIN = 0x20000500, LENGTH = 0x00002754
  data        (RW) : ORIGIN = 0x20002C54, LENGTH = 0x0000139C
  Magic_mem   (RX) : ORIGIN = 0x20003FF0, LENGTH = 0x00000010  <== memory for my new section

  ipsbar      (RW) : ORIGIN = 0x40000000, LENGTH = 0x0
}

 

In SECTIONS:

 

  .Magic : {
    *(.Magic)
  } > Magic_Mem

 

and then use a statement like:

 

#pragma define_section _Magic ".Magic" far_absolute R
__declspec (_Magic) char magic_data[16];

 

to set up variables in my new section.

 

The whole reason I'm trying to do this is to try to set aside a small area of RAM that the compiler's initialization code doesn't clear to 0 or initialize to some value.

 

Why? I want to be able to save a few bytes of system status, so that after an unexpected reset, there is some way for the system to figure out what state it is supposed to be in.

 

But this all seems way too complicated. Is there an easier way to accomplish this?

 

Mark

ラベル(1)
0 件の賞賛
返信
3 返答(返信)

973件の閲覧回数
CrasyCat
Specialist III

Hello

 

Did you look at FAQ-27500 on www.freescale.com?

 

This should tell you how to achieve that.

 

CrasyCat

0 件の賞賛
返信

973件の閲覧回数
mhahn12419
Contributor I

Thanks for the pointer. Looks like it fits the bill.

 

Is there some kind of index to the FAQs? Lots to wade thru :smileyhappy:

 

Mark

0 件の賞賛
返信

973件の閲覧回数
CrasyCat
Specialist III

Hello

 

I would proceed as follows

 

  - Go to www.freescale.com/CodeWarrior

  - Click on the link "Power Architecture™ - mobileGT"

  - Go to "Product Support" Tab

  - Click on the link "Search FAQ knowledgebase"

 

You should see a list of all FAQs for CodeWarrior for MobileGT.

 

CrasyCat

0 件の賞賛
返信