2012-10-11 12:36 AM
To optimize the code I put nearly all the flags to bit structures. Now I came across a bug in the CXSTM8 when writing to bits. Reading bits doesn't bring any problem.
The good news for me is that I found a workaround. Here is the example:/*----------------------------------------------------*/
typedef struct
{int
sem_on :1;/* bit */
int
sem_off :1;/* bit */
int
sem_tog :1;/* bit */
} key_;/*struct*/
key_ key_x;/*struct*/
key_* key_down = &key_x;&sharppragma
sectionconst
{}/*struct*/
key_*const
key_up = &key_x;void clear_key_updown(
void
) {/*struct*/
key_* p_key;key_down->sem_on = 0;
/* variable pointer ..
- ******** ERROR: bad addressing mode *********/ (*key_down).sem_on = 0;/* alternate expression ..
- ******** ERROR: bad addressing mode *********/p_key = key_down;
/* pointer substitution - o.k. */
p_key->sem_on = 0; key_up->sem_on = 0;/* const pointer - o.k. */
(*key_up).sem_on = 0;/* alternate expression - o.k. */
}/*---------end of file------------------------------*/
The workaround you can see is to substitute the specific pointers. WoRo #cxstm8 #cxstm82012-10-11 01:46 AM
2012-10-11 11:30 PM
Hi Luca,
thanks first for your well-known promt reply. I'll append the list file to this posting. The compiler command line is:cxstm8 +mods0 +debug -pxp -no -pp -l -duC_MMI -dUART_SCI -iuc_mmi\include -iinclude $(ToolsetIncOpts) -cl$(IntermPath) -co$(IntermPath) $(InputFile)
Hope it will help solving the problem.
Best Regards, WoRo ________________ Attachments : cxstm8_bug_2012-10-11.ls : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzO9&d=%2Fa%2F0X0000000bL0%2FgFzizlQa6S.Qy6uZor1dKZlLOIqTkjO06F4CQ3MLCZc&asPdf=false