how to get the size of a C global array into an assembly program written for the avr architecture co
- by johannes
I have a .c file with the following
uint8_t buffer[32]
I have a .S file where I want to do the following
cpi r29, buffer+sizeof(buffer)
The second argument for cpi muste be an imidiate value not a location.
But unfortunetly sizeof() is a c operator.
Both files, are getting compiled to seperate object files and linked afterwards.
If I do avr-objdump -x file.c. Amongst other things, I get the size of the buffer. So it is already available in the object file.
How do I access the size of the buffer in my assembly file at compile time?