| 
               Hi, I used STM8s105k6 to design our products with floating arithmetic 
libraries (fast floating library is deactivated) 
When I enter to debug mode using Rlink on RIDE7, target worked well. 
And after starting the debug session, i can press CTRL+D to exit debug 
mode, and can confirm the target is still working. 
But when i reclosing the target power, it look suspiciously likefloating 
calculation routine is skipped. 
Could someone tell me why target is working during debug session and  
not working during no-debug session ? 
Raisonance Version : 7.30.10.0159 
STM8 2.32.10.0307 
Project code size: 17046, data : 1280 
STACK SIZE: 0x200 (Default) 
Fast Floating Library : Deactivated 
Optimization : 0 
Default Global Memory : Data 
Here is the map file result.... 
	TYPE     BASE         LENGTH     RELOCATION      SEGMENT NAME 
	----     ----         ------     ----------      ------------ 
	* * * * * * * *   D A T A       M E M O R Y   * * * * * * * * 
	DATA     000000H      000004H    PAGE0           CSTDLIB_REGISTERS 
	DATA     000004H      00001CH    INSECTION0      ?ZDT?... 
	DATA     000020H      000015H    INSECTION0      ?ZDT?... 
	DATA     000035H      000012H    INSECTION0      ?ZDT?... 
	DATA     000047H      000010H    INSECTION0      ?ZDT?... 
	DATA     000057H      000010H    INSECTION0      ?ZDT?... 
	DATA     000067H      000009H    INSECTION0      ?ZDT?... 
	DATA     000070H      000003H    INSECTION0      ?ZDT?HAL_LED 
	DATA     000073H      000002H    INSECTION0      ?ZDT?HAL_UART 
	DATA     000075H      000001H    INSECTION0      ?ZDT?HAL_OC 
	DATA     000076H      000001H    INSECTION0      ?ZDT?HAL_SCHEDULER 
	DATA     000077H      000022H    INSECTION0      ?DT?... 
	DATA     000099H      000014H    INSECTION0      ?DT?... 
	DATA     0000ADH      00000CH    INSECTION0      ?DT?... 
	DATA     0000B9H      000004H    INSECTION0      ?DT?... 
	DATA     0000BDH      000092H    INSECTION0      ?EDT?... 
	DATA     00014FH      00003AH    INSECTION0      ?EDT?... 
	DATA     000189H      00000CH    INSECTION0      ?EDT?... 
	DATA     000195H      000009H    INSECTION0      ?EDT?... 
	DATA     00019EH      000008H    INSECTION0      ?EDT?HAL_UART 
	DATA     0001A6H      00015AH    INSECTION       ?PR??HAL_EEPROM_PROGRAM_BLOCK_OPERATION?HAL_EEPROM 
	         000300H      000300H                     *** GAP *** 
	DATA     000600H      000200H    UNIT            ?C_STACK?SEG 
             | 
                  
Hi,
Looks like an interesting problem...
There is not much difference between debug mode and normal mode, except that in debug the whole flash is writeable, which sometimes changes the algorithms (when they are not correctly written).
Can you try to reduce the code and show us a (short) piece of code that exhibits the issue, so that we can reproduce it in our Labs?
Thanks,
Hi, Bruno-san
Thanks for your reply and information about the difference between debug and release mode.
At first, I tried to move some variables from DATA space to PAGE0 space.
(When I checked the map file, it gave me an advise as "SUGGESTED OPTIMIZATION".)
After moving some variables to page0 (by adding page0 declaration in from of variable type),
floating point routine works well.
I'd like to confirm which part was the cause. so, I'm continuing the code inspection now.
Here is the cut of code (floating point routine), but it can't regenerate problem...and it's difficult to cut the code...
When i use the former code (Set #if directive), problem ocurred. but when i used the latter
code, problem didn't occur.
-------------------------------
#define NZEROS 2
#define NPOLES 2
#define GAIN 2.502908710e+02
static float xv[NZEROS+1], yv[NPOLES+1];
uint8_t sensor_get_data(int16_t * p_sensor)
{
int16_t temp;
/* Fetch Data */
if (hal_sensor_io_get_data() == NG)
{
/* Reset sensor */
hal_sensor_io_reset();
return NG;
}
else
{
/* Do Nothing */
};
/* Store Current Data */
temp = ((p_g_sensor_packet->data - g_sensor_offset_std) / cg_hal_sensor_io_scale_factor[0]);
xv[0] = xv[1];
xv[1] = xv[2];
xv[2] = (float)temp * 0.003621682151492864300;
yv[0] = yv[1];
yv[1] = yv[2];
yv[2] =
xv[0] +
2 * xv[1] +
xv[2] +
( -0.8371816513 * yv[0]) +
( 1.8226949252 * yv[1]);
*p_sensor = (int16_t)yv[2];
return OK;
}
#else
uint8_t sensor_get_data(int16_t * p_sensor)
{
/* Fetch Data */
if (hal_sensor_io_get_data() == NG)
{
/* Reset sensor */
hal_sensor_io_reset();
return NG;
}
else
{
/* Do Nothing */
};
/* Store Current Data */
*p_sensor = ((p_g_sensor_packet->data - g_sensor_offset_std) / cg_hal_sensor_io_scale_factor[0]);
return OK;
}
#endif