ARM support

I am currently trying to use Java TurboActivate on a couple of different ARM-based boards. I was wondering if you had any documentation on ARM and Linux versions support because on one board, it seems to work fine, but on the other, it is failing and outputting an error log:

## A fatal error has been detected by the Java Runtime Environment:## Internal Error (os_linux_zero.cpp:236), pid=1160, tid=1082541168# Error: caught unhandled signal 4## JRE version: 6.0_18-b18# Java VM: OpenJDK Zero VM (14.0-b16 mixed mode linux-arm )# Derivative: IcedTea6 1.8.13# Distribution: Debian GNU/Linux 6.0.5 (squeeze), package 6b18-1.8.13-0+squeeze2# If you would like to submit a bug report, please include# instructions how to reproduce the bug and visit:# http://icedtea.classpath.org/bugzilla# The crash happened outside the Java Virtual Machine in native code.# See problematic frame for where to report the bug.#

There is a full thread trace as well, but I will hold off on including it unless necessary as it is very long. I believe our processor that's causing issues is a Samsung ARM9 v5. Any help would be appreciated, thanks!

An brief search points to the Error: caught unhandled signal 4 meaning a SIGILL which states that some form of illegal or privileged instruction is being called which is being rejected. Hope that helps narrow the issue down.

Below is the system information from the error log as well.

--------------- S Y S T E M ---------------

OS:6.0.6

uname:Linux 3.1.6 #3 PREEMPT Fri Jan 6 13:05:50 MST 2012 armv4tllibc:glibc 2.11.3 NPTL 2.11.3 rlimit: STACK 8192k, CORE 0k, NPROC infinity, NOFILE 1024, AS infinityload average:0.31 0.31 0.21

CPU:total 1

Memory: 4k page, physical 60680k(1544k free), swap 0k(0k free)

vm_info: OpenJDK Zero VM (14.0-b16) for linux-arm JRE (1.6.0_18-b18), built on Jun 29 2012 13:52:12 by "buildd" with gcc 4.4.5

time: Wed Dec 12 22:28:54 2012elapsed time: 12 seconds

After some more searching, I have narrowed down that the crashing is due to the call:TurboActivateNative.INSTANCE.PDetsFromPath(location);

Hopefully that helps. Thanks for any insight into the issue!

Just to make sure this isn't a bug in JNA (the Java library that make calls to native libraries) can you try compiling our example C app to see if that crashes as well. And if the C app does crash, try different functions and tell me exactly which functions fail (and if any succeed -- in the sense that they don't crash).

Thanks for the quick response, Wyatt. Assuming I built the C Example correctly, I am still getting a SIGILL error in the libTurboActivate.so library. Here are the steps I took to build, in case I am doing it wrong.1) Copy Example.c, TurboActivate.h, my TurboActivate.dat, and libTurboActivate.so into a directory.2) Run g++ -o prog -Llib -Wl,-R,'$ORIGIN' Example.c libTurboActivate.so3) Run ./prog4) Output is "Illegal instruction"5) Run gdb prog6) Output is:Program received signal SIGILL, Illegal instruction.0x40039a30 in ?? () from /usr/testing/libTurboActivate.so(gdb) quit

I tried removing bits of the Example.c to get it to try to narrow down the problem call, but I found the only way it would stop erroring would be if I didn't include libTurboActivate.so in my g++ compile call. Not sure where to go from here. Thanks for any advice!

To clarify, removing the .so dependency also meant I had to remove everything from Example.c until all it did was output Hello world.

I tested the C program on our other board, and it is running properly, so I don't think I built it incorrectly. Still not sure how best to debug the .so for you though. Any ideas? Thanks!

I think the problem is likely that we're compiling for a newer version of ARM than your board. Looking at the info you provided it looks like your board only support ARMv4, while the ARM version of TurboActivate is compiled for ARMv7 (i believe, I don't have the ARM board in front of me).

You can quickly verify this by using "readelf"

readelf -A yourapp
readelf -A libTurboActivate.so

Then look at the following lines. They will look something like this for TurboActivate:

  Tag_CPU_name: "7-A"  Tag_CPU_arch: v7

Also, if you could send the full stack trace to wyatt@wyday.com, that would be helpful. Hopefully the failing instruction will be listed (or at least the address of the instruction).

