Hi there!
There is something very wrong with the last commit.
The AT89LP51 that I'm using resets after executing the following code:
exp = ((float)curr_max_val - data->cfg.inv.ovl.step1) / data->cfg.inv.ovl.exp_div;
ovl_acc += expf(exp);
I can provide the whole project (it is quite big) and it is compiled like this:
/opt/sdcc/bin/sdcc -I./include -I../c51_core_libs/include -DSINE33_SFC -c -mmcs51 --verbose --model-large --opt-code-speed -c source/sp_sfc_process_analog_data.c -o obj/sp_sfc_process_analog_data.rel
sdcc: Calling preprocessor...
sdcc: sdcpp -nostdinc -Wall -std=c11 -I./include -I../c51_core_libs/include -DSINE33_SFC -obj-ext=.rel -D__SDCC_CHAR_UNSIGNED -D__SDCC_MODEL_LARGE -D__SDCC_FLOAT_REENT -D__SDCC=3_6_9 -D__SDCC_VERSION_MAJOR=3 -D__SDCC_VERSION_MINOR=6 -D__SDCC_VERSION_PATCH=9 -DSDCC=369 -D__SDCC_REVISION=10070 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__=1 -D__STDC_NO_THREADS__=1 -D__STDC_NO_ATOMICS__=1 -D__STDC_NO_VLA__=1 -D__STDC_ISO_10646__=201409L -D__STDC_UTF_16__=1 -D__STDC_UTF_32__=1 -isystem /opt/sdcc/bin/../share/sdcc/include/mcs51 -isystem /usr/local/share/sdcc/include/mcs51 -isystem /opt/sdcc/bin/../share/sdcc/include -isystem /usr/local/share/sdcc/include source/sp_sfc_process_analog_data.c
sdcc: Generating code...
The same code, compiled with a yesterday sdcc snapshot, works flawless.
While there have been lots of changes in SDCC recently, most shouldn't affect mcs51 at all.
After the 11th of October until now I only see two changes ([r10073] and [r10070], both on the 16th of October) that would affect mcs51.
Philipp
P.S.: [r10073] affects floating-point comparisons. Does your program use float?
Last edit: Philipp Klaus Krause 2017-10-18
I was thinking that it was "Improve handling of variables on stack in return." fault (because the code is big, it is compiled with the large memory model and I could be in the stack size limit)
but now that you mention the float comparison...
yes, I'm using floats
almost everything is float in there. I'm able to print the printf, that is precisely before a float comparasion, and right after that,
the cpu resets... at least, that printf is the last one that I see before the reset.
Last edit: Cristiano Rodrigues 2017-10-18
You're not compiling with --stack-auto so there are hardly any variables on the stack.
[r10074] "Improve handling of variables on stack in return." does not affect not mcs51. The main impact is on gbz80; to a lesser degree z80, z180, tlcs90, r2k and r3ka are affected.
Philipp
Philipp,
In [r10073] you also removed LE_OP and GE_OP from SDCCopt.c. Was that intentional?
Yes. I found that SDCC does not emit them for float (and even though the infrastructure for converting them to support function calls was there in SDCCopt.c, there were no such support functions in the library, so it wouldn't have worked anyway).
Philipp
Can you provide a small, compileable example that reproduces the issue?
Philipp
I'm trying to create a small example but in that small example I'm not being able to recreate what is happening in the big project.
Hi there!
It is just to say the problem still occurs.
As soon as the following condition is true, bad things happen:
BUT if compile without --opt-code-speed, it works again.
I have all the code attached, in case you want to have a look
Last edit: Cristiano Rodrigues 2018-01-06