The attached example project 7558.TI_ARM_static_variables.zip was created in CCS 6.0.0.00175 using the TI ARM compiler v5.1.5, targetting a TM4C123GH6PM. The following screen show shows that the CCS debugger is showing the incorrect values for variable f_token2 and f_token3:
The summary of the problem is:
1) The running code produces the expected results, in that the CIO console output reports the correct values for all 6 variables g_token1, g_token2, g_token3, f_token1, f_token2 and f_token3
2) The CCS expressions view reports the correct values for the g_token1, g_token2, g_token3 and f_token1 variables and reports that the variables have an address in RAM.
3) The CCS expression view reports incorrect values for the f_token2 and f_token3 variables, and also reports that the variables have an address in flash. The resolved address of these variables is the address of main function in which they are declared.
If the armofd.exe -g program is run on the TI_ARM_static_variables.out executable generated the TI ARM v5.1.5 compiler the debug information reports the address of the g_token1, g_token2, g_token3 and f_token1 variables in RAM:
00002732 2 DW_TAG_variable (.data)
00002733 DW_AT_location DW_OP_addr 0x200007dc
00002739 DW_AT_name g_token1
00002742 DW_AT_decl_column 17
00002743 DW_AT_decl_file 1
00002744 DW_AT_decl_line 8
00002745 DW_AT_type .debug_info(12) + 0x17bd
00002749 DW_AT_TI_symbol_name g_token1
00002606 7 DW_TAG_variable (.bss)
00002607 DW_AT_location DW_OP_addr 0x200009cc
0000260d DW_AT_name g_token2
00002616 DW_AT_decl_column 17
00002617 DW_AT_decl_file 2
00002618 DW_AT_decl_line 9
00002619 DW_AT_type .debug_info(12) + 0x17bd
0000261d DW_AT_TI_symbol_name g_token2
00002626 8 DW_TAG_variable (.bss)
00002627 DW_AT_location DW_OP_addr 0x200009d0
0000262d DW_AT_name g_token3
00002636 DW_AT_decl_column 26
00002637 DW_AT_decl_file 2
00002638 DW_AT_decl_line 10
00002639 DW_AT_type .debug_info(12) + 0x25f6
0000263d DW_AT_TI_symbol_name g_token3
00001b3c 3 DW_TAG_variable (.data)
00001b3d DW_AT_location DW_OP_addr 0x200007e0
00001b43 DW_AT_name f_token1
00001b4c DW_AT_type .debug_info(12) + 0x17bd
00001b50 DW_AT_TI_symbol_name f_token1$1
Whereas the debug information for the f_token2 and f_token3 reports their address in flash:
00001b5b 3 DW_TAG_variable (.text)
00001b5c DW_AT_location DW_OP_addr 0x00002488
00001b62 DW_AT_name f_token2
00001b6b DW_AT_type .debug_info(12) + 0x17bd
00001b6f DW_AT_TI_symbol_name f_token2$2
00001b7a 3 DW_TAG_variable (.text)
00001b7b DW_AT_location DW_OP_addr 0x00002488
00001b81 DW_AT_name f_token3
00001b8a DW_AT_type .debug_info(12) + 0x25f6
00001b8e DW_AT_TI_symbol_name f_token3$3
Therefore, the problem appears to be that the TI ARM v5.1.5 compiler is generating incorrect debug information for some static variables declared inside a function.