Announcement

Collapse
No announcement yet.

what can cause a ADDRESS TRAP ?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • what can cause a ADDRESS TRAP ?

    hello,

    since a few weeks i'am implementing a program for the 4.3 DT display module.
    now i'am getting a ADRESS TRAP exception after downloading the program to the display.

    ADDRESS TRAP
    PC=2458
    SP=-3371
    UserHeap 24430
    SysHeap 11984


    I usually write code for web- and mobile apps and dont know much about those problems.
    the error occurs after one more line of code. it doesnt matter which specific line of code.

    at first it was a simple assignment of a global variable. but the address trap comes also after a print() command.

    any ideas what the reason can be ? i attached my .aux file. maybe it's helpful.

    best regards,
    Alex
    Attached Files
    Last edited by AlexBln; 28th May 2019, 02:53 PM.

  • #2
    Have you tried to increase your Stack Size?
    #STACK 4096

    Also, this can happen when your program is infinitely recursive or when you've set an invalid parameter.

    at first it was a simple assignment of a global variable. but the address trap comes also after a print() command.
    Perhaps you can give us a rundown of your program.

    Best Regards,
    Kevin

    Comment


    • #3
      hello kevin,

      thanks for the reply.
      i tried to increase the stack size to 4096, but it didnt resolve the problem.
      my program is for a 3d printer interface. i have multiple screens/forms, that send some commands via serial communication to receive the status data.

      at the beginning i had some problems with recursive behavior, but i think now i have adapted the code.

      the address trap appeared a few days ago..
      i just declared 3 or 4 global variables and have written an if else statement. in this if else statement are some assignments.
      if i remove the if/else statement, the code works again....
      Last edited by AlexBln; 28th May 2019, 05:35 PM.

      Comment


      • John Kevin
        John Kevin commented
        Editing a comment
        Could you add a snippet of your code so we can take a look?
        Last edited by John Kevin; 28th May 2019, 06:49 PM.

    • #4
      yes of course, i send you the complete code.

      if you delete the if else statement in filamentMenuWindow.fnc (line 40 - 70) the code works fine.
      Last edited by AlexBln; 6th June 2019, 05:33 PM.

      Comment


      • #5
        Hi,

        It seems that you are not calling the filamentMenuWindow() on any of your program, so it is weird that this is causing the address trap.

        On your "startForm.fnc" file you have a 'repeat forever' statement, although you have a 'break' command on the loop,
        I don't think that you need to run this 'if-condition' in a loop.
        Can you try to comment this ('repeat forever') out and run the program again?

        I have tried to do this and the address trap seems to disappear.
        I have not simulated your program entirely so I don't know if this is the only thing causing the issue.
        You may want to check and verify this.

        Best Regards,
        Kevin

        Comment


        • #6
          Hello Kevin,

          thank you for your help.

          I run the filamentMenuWindow(), when the user goes to the menu form and clicks on the 'filament button' (menuWindow.fnc --> line 99-103--> Entw01.visi --> line 81-83).
          I think i need to run the repeat/forever statement in the startForm.fnc, because i want to run the startRequest() until some conditions are true.

          if i comment out the complete startForm.fnc, i didnt get the address trap. but when i just comment out the repeat/forever and let the if/else there, i'am gettting the error.
          its seems no matter which file/func i comment out. the address trap disappers after a few lines of code less than before.
          it seems to be a problem with the quantity...
          Last edited by AlexBln; 29th May 2019, 07:42 PM.

          Comment


          • #7
            Hi,

            I run the filamentMenuWindow(), when the user goes to the menu form and clicks on the 'filament button' (menuWindow.fnc --> line 99-103--> Entw01.visi --> line 81-83).
            I haven't notice that until you point it out. Thank you.

            I think i need to run the repeat/forever statement in the startForm.fnc, because i want to run the startRequest() until some conditions are true.
            Actually, there are too many redirects on your program and keeping up on the process of what is running is really hard for me.

            if i comment out the complete startForm.fnc, i didnt get the address trap. but when i just comment out the repeat/forever and let the if/else there, i'am gettting the error.
            its seems no matter which file/func i comment out. the address trap disappers after a few lines of code less than before.
            it seems to be a problem with the quantity...
            I doubt that the quantity of the code is the problem. If I may suggest, can you try to cut the sub-process on your code? This may help us to further debug your program.
            Also, although the code on each form is separated by the .fnc file, the way you call it is actually redundant. If you can manage to handle it efficiently that would also help.

            Best Regards,
            Kevin

            Comment


            • #8
              Hey Kevin,

              thank you for the response.

              Actually, there are too many redirects on your program and keeping up on the process of what is running is really hard for me
              ... I believe you about that..sorry

              If I may suggest, can you try to cut the sub-process on your code? This may help us to further debug your program.
              Also, although the code on each form is separated by the .fnc file, the way you call it is actually redundant. If you can manage to handle it efficiently that would also help.
              ok, i will try it.
              but how can i "cut the sub-process" for debugging and why is the seperation in fnc. files reduandant. i just want to organize my code with that.

              Best regards ,
              Alex

              Comment


              • #9
                i think the address trap comes every time, when the program cant access some variables..
                i defined the "responsible" variables as global vars, but not at the very beginning of my programm.
                if i move them to the top, it works so far. i will test a bit and will get back to you.

                best regards,
                alex

                Comment


                • John Kevin
                  John Kevin commented
                  Editing a comment
                  Ok, let me know. Thanks

              • #10
                Hi Alex,
                but how can i "cut the sub-process" for debugging
                Perhaps, you can isolate each process (e.g. Serial comms) and if there are no errors/problems you can add the next process that your program wants to execute.

                Also, although the code on each form is separated by the .fnc file, the way you call it is actually redundant.
                What I mean by this is that you are inheriting the inherited file itself, please see the attached image. Although, I am not sure if this is
                causing the issue it is always a good coding practice to manage it properly.


                Best Regards,
                Kevin
                Attached Files

                Comment


                • #11
                  Hi Kevin,

                  ok thanks. i deleted the inherit lines...

                  Comment


                  • John Kevin
                    John Kevin commented
                    Editing a comment
                    Ok, keep me posted.
                Working...
                X