WLINK segments offset
Posted: Mon Apr 10, 2017 3:52 pm
Hello.
I try to make my bootloader, but have trouble with data address offset after linking.
Here my wlink config:
If use it, as a result all data addresses in program calculated as offsets from 0000.
If use next:
It only use offset from 0x7c00 for code, but still use offset from 0000 for data.
If use next:
It generates valid program, puts data at offset 0x7d00 and use valid offset, but this version work only if my code < 0x100 byte and use hardcoded offset for data, so that is not good idea.
How I can set wlink to place DATA right after CODE and use global offset 0x7c00?
I try to make my bootloader, but have trouble with data address offset after linking.
Here my wlink config:
Code: Select all
FILE MBR.asm.obj
FILE MBR.c.obj
NAME MBR.bin
OUTPUT raw
OPTION nodefaultlibs, quiet, start=_start
DISABLE 1014
ORDER
clname CODE
clname DATA
FORMAT dos
If use next:
Code: Select all
FILE MBR.asm.obj
FILE MBR.c.obj
NAME MBR.bin
OUTPUT raw
offset = 0x7c00
OPTION nodefaultlibs, quiet, start=_start
DISABLE 1014
ORDER
clname CODE offset = 0x7c00
clname DATA
FORMAT dos
If use next:
Code: Select all
FILE MBR.asm.obj
FILE MBR.c.obj
NAME MBR.bin
OUTPUT raw
offset = 0x7c00
OPTION nodefaultlibs, quiet, start=_start
DISABLE 1014
ORDER
clname CODE offset = 0x7c00
clname DATA offset = 0x7d00
FORMAT dos
How I can set wlink to place DATA right after CODE and use global offset 0x7c00?