Skip to main content
Visitor II
March 20, 2009
Question

Vector source file(example.lkf) error

  • March 20, 2009
  • 12 replies
  • 2837 views
Posted on March 20, 2009 at 05:45

Vector source file(example.lkf) error

    This topic has been closed for replies.

    12 replies

    sandeep2Author
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    I downloaded:

    1) the STVD and STVP from

    ''http://www.st.com/stonline/products/support/micro/files/sttoolset.exe''

    2) the free 16K version of Cosmic compiler for STM8 from ''http://www.cosmicsoftware.com/download_stm8_16k.php''

    Started with the ''Cosmic C Tutorial'' given in the STVD help.

    Selected the target MCU as ''STM8AF/H51AA''.

    Performed all the steps given in the chapters ''11.1 Setup'' & ''11.2 Build''.

    While performing steps given in Chapter ''11.2.6 Building the application'', i.e. while performing build, the compiler reported following errors:

    ---------------------------------------------------------------------------

    #error clnk c:\program files\stmicroelectronics\st_toolset\stvd\example\tutorial_cosmic\example.lkf:14 can't open file crtsx.st7

    #error clnk c:\program files\stmicroelectronics\st_toolset\stvd\example\tutorial_cosmic\example.lkf:15 can't open file libim.st7

    #error clnk c:\program files\stmicroelectronics\st_toolset\stvd\example\tutorial_cosmic\example.lkf:16 can't open file libm.st7

    The command: ''clnk -l''C:\Program Files\COSMIC\CXSTM8_16K\Lib'' -o Debug\timer.sm8 -mDebug\timer.map ''c:\program files\stmicroelectronics\st_toolset\stvd\example\tutorial_cosmic\example.lkf'' '' has failed, the returned value is: 1

    exit code=1.

    ---------------------------------------------------------------------------

    Clearly, the files, crtsx.st7, libim.st7 & libm.st7, reported by the compiler are related to ST7.

    These file names are mentioned in the example.lkf file (located under folder: \Program files\STMicroelectronics\st_toolset\stvd\Example\tutorial_cosmic)

    I wish to know what changes do I need to do in the example.lkf file (if required) or what changes do I need to do in the configuration settings that will help to get rid of these errors and will help to proceed.

    Regards,

    SU

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    Hi Sandeep,

    When you create the workspace select ''STM8 Cosmic'' from Toolchain list.

    Exactly the files, crtsx.st7, libim.st7 & libm.st7, reported by the compiler are related to ST7. The correspond files related to STM8 are: crtsx.sm8, libim.sm8 & libm.sm8.

    Regards

    Mozra

    sandeep2Author
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    I modified the example.lkf file by including the references to files crtsx.sm8, libim.sm8 and libm.sm8 and saved the file as example_stm8.lkf. Included this lkf file(auto generation feature disabled) under linker input settings. Now when I try to perform Rebuild All, it reports following errors:

    ---------------------------------------------------------------------------

    #error clnk c:\program files\stmicroelectronics\st_toolset\stvd\example\tutorial_cosmic\example_stm8.lkf:17 can't open file libim.sm8

    The command: ''clnk -l''C:\Program Files\COSMIC\CXSTM8_16K\Lib'' -o Debug\timer.sm8 -mDebug\timer.map ''c:\program files\stmicroelectronics\st_toolset\stvd\example\tutorial_cosmic\example_stm8.lkf'' '' has failed, the returned value is: 1

    exit code=1.

    ---------------------------------------------------------------------------

    When I checked at the location “C:\Program Files\COSMIC\CXSTM8_16K\Lib�, ‘libim.sm8’ was not present. I, thus tried to do some tinkering by changing ‘libim.sm8’ name to ‘libis.sm8’(as this file was present at the location) to check what happens. After performing Rebuild All, it reported following errors:

    ---------------------------------------------------------------------------

    #error clnk c:\program files\stmicroelectronics\st_toolset\stvd\example\tutorial_cosmic\example_stm8.lkf:1 symbol c_smodx not defined (Debug\timer.o )

    #error clnk c:\program files\stmicroelectronics\st_toolset\stvd\example\tutorial_cosmic\example_stm8.lkf:1 symbol _rand not defined (Debug\timer.o )

    #error clnk c:\program files\stmicroelectronics\st_toolset\stvd\example\tutorial_cosmic\example_stm8.lkf:1 symbol c_ltor not defined (Debug\timer.o )

    #error clnk c:\program files\stmicroelectronics\st_toolset\stvd\example\tutorial_cosmic\example_stm8.lkf:1 symbol c_lgadc not defined (Debug\timer.o )

    #error clnk c:\program files\stmicroelectronics\st_toolset\stvd\example\tutorial_cosmic\example_stm8.lkf:1 symbol __stack not defined (C:\Program Files\COSMIC\CXSTM8_16K\Lib\crtsx.sm8 )

    #error clnk c:\program files\stmicroelectronics\st_toolset\stvd\example\tutorial_cosmic\example_stm8.lkf:1 symbol c_lcmp not defined (Debug\timer.o )

    #error clnk c:\program files\stmicroelectronics\st_toolset\stvd\example\tutorial_cosmic\example_stm8.lkf:1 symbol f_main not defined (C:\Program Files\COSMIC\CXSTM8_16K\Lib\crtsx.sm8 )

    The command: ''clnk -l''C:\Program Files\COSMIC\CXSTM8_16K\Lib'' -o Debug\timer.sm8 -mDebug\timer.map ''c:\program files\stmicroelectronics\st_toolset\stvd\example\tutorial_cosmic\example_stm8.lkf'' '' has failed, the returned value is: 1

    exit code=1.

    ---------------------------------------------------------------------------

    Same errors were also reported when reference to ‘libis.sm8’ was removed(ie only crtsx.sm8 and libm.sm8 were referred) from the example_stm8.lkf file.

    Please suggest what should be done.

    -SU

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    Hello,

    libiM (note the uppercase) does not exist in STM8, as ''M'' is an st7 memory model that is not supported in stm8 (because it's useless).

    Generally speaking, you cannot port a st7 projet by just changing something manually in the linker file: you need at least to recompile everything with the proper compiler and a coherent memory model between the compiler (options) and the linker (file).

    I have no idea what went wrong with the tutorial installation, but the whole idea behind stvd is that you let it generate the linker file for you, unless you know exactly what you are doing and want to do it by hand.

    Hope it helps.

    Regards,

    Luca (Cosmic)

    sandeep2Author
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    Hi Luca,

    Thanks for providing info about 'libiM'.

    I was actually refering to the Cosmic C tutorial (Section 11.2.4 Customize the Linker options).

    The confusion started because the 'example.lkf' file (located under: Program files\STMicroelectronics\st_toolset\stvd\Example\tutorial_cosmic\ ) is not updated for STM8. It refers to ST7 related settings. It will be great if this issue(of updating the 'example.lkf' for STM8) is being taken care of in the future ''sttoolset'' setup for STM8. Also the Cosmic C tutorial could be updated for target STM8.

    Appriciate you help.

    Regards,

    SU

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    Hi Sandeep,

    I suggest to construct a project from stratch (from the begining) so :

    1) Select your MCU and compiler toolchain

    2) In the setting, I suggest to work with Long Stack model memory, so you must choose in the startup file crtsi0.sm8 or crts0.sm8

    3) keep the Linker option by default

    4) Generate your Project, it will contains the main.c the interrupt table vector

    5) Compile and built this project

    6) If all is OK, add sources files to your project and recompile

    let me know if you have any problems

    Best regards

    Bassinux

    sandeep2Author
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    Hi Bassinux,

    As per your suggestion, I performed following steps:

    1) Selected toolchain as ''STM8 Cosmic'', toolchain root as ''Program Files\COSMIC\CXSTM8_16K'' & MCU as ''STM8AF51AA''.

    2) Selected ''Long Stack (+modsl0)'' under Project Settings -> C Compiler -> Memory Models.

    3) Selected ''crtsi0.sm8'' under Project Settings -> Linker -> Start-up file.

    4) Kept the linker input 'auto'.

    5) The project contained main.c & stm8_interrupt_vector.c. Performed rebuild all. It reported no errors.

    Now when I add source and header files for ADC (ADC_ContinuousConversion) given in the STM8A firmware library, I get some linker errors.

    Please note that I replaced the default generated main.c and stm8_interrupt_vector.c with those given for ADC. Also ensured that 'Vector file name'(under Project settings -> Linker -> Input) is selected providing the correct path(to that of ADC & not the default one).

    Regards,

    SU

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    Hi,

    Can you send me error messages displayed in this last case.

    sandeep2Author
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    Following errors were reported:

    ---------------------------------------------------------------------------

    #error clnk Debug\adc.lkf:1 symbol _GPIO_WriteLow not defined (Debug\stm8a_it.o )

    #error clnk Debug\adc.lkf:1 symbol _GPIO_WriteHigh not defined (Debug\stm8a_it.o )

    #error clnk Debug\adc.lkf:1 symbol _GPIO_Init not defined (Debug\main.o )

    The command: ''clnk -l''C:\Program Files\COSMIC\CXSTM8_16K\Lib'' -o Debug\adc.sm8 -mDebug\adc.map Debug\adc.lkf '' has failed, the returned value is: 1

    exit code=1.

    ---------------------------------------------------------------------------

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:02

    Hi,

    You should include gpio.c in the project and uncomment the line (#define _GPIO (1)) in the conf.h to enable GPIO header file inclusion.

    let me know if you have any problems

    Regards

    mozra