is generated since SDCC cannot prove that your ISR contains no div/divw (when the ISR contains divisions, certain right shifts, inline asm or calls to functions not defined before the ISR, SDCC cannot prove that the ISR does not contain div/divw. In case the ISR contains divisision, these two instructions are a workaround for a hardware bug ("Unexpected DIV/DIVW instruction result in ISR" in the STM8 errata).
You could declare ISRs that contain inline assembly, but no division as __naked, so SDCC omits the function prologue and epilogue (the iret then needs to be in the inline asm).
Philipp
Last edit: Philipp Klaus Krause 2018-06-15
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"Unexpected DIV/DIVW instruction result in ISR" in the STM8 errata
Thank you very much! Now, will try to search errata before asking.
And what is about piece with push a and pop a ?
P.S.
I have read a method to loose unused code for pic14 from [https://sourceforge.net/p/sdcc/mailman/message/34776699/].
Then I've tried to modify stm8 .asm files and added .area f_N before each function.
I've got no errors about such approach.
But there are no command-line options for sdldstm8 to optimize (loose) unused functions.
So, I've got another idea.
Maybe someone can modify aslink and add command-line option and some code from sdar to produce .lib instead of .rel?
At last, linker sdldstm8 will get just some functions from .lib files , but not all functions from .rel files.
Do you know about such discussions here?
Now, I've found a cutting .c file perl script of B.Schwander.
After some modifications, the script cuts all .c files in a directory and makes one .h file and many .c files each with one function inside. The script also makes .lib.
Where can I put such temporary decision to loose unused functions?
Or simply have to make a post here?
Thanks.
Last edit: Andrew 2018-06-15
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've found a cutting .c file perl script of B.Schwander.
After some modifications, the script cuts all .c files in a directory and makes
one .h file and many .c files each with one function inside. The script also makes .lib.
I would like to have a copy of your version of B.Schwanders perl script. Please post it somewhere, or you can email it via david-gould@users.sourceforge.net. Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
was just a minor inefficiency in code generation. As of [r10448], it is no longer generated (code generation for ^ is now more similar to | in handling a).
Philipp
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I have compiled last SDCC : stm8 3.7.1 #10443 (Linux).
Here are my a test.c file and makefile.
test.c :
makefile :
After successful compilation, I was surprised about generated code in test.rst:
test.rst :
So, there are two pieces of garbage:
and
What I have to do to get garbage-free code?
Thanks.
Last edit: Andrew 2018-06-15
The
is generated since SDCC cannot prove that your ISR contains no div/divw (when the ISR contains divisions, certain right shifts, inline asm or calls to functions not defined before the ISR, SDCC cannot prove that the ISR does not contain div/divw. In case the ISR contains divisision, these two instructions are a workaround for a hardware bug ("Unexpected DIV/DIVW instruction result in ISR" in the STM8 errata).
You could declare ISRs that contain inline assembly, but no division as __naked, so SDCC omits the function prologue and epilogue (the iret then needs to be in the inline asm).
Philipp
Last edit: Philipp Klaus Krause 2018-06-15
Thank you very much! Now, will try to search errata before asking.
And what is about piece with push a and pop a ?
P.S.
I have read a method to loose unused code for pic14 from [https://sourceforge.net/p/sdcc/mailman/message/34776699/].
Then I've tried to modify stm8 .asm files and added .area f_N before each function.
I've got no errors about such approach.
But there are no command-line options for sdldstm8 to optimize (loose) unused functions.
So, I've got another idea.
Maybe someone can modify aslink and add command-line option and some code from sdar to produce .lib instead of .rel?
At last, linker sdldstm8 will get just some functions from .lib files , but not all functions from .rel files.
Do you know about such discussions here?
Now, I've found a cutting .c file perl script of B.Schwander.
After some modifications, the script cuts all .c files in a directory and makes one .h file and many .c files each with one function inside. The script also makes .lib.
Where can I put such temporary decision to loose unused functions?
Or simply have to make a post here?
Thanks.
Last edit: Andrew 2018-06-15
I would like to have a copy of your version of B.Schwanders perl script. Please post it somewhere, or you can email it via david-gould@users.sourceforge.net. Thanks!
The
was just a minor inefficiency in code generation. As of [r10448], it is no longer generated (code generation for ^ is now more similar to | in handling a).
Philipp