This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Moving .bss section from RAM to Flash causes program to hang... why?

Other Parts Discussed in Thread: MSP430F5438, MSP430G2553

Hello all,

I am currently migrating code from an existing non-microcontroller project into the MSP430 framework targeting a MSP430F5438 through CCSv . The legacy code makes use of a lot of global variables which are placed in the .bss section. Unfortunately, the total size of the resulting .bss section is 21kb (0x5744) and the F5438 is only 16kb (0x4000). 

When modifying the default lnk_msp430f5438.cmb linker command file to place the large .bss section in Flash (see below) and then launching in debug mode, the micro hangs and wanders through memory aimlessly indicated when halting the processor the resulting PC is up in the FLASH2 memory address space (e.g. 0x1A190).

Modification to linker command file:

Changed:

.bss       : {} > RAM                /* GLOBAL & STATIC VARS              */

to:

.bss       : {} > FLASH                /* GLOBAL & STATIC VARS              */

Furthermore, I have enabled: --code_model=large --data_model=large --near_data=none and silicon version mspx to support the >64kb memory space. The contents of the resulting map file is below. The entry point seems to make sense falling within the .text:_isr section; however, the processor seems to get lost after that.

Are there specific sections of .bss that need to remain in RAM or should be loaded into RAM at run-time to ensure proper operation? If so, any advice on how to achieve this? RAM is now rather empty using only 0x00a0 so I can afford to place any portions of the .bss section in there through the linker command file. I'm thinking the following but wanted to confirm if that was true and in fact how to do it:

rts430x.lib : _lock.obj (.bss) and rts430x.lib: boot.obj (.bss)

When following the instructions from slau131e section 7.5.4.5 Specifying Library or Archive Members as Input to Output Sections in the following manner I receive the errors below:

Further modification to linker command file:

Changed:

.bss       : {} > FLASH                /* GLOBAL & STATIC VARS              */

to:

.bss > RAM
    {
        main.obj (.bss)
        -l=rts430xl.lib<boot.obj> (.bss)
        -l=rts430xl.lib<_lock.obj> (.bss)
    }
    .bss > FLASH
    {
        * (.bss)
    }

Errors generated:

"../lnk_msp430f5438.cmd", line 108: error: -l must specify a filename
"../lnk_msp430f5438.cmd", line 108: error: cannot find file "boot.obj"
"../lnk_msp430f5438.cmd", line 108: error: cannot find file ".bss"
"../lnk_msp430f5438.cmd", line 109: error: cannot find file "_lock.obj"
"../lnk_msp430f5438.cmd", line 109: error: cannot find file ".bss"

Any insights anyone might have would be great!

Thanks very much,

- Mark

 

******************************************************************************
                  MSP430 Linker PC v3.3.0                     
******************************************************************************
>> Linked Thu Nov 11 10:30:02 2010

OUTPUT FILE NAME:   <FREDI.out>
ENTRY POINT SYMBOL: "_c_int00"  address: 0000db3c

MEMORY CONFIGURATION

         name            origin    length      used     unused   attr    fill
----------------------  --------  ---------  --------  --------  ----  --------
  SFR                   00000000   00000010  00000000  00000010  RWIX
  PERIPHERALS_8BIT      00000010   000000f0  00000000  000000f0  RWIX
  PERIPHERALS_16BIT     00000100   00000100  00000000  00000100  RWIX
  INFOD                 00001800   00000080  00000000  00000080  RWIX
  INFOC                 00001880   00000080  00000000  00000080  RWIX
  INFOB                 00001900   00000080  00000000  00000080  RWIX
  INFOA                 00001980   00000080  00000000  00000080  RWIX
  RAM                   00001c00   00004000  000000a0  00003f60  RWIX
  FLASH                 00005c00   0000a380  0000a380  00000000  RWIX
  INT00                 0000ff80   00000002  00000000  00000002  RWIX
  INT01                 0000ff82   00000002  00000000  00000002  RWIX
  INT02                 0000ff84   00000002  00000000  00000002  RWIX
  INT03                 0000ff86   00000002  00000000  00000002  RWIX
  INT04                 0000ff88   00000002  00000000  00000002  RWIX
  INT05                 0000ff8a   00000002  00000000  00000002  RWIX
  INT06                 0000ff8c   00000002  00000000  00000002  RWIX
  INT07                 0000ff8e   00000002  00000000  00000002  RWIX
  INT08                 0000ff90   00000002  00000000  00000002  RWIX
  INT09                 0000ff92   00000002  00000000  00000002  RWIX
  INT10                 0000ff94   00000002  00000000  00000002  RWIX
  INT11                 0000ff96   00000002  00000000  00000002  RWIX
  INT12                 0000ff98   00000002  00000000  00000002  RWIX
  INT13                 0000ff9a   00000002  00000000  00000002  RWIX
  INT14                 0000ff9c   00000002  00000000  00000002  RWIX
  INT15                 0000ff9e   00000002  00000000  00000002  RWIX
  INT16                 0000ffa0   00000002  00000000  00000002  RWIX
  INT17                 0000ffa2   00000002  00000000  00000002  RWIX
  INT18                 0000ffa4   00000002  00000000  00000002  RWIX
  INT19                 0000ffa6   00000002  00000000  00000002  RWIX
  INT20                 0000ffa8   00000002  00000000  00000002  RWIX
  INT21                 0000ffaa   00000002  00000000  00000002  RWIX
  INT22                 0000ffac   00000002  00000000  00000002  RWIX
  INT23                 0000ffae   00000002  00000000  00000002  RWIX
  INT24                 0000ffb0   00000002  00000000  00000002  RWIX
  INT25                 0000ffb2   00000002  00000000  00000002  RWIX
  INT26                 0000ffb4   00000002  00000000  00000002  RWIX
  INT27                 0000ffb6   00000002  00000000  00000002  RWIX
  INT28                 0000ffb8   00000002  00000000  00000002  RWIX
  INT29                 0000ffba   00000002  00000000  00000002  RWIX
  INT30                 0000ffbc   00000002  00000000  00000002  RWIX
  INT31                 0000ffbe   00000002  00000000  00000002  RWIX
  INT32                 0000ffc0   00000002  00000000  00000002  RWIX
  INT33                 0000ffc2   00000002  00000000  00000002  RWIX
  INT34                 0000ffc4   00000002  00000000  00000002  RWIX
  INT35                 0000ffc6   00000002  00000000  00000002  RWIX
  INT36                 0000ffc8   00000002  00000000  00000002  RWIX
  INT37                 0000ffca   00000002  00000000  00000002  RWIX
  INT38                 0000ffcc   00000002  00000000  00000002  RWIX
  INT39                 0000ffce   00000002  00000000  00000002  RWIX
  INT40                 0000ffd0   00000002  00000000  00000002  RWIX
  INT41                 0000ffd2   00000002  00000000  00000002  RWIX
  INT42                 0000ffd4   00000002  00000000  00000002  RWIX
  INT43                 0000ffd6   00000002  00000000  00000002  RWIX
  INT44                 0000ffd8   00000002  00000002  00000000  RWIX
  INT45                 0000ffda   00000002  00000000  00000002  RWIX
  INT46                 0000ffdc   00000002  00000002  00000000  RWIX
  INT47                 0000ffde   00000002  00000000  00000002  RWIX
  INT48                 0000ffe0   00000002  00000000  00000002  RWIX
  INT49                 0000ffe2   00000002  00000002  00000000  RWIX
  INT50                 0000ffe4   00000002  00000000  00000002  RWIX
  INT51                 0000ffe6   00000002  00000000  00000002  RWIX
  INT52                 0000ffe8   00000002  00000000  00000002  RWIX
  INT53                 0000ffea   00000002  00000000  00000002  RWIX
  INT54                 0000ffec   00000002  00000000  00000002  RWIX
  INT55                 0000ffee   00000002  00000000  00000002  RWIX
  INT56                 0000fff0   00000002  00000000  00000002  RWIX
  INT57                 0000fff2   00000002  00000000  00000002  RWIX
  INT58                 0000fff4   00000002  00000000  00000002  RWIX
  INT59                 0000fff6   00000002  00000000  00000002  RWIX
  INT60                 0000fff8   00000002  00000000  00000002  RWIX
  INT61                 0000fffa   00000002  00000000  00000002  RWIX
  INT62                 0000fffc   00000002  00000000  00000002  RWIX
  RESET                 0000fffe   00000002  00000002  00000000  RWIX
  FLASH2                00010000   00035c00  0000a5fd  0002b603  RWIX

