SYSTEM.LNK Issue

Report any suspected bugs that you find
Locked
Helpdesk
Posts: 35
Joined: Sat Jan 01, 2011 5:43 am
Contact:

SYSTEM.LNK Issue

Post by Helpdesk » Mon Dec 11, 2023 8:21 pm

Incorrect code is generated when SYSTEM.SP is used as a parameter to BITS e.g.

Code: Select all

  IF 2 IN BITS(SYSTEM.SP) THEN
.     8     08H  02004H          movs     r0,#4
.    10     0AH  04201H          tst      r1,r0
.    12     0CH  0468DH          mov      sp,r1
it should be something like:

Code: Select all

  IF 2 IN BITS(SYSTEM.SP) THEN
.     8     08H  04668H          mov      r0,sp
.    10     0AH  02104H          movs     r1,#4
.    12     0CH  04208H          tst      r0,r1

cfbsoftware
Site Admin
Posts: 497
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Re: SYSTEM.LNK Issue

Post by cfbsoftware » Mon Dec 11, 2023 8:28 pm

Investigations so far indicate that the problem applies to:

a) SYSTEM.SP and SYSTEM.PC as well as SYSTEM.LNK

b) Built-in functions other than BITS e.g. SYSTEM.VAL, ODD etc. etc.

c) It is only a problem in Astrobe for Cortex-M0, and does not occur in Astrobe for Cortex-M3, M4 and M7.

We will aim to have a fix in the next maintenance release of Astrobe for Cortex-M0. In the meantime a workaround to all of these problems is to store the value in a variable before attempting to use it. E.g.

Code: Select all

  lnkv := SYSTEM.LNK;
  IF 2 IN BITS(lnkv) THEN ...

Locked