3 Replies Latest reply on May 9, 2018 3:48 AM by JoMe_264151

    Problem with adding a const table in application

      This is part of my efforts to try to solve the jump from the bootloader to the app.

      I'm creating a very simple application in which I create a file "some_table.c" which has a medium sized (approx 20 KB) constant table.

      As soon as I add this table in the project I cannot debug anymore: the debugger buttons are grayed out.

      Even more, if I try to add this table to the watch window, to see where it is located in the memory, the watch window doesn't display an address or values, nothing.


      What could be the cause? Is there a limit to a size of a table to a project? Since there is 256 KB of flash available on this part it shouldn't be a problem.

      Attached is the project if it may throw some light.

      Thanks for your help.

        • 1. Re: Problem with adding a const table in application

          Hi Alden,


          I guess the table has been optimized out. You can try:

          1.  volatile const uint8_t some_table[] ={}

          2.               const uint8_t some_table[] ={}

          Build and see SRAM used.




          • 2. Re: Problem with adding a const table in application

            Hi Ryan,


            Thanks for your answer.

            That const table is put in ROM and its address is used in the application.

            So it's not missing, the code sees it. Since that table is never changed, not sure what volatile attribute should do.

            It's just that if I set a breakpoint in main when trying to access it, the debugging buttons are grayed out.

            Optimized out or not, I don't think that the debugger should not let me step and execute instructions.


            Anyway, I've noticed that if I use that table address in another function, without trying to stop with the debugger when I execute that instruction, it works. So, for now this is an acceptable workaround.

            Thank you for your help.

            • 3. Re: Problem with adding a const table in application

              When you change the size of the table from 22,000 entries to 4 entries the problem Alden talks about becomes visible:

              When debugging hoover the cursor in main() over the table name and see what is displayed.


              So there is really something fishy with the debug symbols.