I think this all boils down to ARMv4 vs. ARMv7. I'll see if we can compile TurboActivate with ARMv4 without harming its performance.

Also, is this a board/architecture you'll be realistically targeting for your app? How old is it? Which model is it (CPU model and board/phone model)?

Thanks again for your quick response. I will double check with our hardware guy on the system specs. I must have been mistaken about it. You look to be right though, according to the readelf outputs.

These are my results for readelf -A progAttribute Section: aeabiFile Attributes Tag_CPU_name: "ARM9TDMI" Tag_CPU_arch: v4T Tag_ARM_ISA_use: Yes Tag_THUMB_ISA_use: Thumb-1 Tag_ABI_PCS_wchar_t: 4 Tag_ABI_FP_denormal: Needed Tag_ABI_FP_exceptions: Needed Tag_ABI_FP_number_model: IEEE 754 Tag_ABI_align8_needed: Yes Tag_ABI_align8_preserved: Yes, except leaf SP Tag_ABI_enum_size: int

These are my results for readelf -A libTurboActivate.soAttribute Section: aeabiFile Attributes Tag_CPU_name: "7-A" Tag_CPU_arch: v7 Tag_CPU_arch_profile: Application Tag_ARM_ISA_use: Yes Tag_THUMB_ISA_use: Thumb-2 Tag_VFP_arch: VFPv3-D16 Tag_ABI_PCS_wchar_t: 4 Tag_ABI_FP_denormal: Needed Tag_ABI_FP_exceptions: Needed Tag_ABI_FP_number_model: IEEE 754 Tag_ABI_align8_needed: Yes Tag_ABI_align8_preserved: Yes, except leaf SP Tag_ABI_enum_size: int Tag_ABI_HardFP_use: SP and DP Tag_ABI_optimization_goals: Aggressive Speed Tag_CPU_unaligned_access: v6 Tag_DIV_use: Not allowed

I will try to get you the stacktrace from the Example program. In the meantime, here is the Thread output from the error log that I didn't post before because it was too long. Not sure if it will help.

Current thread (0x0001ec30): JavaThread "main" [_thread_in_native, id=1180, stack(0x407bd000,0x4093c000)]

Stack: [0x407bd000,0x4093c000], sp=0x4087a98c, free space=758kJava frames: 0x4093a6f0: istate->_thread = 0x0001ec30 0x4093a6f4: istate->_bcp = 0x00000000 0x4093a6f8: istate->_locals = 0x4093a73c 0x4093a6fc: istate->_constants = 0x62eee3a0 0x4093a700: istate->_method = 0x62eeab10 0x4093a704: istate->_mdx = 0x4093a6dc 0x4093a708: istate->_stack = 0x00000000 0x4093a70c: istate->_msg = 0x00000000 0x4093a710: istate->_result = 0x4093a6dc 0x4093a714: (istate->_result) = 0x4093a6b8 0x4093a718: (istate->_result) = 0x4093a6dc 0x4093a71c: istate->_prev_link = 0x00000000 0x4093a720: istate->_oop_temp = 0x62eec868 0x4093a724: istate->_stack_base = 0x4093a6f0 0x4093a728: istate->_stack_limit = 0x4093a6ec 0x4093a72c: istate->_monitor_base = 0x4093a6f0 0x4093a730: istate->_self_link = 0x00000000 0x4093a734: frame_type = INTERPRETER_FRAME 0x4093a738: next_frame = 0x4093a788

0x4093a73c: word[19] = 0x42a303b0 0x4093a740: istate->_thread = 0x0001ec30 0x4093a744: istate->_bcp = 0x62f23baa 0x4093a748: istate->_locals = 0x4093a7b0 0x4093a74c: istate->_constants = 0x62f25e70 0x4093a750: istate->_method = 0x62f23da8 0x4093a754: istate->_mdx = 0x0001ec30 0x4093a758: istate->_stack = 0x4093a738 0x4093a75c: istate->_msg = 0x00000000 0x4093a760: istate->_result = 0x629d3548 0x4093a764: (istate->_result) = 0x4093c170 0x4093a768: (istate->_result) = 0x4093a7ac 0x4093a76c: istate->_prev_link = 0x4093a744 0x4093a770: istate->_oop_temp = 0x00000000 0x4093a774: istate->_stack_base = 0x4093a740 0x4093a778: istate->_stack_limit = 0x4093a720 0x4093a77c: istate->_monitor_base = 0x4093a740 0x4093a780: istate->_self_link = 0x00000000 0x4093a784: frame_type = INTERPRETER_FRAME 0x4093a788: next_frame = 0x4093a804

