AnsweredAssumed Answered

ADSP-21371 program memory corruption

Question asked by AlessandroFARO on Jun 26, 2018
Latest reply on Jul 12, 2018 by Jithul_Janardhanan

Hi, my name is Alessandro and I'm new in this community. I have a very strange issue in the development of a 21371 firmware for a CNC machine. Recently I made an apparently innocuous change in a C source file by adding a new "case" in a switch statement. The debug through ICE-1000 went good both in debug and release configurations so I moved to the LDR generation and the final programming of the firmware in flash memory (SPI flash). After the chip reset, the firmware loads correctly but the program image in memory is corrupted from a certain address. In particular the "main" function is corrupted as well so the machine do not starts.

 

I did a lot of tests to find the cause of the issue:

- The DXE file seems good as the program runs ok if loaded by the emulator

- I checked the content of the flash memory: it is correct and corresponds with the loaded LDR

- I found the address in program memory where the corruption starts and the corresponding position in the LDR file and in DXE. 

 

Memory dump of working program

(DXE loaded from emulator)

Memory dump of corrupt program

(booted from flash)

...

[0020AAA0] 0x5FFEB1800000
[0020AAA1] 0x1002002A0C1B
[0020AAA2] 0x0F0100000043
[0020AAA3] 0x013E0000A021
[0020AAA4] 0x072000000004
[0020AAA5] 0x0F1400000005
---------------------------------------
[0020AAA6] 0x1114002AB8AD
[0020AAA7] 0x073E00000001
[0020AAA8] 0x073E00000001
[0020AAA9] 0x073E0000070F
[0020AAAA] 0x1000000E0BDE
[0020AAAB] 0x013E000CA000
[0020AAAC] 0x1004000E0BBD
[0020AAAD] 0x013E00130804
[0020AAAE] 0xAD08FFFFFFBC

...

...

[0020AAA0] 0x5FFEB180000
[0020AAA1] 0x1002002A0C1
[0020AAA2] 0x0F0100000043
[0020AAA3] 0x013E0000A02
[0020AAA4] 0x072000000004
[0020AAA5] 0x0F1400000005
<<< diffences start here and propagate to the rest of memory
[0020AAA6] 0x0001002AB8AD
[0020AAA7] 0x0001073E0000
[0020AAA8] 0x070F073E0000
[0020AAA9] 0x0BDE073E0000

[0020AAAA] 0xA0001000000E
[0020AAAB] 0x0BBD013E000C
[0020AAAC] 0x08041004000E
[0020AAAD] 0xFFBC013E0013
[0020AAAE] 0x0080AD08FFFF

...

It seems to me some sort of misalingment of the instruction codes as highlighted with colors.

 

Last but not the least, I found that the address where this starts is part of the "switch-case" statement code

I dont't know where to start to look for the issue. If I change the "case" value (for example from "case 215:" to "case 216:") the DXE content changes significantly (and also the position of routines in memory) and the problem disappears.

 

Any idea?

Outcomes