Taking RISC-V to the next level!

IAR Embedded Workbench for RISC-V now released

Tools for Risc-V

Why is my assembly too complex?

Technical Note 28162



10/30/2015 9:41 AM


This Technical Note discusses a situation that occurs when writing an assembly statement that is too complex. This situation most often occurs when migrating from IAR Embedded Workbench for ARM version 4.x to version 5.x and newer.

The diagnostic

Error[109]: Expression is too complex

.. will be generated for assembler instructions that are to complex.

Please Note that the error message might point to the wrong line. That is, the unsupported expression can be on a line above the line to which the error message points.


Double-click on the error message to see which instruction that generated your error. And search from that line and upwards. The offending instruction need to be rewritten.


It is not possible to have two symbols in one expression, if these two symbols are solved at link-time.

If the symbols in the expression are solved at assembly-time then the expression is not "to complex".

The most complex allowed expression is:
"An expression with 1 symbol and 1 fixed value".


The following source gives the impression of "An expression with 2 symbols".

Stack_Size     EQU   0x00000800   ;; fixed value
Stack_Mem DS8 Stack_Size
Heap_Size EQU 0x00001000 ;; fixed value
Heap_Mem DS8 Heap_Size

LDR R0, = Heap_Mem
LDR R1, = (Stack_Mem + Stack_Size)
LDR R2, = (Heap_Mem + Heap_Size)
LDR R3, = Stack_Mem

The Stack_Size and Heap_Size are resolved at assembly-time, that is, replaced with fixed values. Thus, at link-time, the expressions looks like:

               LDR    R0, = Heap_Mem
LDR R1, = (Stack_Mem + 0x00000800)
LDR R2, = (Heap_Mem + 0x00001000)
LDR R3, = Stack_Mem


All product names are trademarks or registered trademarks of their respective owners.


© IAR Systems 1995-2019 - All rights reserved.

We use cookies on this website to provide you with a better experience. You need to accept cookies to continue using this site. Cookies