Hi,
Simple question, but very hard to find answer, maybe somebody here knows:
I want to create a simple macro like I can in C:
#define ALIGN_UP(addr, align) (((addr) + (align) - 1) & ~((align) - 1))
I've tried:
MACRO ALIGN_UP $addr,$align ((($addr) + ($align) - 1) & ~(($align) - 1)) MEND
but this doesn't work:
MYVAR EQU ALIGN_UP(768, 1024)
I get "error A2173: syntax error in expression".
I've also tried:
MACRO ALIGN_UP $var,$addr,$align $var EQU ((($addr) + ($align) - 1) & ~(($align) - 1)) MEND
But this also doesn't work:
ALIGN_UP(MYVAR, 768, 1024)
I get "error A2007: wrong operand type for '-'"
In the examples above I use numbers, but of course what I want to accomplish is like this:
IMAGE_BOOT_BOOTIMAGE_START_OFFSET EQU ALIGN_UP(IMAGE_BOOT_BOOTIMAGE_CSF_OFFSET+IMAGE_BOOT_BOOTIMAGE_CSF_SIZE, 1024)
This of course works just fine:
IMAGE_BOOT_BOOTIMAGE_START_OFFSET EQU (((IMAGE_BOOT_BOOTIMAGE_CSF_OFFSET+IMAGE_BOOT_BOOTIMAGE_CSF_SIZE) + (1024 - 1)) & ~(1024 - 1))
But it's a maintenance nightmare.
Surely using macros like this must be possible in ARM assembly?