Best way to change the Memory Model of an existing project?

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

Best way to change the Memory Model of an existing project?

ソリューションへジャンプ
1,571件の閲覧回数
jgirard1
Contributor III

I am moving from Tiny to Small in my HC(S)08 project.  I need to know the best way to change the Memory Model of an existing project?  Just changing the Memory Model type option in the Build Options of the CPU properties is not enough.  There are other settings for the command lines of the compiler and assembler that do not get changed automatically.  I changed these manually and was able to get the new memory model to build, but...

 

The issue I am having is the generated code is not using zero page instructions to access the variables anymore.  I used #pragma DATA_SEG MY_ZEROPAGE to force my variables into zero page and I confirmed this by looking in the MAP file.

 

#pragma DATA_SEG MY_ZEROPAGE

byte Test1;

#pragma DATA_SEG DEFAULT

 

I also checked out the PRM and that looks correct for MY_ZEROPAGE section going to 0x80-0xFF.

 

SECTIONS
    Z_RAM                    =  READ_WRITE   0x0080 TO 0x00FF;
    RAM                      =  READ_WRITE   0x0100 TO 0x107F;
    ROM                      =  READ_ONLY    0x1900 TO 0xFFAD;
    EEPROM                   =  READ_ONLY    0x1400 TO 0x17FF;
END

PLACEMENT
    DEFAULT_RAM,
    MY_FARDATA                          /* non-zero page variables */
                                        INTO  RAM;

    DEFAULT_ROM, ROM_VAR, STRINGS       INTO  ROM;
    _DATA_ZEROPAGE,                     /* zero page variables */
    MY_ZEROPAGE                         INTO  Z_RAM;
END

 

The address of Test1 is 0x84 according to the MAP file.  I would expect the code to be a BSET instruction.

 

  0007 450000   [3]             LDHX  @Test1
  000a f6       [3]             LDA   ,X
  000b aa01     [2]             ORA   #1
  000d f7       [2]             STA   ,X

 

There are many places in the code with other variables that are not using the optimized zero page instructions.

 

Is there another setting somewhere that I am missing? 

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,161件の閲覧回数
bigmac
Specialist III

Hello,

 

Try the following pragma -

#pragma DATA_SEG __SHORT_SEG MY_ZEROPAGE

 

Since the PRM file is used by the linker, and not the compiler, the compiler does not know that MY_ZEROPAGE is located within page zero, unless you explicitly indicate this via the pragma.

 

Regards,

Mac

 

 

 

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,162件の閲覧回数
bigmac
Specialist III

Hello,

 

Try the following pragma -

#pragma DATA_SEG __SHORT_SEG MY_ZEROPAGE

 

Since the PRM file is used by the linker, and not the compiler, the compiler does not know that MY_ZEROPAGE is located within page zero, unless you explicitly indicate this via the pragma.

 

Regards,

Mac

 

 

 

0 件の賞賛
返信
1,161件の閲覧回数
jgirard1
Contributor III

I overlooked the __SHORT_SEG.  That took care of the issue.  Thanks.

0 件の賞賛
返信