how to get the size of a C global array into an assembly program written for the avr architecture co

Posted by johannes on Stack Overflow See other posts from Stack Overflow or by johannes
Published on 2010-02-01T15:40:24Z Indexed on 2010/04/04 23:33 UTC
Read the original article Hit count: 283

Filed under:
|
|
|
|

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?

© Stack Overflow or respective owner

Related posts about assembly

Related posts about avr