how to write code in a specific address using C?

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

how to write code in a specific address using C?

ソリューションへジャンプ
2,584件の閲覧回数
ffogg
Contributor II

hello there,

 

i'm programming the MC9S08QG8 chip with Codewarrior v6.2 and using the C compiler.

 

I need to program a piece of program above address 0xF600 when the program begins

at address 0xE000 and ends at 0xE430 and now i must add some more routines starting

in 0xF600 (a little BIOS) any chance? And of course using 'C'

 

Thanks in advance.

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,546件の閲覧回数
ffogg
Contributor II
thanks once more, it worked fine.

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,546件の閲覧回数
ffogg
Contributor II

thanks mac, for your fast and well explained answer

tomorrow if everything is Ok i will try your solution.

I will comment you the final result.

 

Thanks again and have a good time.

0 件の賞賛
返信
1,546件の閲覧回数
bigmac
Specialist III

Hello, and welcome to the forum.

 

You would need to modify the PRM file for the project, to create a new segment starting at 0xF600.

 

NAMES END


SEGMENTS

    Z_RAM  =  READ_WRITE   0x0060 TO 0x00FF;
    RAM    =  READ_WRITE   0x0100 TO 0x025F;
    ROM    =  READ_ONLY    0xE000 TO 0xF5FF;

    HIROM  =  READ_ONLY    0xF600 TO 0xFFAD;

    ROM1   =  READ_ONLY    0xFFC0 TO 0xFFCF;
END

PLACEMENT

    _DATA_ZEROPAGE,

    MY_ZEROPAGE            INTO  Z_RAM;
    DEFAULT_RAM            INTO  RAM;

    _PRESTART,             /* startup code */
    STARTUP,               /* startup data structures */
    ROM_VAR,               /* constant variables */
    STRINGS,               /* string literals */
    VIRTUAL_TABLE_SEGMENT, /* C++ virtual table segment */
    DEFAULT_ROM,
    COPY                   INTO  ROM;

    BIOS_ROM               INTO  HIROM
END


STACKSIZE 0x50
VECTOR 0 _Startup

 

Then preceeding the functions required for the BIOS, you will need to use an appropriate #pragma so that the linker to places the code within the BIOS_ROM segment, rather than the DEFAULT_ROM segment.

 

Regards,

Mac

 

0 件の賞賛
返信
1,547件の閲覧回数
ffogg
Contributor II
thanks once more, it worked fine.
0 件の賞賛
返信