0x4093a78c: word[30] = 0x00000000 0x4093a790: word[29] = 0x00000000 0x4093a794: word[28] = 0x00000000 0x4093a798: word[27] = 0x00000000 0x4093a79c: word[26] = 0x42a303b0 0x4093a7a0: word[25] = 0x00000000 0x4093a7a4: word[24] = 0x00000000 0x4093a7a8: word[23] = 0x4296cae0 0x4093a7ac: word[22] = 0x4296c648 0x4093a7b0: word[21] = 0x42a303b0 0x4093a7b4: word[20] = 0x00000001 0x4093a7b8: word[19] = 0x4296b8f8 0x4093a7bc: istate->_thread = 0x0001ec30 0x4093a7c0: istate->_bcp = 0x62f240ca 0x4093a7c4: istate->_locals = 0x4093a820 0x4093a7c8: istate->_constants = 0x62f25e70 0x4093a7cc: istate->_method = 0x62f241b0 0x4093a7d0: istate->_mdx = 0x4093a780 0x4093a7d4: istate->_stack = 0x4093a7a8 0x4093a7d8: istate->_msg = 0x00000000 0x4093a7dc: istate->_result = 0x00000002 0x4093a7e0: (istate->_result) = 0x4093c140 0x4093a7e4: (istate->_result) = 0x4296bc38 0x4093a7e8: istate->_prev_link = 0x62f26790 0x4093a7ec: istate->_oop_temp = 0x00000000 0x4093a7f0: istate->_stack_base = 0x4093a7b4 0x4093a7f4: istate->_stack_limit = 0x4093a794 0x4093a7f8: istate->_monitor_base = 0x4093a7bc 0x4093a7fc: istate->_self_link = 0x48fbf150 0x4093a800: frame_type = INTERPRETER_FRAME 0x4093a804: next_frame = 0x4093a870

0x4093a808: word[26] = 0x00000000 0x4093a80c: word[25] = 0x00000000 0x4093a810: word[24] = 0x00000000 0x4093a814: word[23] = 0x00000000 0x4093a818: word[22] = 0x4296b8f8 0x4093a81c: word[21] = 0x4296c648 0x4093a820: word[20] = 0x42a303b0 0x4093a824: word[19] = 0x4295f830 0x4093a828: istate->_thread = 0x0001ec30 0x4093a82c: istate->_bcp = 0x62f204e5 0x4093a830: istate->_locals = 0x4093a884 0x4093a834: istate->_constants = 0x62f21058 0x4093a838: istate->_method = 0x62f20578 0x4093a83c: istate->_mdx = 0x4093c140 0x4093a840: istate->_stack = 0x4093a818 0x4093a844: istate->_msg = 0x00000000 0x4093a848: istate->_result = 0x00000000 0x4093a84c: (istate->_result) = 0x4093c140 0x4093a850: (istate->_result) = 0x4093a81c 0x4093a854: istate->_prev_link = 0x4093a7fc 0x4093a858: istate->_oop_temp = 0x00000000 0x4093a85c: istate->_stack_base = 0x4093a828 0x4093a860: istate->_stack_limit = 0x4093a810 0x4093a864: istate->_monitor_base = 0x4093a828 0x4093a868: istate->_self_link = 0x00000000 0x4093a86c: frame_type = INTERPRETER_FRAME 0x4093a870: next_frame = 0x4093a8d4

