2010-08-02 11:49 PM
Cosmic Linker Error
#cosmic-link-linking-stvd #cosmic-link-linking-stvd #linking2011-05-17 06:09 AM
Greetings:
I determine that the error disappeared when I removed the stm8s_flash.c library file from the project.The stm8s_flash.c contains the statement block: #ifdef USE_COSMIC_SECTIONS #pragma section (FLASH_CODE) #pragma section const {FLASH_CONST} #pragma section @near [FLASH_URAM] #pragma section @near {FLASH_IRAM} #pragma section @tiny [FLASH_UZRAM] #pragma section @tiny {FLASH_IZRAM} #endif Since the stm8s.h file defines USE_COSMIC_SECTIONS when the Cosmic compiler is used I presume this causes the linker to generate the error: #error clnk Debug\lcm_ta_cos.lkf:1 no default placement for segment .FLASH_CODE I don't believe the linker creates any segments with the above names. Any suggestions how to fix this? Thanks in advance! Best Regards, Tom Alldread2011-05-17 06:09 AM
2011-05-17 06:09 AM
Greetings Luca:
Thanks once more for your help! I found a stm8s105.lkf file in one of the ST standard library FLASH examples with segment code for the FLASH_CODE and FLASH_CONST declarations. I added these definitions to the STVD segments table and solved the linker error problem. I have attached two lkf files, ''lcm_ta_cos'' and ''lc_meter_v1.lkf''. The new definitions I provided are shown in the first file. But the project with the second file which does not have the definitions compiles OK. I believe the only difference is the directory tree. In the second case the linker finds the FLASH_CODE definition without the memory address details being placed within the lkf linker file. My question is why does the second case work without the definition being placed in the lkf file? Where else does the linker look for segment definitions? Thanks in advance for any clarifications! Best Regards, Tom Alldread2011-05-17 06:09 AM
Greetings:
Thanks for the help! Although I have read the user guide I don't really understand the reason for the ''pragma section'' statement. Is it a command to the linker to rename the previously named sections or does it assign alias names for the sections? In the case of the stm8s_flash.c file I wonder why the pragma block of code is there in the first place and what might fail if it is removed? Do the Cosmic STM8 tools, possibly the assembler, need the specific Cosmic section names? I do know that if I remove the pragma block with comment /* */ markers the program then compiles OK without any errors. The directory tree structure also seems to affect the error. Must the STVD directory structure rigidly follow the example projects? Is there a problem with the following structure? stm8Projects\CosmicStwSpace\ProjectStpHome\Debug stm8Projects\librairies\STM8S_StdPeriph_Driver\inc stm8Projects\librairies\STM8S_StdPeriph_Driver\src Thanks in advance for any help! Best Regards, Tom Alldread2011-05-17 06:09 AM
2011-05-17 06:09 AM
It seems my attachments did not work so I will try again here:
2011-05-17 06:09 AM
Greetings:
The inconsistency problem turned out to be caused by a different option in the stm8s.h file where USE_COSMIC_SECTIONS is defined. In one case it was defined and the other it was commented out. Although this appeared like a directory path problem it was not, just two different stm8s.h library definition files. I still do not know when Cosmic sections are supposed to be used but in my case it is apparent that these definitions are not needed nor supported by the default linker values. I am happy to know the problem was not directory structure sensitive as I once thought. It appears the STVD package is nice and flexible with regards to directory paths. The cause would have been much easier to track down if there was a way to list the defined compiler directive symbols. If anyone knows of a way to generate a list of active compiler directive symbols please let me know. Since conditional compile statements are common place I think a feature within the IDE that would permit one to easily determine whether or not a given symbol has been defined would be very useful. Best Regards, Tom Alldread2011-05-17 06:09 AM
>> If anyone knows of a way to generate a list of active compiler directive symbols please let me know.
use the cobj utility provided with all cosmic compilers: cobj -i acia.o and you will get an output like this: > acia.o: 16 Aug 2010 11:49 cpstm8 V4.8.33: -d MYDEF -f -h modsl.h -pb -u -x cgstm8 V4.3.4.2: costm8 V4.3.3: castm8 V4.6.8: Regards, Luca (Cosmic)