Skip to main content
Visitor II
August 14, 2017
Solved

uint32_t problem with STVD + Cosmic FSE

  • August 14, 2017
  • 3 replies
  • 2527 views
Posted on August 14, 2017 at 18:04

Hello, I use STM8AF52xx, STVD and cosmic FSE, when I try to use  STM8S_StdPeriph_Lib and CAN example I encounter this error:

&sharperror clnk Debug\stm8af52ax.lkf:1 @svlreg missing for function f_CAN_RX_IRQHandler

(I have deleted LCD and LED functions just to have pure CAN because there was similar error concerning LCD/LED).

This is part of code that is responsible for error:

it is can_recieve() routine

0690X000006041CQAQ.jpg

As it seems error is caused by uint32_t variables, more precisely with data manipulations.

I was able to assign pure numerical value, but combined statement (assign value from other variable and for example shifting left ) throws error.

I can compile stm8s_can.c without problem, but if try to I build whole project I got error as stated at beginning.

If I comment code with uint32_t variables project would build without errors.

Workspace is available in attachment. 

What is causing this error?

best regards,

Radim.

##error-clnk-@svlreg-missing-for-function*
    This topic has been closed for replies.
    Best answer by luca239955_stm1_st
    Posted on August 16, 2017 at 15:55

    Hello,

    as the linker says add @svlreg to your function declaration (both prototype and actual function) and the problem will go away.

    The issue is that when using 32 bits variables in interrupt functions the compiler must save the internal variable c_lreg (used for this kind of calculations) on the stack under interrupt to avoid possible corruption; this is controlled by the @svlreg keyword.

    Regards,

    Luca

    3 replies

    Visitor II
    August 16, 2017
    Posted on August 16, 2017 at 15:55

    Hello,

    as the linker says add @svlreg to your function declaration (both prototype and actual function) and the problem will go away.

    The issue is that when using 32 bits variables in interrupt functions the compiler must save the internal variable c_lreg (used for this kind of calculations) on the stack under interrupt to avoid possible corruption; this is controlled by the @svlreg keyword.

    Regards,

    Luca

    Visitor II
    August 16, 2017
    Posted on August 16, 2017 at 22:52

    thank you very much for your time and effort, I was not aware of this 

    best regards,

    R.

    Visitor II
    August 16, 2019

    I am having this problem also but when I add @svlreg to the interrupt function prototype and function I now get the following linker error:

    clnk -l"C:\Program Files (x86)\COSMIC\FSE_Compilers\Lib" -o Debug\5971.sm8 -mDebug\5971.map Debug\5971.lkf

    #error clnk Debug\5971.lkf:1 segment .bsct size overflow (277)

    #error clnk Debug\5971.lkf:1 segment .ubsct size overflow (3218)

    #error clnk Debug\5971.lkf:1 segment .bit size overflow (9)

     The command: "clnk -l"C:\Program Files (x86)\COSMIC\FSE_Compilers\Lib" -o Debug\5971.sm8 -mDebug\5971.map Debug\5971.lkf " has failed, the returned value is: 1

    exit code=1.

    I am new to STM8 and Cosmic. Any suggestions please?

    Cheers, Bruce

    Visitor II
    August 18, 2019

    Hello,

    I don't see how just adding @svlreg can make your segments overflow.. please make sure you start from a project that does compile and link correctly, then add @svlreg only (no other modifications), compile again and check the result.

    If you can't make it work you can contact our support at support@cosmic.fr

    Regards,

    Luca (Cosmic)