0x4093a874: word[24] = 0x00000000 0x4093a878: word[23] = 0x4295f8f0 0x4093a87c: word[22] = 0x62edf820 0x4093a880: word[21] = 0x42a303b0 0x4093a884: word[20] = 0x4295f830 0x4093a888: word[19] = 0x4295f830 0x4093a88c: istate->_thread = 0x0001ec30 0x4093a890: istate->_bcp = 0x62ee60a7 0x4093a894: istate->_locals = 0x4093a8ec 0x4093a898: istate->_constants = 0x62eee3a0 0x4093a89c: istate->_method = 0x62ee6128 0x4093a8a0: istate->_mdx = 0x4093a880 0x4093a8a4: istate->_stack = 0x4093a874 0x4093a8a8: istate->_msg = 0x00000000 0x4093a8ac: istate->_result = 0x4093c140 0x4093a8b0: (istate->_result) = 0x4093c140 0x4093a8b4: (istate->_result) = 0x4093a8c8 0x4093a8b8: istate->_prev_link = 0x00000000 0x4093a8bc: istate->_oop_temp = 0x00000000 0x4093a8c0: istate->_stack_base = 0x4093a88c 0x4093a8c4: istate->_stack_limit = 0x4093a874 0x4093a8c8: istate->_monitor_base = 0x4093a88c 0x4093a8cc: istate->_self_link = 0x00000002 0x4093a8d0: frame_type = INTERPRETER_FRAME 0x4093a8d4: next_frame = 0x4093a938

0x4093a8d8: word[24] = 0x00000000 0x4093a8dc: word[23] = 0x00000000 0x4093a8e0: word[22] = 0x00000000 0x4093a8e4: word[21] = 0x48fe3d50 0x4093a8e8: word[20] = 0x62edf820 0x4093a8ec: word[19] = 0x42a303b0 0x4093a8f0: istate->_thread = 0x0001ec30 0x4093a8f4: istate->_bcp = 0x62ee5ffd 0x4093a8f8: istate->_locals = 0x4093a940 0x4093a8fc: istate->_constants = 0x62eee3a0 0x4093a900: istate->_method = 0x62ee6020 0x4093a904: istate->_mdx = 0x4093a8ac 0x4093a908: istate->_stack = 0x4093a8e0 0x4093a90c: istate->_msg = 0x00000000 0x4093a910: istate->_result = 0x4093a8dc 0x4093a914: (istate->_result) = 0x4093c140 0x4093a918: (istate->_result) = 0x4093a8dc 0x4093a91c: istate->_prev_link = 0x4093a8dc 0x4093a920: istate->_oop_temp = 0x00000000 0x4093a924: istate->_stack_base = 0x4093a8f0 0x4093a928: istate->_stack_limit = 0x4093a8e0 0x4093a92c: istate->_monitor_base = 0x4093a8f0 0x4093a930: istate->_self_link = 0x4087b45c 0x4093a934: frame_type = INTERPRETER_FRAME 0x4093a938: next_frame = 0x4093a98c

0x4093a93c: word[20] = 0x62edf820 0x4093a940: word[19] = 0x42a303b0 0x4093a944: istate->_thread = 0x0001ec30 0x4093a948: istate->_bcp = 0x62edf5d6 0x4093a94c: istate->_locals = 0x4093a98c 0x4093a950: istate->_constants = 0x62edf890 0x4093a954: istate->_method = 0x62edf5e8 0x4093a958: istate->_mdx = 0x00000000 0x4093a95c: istate->_stack = 0x4093a938 0x4093a960: istate->_msg = 0x00000000 0x4093a964: istate->_result = 0x4093a9a8 0x4093a968: (istate->_result) = 0x4093c140 0x4093a96c: (istate->_result) = 0x00000000 0x4093a970: istate->_prev_link = 0x4093a934 0x4093a974: istate->_oop_temp = 0x00000000 0x4093a978: istate->_stack_base = 0x4093a944 0x4093a97c: istate->_stack_limit = 0x4093a938 0x4093a980: istate->_monitor_base = 0x4093a944 0x4093a984: istate->_self_link = 0x4093a998 0x4093a988: frame_type = INTERPRETER_FRAME 0x4093a98c: next_frame = 0x4093a998

0x4093a990: call_wrapper = 0x4087b8bc 0x4093a994: frame_type = ENTRY_FRAME 0x4093a998: next_frame = 0x4093a9f4

0x4093a99c: word[22] = 0x00000002 0x4093a9a0: word[21] = 0x00000002 0x4093a9a4: word[20] = 0x4093a9f4 0x4093a9a8: word[19] = 0x4299f5a0 0x4093a9ac: istate->_thread = 0x0001ec30 0x4093a9b0: istate->_bcp = 0x62e825cf 0x4093a9b4: istate->_locals = 0x4093aa00 0x4093a9b8: istate->_constants = 0x62e84ff8 0x4093a9bc: istate->_method = 0x62e82670 0x4093a9c0: istate->_mdx = 0x62b91210 0x4093a9c4: istate->_stack = 0x4093a9a8 0x4093a9c8: istate->_msg = 0x00000000 0x4093a9cc: istate->_result = 0x00000000 0x4093a9d0: (istate->_result) = 0x4093c140 0x4093a9d4: (istate->_result) = 0x4093c140 0x4093a9d8: istate->_prev_link = 0x48fbd7a0 0x4093a9dc: istate->_oop_temp = 0x00000000 0x4093a9e0: istate->_stack_base = 0x4093a9ac 0x4093a9e4: istate->_stack_limit = 0x4093a998 0x4093a9e8: istate->_monitor_base = 0x4093a9ac 0x4093a9ec: istate->_self_link = 0x4093a9b0 0x4093a9f0: frame_type = INTERPRETER_FRAME 0x4093a9f4: next_frame = 0x4093aa4c

0x4093a9f8: word[21] = 0x00000000 0x4093a9fc: word[20] = 0x42a303c8 0x4093aa00: word[19] = 0x00000001 0x4093aa04: istate->_thread = 0x0001ec30 0x4093aa08: istate->_bcp = 0x62cbdc6f 0x4093aa0c: istate->_locals = 0x4093aa54 0x4093aa10: istate->_constants = 0x62cc0178 0x4093aa14: istate->_method = 0x62cbddb0 0x4093aa18: istate->_mdx = 0x4093a9c0 0x4093aa1c: istate->_stack = 0x4093aa00 0x4093aa20: istate->_msg = 0x00000000 0x4093aa24: istate->_result = 0x00000002 0x4093aa28: (istate->_result) = 0x4093c140 0x4093aa2c: (istate->_result) = 0x00000000 0x4093aa30: istate->_prev_link = 0x00000000 0x4093aa34: istate->_oop_temp = 0x00000000 0x4093aa38: istate->_stack_base = 0x4093aa04 0x4093aa3c: istate->_stack_limit = 0x4093a9f8 0x4093aa40: istate->_monitor_base = 0x4093aa04 0x4093aa44: istate->_self_link = 0x4087b884 0x4093aa48: frame_type = INTERPRETER_FRAME 0x4093aa4c: next_frame = 0x4093aaa0

0x4093aa50: word[20] = 0x00000000 0x4093aa54: word[19] = 0x00000000 0x4093aa58: istate->_thread = 0x0001ec30 0x4093aa5c: istate->_bcp = 0x62b8a714 0x4093aa60: istate->_locals = 0x4093aab0 0x4093aa64: istate->_constants = 0x62b8d238 0x4093aa68: istate->_method = 0x62b8a790 0x4093aa6c: istate->_mdx = 0x62b8d238 0x4093aa70: istate->_stack = 0x4093aa54 0x4093aa74: istate->_msg = 0x00000000 0x4093aa78: istate->_result = 0x4093aa58 0x4093aa7c: (istate->_result) = 0x4093c140 0x4093aa80: (istate->_result) = 0x4093aa8c 0x4093aa84: istate->_prev_link = 0x4093c140 0x4093aa88: istate->_oop_temp = 0x00000000 0x4093aa8c: istate->_stack_base = 0x4093aa58 0x4093aa90: istate->_stack_limit = 0x4093aa4c 0x4093aa94: istate->_monitor_base = 0x4093aa58 0x4093aa98: istate->_self_link = 0x4093aa50 0x4093aa9c: frame_type = INTERPRETER_FRAME 0x4093aaa0: next_frame = 0x4093aafc

