Apr 01, 2020
06:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 01, 2020
06:36 AM
Hi,
I'm using the hightec compiler, and I'm seeing the following:

For addind a value, the compiler adds a shift left of 3.... why is that?
this causes the value of offset to be larger than I intend it to be.
I'm using the hightec compiler, and I'm seeing the following:
For addind a value, the compiler adds a shift left of 3.... why is that?
offset = (j<<5);
0x80000C2E 19 EF FC FF LD.W d15,[a14]-0x4
0x80000C32 06 5F SH d15,0x5
0x80000C34 53 1F 40 20 MUL.U e2,d15,0x1
0x80000C38 89 E2 68 F9 ST.D [a14]-0x18,e2
offset += destLoc;
0x80000C3C 19 EF E8 FF LD.W d15,[a14]-0x18
0x80000C40 06 3F SH d15,0x3
0x80000C42 19 E2 F4 FF LD.W d2,[a14]-0xC
0x80000C46 42 2F ADD d15,d2
0x80000C48 0B F0 00 28 MOV e2,d15
0x80000C4C 89 E2 68 F9 ST.D [a14]-0x18,e2
this causes the value of offset to be larger than I intend it to be.
- Tags:
- IFX
5 Replies
Apr 01, 2020
08:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 01, 2020
08:27 AM
Can you include more code here - how are offset and destLoc declared?
Apr 01, 2020
10:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 01, 2020
10:54 AM
Hi,
The code:
The code:
uint16 password = IfxScuWdt_getSafetyWatchdogPassword();
uint32 j = 0, i=0;
uint64 *dst;
uint64 *destLoc = 0;
volatile uint32 delay = 0;
uint32 offset = 0;
if (((((uint32)dest & 0xff000000) == 0xa0000000) || ((uint32)dest & 0xff000000) == 0x80000000)) // program flash
{
destLoc = (uint64 *) (0xa0000000 | (uint32)dest);
}
else if (((uint32)dest & 0xff000000) == 0xaf000000) // data flash
{
destLoc = (uint64 *) (0xaf000000 | (uint32)dest);
}
for (j= 0; j < size/0x20; j++)
{
IfxFlash_clearStatus(0);
offset = (j<<5);
offset += destLoc;
Apr 01, 2020
12:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 01, 2020
12:03 PM
Why use uint64? The AURIX only supports a 32-bit address space.
I'd use an explicit typecast for the line offset += destLoc:
I'd use an explicit typecast for the line offset += destLoc:
offset += (uint32) destLoc;
Apr 02, 2020
12:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 02, 2020
12:43 AM
Thought about it, but dn't understand why does it matter.
works anyway.
works anyway.
Apr 02, 2020
01:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 02, 2020
01:08 AM
This comes from the pointer arithmetic:
pointer 64 bit -> right shift 3
pointer 32 bit -> right shift 2
pointer 16 bit -> right shift 1
pointer 8 bit -> right shift 0
pointer 64 bit -> right shift 3
pointer 32 bit -> right shift 2
pointer 16 bit -> right shift 1
pointer 8 bit -> right shift 0
This widget could not be displayed.