This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

getting an illegal instruction error and exiting while running on beagle board

Note: This was originally posted on 16th January 2013 at http://forums.arm.com

Hi ..
           I am getting an illegal instruction error and exiting while running on beagle board , code i have cross compiled on linux machine,  the error is coming at different places for multiple runs,   code has no assembly,    the same code is successfully running on  beagle board when compiled with Code Worrier and executing with TRACE 32 tool,
            How to solve this issue any idea...?


Thanks in advance,
mahesh
  • Note: This was originally posted on 18th January 2013 at http://forums.arm.com


    First guess would either incorrect compiler flags, or something like having the FPU disabled.  You haven't given much to go on.

    Have you looked at the instruction(s) that triggered the error?



    Hi,

            Thanks for the reply,   I have given the compiler options  
        CC =  arm-unknown-linux-gnueabi-gcc -mfloat-abi=softfp  
    CFLAGS = -march=armv7-a -mcpu=cortex-a8 -mfpu=neon -O3

           I do not have clear idea when to use softfp or soft or hard ....

    I do not have native compiler installed on my beagle board (rev  C), so i am using the cross_compiler tool chain , I am getting run time error as "Illegal instruction" nothing more than that,  Is there any other way of knowing more about the error...?
  • Note: This was originally posted on 18th January 2013 at http://forums.arm.com


    Is this an application running under an OS like Linux, or a bare-metal application?

    The fact is happens at different places in different runs means that the code-gen is probably OK, and something else is going wrong (if it was a code-gen bug from the compiler it would probably fail in the same place every time). Some random ideas, but hard to say without more detail:

    Option one: You have memory corruption and something is trampling the code which is running, or corrupting the stack. Try turning on the MMU and making your code section read-only.

    Option two: Your caches are getting into an inconsistent state.

    Option three: Could be something like you are handling an interrupt in a different ISA to the program which was running before, and not retuning in a way which is restoring the ISA configuration. e.g. running in thumb, interrupt switches the core to ARM, you handle the interrupt and then jump back into the original code trying to run Thumb binaries in ARM mode.

    I'd suggest looking at the fault status register and the SPSR when the fault happens to work out which mode the core was in when the fault happened, and get a bit more data about the fault.

    HTH,
    Iso




    Hi,

       Thanks for the reply,

    My application is stand alone application  (video codec) ,  i am running it on the beagle board (rev C) having the Angstrom linux OS,


    --> Is there any way to get more details about the error,..?
    --> Could you suggest how to make my code section read- only,,    The same application when running on BB without OS  is running fine,  there we would initialize caches etc and  we would have a scatter file where we have memory mapping , But Now (with OS) how could i make my code Read -only..?
    --> If caches are going into inconsistent state, how can i check ...?


          My application giving error and exiting at random place, how can i know when that may occur..?   On BB i do not have debugger ,  Does GDB helps for this......?


    I am new to this domain, could you suggest a bit more clearly,  or ask for the required details  to understand the problem..

    Thank you,
    Mahesh.
  • Note: This was originally posted on 16th January 2013 at http://forums.arm.com

    First guess would either incorrect compiler flags, or something like having the FPU disabled.  You haven't given much to go on.

    Have you looked at the instruction(s) that triggered the error?
  • Note: This was originally posted on 16th January 2013 at http://forums.arm.com

    Is this an application running under an OS like Linux, or a bare-metal application?

    The fact is happens at different places in different runs means that the code-gen is probably OK, and something else is going wrong (if it was a code-gen bug from the compiler it would probably fail in the same place every time). Some random ideas, but hard to say without more detail:

    Option one: You have memory corruption and something is trampling the code which is running, or corrupting the stack. Try turning on the MMU and making your code section read-only.

    Option two: Your caches are getting into an inconsistent state.

    Option three: Could be something like you are handling an interrupt in a different ISA to the program which was running before, and not retuning in a way which is restoring the ISA configuration. e.g. running in thumb, interrupt switches the core to ARM, you handle the interrupt and then jump back into the original code trying to run Thumb binaries in ARM mode.

    I'd suggest looking at the fault status register and the SPSR when the fault happens to work out which mode the core was in when the fault happened, and get a bit more data about the fault.

    HTH,
    Iso