SECTION ALLOCATION MAP

 output                                  attributes/
section   page    origin      length       input sections
--------  ----  ----------  ----------   ----------------
.pinit     0    00005c00    00000000     UNINITIALIZED

.stack     0    00005b60    000000a0     UNINITIALIZED
                  00005b60    00000004     rts430xl.lib : boot.obj (.stack)
                  00005b64    0000009c     --HOLE--

.bss       0    00005c00    00005748     UNINITIALIZED
                  00005c00    00001060     sri_quart.obj (.bss)
                  00006c60    00000e70     sri_frwv_cmd_packet_selftest.obj (.bss)
                  00007ad0    00000dce     sri_frwv_send_selftest.obj (.bss)
                  0000889e    00000896     sri_frwv_cmd_fill_frames_selftest.obj (.bss)
                  00009134    000004ca     main.obj (.bss)
                  000095fe    000003a6     sri_m2k_send_selftest.obj (.bss)
                  000099a4    00000344     sri_frwv_cmd_packet.obj (.bss)
                  00009ce8    0000033e     sri_pparse_cntxts.obj (.bss)
                  0000a026    00000330     sri_frwv_packet_selftest.obj (.bss)
                  0000a356    00000310     sri_test_harness.obj (.bss)
                  0000a666    000002ca     sri_m2k_msg_selftest.obj (.bss)
                  0000a930    00000240     sri_frwv_dual_parse_selftest.obj (.bss)
                  0000ab70    000001a4     sri_frwv_ack_selftest.obj (.bss)
                  0000ad14    000000d2     fredi_imls.obj (.bss)
                  0000ade6    000000cf     fredi_m2k.obj (.bss)
                  0000aeb5    00000001     sri_frwv_dual_parse.obj (.bss)
                  0000aeb6    000000c4     sri_frwv_cmd_fill_selftest.obj (.bss)
                  0000af7a    000000c2     sri_m2k_display.obj (.bss)
                  0000b03c    0000006a     sri_m2k_msg.obj (.bss)
                  0000b0a6    00000068     sri_frwv_cmd_packet_epoch_selftest.obj (.bss)
                  0000b10e    00000060     sri_ubx_binary_msg.obj (.bss)
                  0000b16e    0000005c     sri_rtca_data.obj (.bss)
                  0000b1ca    00000042     sri_tspi_data.obj (.bss)
                  0000b20c    00000039     sri_imiles_msg.obj (.bss)
                  0000b245    00000001     sri_m2k_spoof.obj (.bss)
                  0000b246    00000030     sri_msgqueue_selftest.obj (.bss)
                  0000b276    0000002c     fredi_frwv.obj (.bss)
                  0000b2a2    00000017     sri_frwv_ack.obj (.bss)
                  0000b2b9    00000001     --HOLE--
                  0000b2ba    00000015     sri_frwv_packet.obj (.bss)
                  0000b2cf    00000001     --HOLE--
                  0000b2d0    00000014     fredi_stats.obj (.bss)
                  0000b2e4    00000014     sri_imiles_send.obj (.bss)
                  0000b2f8    00000014     sri_time.obj (.bss)
                  0000b30c    0000000e     sri_m2k_send.obj (.bss)
                  0000b31a    00000008     rts430xl.lib : _lock.obj (.bss)
                  0000b322    00000008                  : boot.obj (.bss)
                  0000b32a    00000008     sri_frwv_send_fill.obj (.bss)
                  0000b332    00000007     fredi_frwv_status.obj (.bss)
                  0000b339    00000001     --HOLE--
                  0000b33a    00000005     sri_frwv_cmd_fill.obj (.bss)
                  0000b33f    00000001     --HOLE--
                  0000b340    00000004     fredi_uart.obj (.bss)
                  0000b344    00000002     sri_debug.obj (.bss)
                  0000b346    00000002     sri_hardware_status.obj (.bss)

.cinit     0    0000b348    0000279c    
                  0000b348    00000dda     sri_frwv_send_selftest.obj (.cinit)
                  0000c122    00000788     sri_frwv_cmd_fill_frames_selftest.obj (.cinit)
                  0000c8aa    00000430     sri_frwv_cmd_packet_selftest.obj (.cinit)
                  0000ccda    00000294     sri_frwv_packet_selftest.obj (.cinit)
                  0000cf6e    000001be     sri_frwv_dual_parse_selftest.obj (.cinit)
                  0000d12c    0000018c     sri_frwv_ack_selftest.obj (.cinit)
                  0000d2b8    0000017e     sri_m2k_msg_selftest.obj (.cinit)
                  0000d436    0000017c     sri_m2k_send_selftest.obj (.cinit)
                  0000d5b2    000000c6     sri_frwv_cmd_fill_selftest.obj (.cinit)
                  0000d678    000000a8     sri_m2k_display.obj (.cinit)
                  0000d720    00000096     sri_pparse_cntxts.obj (.cinit)
                  0000d7b6    00000074     sri_frwv_cmd_packet_epoch_selftest.obj (.cinit)
                  0000d82a    00000064     sri_m2k_msg.obj (.cinit)
                  0000d88e    00000054     fredi_imls.obj (.cinit)
                  0000d8e2    00000045     sri_imiles_msg.obj (.cinit)
                  0000d927    00000001     --HOLE-- [fill = 0]
                  0000d928    00000043     fredi_m2k.obj (.cinit)
                  0000d96b    00000001     --HOLE-- [fill = 0]
                  0000d96c    00000041     sri_msgqueue_selftest.obj (.cinit)
                  0000d9ad    00000001     --HOLE-- [fill = 0]
                  0000d9ae    00000040     sri_rtca_data.obj (.cinit)
                  0000d9ee    00000021     sri_frwv_packet.obj (.cinit)
                  0000da0f    00000001     --HOLE-- [fill = 0]
                  0000da10    00000020     sri_frwv_send_fill.obj (.cinit)
                  0000da30    0000001e     sri_ubx_binary_msg.obj (.cinit)
                  0000da4e    00000017     fredi_frwv_status.obj (.cinit)
                  0000da65    00000001     --HOLE-- [fill = 0]
                  0000da66    00000011     sri_frwv_cmd_fill.obj (.cinit)
                  0000da77    00000001     --HOLE-- [fill = 0]
                  0000da78    0000000f     fredi_frwv.obj (.cinit)
                  0000da87    00000001     --HOLE-- [fill = 0]
                  0000da88    0000000f     main.obj (.cinit)
                  0000da97    00000001     --HOLE-- [fill = 0]
                  0000da98    0000000f     sri_debug.obj (.cinit)
                  0000daa7    00000001     --HOLE-- [fill = 0]
                  0000daa8    0000000a     fredi_stats.obj (.cinit)
                  0000dab2    00000008     sri_test_harness.obj (.cinit)
                  0000daba    00000007     sri_frwv_ack.obj (.cinit)
                  0000dac1    00000001     --HOLE-- [fill = 0]
                  0000dac2    00000007     sri_frwv_cmd_packet.obj (.cinit)
                  0000dac9    00000001     --HOLE-- [fill = 0]
                  0000daca    00000007     sri_frwv_dual_parse.obj (.cinit)
                  0000dad1    00000001     --HOLE-- [fill = 0]
                  0000dad2    00000007     sri_imiles_send.obj (.cinit)
                  0000dad9    00000001     --HOLE-- [fill = 0]
                  0000dada    00000007     sri_m2k_spoof.obj (.cinit)
                  0000dae1    00000001     --HOLE-- [fill = 0]
                  0000dae2    00000002     (.pad.cinit) [fill = 0]

.text:_isr
*          0    0000dae4    000000aa    
                  0000dae4    00000058     sri_quart.obj (.text:_isr:USCI_A1_ISR)
                  0000db3c    0000002a     rts430xl.lib : boot.obj (.text:_isr:_c_int00_noexit)
                  0000db66    0000001a     sri_quart.obj (.text:_isr:USCI_A3_ISR)
                  0000db80    0000000e     sri_time.obj (.text:_isr:TIMER1_A0_ISR)

.text.1    0    0000db8e    000023f2    
                  0000db8e    00000a2c     sri_frwv_cmd_packet.obj (.text:sri_frwv_cmd_packet_dispatch)
                  0000e5ba    000008f0     sri_ubx_binary_msg.obj (.text:sri_ubx_bmsg_dispatch)
                  0000eeaa    000006ba     sri_m2k_msg.obj (.text:sri_m2k_msg_dispatch)
                  0000f564    000004da     sri_pparse.obj (.text:sri_pparse)
                  0000fa3e    0000041a     sri_frwv_packet.obj (.text:sri_frwv_packet_dispatch)
                  0000fe58    00000128     sri_frwv_packet.obj (.text:sri_frwv_do_frequency_cmd)

.int44     0    0000ffd8    00000002    
                  0000ffd8    00000002     sri_quart.obj (.int44)

.int46     0    0000ffdc    00000002    
                  0000ffdc    00000002     sri_quart.obj (.int46)

.int49     0    0000ffe2    00000002    
                  0000ffe2    00000002     sri_time.obj (.int49)

.reset     0    0000fffe    00000002    
                  0000fffe    00000002     rts430xl.lib : boot.obj (.reset)

.const     0    00010000    0000391f    
                  00010000    00000a34     sri_frwv_cmd_packet.obj (.const:.string)
                  00010a34    000006e6     sri_frwv_packet.obj (.const:.string)
                  0001111a    000003b4     sri_m2k_msg.obj (.const:.string)
                  000114ce    00000334     sri_frwv_send_selftest.obj (.const:.string)
                  00011802    00000218     sri_m2k_display.obj (.const:.string)
                  00011a1a    00000200     sri_test_harness.obj (.const:.string)
                  00011c1a    000001ae     sri_tspi_data.obj (.const:.string)
                  00011dc8    000001a6     fredi_m2k.obj (.const:.string)
                  00011f6e    000001a4     fredi_imls.obj (.const:.string)
                  00012112    0000019a     sri_debug.obj (.const:.string)
                  000122ac    00000194     sri_frwv_send_fill.obj (.const:.string)
                  00012440    00000186     sri_msgqueue_selftest.obj (.const:.string)
                  000125c6    00000168     sri_frwv_cmd_packet_epoch_selftest.obj (.const:.string)
                  0001272e    00000160     sri_frwv_cmd_fill_frames_selftest.obj (.const:.string)
                  0001288e    00000152     sri_m2k_msg_selftest.obj (.const:.string)
                  000129e0    00000150     sri_rtca_data.obj (.const:.string)
                  00012b30    00000144     sri_frwv_cmd_packet_selftest.obj (.const:.string)
                  00012c74    00000136     sri_frwv_packet_selftest.obj (.const:.string)
                  00012daa    000000fa     sri_frwv_ack.obj (.const:.string)
                  00012ea4    000000f8     sri_frwv_dual_parse_selftest.obj (.const:.string)
                  00012f9c    000000f4     sri_ubx_binary_msg.obj (.const:.string)
                  00013090    000000ee     sri_m2k_send_selftest.obj (.const:.string)
                  0001317e    000000e0     sri_frwv_cmd_fill_selftest.obj (.const:.string)
                  0001325e    000000d8     sri_frwv_ack_selftest.obj (.const:.string)
                  00013336    000000aa     sri_imiles_msg.obj (.const:.string)
                  000133e0    0000009c     fredi_frwv_data.obj (.const:.string)
                  0001347c    0000009c     sri_m2k_spoof.obj (.const:.string)
                  00013518    00000062     fredi_stats.obj (.const:.string)
                  0001357a    00000062     sri_msgqueue.obj (.const:.string)
                  000135dc    00000060     fredi_qhandlers.obj (.const:.string)
                  0001363c    0000005e     sri_frwv_cmd_fill.obj (.const:.string)
                  0001369a    0000005e     sri_pparse_cntxts.obj (.const:sri_m2k_lens)
                  000136f8    00000052     fredi_frwv_status.obj (.const:.string)
                  0001374a    00000040     sri_hardware_status.obj (.const:.string)
                  0001378a    00000034     fredi_frwv.obj (.const:.string)
                  000137be    0000002c     sri_time.obj (.const:.string)
                  000137ea    0000002a     fredi_les.obj (.const:.string)
                  00013814    0000002a     sri_frwv_dual_parse.obj (.const:.string)
                  0001383e    00000024     sri_imiles_send.obj (.const:.string)
                  00013862    0000001e     sri_m2k_send.obj (.const:.string)
                  00013880    0000001e     sri_queue.obj (.const:.string)
                  0001389e    0000001c     sri_quart.obj (.const:.string)
                  000138ba    0000001c     sri_m2k_display.obj (.const)
                  000138d6    00000018     main.obj (.const:.string)
                  000138ee    00000016     sri_pparse.obj (.const:.string)
                  00013904    00000014     rts430xl.lib : _printfi_min.obj (.const:.string)
                  00013918    00000002     sri_pparse_cntxts.obj (.const:sri_Imiles_sync)
                  0001391a    00000002     sri_pparse_cntxts.obj (.const:sri_m2k_sync)
                  0001391c    00000002     sri_pparse_cntxts.obj (.const:sri_ubx_sync)
                  0001391e    00000001     sri_pparse_cntxts.obj (.const:sri_frwv_sync)

