The following code doesn't compile for the AVR target (FPC 38288):
program macrotest;
begin
asm
{$ifdef FPC_SRAMSIZE}
sts FPC_SRAMSIZE , r31 // macrotest.pp(5,9) Error: Unknown identifier
"FPC_SRAMSIZE"
{$endif}
end;
end.
Is the use of macros in assembler blocks allowed?
(Compiled with: ~/fpc/3.1.1/compiler/avr/pp -Wpattiny13 -Sgm macrotest.pp)
Clearly the ifdef check passed so FPC_SRAMSIZE is defined, however when the
macro is used FPC
doesn't recognize it. If the macro reference is moved outside the asm block to
a const then it
works as expected (to some degree, there is another problem unrelated to the
use of a macro).
This code compiles as expected:
program macrotest;
const
sramSize = FPC_SRAMSIZE;
begin
asm
sts sramSize , r31
end;
end.
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal