NEON statement throws exception in Windows CE 7

I am happy to ask questions in the stack overflow due to the quick response of experts around the world :-) I want to clearly explain the problem that I encountered.

What do I want to do?

My environment

  • I am compiling a NEON instruction set in Visual Studio 2008 with Platform Builder for Windows CE 7.0. The latest platform designer supports the assembly of NEON commands.
  • I run my code on the OMAP3530 Mistral EVM board.
  • I created a simple static library (NEONLIB.lib) that contains NEON instructions to perform the required operation. I created a simple Stream driver (stream_interface.dll) that uses this static library to perform the memcpy operation in the 1280X720X2 byte buffer. I load and unload this driver dynamically using a simple application (Neon_Test.exe).

Problem i am facing

  • Once the OS boots up, I launch this application manually and follow the exception I get.

Exception "Data Abort" (0x4): Thread-Id = 047d002a (pth = c049c990), Proc-Id = 00400002 (pprc = 8a3425e0) 'NK.EXE', VM-active = 05420012 (pprc = c04a1344) 'Neon_Test.exe "PID: 00400002 TID: 047D002A PC = ef135120 (stream_interface.dll + 0x00005120) RA = ef133c18 (stream_interface.dll + 0x00003c18) SP = d0f3fc84, BVA = 00000000

NeonMemcpy works in my driver, which calls the NEON function.

File Stream_Interface.map

.... 0001:000029f0 ?NeonInit@ @YAHXZ 100039f0 f Neon_Process.obj 0001:00002bb4 ?NeonMemcpy@ @YAXXZ 10003bb4 f Neon_Process.obj 0001:00002c58 NKDbgPrintfW 10003c58 f coredll:COREDLL.dll 0001:00002c68 SetLastError 10003c68 f coredll:COREDLL.dll .... 

File Neon_Process.cod

 ....... ; 108 : MemcpyCustom((void*)g_pOUTVirtualAddr, (void*)g_pINPVirtualAddr, 1280 * 720 * 2); 00050 e5951000 ldr r1,[r5] 00054 e1a04000 mov r4,r0 00058 e5950004 ldr r0,[r5,#4] 0005c e3a02ae1 mov r2,#0xE1000 00060 eb000000 bl MemcpyCustom ; 109 : RETAILMSG(1, (L"Time for Copy using Neon %d\r\n", GetTickCount() - dwStartTime)); 00064 eb000000 bl GetTickCount 00068 e1a03000 mov r3,r0 ....... 

My build source

 AREA omap_neoncoding, CODE, READONLY EXPORT MemcpyCustom INCLUDE omap_neoncoding.inc MemcpyCustom stmfd sp!, {r4-r12,lr} NEONCopyPLD PLD [r1, #0xC0] VLDM r1!,{d0-d7} VSTM r0!,{d0-d7} SUBS r2,r2,#0x40 BGE NEONCopyPLD END 

Based on an article by Bruce Eitman, http://geekswithblogs.net/BruceEitman/archive/2008/05/19/windows-ce--finding-the-cause-of-a-data-abort.aspx , where the exception occurred , It was

 00064 eb000000 bl GetTickCount 

But I'm sure there is no problem in GetTickCount (), if I remove the MemcpyCustom function, everything will be fine. Hope I have given all the information to help sort this out. Please help me find out the exact reason for the exception. Do I need to take any steps before calling neon functions or any other special neon instructions?

Thanks in advance for your help.

Spark

+4
source share
1 answer

You enter registers in the prologue function:

 stmfd sp!, {r4-r12,lr} 

But in the end there is no corresponding pop, and no return command. Thus, execution continues to what code will be after the function, and what happens next is all guessed. The following, installed after BGE, should fix the problem:

 ldmfd sp!, {r4-r12,pc} 

EDIT: By the way, since you are not actually using r4-r12 in a function, you do not need to save them. You also do not need to save d0-d7, as they are considered volatile. Therefore, you can remove stmfd and replace ldmfd with just bx lr .

 MemcpyCustom PLD [r1, #0xC0] VLDM r1!,{d0-d7} VSTM r0!,{d0-d7} SUBS r2,r2,#0x40 BGE MemcpyCustom BX lr 
+5
source

All Articles