Page 1 of 1

SYSTEM.LNK Issue

Posted: Mon Dec 11, 2023 8:21 pm
by Helpdesk
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

Re: SYSTEM.LNK Issue

Posted: Mon Dec 11, 2023 8:28 pm
by cfbsoftware
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 ...