Спасибо за ценный ответ. Посмотрел map при смещении на 150:
Код
Name Link Load Length Selector Space Scale
C:\Users\NIR\AppData\Local\Temp\s71g.obj
end_init 285 285 2 2A8 0
reset_vec 150 150 2 2A0 0
config 8007 8007 2 1000E 0
dist/default/production\medic.X.production.obj
cinit 951 951 6AF 12A2 0
intentry 154 154 131 2A8 0
text54 764 764 15 2A8 0
text41 287 287 4DD 2A8 0
text12 858 858 F9 10B0 0
text11 1990 1990 670 3320 0
cstackBANK0 20 20 33 20 1
cstackCOMMON 70 70 B 70 1
clrtext 779 779 C 2A8 0
bssBANK2 120 120 28 120 1
bssBANK1 A0 A0 46 A0 1
dataBANK0 6C 6C 4 20 1
bssBANK0 53 53 19 20 1
bssCOMMON 7B 7B 3 70 1
stringtext 1000 1000 6BE 20 0
Код
Psect | Contents | Memory Range | Size
------------|--------------------------------|---------------|--------------
| | |
reset_vec | Reset vector | 0150h - 0151h | 2 words
intentry | Interrupt context entry code | 0154h - 0284h | 305 words
end_init | Initialization code | 0285h - 0286h | 2 words
text41 | Program and library code | 0287h - 0763h | 1245 words
text54 | Program and library code | 0764h - 0778h | 21 words
clrtext | Memory clearing code | 0779h - 0784h | 12 words
text12 | Program and library code | 0858h - 0950h | 249 words
cinit Microchip MPLAB XC8 C Compiler (PRO Mode) V1.33
Код
Program space:
CONST used 0h ( 0) of 1EB0h words ( 0.0%)
CODE used 144Bh ( 5195) of 1EB0h words ( 66.1%)
STRCODE used 6BEh ( 1726) of 1EB0h words ( 22.0%)
ENTRY used 0h ( 0) of 1EB0h words ( 0.0%)
STRING used 0h ( 0) of 1EB0h words ( 0.0%)
Код
Memory Summary:
Program space used 1B09h ( 6921) of 2000h words ( 84.5%)...
Видно, что смещение происходит и на нужную величину. Так же памяти у него достаточно, около 1000 слов, а надо всего 512.
Настораживает строчка:
Код
hlink "--edf=C:\Program Files (x86)\Microchip\xc8\v1.33\dat\en_msgs.txt" -cs -h+dist/default/production\medic.X.production.sym --cmf=dist/default/production\medic.X.production.cmf -z -Q16F1825 -oC:\Users\NIR\AppData\Local\Temp\s8m8.6 -Mdist/default/production/medic.X.production.map -ver=XC8#PRO##V1.33 -ASTACK=020C8h-0225fh -pstack=STACK -ACONST=0150h-01FFh,0200h-02FFhx30 -ACODE=0150h-07FFh,0800h-0FFFhx3 -ASTRCODE=0150h-01FFFh -AENTRY=0150h-01FFh,0200h-02FFhx30 -ASTRING=0150h-01FFh,0200h-02FFhx30 -ACOMMON=070h-07Fh -ABANK0=020h-06Fh -ABANK1=0A0h-0EFh -ABANK2=0120h-016Fh -ABANK3=01A0h-01EFh -ABANK4=0220h-026Fh -ABANK5=02A0h-02EFh -ABANK6=0320h-036Fh -ABANK7=03A0h-03EFh -ABANK8=0420h-046Fh -ABANK9=04A0h-04EFh -ABANK10=0520h-056Fh -ABANK11=05A0h-05EFh -ABANK12=0620h-064Fh -ABIGRAM=02000h-023EFh -ARAM=020h-06Fh,0A0h-0EFh,0120h-016Fh,01A0h-01EFh,0220h-026Fh,02A0h-02EFh,0320h-036Fh,03A0h-03EFh,0420h-046Fh,04A0h-04EFh,0520h-056Fh,05A0h-05EFh,0620h-064Fh -AABS1=020h-07Fh,0A0h-0EFh,0120h-016Fh,01A0h-01EFh,0220h-026Fh,02A0h-02EFh,0320h-036Fh,03A0h-03EFh,0420h-046Fh,04A0h-04EFh,0520h-056Fh,05A0h-05EFh,0620h-064Fh -ASFR0=00h-01Fh -ASFR1=080h-09Fh -ASFR2=0100h-011Fh -ASFR3=0180h-019Fh -ASFR4=0200h-021Fh -ASFR5=0280h-029Fh -ASFR6=0300h-031Fh -ASFR7=0380h-039Fh -ASFR8=0400h-041Fh -ASFR9=0480h-049Fh -ASFR10=0500h-051Fh -ASFR11=0580h-059Fh -ASFR12=0600h-061Fh -ASFR13=0680h-06EFh -ASFR14=0700h-076Fh -ASFR15=0780h-07EFh -ASFR16=0800h-086Fh -ASFR17=0880h-08EFh -ASFR18=0900h-096Fh -ASFR19=0980h-09EFh -ASFR20=0A00h-0A6Fh -ASFR21=0A80h-0AEFh -ASFR22=0B00h-0B6Fh -ASFR23=0B80h-0BEFh -ASFR24=0C00h-0C6Fh -ASFR25=0C80h-0CEFh -ASFR26=0D00h-0D6Fh -ASFR27=0D80h-0DEFh -ASFR28=0E00h-0E6Fh -ASFR29=0E80h-0EEFh -ASFR30=0F00h-0F6Fh -ASFR31=0F80h-0FEFh -preset_vec=0150h,intentry=0154h,init,end_init -ppowerup=CODE -pcinit=CODE -pfunctab=CODE -ACONFIG=08007h-08008h -pconfig=CONFIG -DCONFIG=2 -AIDLOC=08000h-08003h -pidloc=IDLOC -DIDLOC=2 -AEEDATA=00h-0FFh/0F000h -peeprom_data=EEDATA -DEEDATA=2 -DCODE=2 -DSTRCODE=2 -DSTRING=2 -DCONST=2 -DENTRY=2 -k C:\Users\NIR\AppData\Local\Temp\s8m8.obj dist/default/production\medic.X.production.obj
А именно -ACODE=0150h-07FFh,0800h-0FFFhx3 -ASTRCODE=0150h-01FFFh. Почему то класс кода делится на сегменты, один от 150 до 800, а остальные по 2к. слова далее до конца. При смещении на 200, линковщик после выше указанного текста hlink... выдаёт ошибку 0: (1347) can't find 0x58F words (0x58f withtotal) for psect "text41" in class "CODE" (largest unused contiguous range 0x493). Да, после изменения смещения параметр в линковщике меняется на -ACODE=0200h-07FFh,0800h-0FFFhx3.
К сожалению я не знаю, возможно ли вручную задать -ACODE=0200h-1FFF и будет ли это иметь какой то смысл, но это единственная моя догадка на данный момент. Если не сложно, подскажите пожалуйста.
Добавлено:
Нашёл такой текст в документации:
Цитата
The second cause of this message is when the total amount of memory needed by the
psect being positioned is sufficient, but that this memory is fragmented in such a way
that the largest contiguous block is too small to accommodate the psect. The linker is
unable to split psects in this situation. That is, the linker cannot place part of a psect at
one location and part somewhere else. Thus, the linker must be able to find a contiguous
block of memory large enough for every psect. If this is the cause of the error, then
the psect must be split into smaller psects if possible.
To find out what memory is still available, generate and look in the map file, see
Section 4.8.8 “-M: Generate Map File” for information on how to generate a map file.
Search for the string UNUSED ADDRESS RANGES. Under this heading, look for the
name of the segment specified in the error message. If the name is not present, then
all the memory available for this psect has been allocated. If it is present, there will be
one address range specified under this segment for each free block of memory. Determine
the size of each block and compare this with the number of words specified in the
error message.
Psects containing code can be reduced by using all the compiler’s optimizations, or
restructuring the program. If a code psect must be split into two or more small psects,
this requires splitting a function into two or more smaller functions (which may call each
other). These functions may need to be placed in new modules.
Psects containing data may be reduced when invoking the compiler optimizations, but
the effect is less dramatic. The program may need to be rewritten so that it needs less
variables. If the default linker options must be changed, this can be done indirectly
through the driver using the driver -L- option, see Section 4.8.7 “-L-: Adjust Linker
Options Directly”. Section 4.8.8 “-M: Generate Map File” has information on interpreting
the map file’s call graph if the compiler you are using uses a compiled stack. (If
the string Call graph: is not present in the map file, then the compiled code uses a
hardware stack.) If a data psect needs to be split into smaller psects, the definitions for
variables will need to be moved to new modules or more evenly spread in the existing
modules. Memory allocation for auto variables is entirely handled by the compiler.
Other than reducing the number of these variables used, the programmer has little control
over their operation. This applies whether the compiled code uses a hardware or
compiled stack.
На сколько я понимаю, предлагается разбивать функции или же редактировать параметры линковщика.
Я изменил параметр линковщика на -L-ACODE=0200h-07FFh,800h-1FFFh (это вставил в Additional option в настройках проекта XC8 Linker). В map файле проверил что установил правильно, проект скомпилировался. Когда добавил смещение, то получил новую ошибку: 1297: (1357) fixup overflow storing 0x92D in 2 bytes at 0x3254/0x2 -> 0x192A (dist/default/production\medic.X.production.obj 232/0x24)
Что это то такое?
Сообщение отредактировал vovken1997 - Mar 17 2016, 21:22