Forums - Declaring largish arrays causes the hexagonn run-time image to crash (return -1) or worse, lock up the embedded system!

7 posts / 0 new
Last post
Declaring largish arrays causes the hexagonn run-time image to crash (return -1) or worse, lock up the embedded system!
david.beard
Join Date: 16 Jun 14
Posts: 11
Posted: Mon, 2014-08-25 10:05

Declaring largish arrays causes the hexagonn run-time image to crash (return -1) or worse, lock up the embedded system!

Q1. Are there any known issues re the Windows hexagon SDK re declaration of large arrays on the hexagon (in c)

Q2. Is this expected behaviour due to hexagon (QDSP6V5) architectural limitations?

 

For example, add the highlighted code, following, to ...\examples\common\calculator\src\calculator_imp.c:

int int_array[0xA000]; // Note int is 32-bits

 

int calculator_sum(const int* vec, int vecLen, int64* res) {
 
   int ii = 0;
   *res = 0;
 
   for(ii = 0; ii < vecLen; ++ii) {
      *res = *res + vec[ii];
   }
 
   for (uint32 index = 0; index < sizeof(int_array)/sizeof(int); index++) {
      *res += int_array[index];
   }
 
   FARF(HIGH, "===============     DSP: sum result %lld ===============", *res);
   return 0;
}
 
 
Then perfrom (assumes signature set, etc):
 
make tree V=hexagonv5_Debug_dynamic
make tree V=android_Debug
adb root
adb wait-for-device
adb remount
adb push "android_Debug\\calculator" "//data//"
adb shell chmod 777 "//data//calculator"
adb push "android_Debug\\libcalculator.so" "//system//lib"
adb shell mkdir -p "//system//lib//rfsa"
adb shell mkdir -p "//system/lib//rfsa//adsp"
adb push "hexagonv5_Debug_dynamic\\libcalculator_skel.so" "//system//lib//rfsa//adsp"
adb shell "//data//calculator 22 0 0 0 1000"
 
Result:
 
- starting calculator test
- allocate 4000 bytes from heapid 22 with flags 0x0
- creating sequence of numbers from 0 to 999
- compute sum on the aDSP
Error: compute on aDSP failed
 

System: DragonBoard APQ8074

Hexagon SDK 1.1.0 on WinXp (hexagon-cpp (Sourcery QuIC Lite 5.0-432) 4.4.0)

 

  • Up0
  • Down0
david.beard
Join Date: 16 Jun 14
Posts: 11
Posted: Fri, 2014-08-29 07:41

Update.

I've updated to SDK 1.2.2 and the problem still occurs for Release and Debug buillds. Now the APQ8074 dragonboard no longer locks up when the hexagon app dies, which is a little less frustrating....

 
Here's an extract from the map file (libcalculator_skel.so.map) when defining int int_array[0x97A0]. Perhaps this is a clue?
 
...
*(COMMON)
 COMMON         0x00004180    0x25e80 hexagon_Debug_dynamic/calculator_imp.o
                0x00004180                int_array
                0x0002a000                . = ALIGN ((. != 0x0)?0x40:0x1)
                0x0002a000                . = ALIGN (0x40)
                0x0002a000                _end = .
                0x0002a000                . = ALIGN (DEFINED (DATAALIGN)?(DATAALIGN * 0x400):0x1000)
                0x0002a000                . = ALIGN (0x40)
 
.sdata          0x0002a000        0x0

 

                0x0002a000                PROVIDE (_SDA_BASE_, .)
...
 
 
Increasing the array by 1 element causes it to fail at run-time: int int_array[0x97A1]:
 
....
*(COMMON)
 COMMON         0x00004180    0x25e84 hexagon_Debug_dynamic/calculator_imp.o
                0x00004180                int_array
                0x0002a040                . = ALIGN ((. != 0x0)?0x40:0x1)
 *fill*         0x0002a004       0x3c 00
                0x0002a040                . = ALIGN (0x40)
                0x0002a040                _end = .
                0x0002b000                . = ALIGN (DEFINED (DATAALIGN)?(DATAALIGN * 0x400):0x1000)
                0x0002b000                . = ALIGN (0x40)
 
.sdata          0x0002b000        0x0
                0x0002b000                PROVIDE (_SDA_BASE_, .)
....
 
Here's modified calculator app failing...
---- Run Calculator Example on aDSP ----
adb shell "//data//calculator 22 0 0 0 1000"
 
- starting calculator test
- allocate 4000 bytes from heapid 22 with flags 0x0
- creating sequence of numbers from 0 to 999
- compute sum on the aDSP
Error: compute on aDSP failed
 
>>>>> Q. I've not updated the dragonboard firmware. Should I?
 
David.frustrated
 
 
  • Up0
  • Down0
Mr.32
Join Date: 31 Jul 14
Posts: 1
Posted: Mon, 2014-09-01 23:33

 

 

Have you solved this? I am facing same problem.

Please guide me.

  • Up0
  • Down0
david.beard
Join Date: 16 Jun 14
Posts: 11
Posted: Tue, 2014-09-02 05:09

Hi Mr.32,

I've upgraded to SDK 1.2.2. It does not solve the problem.

 

  • Up0
  • Down0
david.beard
Join Date: 16 Jun 14
Posts: 11
Posted: Tue, 2014-09-02 05:54

UPDATE: Modified calculator app still fails using SDK 1.2.2.

Here's how to replicate the problem:

