Topic : Possible error in generated code to access field of idata struct ?

Forum : 8051

Original Post
Post Information Post
September 9, 2013 - 4:00pm
Guest

Hi

I seem to have a problem with code generated to access field of a struct in idata.

With a shared header.h file containing:

typedef unsigned int INT16_U;

typedef struct
{
...

INT16_U TZSamplingTicks;
...

}TT_LOGGING_STATE_VECTOR;

extern TT_LOGGING_STATE_VECTOR idata StateVector;

and sleepB3.c containing

TT_LOGGING_STATE_VECTOR idata StateVector;

INT16_U SleepTicksChunk;

The assignment:

396 2 SleepTicksChunk = StateVector.TZSamplingTicks;

generates the following code:

; SOURCE LINE # 396
005E 850000 R MOV StateVector+01BH,SleepTicksChunk
0061 850000 R MOV StateVector+01CH,SleepTicksChunk+01H

The above code fails to make the required assignment.

It appears to me that the necessary indirection is absent, and the effect of the MOV statements will be to pick up the bytes at the same addresses in data, rather than idata.

Is this perhaps an error in your compiler?

I am using version RC51 Compiler 6.14.12.0087

Thank you

Damien

Replies
Post Information Post
+1
0
-1
September 12, 2013 - 11:43am
Raisonance Support Team

Hello,
We confirm this issue! this appear when you set the optimisation to level 7 (not for 6).
The Rkit51 has been corrected and soon will arrive a new release of this kit.
I can send you this kit corrected if you cannot wait for the next release.

Best regards,

+1
0
-1
September 12, 2013 - 12:19pm
Guest

Hi Etienne

Thank you for confirming this and for fixing it quickly.

I also experienced a related issue that your fix may have cured: I have code which performs arithmetic (addition and subtraction) on unsigned 32 bit variables; the code worked correctly when the variables were in data, but it failed when they were moved to idata.

I put in a workaround to overcome this; but if necessary I can restore the old code and produce assember listings for you.

Best

Damien

+1
0
-1
September 17, 2013 - 9:30am
Raisonance Support Team

Hi Damien,

Can you send us the old code to
Thank a lot for reporting issue.

Best regards,

+1
0
-1
September 20, 2013 - 4:05pm
Raisonance Support Team

The second issue has been solved. It works with the latest release.

Best regards,