2018-03-06 08:23 AM
Hi all,
I'm developing an application (PROJECT) for a STM8S208RB (128k flash) t
hat was using around 100kB of flash. Now
I have added a new library (LIBRARY) that has increased memory usage to 120kBof flash
.Now, when I delete some code in my application I get the following error:
&sharperror clnk
PROJECT
_release\PROJECT
.lkf:152PROJECT
_release\library_api.o: section boundary crossing (.text:095c) f_LIBRARY_SetListCallbackThe command: 'clnk -l'C:\Program Files (x86)\COSMIC\FSE_Compilers\Lib' -o PROJECT_release\project.sm8 -m
PROJECT
_release\PROJECT
.mapPROJECT
_release\PROJECT
.lkf' has failed, the returned value is: 1exit code=1.
(I get this error after commenting an if-else related with the library)
(
LIBRARY_SetListCallback is a function related with the library, but it doesn't have any relation with the if-else
)I'm using the following compiler options:
+modsl)
Minimize code size (+compact)
Enforce Prototyping Functions (-pp)
Allow Pointer Narrowing (-pnp)
I'm using
the following linker options:
Interrupt vector on 0x8000
Code/Constants from 0x8080 to 0x27FFF
Zero page from 0x0000 to 0x00FF
RAM from 0x0100 to 0x13FF
This is my memory sections map:
--------
Segments--------start 00008080 end 0000ba6c length 14828 segment .const
start 0000bd17 end 000258f4 length 105437 segment .textstart 00004000 end 00004000 length 0 segment .eepromstart 00000000 end 00000000 length 0 segment .bsctstart 00000000 end 0000000a length 10 segment .ubsctstart 0000000a end 0000000a length 0 segment .bitstart 0000000a end 0000000a length 0 segment .sharestart 00000100 end 000003a3 length 675 segment .data, initializedstart 0000ba74 end 0000bd17 length 675 segment .data, fromstart 000003a3 end 00001380 length 4061 segment .bssstart 00000000 end 000079be length 31166 segment .info.start 00008000 end 00008080 length 128 segment .conststart 0000ba6c end 0000ba74 length 8 segment .initI looked for this error code in the STM8 forum but I couldn't find a answer that would help me.
Has anybody any idea of how to solve this linker error?
Thanks all of you in advance,
Guillermo,
#linker #section-boundary-crossing #stm8-microcontrollersSolved! Go to Solution.
2018-03-07 09:11 AM
Hello,
there are some sections of code that cannot be linked across the 0xFFFF limit, because they contain 16 bit internal jumps that would work either below 0xFFFF or above it, but not across. Usually these small sections of code are inside the libraries that we (Cosmic) provide with the compiler, but in your case it looks like they are inside some libraires provided by someone else: the solution is to link these libraries at another address, by either changig the linking order (that was basically what was happening when your overall code was bigger) or by forcing a segment beginning at 0x10000 just before the object file where you get the problem.
I hope this is clear, but if you have difficulties don't hesitate to contact us directly on the support email.
Regards,
Luca (Cosmic)
2018-03-07 09:11 AM
Hello,
there are some sections of code that cannot be linked across the 0xFFFF limit, because they contain 16 bit internal jumps that would work either below 0xFFFF or above it, but not across. Usually these small sections of code are inside the libraries that we (Cosmic) provide with the compiler, but in your case it looks like they are inside some libraires provided by someone else: the solution is to link these libraries at another address, by either changig the linking order (that was basically what was happening when your overall code was bigger) or by forcing a segment beginning at 0x10000 just before the object file where you get the problem.
I hope this is clear, but if you have difficulties don't hesitate to contact us directly on the support email.
Regards,
Luca (Cosmic)
2018-03-08 06:32 AM
Hi Luca,
Thank you so much for your fast response, now I think I understand the source of my problem.
Most of the new library is at the end of the .text segment (IE: The
LIBRARY_SetListCallback
mentioned in the error is located around 0x25000, really far away from 0xFFFF) BUT I added also some new code that was located at the begining of .text (IE: the mentioned if-else that triggered the error). So because of this new code I think I have moved some other code across 0xFFFF, generating the
section boundary crossing
error. Is this reasoning correct?
Following your instructions, I have changed the linking order manually in the 'PROJECT.lkf' file, so now from 0x8080 to 0
x12000 I have some libraries that I will never modify, so there is no risk of 'move code across 0xFFFF' again. At this point I have some doubts:Thanks all you in advance and best regards.
Guillermo,