0x4093aaa4: word[22] = 0x00000000 0x4093aaa8: word[21] = 0x48ff34a0 0x4093aaac: word[20] = 0x49007748 0x4093aab0: word[19] = 0x48ff3290 0x4093aab4: istate->_thread = 0x0001ec30 0x4093aab8: istate->_bcp = 0x62b8a921 0x4093aabc: istate->_locals = 0x4093ab0c 0x4093aac0: istate->_constants = 0x62b8d238 0x4093aac4: istate->_method = 0x62b8a988 0x4093aac8: istate->_mdx = 0x00000008 0x4093aacc: istate->_stack = 0x4093aaac 0x4093aad0: istate->_msg = 0x00000000 0x4093aad4: istate->_result = 0x40290be8 0x4093aad8: (istate->_result) = 0x4093c140 0x4093aadc: (istate->_result) = 0x0005cca4 0x4093aae0: istate->_prev_link = 0x00000008 0x4093aae4: istate->_oop_temp = 0x00000000 0x4093aae8: istate->_stack_base = 0x4093aab4 0x4093aaec: istate->_stack_limit = 0x4093aaa4 0x4093aaf0: istate->_monitor_base = 0x4093aab4 0x4093aaf4: istate->_self_link = 0x0113fcae 0x4093aaf8: frame_type = INTERPRETER_FRAME 0x4093aafc: next_frame = 0x4093ab18

0x4093ab00: local[3] = 0x00000000 0x4093ab04: local[2] = 0x48ff3290 0x4093ab08: local[1] = 0x00000000 0x4093ab0c: local[0] = 0x48ff3380 0x4093ab10: call_wrapper = 0x4093ab74 0x4093ab14: frame_type = ENTRY_FRAME 0x4093ab18: next_frame = 0x00000000

This is the spec our hardware guy sent me.

CPU Samsung S3C2440Core ARM920TCPU Speed 400 MHzNAND Memory Size 512 MBSDRAM Size 64 MBBoot Time 30 sEthernet Cable 10/100BASE-TOperating System Debian Linux

OK, this is a pretty old CPU (almost a decade old). Will your app be targeting old CPUs with the ARMv4 architecture? If so, we can work on supporting that with TurboActivate.

Yes, we are planning on using this architecture as one of our product options. Not the only one, but we definitely would appreciate an ARMv4 TurboActivate build if it's not too much trouble. Thanks!

OK, we'll try to get that out with TurboActivate 3.3. The schedule's a bit tight right now (we're shooting for an end-of-month release). If we can't get a ARMv4 version of TurboActivate in 3.3, then we'll make a quick release immediately after 3.3 (3.3.1, presumably) that will add ARMv4 support.

Thank you very much! Please let me know if I can be of any assistance to moving that along.

Just wanted to follow up and check on the progress towards 3.3. We are still in need of an ARMv4 solution as soon as possible as it is the only thing holding us back from being able to deploy with TurboActivate. Please let us know how we can help in terms of development and testing to get this working.

Hey Jonathan,

We can have a pre-release version of TurboActivate 3.3 (for ARMv4 Linux) out by Friday. The "final" version will be a little bit longer in coming.

Would you like the pre-release version?

That would make my new year. Thanks! Please let me know when we could get access to that.

Just an update: I'll send you the pre-release ARMv4 TurboActivate 3.3 later today. We still have some testing to make sure this beta version doesn't have any bugs in the existing features.

Edit, 1/7/2013: We're fixing some show-stopper bugs -- once we get these squashed I'll send you the pre-release version.

Thanks for your continued support! I look forward to getting the pre-release soon.

Just following up again regarding the ARMv4 pre-release 3.3. How is everything going? Is there an estimated delivery date? If possible, we would be happy with simply the libraries for ARMv4 support if they are ready. We probably do not need any 3.3 features yet. Thanks!

Unfortunately we can't just recompile 3.2.2 with ARMv4 support because we needed to make code changes to support ARMv4.

We're close to the pre-release version. We're stress testing the server changes that need to be made to support new TA 3.3 features (so we don't mess up old TurboActivate versions activating).

Thanks for the update, Sam. Happy to hear you are close.

How is the progress with testing? We are willing to help in any way to speed up the process. Thanks for your support!

We're almost done (all the tests thus far have succeeded). We have a few remaining. Then we'll send you the pre-release of TA 3.3.

Thank you very much! Definitely appreciate the continued updates of your progress.

TurboActivate 3.3.3 is out. You can get it on your API page. This adds (among many other things) ARMv4 support.