.text.2    0    00013920    00006cde    
                  00013920    00000410     sri_msgqueue_selftest.obj (.text:test_msgq_basic)
                  00013d30    000003a2     sri_frwv_packet.obj (.text:sri_frwv_packet_dispatch_edi_cmd)
                  000140d2    000002d6     sri_frwv_send_fill.obj (.text:sri_frwv_fill_PDU_tspi)
                  000143a8    00000200     sri_frwv_send_selftest.obj (.text:packet_run_test)
                  000145a8    000001f4     sri_frwv_packet.obj (.text:DoSlotCmd)
                  0001479c    000001f2     sri_frwv_packet.obj (.text:DoDamageCmdM2k)
                  0001498e    000001d6     sri_frwv_cmd_packet_selftest.obj (.text:frwv_cmd_cmp_cmd_data)
                  00014b64    000001ce     sri_frwv_send_fill.obj (.text:sri_frwv_translate_damage)
                  00014d32    000001bc     sri_frwv_packet.obj (.text:DoDamageCmdImls)
                  00014eee    000001ba     sri_frwv_dual_parse.obj (.text:sri_frwv_dual_parse)
                  000150a8    000001b8     sri_m2k_msg_selftest.obj (.text:m2kmsg_run_test)
                  00015260    000001b2     sri_m2k_send_selftest.obj (.text:m2k_send_run_test)
                  00015412    000001ae     sri_frwv_cmd_fill.obj (.text:sri_frwv_cmd_request_set_RAM_frametable_internal)
                  000155c0    00000184     sri_frwv_send_fill.obj (.text:sri_frwv_fill_slave_PDU)
                  00015744    00000182     sri_frwv_cmd_fill_selftest.obj (.text:cmd_fill_run_test)
                  000158c6    00000182     sri_frwv_cmd_packet_epoch_selftest.obj (.text:cmd_packet_epoch_run_test)
                  00015a48    00000180     rts430xl.lib : _printfi_min.obj (.text:_setfield)
                  00015bc8    0000017e     sri_frwv_cmd_fill.obj (.text:sri_frwv_cmd_fill_SuperEpoch)
                  00015d46    00000178     sri_frwv_ack_selftest.obj (.text:ack_run_test)
                  00015ebe    00000174     sri_frwv_cmd_packet.obj (.text:sri_frwv_cmd_data_calc_push_delay_ticks)
                  00016032    00000160     sri_frwv_dual_parse_selftest.obj (.text:dparse_run_test)
                  00016192    00000160     main.obj (.text:main)
                  000162f2    00000156     sri_frwv_packet.obj (.text:sri_frwv_do_super_epoch_cmd)
                  00016448    0000014c     sri_frwv_cmd_fill_frames_selftest.obj (.text:cmd_fill_frames_run_test)
                  00016594    0000014c     sri_frwv_cmd_packet_selftest.obj (.text:cmd_packet_run_test)
                  000166e0    00000140     sri_test_harness.obj (.text:sri_test_harness_cmp_bytes)
                  00016820    00000132     sri_frwv_cmd_fill.obj (.text:sri_frwv_cmd_fill_READ_BULK)
                  00016952    00000132     sri_frwv_packet.obj (.text:sri_frwv_packet_dispatch_cmd_size)
                  00016a84    00000130     sri_frwv_send_fill.obj (.text:sri_frwv_fill_dump_struct)
                  00016bb4    00000126     sri_rtca_data.obj (.text:sri_rtca_data_describe_damage)
                  00016cda    0000011c     sri_frwv_ack.obj (.text:sri_frwv_ack_enqueue)
                  00016df6    0000011a     sri_m2k_spoof.obj (.text:sri_m2k_spoof_vest)
                  00016f10    00000118     sri_frwv_cmd_fill.obj (.text:sri_frwv_cmd_fill_slot_buffer)
                  00017028    00000110     sri_frwv_send_fill.obj (.text:sri_frwv_fill_PDU_hw)
                  00017138    00000100     sri_frwv_send_fill.obj (.text:sri_frwv_fill_slave_packet)
                  00017238    000000f8     sri_m2k_send.obj (.text:sri_m2k_send_ack)
                  00017330    000000f2     sri_m2k_msg_selftest.obj (.text:m2kmsg_cmp_rtca_rte_data)
                  00017422    000000ee     sri_frwv_cmd_packet.obj (.text:sri_frwv_cmd_data_init)
                  00017510    000000ec     sri_frwv_cmd_packet.obj (.text:addDispatchEntry)
                  000175fc    000000ea     sri_frwv_cmd_packet.obj (.text:sri_frwv_cmd_data_calc_epoch_us)
                  000176e6    000000e4     sri_frwv_send_fill.obj (.text:sri_frwv_fill_prepare_pdu)
                  000177ca    000000e4     sri_tspi_data.obj (.text:sri_tspi_debug_dump_utc_time)
                  000178ae    000000de     sri_frwv_packet_selftest.obj (.text:packet_run_test)
                  0001798c    000000d6     rts430xl.lib : _printfi_min.obj (.text:_printfi_minimal)
                  00017a62    000000d6     sri_frwv_cmd_fill.obj (.text:sri_frwv_cmd_fill_EEPROM_READ_WRITE)
                  00017b38    000000d4     sri_rtca_data.obj (.text:sri_rtca_rte_debug_dump)
                  00017c0c    000000ce     sri_frwv_cmd_fill.obj (.text:sri_frwv_cmd_request_buffer)
                  00017cda    000000c8     sri_frwv_cmd_fill.obj (.text:sri_frwv_cmd_fill_WRITE_RAM_TDMA)
                  00017da2    000000c8     sri_m2k_send.obj (.text:sri_m2k_send_setpid)
                  00017e6a    000000c4     sri_queue.obj (.text:sri_queue_write)
                  00017f2e    000000c0     sri_m2k_display.obj (.text:lot2Line2Formatter)
                  00017fee    000000ba     sri_queue.obj (.text:sri_queue_read)
                  000180a8    000000ba     sri_tspi_data.obj (.text:sri_tspi_debug_dump_space)
                  00018162    000000b6     sri_tspi_data.obj (.text:sri_tspi_debug_dump_gps_time)
                  00018218    000000b4     sri_frwv_cmd_fill.obj (.text:sri_frwv_cmd_fill_internal)
                  000182cc    000000b4     sri_frwv_cmd_packet.obj (.text:sri_frwv_cmd_packet_check_tdma_values)
                  00018380    000000aa     fredi_qhandlers.obj (.text:_fredi_qhandlers_parse_generic)
                  0001842a    0000009c     sri_frwv_ack.obj (.text:sri_frwv_ack_dequeue)
                  000184c6    0000009c     sri_m2k_msg.obj (.text:sri_m2k_msg_decode_pid)
                  00018562    0000009c     sri_m2k_send.obj (.text:sri_m2k_send_admin_kill)
                  000185fe    0000009c     sri_m2k_send.obj (.text:sri_m2k_send_rte)
                  0001869a    00000094     sri_frwv_cmd_packet.obj (.text:sri_frwv_cmd_packet_check_id_values)
                  0001872e    00000092     fredi_qhandlers.obj (.text:_fredi_qhandlers_fill_buf)
                  000187c0    00000092     sri_frwv_cmd_packet.obj (.text:sri_frwv_cmd_data_calc_numUsedFrames)
                  00018852    00000092     fredi_frwv.obj (.text:sri_frwv_xmit)
                  000188e4    0000008c     rts430xl.lib : _printfi_min.obj (.text:_ltostr)
                  00018970    0000008a     sri_frwv_cmd_packet.obj (.text:sri_frwv_cmd_packet_were_slots_set)
                  000189fa    00000088     sri_frwv_send_fill.obj (.text:sri_frwv_fill_PDU_m2k)
                  00018a82    00000086     sri_frwv_cmd_packet.obj (.text:sri_frwv_freq_data_set)
                  00018b08    00000084     sri_msgqueue.obj (.text:sri_msgqueue_dequeue)
                  00018b8c    00000084     sri_msgqueue.obj (.text:sri_msgqueue_enqueue)
                  00018c10    00000080     sri_frwv_send_fill.obj (.text:sri_frwv_fill_PDU_tess)
                  00018c90    0000007c     sri_m2k_msg.obj (.text:m2k_xmit_setpid)
                  00018d0c    00000078     sri_frwv_cmd_packet.obj (.text:sri_frwv_cmd_packet_is_epoch_valid)
                  00018d84    00000076     sri_msgqueue.obj (.text:sri_msgqueue_init)
                  00018dfa    00000070     rts430xl.lib : vsnprintf.obj (.text:vsnprintf)
                  00018e6a    0000006e     sri_m2k_send.obj (.text:sri_m2k_send_dpcutype)
                  00018ed8    0000006e     sri_m2k_send.obj (.text:sri_m2k_send_reset)
                  00018f46    0000006e     sri_m2k_send.obj (.text:sri_m2k_send_resurrect)
                  00018fb4    0000006e     sri_m2k_send.obj (.text:sri_m2k_send_status)
                  00019022    0000006e     sri_queue.obj (.text:sri_queue_enqueue)
                  00019090    0000006c     fredi_uart.obj (.text:UART_putChar)
                  000190fc    0000006c     rts430xl.lib : vsnprintf.obj (.text:_outs)
                  00019168    0000006c     sri_frwv_packet.obj (.text:compare_radio_info)
                  000191d4    00000066     sri_imiles_send.obj (.text:sri_imls_send_admin_kill)
                  0001923a    00000066     sri_queue.obj (.text:sri_queue_dequeue)
                  000192a0    00000062     sri_pparse.obj (.text:sri_pparse_client_done)
                  00019302    00000060     rts430xl.lib : _printfi_min.obj (.text:_getarg_diouxp)
                  00019362    00000060     sri_quart.obj (.text:quart_init)
                  000193c2    00000060     sri_pparse.obj (.text:sri_pparse_init)
                  00019422    00000060     sri_queue.obj (.text:sri_queue_init)
                  00019482    0000005c     rts430xl.lib : autoinit.obj (.text:_auto_init)
                  000194de    0000005a                  : _printfi_min.obj (.text:_pproc_diouxp)
                  00019538    0000005a     sri_imiles_send.obj (.text:sri_imls_send_reset)
                  00019592    0000005a     sri_time.obj (.text:time_init)
                  000195ec    00000058     sri_m2k_display.obj (.text:lot2Line1Formatter)
                  00019644    00000058     rts430xl.lib : div32u.obj (.text)
                  0001969c    00000058     sri_pparse.obj (.text:sri_pparse_is_parser_reset)
                  000196f4    00000058     sri_time.obj (.text:time_now)
                  0001974c    00000056     sri_frwv_ack.obj (.text:sri_frwv_ack_init)
                  000197a2    00000054     sri_m2k_msg_selftest.obj (.text:m2kmsg_cmp_rtca_static_data)
                  000197f6    00000054     sri_frwv_packet.obj (.text:reset_radio_info)
                  0001984a    00000052     fredi_uart.obj (.text:UART_printf)
                  0001989c    00000050     fredi_io.obj (.text:init_MM2_uart)
                  000198ec    00000048     rts430xl.lib : _printfi_min.obj (.text:_pproc_str)
                  00019934    00000048     sri_rtca_data.obj (.text:sri_rtca_data_init)
                  0001997c    00000046     sri_quart.obj (.text:quart_read)
                  000199c2    00000046     sri_quart.obj (.text:quart_write)
                  00019a08    00000044     fredi_uart.obj (.text:UART_write)
                  00019a4c    00000044     rts430xl.lib : sprintf.obj (.text:sprintf)
                  00019a90    00000044     sri_pparse.obj (.text:sri_pparse_is_payload_valid)
                  00019ad4    00000042     fredi_frwv_status.obj (.text:sri_freewave_status_debug)
                  00019b16    00000042     sri_frwv_send_fill.obj (.text:sri_frwv_fill_init)
                  00019b58    00000042     sri_m2k_display.obj (.text:sri_m2k_display_set_rit_init)
                  00019b9a    00000040     rts430xl.lib : div32s.obj (.text)
                  00019bda    0000003e                  : asr32.obj (.text:l_asr_const)
                  00019c18    0000003e                  : lsr32.obj (.text:l_lsr_const)
                  00019c56    0000003e     sri_frwv_cmd_packet.obj (.text:sri_frwv_cmd_data_recalc_push_delay_ticks)
                  00019c94    0000003e     sri_rtca_data.obj (.text:sri_rtca_static_debug_dump)
                  00019cd2    0000003e     sri_xsums.obj (.text:sri_xsum_8bit_fletcher)
                  00019d10    0000003c     fredi_frwv.obj (.text:fredi_frwv_send_init)
                  00019d4c    0000003a     rts430xl.lib : memcmp.obj (.text:memcmp)
                  00019d86    00000038     fredi_io.obj (.text:init_GPS_uart)
                  00019dbe    00000038     fredi_io.obj (.text:init_MILES_uart)
                  00019df6    00000038     fredi_io.obj (.text:init_diag_uart)
                  00019e2e    00000038     fredi_io.obj (.text:init_uart)
                  00019e66    00000038     sri_debug.obj (.text:sri_assert_do)
                  00019e9e    00000038     sri_m2k_send.obj (.text:sri_m2k_send_init)
                  00019ed6    00000036     sri_frwv_packet.obj (.text:DoDamageCmd)
                  00019f0c    00000036     sri_frwv_cmd_packet.obj (.text:sri_frwv_cmd_packet_check_current_tdma_values)
                  00019f42    00000036     sri_frwv_cmd_packet.obj (.text:sri_frwv_freq_data_init)
                  00019f78    00000034     rts430xl.lib : _printfi_min.obj (.text:_div)
                  00019fac    00000034     sri_quart.obj (.text:quart_getrxbytesavail)
                  00019fe0    00000034     sri_pparse.obj (.text:sri_pparse_packet_peek_idx)
                  0001a014    00000032     rts430xl.lib : memccpy.obj (.text:memccpy)
                  0001a046    0000002e                  : vsnprintf.obj (.text:_outc)
                  0001a074    0000002e     fredi_qhandlers.obj (.text:fredi_qhandlers_UBLOX_i)
                  0001a0a2    0000002c     rts430xl.lib : div16s.obj (.text)
                  0001a0ce    0000002c     sri_frwv_cmd_fill.obj (.text:sri_frwv_cmd_fill_READ_ROM_TDMA)
                  0001a0fa    0000002c     sri_frwv_cmd_fill.obj (.text:sri_frwv_cmd_request)
                  0001a126    0000002c     sri_frwv_packet.obj (.text:sri_frwv_packet_insert_slotcmd)
                  0001a152    0000002a     sri_m2k_display.obj (.text:dynamicFormatter)
                  0001a17c    0000002a     rts430xl.lib : memcpy.obj (.text:memcpy)
                  0001a1a6    0000002a     sri_m2k_display.obj (.text:picSerialNumberFormatter)
                  0001a1d0    0000002a     sri_test_harness.obj (.text:sri_test_harness_func_result)
                  0001a1fa    0000002a     sri_m2k_display.obj (.text:ternSerialNumberFormatter)
                  0001a224    00000028     rts430xl.lib : sprintf.obj (.text:_outs)
                  0001a24c    00000028     fredi_frwv_status.obj (.text:fredi_frwv_status_init)
                  0001a274    00000024     sri_msgqueue.obj (.text:sri_msgqueue_isfull)
                  0001a298    00000022     fredi_qhandlers.obj (.text:fredi_qhandlers_default_o)
                  0001a2ba    00000022     rts430xl.lib : mult32_f5hw.obj (.text)
                  0001a2dc    00000022     sri_frwv_cmd_fill.obj (.text:sri_frwv_cmd_fill_ID)
                  0001a2fe    00000022     sri_frwv_cmd_fill.obj (.text:sri_frwv_cmd_fill_VERSION)
                  0001a320    00000022     sri_queue.obj (.text:sri_queue_isfull)
                  0001a342    00000022     sri_tspi_data.obj (.text:sri_tspi_data_init)
                  0001a364    00000020     rts430xl.lib : memset.obj (.text:memset)
                  0001a384    0000001e     sri_m2k_msg.obj (.text:sri_m2k_msg_damage_source_by_subcode)
                  0001a3a2    0000001e     sri_msgqueue.obj (.text:sri_msgqueue_getavail)
                  0001a3c0    0000001e     sri_tspi_data.obj (.text:sri_tspi_debug_dump_time)
                  0001a3de    0000001c     sri_frwv_cmd_fill.obj (.text:sri_frwv_cmd_request_init)
                  0001a3fa    0000001c     sri_frwv_cmd_fill.obj (.text:sri_frwv_cmd_request_set_RAM_frametable)
                  0001a416    0000001c     sri_msgqueue.obj (.text:sri_msgqueue_isempty)
                  0001a432    0000001c     sri_queue.obj (.text:sri_queue_isempty)
                  0001a44e    0000001a     rts430xl.lib : strlen.obj (.text:strlen)
                  0001a468    00000018     sri_frwv_cmd_packet.obj (.text:sri_frwv_cmd_data_recalc_numUsedFrames)
                  0001a480    00000018     sri_frwv_dual_parse.obj (.text:sri_frwv_dual_parse_reinit_state_machine)
                  0001a498    00000018     sri_xsums.obj (.text:sri_xsum_16bit_sum)
                  0001a4b0    00000018     sri_xsums.obj (.text:sri_xsum_8bit_blockparity)
                  0001a4c8    00000016     rts430xl.lib : div16u.obj (.text)
                  0001a4de    00000016                  : mult16_f5hw.obj (.text)
                  0001a4f4    00000016     sri_msgqueue.obj (.text:sri_msgqueue_getlength)
                  0001a50a    00000016     sri_queue.obj (.text:sri_queue_getlength)
                  0001a520    00000014     rts430xl.lib : sprintf.obj (.text:_outc)
                  0001a534    00000014     sri_xsums.obj (.text:sri_xsum_null)
                  0001a548    00000012     sri_imiles_send.obj (.text:show_send_buf)
                  0001a55a    00000010     sri_m2k_display.obj (.text:sri_m2k_display_get_rit_init)
                  0001a56a    00000010     sri_m2k_display.obj (.text:sri_m2k_display_set_rit_receive)
                  0001a57a    00000010     sri_m2k_display.obj (.text:sri_m2k_setVestType)
                  0001a58a    00000010     sri_m2k_display.obj (.text:sri_m2k_set_m2k_event_disable_state)
                  0001a59a    0000000e     fredi_qhandlers.obj (.text:fredi_qhandlers_init)
                  0001a5a8    0000000a     sri_time.obj (.text:time_go)
                  0001a5b2    00000008     fredi_qhandlers.obj (.text:fredi_qhandlers_handle)
                  0001a5ba    00000008     sri_frwv_cmd_packet.obj (.text:sri_frwv_cmd_packet_numUsedFrames)
                  0001a5c2    00000008     sri_frwv_cmd_packet.obj (.text:sri_frwv_cmd_packet_push_delay_ticks)
                  0001a5ca    00000008     sri_frwv_packet.obj (.text:sri_frwv_ediSerial)
                  0001a5d2    00000008     sri_m2k_display.obj (.text:sri_m2k_display_get_rit_receive)
                  0001a5da    00000008     sri_test_harness.obj (.text:sri_test_harness_is_in_test)
                  0001a5e2    00000006     sri_frwv_dual_parse.obj (.text:sri_frwv_dual_parse_client_done)
                  0001a5e8    00000006     sri_imiles_send.obj (.text:sri_imls_get_xmit_queue)
                  0001a5ee    00000006     sri_m2k_send.obj (.text:sri_m2k_get_xmit_queue)
                  0001a5f4    00000004     rts430xl.lib : pre_init.obj (.text:_system_pre_init)
                  0001a5f8    00000004                  : exit.obj (.text:abort)
                  0001a5fc    00000002                  : _lock.obj (.text:_nop)

  • Flash memory are for read only (except special operations "erase" or "program"). Variables, stack, etc. must use RAM.

  • After some tweaking I was able to alter the number and size of globals such that the .bss section, along with .cio .sysmem and .stack, all fit comfortably within the RAM section. However the micro is still does not correctly start at main() when debug is entered. I thought it might be a problem with accessing the upper blocks of memory, so I created a dummy app and forced the entire .text section to reside in 0x10000 and above. The result was the dummy app functioning just fine. To further investigate I took a look at the disassembly of each (see below). Both have valid pointers to main residing in FLASH2.

    The only difference I can tell is 0x07348:   13B1 9948           CALLA   #_auto_init  which is a fall through if the jump is not taken to #main.

    Any thoughts on why this is included in the trouble app and not the dummy one? Or any suggestions on what else to try to continue debugging the situation?

    - Mark

    Dummy app:

    c_int00, _c_int00_noexit:
    0x05CD8:   0081 5C00           MOVA    #0x05c00,SP
    0x05CDC:   1880 40F2 0F76 1E64 MOVX.A  #0x10f76,&lock
    0x05CE4:   1880 40F2 0F76 1E68 MOVX.A  #0x10f76,&unlock
    0x05CEC:   13B1 0F6E           CALLA   #_system_pre_init
    0x05CF0:   930C                TST.W   R12
    0x05CF2:   2402                JEQ     (C$L2)
    0x05CF4:   13B1 0AA0           CALLA   #_auto_init
             C$L2:
    0x05CF8:   430C                CLR.W   R12
    0x05CFA:   13B1 0666           CALLA   #main
    0x05CFE:   13B1 0F72           CALLA   #abort
             USCI_A1_ISR:
    0x05D02:   140F                PUSHM.A #1,R15
    0x05D04:   3C08                JMP     (C$L4)

             main:
    0x10666:   00B1 0008           SUBA    #0x00008,SP
    0x1066A:   40B2 5A80 015C      MOV.W   #0x5a80,&Watchdog_Timer_WDTCTL
    0x10670:   435C                MOV.B   #1,R12
    0x10672:   13B1 0D04           CALLA   #init_uart
    0x10676:   407C 0003           MOV.B   #0x0003,R12
    0x1067A:   13B1 0D04           CALLA   #init_uart
    0x1067E:   43D1 0006           MOV.B   #1,0x0006(SP)
    0x10682:   D232                EINT

    Trouble app:

    c_int00, _c_int00_noargs:
    0x07320:   0081 5C00           MOVA    #0x05c00,SP
    0x07324:   1800 43C2 5952      CLRX.A  &cleanup_ptr
    0x0732A:   1800 43C2 5956      CLRX.A  &dtors_ptr
    0x07330:   1880 40F2 B1FA 594A MOVX.A  #0x1b1fa,&lock
    0x07338:   1880 40F2 B1FA 594E MOVX.A  #0x1b1fa,&unlock
    0x07340:   13B1 B1EA           CALLA   #_system_pre_init
    0x07344:   930C                TST.W   R12
    0x07346:   2402                JEQ     (C$L4)
    0x07348:   13B1 9948           CALLA   #_auto_init
             C$L4:
    0x0734C:   430C                CLR.W   R12
    0x0734E:   13B1 281A           CALLA   #main
    0x07352:   431C                MOV.W   #1,R12
    0x07354:   13B1 A9EA           CALLA   #exit
             USCI_A3_ISR:
    0x07358:   140F                PUSHM.A #1,R15
    0x0735A:   3C00                JMP     (C$L7)
             C$L7:
    0x0735C:   421F 069E           MOV.W   &USCI_A3__UART_Mode_UCA3IV,R15
    0x07360:   930F                TST.W   R15
    0x07362:   2404                JEQ     (C$L8)
    0x07364:   832F                DECD.W  R15
    0x07366:   2402                JEQ     (C$L8)
    0x07368:   832F                DECD.W  R15
    0x0736A:   2400                JEQ     (C$L8)
             C$L8:
    0x0736C:   160F                POPM.A  #1,R15
    0x0736E:   1300                RETI

             main:
    0x1281A:   00B1 0130           SUBA    #0x00130,SP
    0x1281E:   40B2 5A80 015C      MOV.W   #0x5a80,&Watchdog_Timer_WDTCTL
    0x12824:   4381 008C           CLR.W   0x008c(SP)
    0x12828:   4381 008E           CLR.W   0x008e(SP)
    0x1282C:   13B1 9F58           CALLA   #time_now
    0x12830:   4C81 0090           MOV.W   R12,0x0090(SP)
    0x12834:   4D81 0092           MOV.W   R13,0x0092(SP)
    0x12838:   4381 0094           CLR.W   0x0094(SP)
    0x1283C:   4381 0096           CLR.W   0x0096(SP)
    0x12840:   4381 0098           CLR.W   0x0098(SP)
    0x12844:   4381 009A           CLR.W   0x009a(SP)

  • I appreciate the reply old_cow_yellow.  In digging in to SLAU131E, section 2.1 does call out ".bss section usually reserves space for uninitialized variables". I could foresee it being possible to manage the various global variables swapping them into and out of RAM as necessary; however, I think I would rather avoid that...

    I figured a better solution would be to attempt to reduce the size of the .bss section through eliminating some of the uninitialized global variables. I was successful and now the complete application fits into memory; however, I am still seeing the issue of entering main() at the start of debugging. I just posted what I have done thus far in hopes of debugging this issue... still searching for a solution.

    Thanks,

    - Mark

  • I think you can set a break-point at c_init00 (that is, at the address where the RESET VECTOR is pointing to) and then click at the Reset button on the Debug screen. It should break at c_init00.

    For your dummy app., that location is 0x5CD8. For your trouble app., that location is 0x07320.

    Alternatively, you could simply change PC to point to that location, instead of the starting location of main()

    Normally, Debug assumes you only want to debug your c code starting at main(). They did not think that the c start up code ever needs to be debugged (because they wrote it.)

  • Haha, well in this instance "they" would be wrong because that is where the issues emanate from. I had exactly the same thought after I left the office and had a chance to test it this morning. Setting a breakpoint at c_init00 *does* work and is a very effective way to observe the start-up code prior to execution of main. What I discovered from stepping through each the trouble app and the dummy app is that each execute CALLA   #_auto_init prior to (attempting) to call main. Within the various layers of _auto_init is a call to memcpy that loops for a while, presumably preparing memory for further execution. The bizarre thing is that not only does the trouble app never get to the call to main, but it loops back to c_init00 after four executions of the memcpy function... weird, right??!?

    The chunk of memcpy that loops is from 0x1AB8C to 0x1ABA0 below. The first three executions it successfully hits a breakpoint I have set at 0x1ABA2; however, on the fourth iteration it gets lost somewhere between 0x1AB8C to 0x1ABA0. I have tried to single step it through the assembly to see where the issue is, but after a hundred or so iterations I felt it was rather fruitless. The JLO and JNE jumps seem to have reasonable address to jump to, either back to C$L2 or continue on to C$L3. The only thing I can think of is that since this code resides in the upper FLASH block (i.e. >0x1000) the shortened address of (0xab8c) and (0xaba2) may be causing issue. This logic seems flawed though because this chunk of code successfully executes plenty of times prior to choking and looping back to #_auto_ini.

    Furthermore, perhaps the reason why I don't see this issue in the dummy app is because the code space is significantly smaller than the problem app so it is not reaching out to the extra memory with the memcpy... I might be reaching a bit on that one though :)

    Oh also, I should mention that pointing the PC to the address of #main does successfully enter main and from what I can tell I can debug as normal from there. So I have a temporary work around, but would very much like to figure out what is the route source of the issue.

    If there are any TI employees reading this, is this a known problem at all and how should one address it?

    Thanks,

    - Mark

             memcpy:
    0x1AB7C:   141A                PUSHM.A #2,R10
    0x1AB7E:   0CC9                MOVA    R12,R9
    0x1AB80:   930F                TST.W   R15
    0x1AB82:   2002                JNE     (0xab88)
    0x1AB84:   930E                TST.W   R14
    0x1AB86:   240D                JEQ     (0xaba2)
             C$L1:
    0x1AB88:   430A                CLR.W   R10
    0x1AB8A:   430B                CLR.W   R11
             C$L2:
    0x1AB8C:   00A9 0001           ADDA    #0x00001,R9
    0x1AB90:   4DF9 FFFF           MOV.B   @R13+,0xffff(R9)
    0x1AB94:   531A                INC.W   R10
    0x1AB96:   630B                ADC.W   R11
    0x1AB98:   9F0B                CMP.W   R15,R11
    0x1AB9A:   2BF8                JLO     (0xab8c)
    0x1AB9C:   2002                JNE     (0xaba2)
    0x1AB9E:   9E0A                CMP.W   R14,R10
    0x1ABA0:   2BF5                JLO     (0xab8c)
             C$L3:
    0x1ABA2:   1619                POPM.A  #2,R10
    0x1ABA4:   0110                RETA

  • Mark,

    If you have a lot of variables that need to be initialized at runtime, maybe the watchdog timer is expiring before you even hit main. Since you mention the processor getting reset (halting back at _c_int00) before completing the _auto_init, my guess is that the watchdog is causing the reset.

    If this is the issue, you can resolve it disabling the watchdog in the startup routine called before calling main. Please take a look at this article on how to do this: http://processors.wiki.ti.com/index.php/CCE_FAQ#Modifying_the_C_startup_routines_to_perform_application_specific_initialization_prior_to_calling_main.28.29_in_CCE_v3

    Although written for CCE3, the same idea applies to CCSv4. The file pre_init.c will be in the \tools\compiler\msp430\lib\rtssrc folder within CCSv4, after extracting rtssrc.zip. Add a copy of this file to your project and add the code to disable watchdog.

    Hope this helps.

     

  • Hi Aarti,

    Your suggestion worked like a charm! Thank you *very* much for identifying the issue. For the sake of anyone else reading this, the modification I made to pre_init.c is as follows:

    #include "msp430f5438.h"

    int _system_pre_init(void)
    {
        /* NOTE: STOPING WDT HERE WAS RECOMMENDED BY TI TO AVOID TIMING OUT
         * DURING START UP */
        WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
       
        return 1;
    }

    Then, as Aarti, commented include this file in your project and life is good!

    Thanks again,

    - Mark

  • I have no clue what your project does, but a look at the table you posted seems to indicate that there is much memory wasted by defining separate data storage for data buffers in different modules, instead of using the same buffer for all.

    e.g. sri_frwv_send_selftest.obj reserves 3 kb in bss for what? Just for temporary use when the function in this module is called? Each of the modules does the same. I guess (while of course not knowing the code) that ALL these modules could share the same glbal buffer as they probably only need it during their execution and do not store any permanent information in it.

    Also, often programs hold a 'blueprint' of initialized data structures in ram and only modify a parameter (or even copy the structure and then alter the required fields). Declaring this 'blueprint' const will move it from ram to flash. The workign copy can then be allocated on stack and freed after use.


    Just some thoughts on how to bring this memory hog (for an MSP) down to a usable size.

  • Hi Jens-Michael,

    Your observations are quite right. Along the same lines, I refactored portions of the code pushing variables used in modules such as the "selftest" out to flash via the #pragma DATA_SECTION directive. This opened up considerable space in RAM leaving plenty of space in flash as well. The end result is much the same as your suggestion of declaring as const and then pulling onto the stack at run-time. Thank you for taking the time to comment with these helpful hints as well.

    Best,

    - Mark

  • Hello,

    I had the exact same error with the debugging session, doesn't get to main but the program works good. I tried to solve this problem by the means exposed here (changing pre_init.c), I even changed the linker options as said in the other post so there is no symbol redefined. But now, i'm having another problem with this, the builder now throws: 

    Description Resource Path Location Type
    #66 expected a ";" lnk_msp430g2553.cmd /Lab2Interfaces line 22 C/C++ Problem

    Description Resource Path Location Type
    #78-D this declaration has no storage class or type specifier lnk_msp430g2553.cmd /Lab2Interfaces line 21 C/C++ Problem

    As you may guess, i'm using an MSP430G2553 and CCS 5.2, i'm also using Grace.

    Thank for your help my fellow engineers. :)

  • Well, on the G2553 there isn't so much ram that its initialization could cause the watchdog to bark. So the solution of diabling the watchdog will not work for you.

    Julian Grisales said:
    doesn't get to main but the program works good.

    What do you mean by this? Either it works good or it doesn't get to main. If main isn't executed, how can the program 'work good'?

  • Hi Jens-Michael,

    The program get build and even if the main isn't reached (only in CCS Debug), by means of magic (or just doesn't understable by me), the program still works, only you cannot use Breakpoints, so you are not debugging at all. After i did the previous procedure there were errors, i guess is because of what you just told me. 

    But I already solved this issue, after I did the whole pre_init.c procedure I was building the release version, I really don't know what this means but after i choose to build as debug version this works perfectly and i'm using breakpoints like a charm, worth clarifying that before modifying the pre_init.c file the debug was working neither in debug nor in release build options.

    Thank you very much for your reply, have a nice day! :)

  • That sounds weird.

    Well, the release version usually differs from the debug version in that it doesn't include debug information (or at lease onyl does include limited debug information) into the output file, so the debugger cannot assocuate certain memory addresses with source code lines. This mainly affects C code. However, the switch of the build likely got the whole project compied from scratch. Maybe your problem was that there was some previously compiled code that didn't get recompiled for some reason. It normally should, but sometimes, the automatic detection fails. In this case, doing a clean (which deletes all temporary files as if the project has never been compiled before) helps. Maybe your pre-init code was never linked before.

    About the original problem, it is possible that disabling the watchdog is necessary in your case too, but not because of the long and slow initialization of many variables. It is possible that the watchdg, if active, continues running if you hit a breakpoint, so it expires while the debugger is still fetching data form the MSP. so the MSP is reset while the debugger is still working on the break.
    Newer versions of the debugger are intended to stop the clocks on a breakpoint. This should also freeze the watchdog. But some compiler versions didn't do it properly on some devices, and IIRC on some MSPs, there is no way to stop the WDT clock at all.

**Attention** This is a public forum