2017-08-14 09:04 AM
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
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*Solved! Go to Solution.
2017-08-16 06:55 AM
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
2017-08-16 06:55 AM
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
2017-08-16 03:52 PM
thank you very much for your time and effort, I was not aware of this
best regards,
R.
2017-09-12 07:07 PM
Hi Luca
How do i add this to my project?, (sorry for the newbie question) i'm new using this IDE.
Hello,
as the linker says add @svlreg to your function declaration (both prototype and actual function) and the problem will go away.
Thank you very much
Best regards
2017-09-14 01:51 AM
Hello,
it's in the source code, it does not depend on the IDE.. at some point you have an interrupt function like
@interrupt void my_interrupt_function(void) { ..interrupt function using 32 bits math.. }
and you just add @svlreg to it so that it becomes
@svlreg @interrupt void my_interrupt_function(void) { ..interrupt function using 32 bits math.. }
Regards,
Luca
2017-09-19 01:34 PM
Hello, what documentation would you recommend to understand such syntax? i haven't seen it before.
Any info will be apreciated Best regards2019-08-16 03:22 AM
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
2019-08-18 01:38 AM
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)