How to force constants in the banked section

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

How to force constants in the banked section

Jump to solution
3,404 Views
tim_milliken
Contributor III
Can anyone help me force a const unsigned char to a banked section and still be able to access it> I tried #pragam CODE_SEG DEFAULT before the const but that did not work. The compiler is trying to put my font table in non banked section and runs out of code space real fast.. Tim
Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
1,782 Views
tim_milliken
Contributor III
Thanks for the help, nothing like the HC08 manuals, tehy seem to bo more complete than the 565 manuals. Or atleast easier to read. :smileytongue:
Tim

View solution in original post

0 Kudos
Reply
3 Replies
1,782 Views
Alban
Senior Contributor II
Hello,
 
Normal, DEFAULT has its default location in unbanked space in general projects.
Chose a zone from your PRM file which is in Paged memory and replace DEFAULT with that name.
 
Code:
In "SECTIONS":   /* unbanked FLASH ROM */    ROM_4000 = READ_ONLY  0x4000 TO 0x7FFF;    ROM_C000 = READ_ONLY  0xC000 TO 0xFEFF;    /* banked FLASH ROM */    PAGE_38 = READ_ONLY  0x388000 TO 0x38BFFF;       PAGE_39 = READ_ONLY  0x398000 TO 0x39BFFF;       PAGE_3A = READ_ONLY  0x3A8000 TO 0x3ABFFF;       PAGE_3B = READ_ONLY  0x3B8000 TO 0x3BBFFF;       PAGE_3C = READ_ONLY  0x3C8000 TO 0x3CBFFF;       PAGE_3D = READ_ONLY  0x3D8000 TO 0x3DBFFF;   In "PLACEMENT"   DEFAULT_ROM                 INTO PAGE_38,PAGE_3A,PAGE_3B,PAGE_3C;       pagecodeA                   INTO PAGE_39;In source:   #pragam CONST_SEG pagecodeA                   

 
Alban.

Message Edited by Alban on 2007-02-16 03:12 PM

0 Kudos
Reply
1,782 Views
Alban
Senior Contributor II
Modified previous post.
Not confuse CODE_SEG with CONST_SEG.
 
 
Nothing like a good user manual.
 
          "Manual_Compiler_HC08.pdf" pages 301-304
 
 

#pragma CONST_SEG: Constant Data

Segment Definition

Scope: Next pragma CONST_SEG

Syntax: "#pragma CONST_SEG” (<Modif> <Name> | “DEFAULT”)

Synonym: CONST_SECTION

Arguments: <Modif>: Some of the following strings may be used: SHORT, __SHORT_SEG,  DIRECT,__DIRECT_SEG,  NEAR, __NEAR_SEG, CODE, __CODE_SEG, FAR, __FAR_SEG,

Each modifier has a synonym in the form of “__<modifier>_ SEG”. This reduces clashes with other possible defines in header files, e.g. if NEAR is undefined in another portion of your code.

The segment modifiers are backend-dependent. Refer to the backend chapter to find the supported modifiers and their meaning.

The SHORT modifier specifies a segment which is accessed with - bit addresses.

<Name>: The name of the segment. This name must be used in the link parameter file on the left side of the assignment in the PLACEMENT part. Please refer to the linker manual for details.

Default: DEFAULT

Description: This pragma allocates constant variables into a segment. The segment is then located in the link parameter file to specific addresses.

The pragma CONST_SEG sets the current const segment. This segment is places all constant variable declarations. The default segment is set with:

#pragma CONST_SEG DEFAULT”

0 Kudos
Reply
1,783 Views
tim_milliken
Contributor III
Thanks for the help, nothing like the HC08 manuals, tehy seem to bo more complete than the 565 manuals. Or atleast easier to read. :smileytongue:
Tim
0 Kudos
Reply