AnsweredAssumed Answered

code and constants in same segment

Question asked by Ron Wilson on Apr 26, 2011
Latest reply on Apr 27, 2011 by Ron Wilson

I am using CW 5.0 for S12X.

 

I have a large, constant table that is used only by a few functions, so I want to have both the table and those functions in their own segment:

 

#pragma CONST_SEG DISPATCH_SEG

const DispatchRec DIspatchTable[] = {

// entries in dispatch table

};

#pragma CONST_SEG DEFAULT_SEG

 

#pragma CODE_SEG DISPATCH_SEG

 

However, at the #pragma to place the functions, I get the error "Segment name already used"

 

I tried using DISPATCH_TABLE and DISPATCH_CODE, then placing them into the same section in the linker directives, but unless I define a section specifically for these 2 segments, the linker places them in different 16k banks. (The 2 segments total less than 16k).

 

Is there a way to get this to work without having to define a seperate section to hold these 2 segments? The reason I ask is that there are other table/function combinations I want to treat the same way, so if I have to define a section for each pair, I am then taking full control of the memory allocation for most of my application, which is a lot of extra work.

Outcomes