Above code (modified calculator app) works (for me) with:

int int_array[0x9FA0];

Map file (libcalculator_skel.so.map) extarct:

...
*(COMMON)
 COMMON         0x00004180    0x27e80 hexagon_Release_dynamic/calculator_imp.o
                0x00004180                int_array
                0x0002c000                . = ALIGN ((. != 0x0)?0x40:0x1)
                0x0002c000                . = ALIGN (0x40)
                0x0002c000                _end = .
                0x0002c000                . = ALIGN (DEFINED (DATAALIGN)?(DATAALIGN * 0x400):0x1000)
                0x0002c000                . = ALIGN (0x40)
 
.sdata          0x0002c000        0x0
                0x0002c000                PROVIDE (_SDA_BASE_, .)
...
 
 
Increase array size by 1 word -> Code FAILS:

 

int int_array[0x9FA1];

 

---- Run Calculator Example Locally on Android ----
 
- starting calculator test
- allocate 4000 bytes from heapid 22 with flags 0x0
- creating sequence of numbers from 0 to 999
- compute sum locally
- sum = 499500
success
 
---- Run Calculator Example on aDSP ----
adb shell "//data//calculator 22 0 0 0 1000"
 
- starting calculator test
- allocate 4000 bytes from heapid 22 with flags 0x0
- creating sequence of numbers from 0 to 999
- compute sum on the aDSP
Error: compute on aDSP failed
 
 

Map file extract (note *fill):

...
*(COMMON)
 COMMON         0x00004180    0x27e84 hexagon_Release_dynamic/calculator_imp.o
                0x00004180                int_array
                0x0002c040                . = ALIGN ((. != 0x0)?0x40:0x1)
 *fill*         0x0002c004       0x3c 00
                0x0002c040                . = ALIGN (0x40)
                0x0002c040                _end = .
                0x0002d000                . = ALIGN (DEFINED (DATAALIGN)?(DATAALIGN * 0x400):0x1000)
                0x0002d000                . = ALIGN (0x40)
 
.sdata          0x0002d000        0x0
                0x0002d000                PROVIDE (_SDA_BASE_, .)
...
 
 
NB: This is using Release flavor. Debug fails, too, but array size is different.
 
Qualcomm hexagon tools division please investigate this issue!!
 
I'm using APQ8074 dragonbaord with original aDSP firmware. 
Q. Should I update the firmware, etc?
If so, how?
 
Thanks
David
 
 
 
 
 
 

 

 

 

 

 

  • Up0
  • Down0
david.beard
Join Date: 16 Jun 14
Posts: 11
Posted: Tue, 2014-09-02 05:55

I've posted details re testing with SDK 1.2.2.

Due to lengthy post it needs approval....

 

  • Up0
  • Down0
david.beard
Join Date: 16 Jun 14
Posts: 11
Posted: Tue, 2014-09-02 05:57
UPDATE: Modified calculator app still fails using SDK 1.2.2.
 
Here's how to replicate the problem:
 
Above code (modified calculator app) works with:
 
int int_array[0x9FA0];
 
Map file (libcalculator_skel.so.map) extract:
 
...
*(COMMON)
 COMMON         0x00004180    0x27e80 hexagon_Release_dynamic/calculator_imp.o
                0x00004180                int_array
                0x0002c000                . = ALIGN ((. != 0x0)?0x40:0x1)
                0x0002c000                . = ALIGN (0x40)
                0x0002c000                _end = .
                0x0002c000                . = ALIGN (DEFINED (DATAALIGN)?(DATAALIGN * 0x400):0x1000)
                0x0002c000                . = ALIGN (0x40)
 
.sdata          0x0002c000        0x0
                0x0002c000                PROVIDE (_SDA_BASE_, .)
...
 
 
Increase array size by 1 word -> Code FAILS:
 
 
int int_array[0x9FA1];
 
 
 
---- Run Calculator Example Locally on Android ----
 
- starting calculator test
- allocate 4000 bytes from heapid 22 with flags 0x0
- creating sequence of numbers from 0 to 999
- compute sum locally
- sum = 499500
- success
 
---- Run Calculator Example on aDSP ----
adb shell "//data//calculator 22 0 0 0 1000"
 
- starting calculator test
- allocate 4000 bytes from heapid 22 with flags 0x0
- creating sequence of numbers from 0 to 999
- compute sum on the aDSP
Error: compute on aDSP failed
 
 
Map file extract (note *fill):
 
...
*(COMMON)
 COMMON         0x00004180    0x27e84 hexagon_Release_dynamic/calculator_imp.o
                0x00004180                int_array
                0x0002c040                . = ALIGN ((. != 0x0)?0x40:0x1)
 *fill*         0x0002c004       0x3c 00
                0x0002c040                . = ALIGN (0x40)
                0x0002c040                _end = .
                0x0002d000                . = ALIGN (DEFINED (DATAALIGN)?(DATAALIGN * 0x400):0x1000)
                0x0002d000                . = ALIGN (0x40)
 
.sdata          0x0002d000        0x0
                0x0002d000                PROVIDE (_SDA_BASE_, .)
...
 
 
NB: This is using Release flavor. Debug fails, too, but array size is different.
 
Qualcomm hexagon tools division please investigate this issue!!
 
I'm using APQ8074 dragonbaord with original aDSP firmware.
Q. Should I update the firmware, etc?
If so, how?
 
Thanks
David
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.