avra
avra copied to clipboard
Add preprocessor macros
Add initial implementation of AVRASM2 style preprocessor macros. It is not yet a full implementation. However it does support the following.
.device atmega328p
#define EIGHT (1 << 3)
#define SQR(X) ((X)*(X))
ldi r16, EIGHT
ldi r16, SQR(4)
#define FOOBAR subi
#define IMMED(X) X##i
#define SUBI(X,Y) X ## Y
IMMED(ld) r16, 1
SUBI(FOO, BAR) r16, 1
IMMED(ld) r16, SQR(SQR(1+1))
Regression test provided, all passing.
cd tests/regression && ./runtests.sh
Testing p36-invalid-inequality-operator
PASSED
Testing pr16
PASSED
Testing pr31
HEX file ok
EEPROM file ok
PASSED
Testing pr36-invalid-equality-operator
PASSED
Testing pr36-valid-binary-operators
HEX file ok
EEPROM file ok
PASSED
Testing preprocessor-macros
HEX file ok
No expected EEPROM file found
PASSED
Testing test1
HEX file ok
EEPROM file ok
PASSED
Testing test2
HEX file ok
EEPROM file ok
PASSED
8 tests, 0 failed