It seems you can only use hard-coded values in a MEMORY command.
Why can't you use scripts ike:
EXT_RAM_START = ...
EXT_RAM_SIZE = ......
MEMORY
{
ext_ram: ORIGIN = EXT_RAM_START, LENGTH = EXT_RAM_SIZE
}
This can make things a lot easier...