Zero Page RAM Allocation

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

Zero Page RAM Allocation

2,090 Views
DRichards
Contributor III

I'm using an HCS08QB4 and hitting memory problems. All variables are going into 0x100 - 0x15F which is where the stack also resides. Zero page RAM from 0x60 - 0xFF is not being used. How do I get variables to be allocated to zero page?

I have tried various combinations of #pragma segment and int near x, but I can't get it to work. e.g. Link error L1907. Can somebody please supply a simple example as I need this 160 bytes of RAM.

Labels (1)
0 Kudos
Reply
2 Replies

813 Views
CompilerGuru
NXP Employee
NXP Employee

Check the prm file, sounds like the zero page segment name is not listed after INTO for the DEFAULT_RAM clause.

Segment names can be listed multiple times, so place all zero page variables into the zero page first and then list the same segment name as destination for DEFAULT_RAM too.

That should make those 160 bytes available for use easily, but it will be using the more expensive EXT extended addressing modes.

So in order to place variables explictely into the zero page use a 

#pragma DATA_SEG __SHORT_SEG MY_ZEROPAGE

search in the forums for "#pragma DATA_SEG __SHORT_SEG"

For example

http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&message.id=11614&query.id=1225...

 

pragma section is for the coldfire compiler, not for the S08, you should get a warning when using it. Using near changes the way the compiler accesses variables, it does not change the place/section it gets allocated into.

 

Daniel

 

 

0 Kudos
Reply

813 Views
J2MEJediMaster
Specialist I

Do a search on the string "zero page" in the search box at the bottom left of this web page. This subject has come up a number of times in these forums, you should find out what you need.

 

---Tom

0 Kudos
Reply