Problem with adding a const table in application

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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.

0 Likes
1 Solution
Anonymous
Not applicable

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.

View solution in original post

0 Likes
3 Replies
RyanZhao
Moderator
Moderator
Moderator
250 sign-ins First question asked 750 replies posted

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.

Thanks,

Ryan

0 Likes
Anonymous
Not applicable

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.

0 Likes

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.

Bob

0 Likes