Assembly syntax for Tc2xx Tricore

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

cross mob
DuongBui
Level 1
Level 1
First question asked Welcome!

Hi guys,

I am currently working with the TC275 tricore chip, and am exploring the startup code taken from the example on Hightec free tricore entry toolchain. I'm wondering about the effect of square brackets in assembly statements. As I worked with ARM core before, when square brackets are surrounded by a register, it means a reference to the value that the address of that register is storing.

But for Tricore, for example with LEA instruction: "lea %a14, [%a14]lo:__crt0_config". This instruction means something like taking the low 16 bit value of the __crt0_config function address plus the low 16 bit value available in register a14 and then assigning it to the low 16 bit in register a14.

I refer to the documentation in the userguide of Hightec free tricore entry toolchain and it says: 

Indirection:  If an operand (register or constant) is used to access memory indirectly, you may, at your option, wrap it in square brackets (e.g. ’[r4]’). This is completely in compliance with the specification mentioned above; however, there are no options which let you specify if the use of such indirection specifiers (read: square brackets) is illegal, optional, or mandatory. This means you can’t change the default, which is ”optional”. Of course, if you use indirection specifiers at places where they’re not allowed, you’ll get an error message, which again is compliant with the Assembler Mnemonics Specification. 

In addition to the lea instruction, there are also ld.w and st.w instruction that also use square brackets (but the mov command does not). I think this is related to addressing mode.

Please help me understand the problem.

Thanks!!!

0 Likes
1 Solution
µC_Wrangler
Employee
Employee
50 solutions authored 100 sign-ins 25 likes received

It might be better to look at TriCore Architecture Manual volume 2, which describes every instruction.  In this case, it says for this form of LEA:


EA = A[b] + sign_ext(off16);

A[a] = EA[31:0];

In other words: set A14 to the lower 16 bits of crt0_config's address plus A14.

View solution in original post

0 Likes
1 Reply
µC_Wrangler
Employee
Employee
50 solutions authored 100 sign-ins 25 likes received

It might be better to look at TriCore Architecture Manual volume 2, which describes every instruction.  In this case, it says for this form of LEA:


EA = A[b] + sign_ext(off16);

A[a] = EA[31:0];

In other words: set A14 to the lower 16 bits of crt0_config's address plus A14.

0 Likes