AURIX TC27x, Asm grammar question

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User19956
Level 1
Level 1
hi everyone.
i want to use "store" instruction using __asm__

Here are some codes.

unsigned int AddrVal =0x70000010;
unsigned int DataVal = 0x5;

__asm__("st.w 0x70000010," :: "d" (DataVal));


I want to store DataVal(5) to AddrVal but not using number 0x70000010.

How can i change it to variable?
__asm__("st.w AddrVal(?)," :: "d" (DataVal));

Thank you for reading.
0 Likes
3 Replies
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored
Please check this:
__asm__("st.w [%0],%1," ::"a" (AddrVal), "d" (DataVal));
0 Likes
User19956
Level 1
Level 1
Thanks, Now I have a problem with something else.
I want to write data to A11(Return Address) and i don't know how to using asm grammar.
I tried below already but it doesn't work.

unsigned int curr_pc = 0x1;
__asm__("mov.a a11,%1" :"a11" :: "d" (curr_pc));

Thank you for reading.
0 Likes
MoD
Employee
Employee
50 likes received 500 replies posted 100 solutions authored
You must use %0 instead of %1 in your case. Please note the 0x1 is not a valid value for PC.
0 Likes