Re: [Sdcc-user] New user / header files / optimisations STM8

2016-04-20 Thread Nick Hill
On 20 April 2016 at 06:39, Kustaa Nyholm wrote: >>The compiler can still do computations using the max >>precision fp type it has > > Perhaps, but depending on the hypothetical libraries and > hypothetical algorithms and rounding rules computing > > at max precisions might not produce exactly same

Re: [Sdcc-user] New user / header files / optimisations STM8

2016-04-19 Thread Kustaa Nyholm
>The compiler can still do computations using the max >precision fp type it has Perhaps, but depending on the hypothetical libraries and hypothetical algorithms and rounding rules computing at max precisions might not produce exactly same results. Don't know for sure as I'm no expert on the intr

Re: [Sdcc-user] New user / header files / optimisations STM8

2016-04-19 Thread Nick Hill
On 19 April 2016 at 23:16, Nick Hill wrote: > #define THERMISTOR_BETA 3380 > #define THERMISTOR_R0 1 > #define THERMISTOR_T0 (298.15) > #define Rinf (THERMISTOR_R0*pow(2.718,(-1*(THERMISTOR_BETA/THERMISTOR_T0 > > With Cosmic compiler, any reference to Rinf pulls a large chunk of > math lib

Re: [Sdcc-user] New user / header files / optimisations STM8

2016-04-19 Thread alvin albrecht
>However, just a few days ago we discussed >various floating point formats and one of them >was to leave the actual computations to the FP >library, which would make it hard for the compiler >to optimise these as it could not call those functions >at compile time. >This is pretty trivial to optimiz

Re: [Sdcc-user] New user / header files / optimisations STM8

2016-04-19 Thread Nick Hill
On 19 April 2016 at 16:50, Maarten Brock wrote: > What kind of 'functions' are you talking about here? SDCC uses functions > even for 'normal' operations like multiplication and addition at runtime. > I would expect these to be optimised out, but not the functions from e.g. > math.h. > > float a

Re: [Sdcc-user] New user / header files / optimisations STM8 (Nick Hill)

2016-04-19 Thread Nick Hill
On 19 April 2016 at 19:53, Georg Icking-Konert wrote: > Hi Nick, > > I totally agree that the SPL headers (and functions) are not very > convenient. However, "unfortunately“... Hi Georg, Agreed. The frustrations I felt caused me to write an angry letter to ST product manager, but in the end I de

Re: [Sdcc-user] New user / header files / optimisations STM8

2016-04-19 Thread Kustaa Nyholm
>perhaps there is some technical or >historical precedent for this? Most likely just a matter of priority. However, just a few days ago we discussed various floating point formats and one of them was to leave the actual computations to the FP library, which would make it hard for the compiler to

Re: [Sdcc-user] New user / header files / optimisations STM8 (Nick Hill)

2016-04-19 Thread Georg Icking-Konert
Hi Nick, I totally agree that the SPL headers (and functions) are not very convenient. However, "unfortunately“ there are a lot of examples on the ST homepage for the STM8 which are based on the SPL… > Has someone already released fine grained SDCC compatible header > files for the STM8? Due

Re: [Sdcc-user] New user / header files / optimisations STM8

2016-04-19 Thread Philipp Klaus Krause
On 19.04.2016 17:21, Nick Hill wrote: > On 19 April 2016 at 08:15, Philipp Klaus Krause wrote: > >> While SDCC has different optimizations from Cosmic, and in some cases >> will optimize better or worse than Cosmic, in this case it probably >> won't matter much. SDCC does not currently optimize c

Re: [Sdcc-user] New user / header files / optimisations STM8

2016-04-19 Thread Maarten Brock
> On 19 April 2016 at 08:15, Philipp Klaus Krause wrote: > >> While SDCC has different optimizations from Cosmic, and in some cases >> will optimize better or worse than Cosmic, in this case it probably >> won't matter much. SDCC does not currently optimize calls to float >> functions with constan

Re: [Sdcc-user] New user / header files / optimisations STM8

2016-04-19 Thread Nick Hill
On 19 April 2016 at 08:15, Philipp Klaus Krause wrote: > While SDCC has different optimizations from Cosmic, and in some cases > will optimize better or worse than Cosmic, in this case it probably > won't matter much. SDCC does not currently optimize calls to float > functions with constant argum

Re: [Sdcc-user] New user / header files / optimisations STM8

2016-04-19 Thread Nick Hill
Thank you for the interesting replies. It looks like things are moving in the right direction. I have linked the SPL to my projects, but somewhat half-heartedly since it doesn't tend to resolve to register bits. I would rather do something like: while (!CLK.ICKR.HSIRDY); instead of: while ((CLK_I

Re: [Sdcc-user] New user / header files / optimisations STM8

2016-04-19 Thread Philipp Klaus Krause
On 18.04.2016 22:58, Nick Hill wrote: > > I don't believe the Cosmic compiler free version is supposed to lack > optimisation found on the paid for version. However, I'm not > particularly impressed with the Cosmic compiler since I have defined a > constant expression featuring a raised to the po

Re: [Sdcc-user] New user / header files / optimisations STM8

2016-04-19 Thread Philipp Klaus Krause
On 18.04.2016 22:58, Nick Hill wrote: > Hi All. > > I have recently re-entered the world of micro programming with both > STM8 and PIC. > > I found the move from PC a little difficult since there seems to be a > range of proprietary headers which published code tends to be written > for. It is of

Re: [Sdcc-user] New user / header files / optimisations STM8

2016-04-19 Thread Philipp Klaus Krause
On 18.04.2016 22:58, Nick Hill wrote: > I have had to start re-factoring some code in my header file, and find > the ST header files broadly incompatible with SDCC. Where do I go from > here? Has someone already released fine grained SDCC compatible header > files for the STM8? By "ST header file

[Sdcc-user] New user / header files / optimisations STM8

2016-04-18 Thread Nick Hill
Hi All. I have recently re-entered the world of micro programming with both STM8 and PIC. I found the move from PC a little difficult since there seems to be a range of proprietary headers which published code tends to be written for. It is often not even clear which header files code is written