This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Addressing functions in avr-as


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello list,

I'm unsure if this is the correct list, if not please hint me to the
right place.

I have some trouble with macros on avr-as. Let's say I have the
following code:


.macro mangleAddress addr
	ldi r16, ((\addr) & 0x0000ff) >> 0
	ldi r17, ((\addr) & 0x00ff00) >> 8
	ldi r18, ((\addr) & 0xff0000) >> 16
.endm

Then I'm able to use it in the following fashion:

mangleAddress 123456

Which results in the expected:

0:       00 e4           ldi     r16, 0x40       ; 64
2:       12 ee           ldi     r17, 0xE2       ; 226
4:       21 e0           ldi     r18, 0x01       ; 1

Also, this works, too (compiles and links fine):

jmp foobar

However, what does not is

mangeAddress foobar

Where I'd like the linker to resolve the address and then enter them
into the macro as above. How can I achieve something like that?

Kind regards,
Johannes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwPj8IACgkQN7zEVXrmOiOIiwCfd0MMRi75bjaQITWQdWGswNxL
Jv8AoKNxCZ4Oidz4OuZtkh5MdGKDkZXx
=iT8J
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]