Aurix TriCore simulator problem

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

cross mob
Not applicable
Hello everyone,

I have problem and I hope you can help me. I'm testing software using Aurix simulator and I don't understand one thing, below I have presented example:

I have a preprocessor constant (define) which is defined as follow: Function(a,b,c) Conut(a,b,c). Sub elements a,b,c have values as below:

a = 0x07
b = 0x02
c = 0x04

I need to compute a simple equation (look below) but there is a problem. When I compute this manually I get 0x00070204, but when I look into debuger I have value 0x0007020F. How it's possible to get F at end ? Perhaps this is a problem with simulator configuration. Please help. Values a,b,c are always the same (they are defines).

(((a&0xFFFF) << 16) | ((b&0xFF)) << 😎 | c&0xFF
0 Likes
8 Replies
µC_Wrangler
Employee
Employee
50 solutions authored 100 sign-ins 25 likes received
mib86 wrote:
I have problem and I hope you can help me. I'm testing software using Aurix simulator and I don't understand one thing, below I have presented example:

I have a preprocessor constant (define) which is defined as follow: Function(a,b,c) Conut(a,b,c). Sub elements a,b,c have values as below:

a = 0x07
b = 0x02
c = 0x04

I need to compute a simple equation (look below) but there is a problem. When I compute this manually I get 0x00070204, but when I look into debuger I have value 0x0007020F. How it's possible to get F at end ? Perhaps this is a problem with simulator configuration. Please help. Values a,b,c are always the same (they are defines).

(((a&0xFFFF) << 16) | ((b&0xFF)) << 😎 | c&0xFF

Looks like some parentheses are mismatched, and some are missing. Try this instead:

((a&0xFFFF) << 16) | ((b&0xFF) << 😎 | (c&0xFF)

If there's still trouble, post the full macro definition.
0 Likes
Not applicable
@Neal Manson Perhaps I forgot to write them because I have this code in work but I will check it tommorow because there can be error in source code and brackets can make error. I didn't write this code I need to make unit tests in TESSY for this code. In addition do you think that such mistakes can be from wrong simulator configuration ? Or something else or I need to look mistake only in source code ?
0 Likes
µC_Wrangler
Employee
Employee
50 solutions authored 100 sign-ins 25 likes received
mib86 wrote:
@Neal Manson Perhaps I forgot to write them because I have this code in work but I will check it tommorow because there can be error in source code and brackets can make error. I didn't write this code I need to make unit tests in TESSY for this code. In addition do you think that such mistakes can be from wrong simulator configuration ? Or something else or I need to look mistake only in source code ?

It doesn't sound like anything too complex to throw off the simulator, but let's see the specifics.
0 Likes
Not applicable
Tommorow I will paste exact piece of code because now I can write somehing wrong. I can also upload my configuration if it will be needed
0 Likes
Not applicable
mib86 wrote:
Tommorow I will paste exact piece of code because now I can write somehing wrong. I can also upload my configuration if it will be needed


Below I pasted original code

#define ERROR_CODE(TTID, GRP, EID)  ( (Sl_TstRsltType)(((((uint32)TTID) & (uint32)0xFFFF) << 16U) | ((((uint32)GRP)  & (uint32)0xFF)   <<  8U) | ((((uint32)EID)  & (uint32)0xFF))) )


TTID = 0x07
GRP = 0x02
EID = 0x04

Sl_TstRsltType is a unsigned long type. I'm doing tests on 64 bit unit.
0 Likes
µC_Wrangler
Employee
Employee
50 solutions authored 100 sign-ins 25 likes received
Works fine for me with Tasking v4.3r3 - that is, x is 0x070204:
x = ERROR_CODE( 7, 2, 4 );


Using Debug Target Configuration:
Target: TriCore 1.6.X Instruction Set Simulator - Production Device
Selected CPU type: tc23x
Register file: C:/Program Files/TASKING/TriCore v4.3r3/ctc/include/sfr/regtc23x.sfr
Communication: TSIM1 Simulator
Debug Instrument Module: tsim16p_e
Using Java Link Version 1.119
Starting Debugger...
TASKING VX-toolset for TriCore: debugger, Build 239.2.13
Copyright 2006-2014 Altium BV

Launching configuration: sim
Loading application "C:\Users\manson\workspace_ctc_v4.3r1\sim\Debug\sim.elf"...

Could you show how you're actually invoking the macro?
0 Likes
Not applicable
Neal Manson wrote:
Works fine for me with Tasking v4.3r3 - that is, x is 0x070204:



Could you show how you're actually invoking the macro?


I'm using it in that way
TRAPTST_SMU_CLRALMSTSERR = ERROR_CODE((Sl_ErrorTstTypeIdType)TRAP_TESTTYPE_ID, ERROR_GRP_SMU, EID_CLRALMSTSERR)


I'm using TASKING VX-toolset for TriCore v4.2r2. Perhaps you have newer version and I need backup. I get same value as you but when I'm making unit tests in TESSY after code execution I recieve 0x07020F 😞
0 Likes
µC_Wrangler
Employee
Employee
50 solutions authored 100 sign-ins 25 likes received
mib86 wrote:
I'm using it in that way
TRAPTST_SMU_CLRALMSTSERR = ERROR_CODE((Sl_ErrorTstTypeIdType)TRAP_TESTTYPE_ID, ERROR_GRP_SMU, EID_CLRALMSTSERR)


I'm using TASKING VX-toolset for TriCore v4.2r2. Perhaps you have newer version and I need backup. I get same value as you but when I'm making unit tests in TESSY after code execution I recieve 0x07020F 😞

I doubt the simulator has changed in a long time.

Your example doesn't tell the whole story though - can you include all of the declarations and definitions necessary for the single line of code you listed to compile?
0 Likes