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.

5510DSK Hello Program Not Working Correctly

I created the Hello World program using the VC5510.cmd link file from CC5 (combined DRAM1, 2 $ 3 so that the ".text" code will fit in the memory.  Below is the partially VC5510.cmd file.

MEMORY
{
    MMR:     o = 0x000000  l = 0x0000c0  /* 192B Memory Mapped Registers */
    DARAM0:  o = 0x0000C0  l = 0x001F40  /* 8kB Dual Access RAM 0 */
    DARAM1:  o = 0x002000  l = 0x006000  /* 8kB Dual Access RAM 1 */
//    DARAM2:  o = 0x004000  l = 0x002000  /* 8kB Dual Access RAM 2 */
//    DARAM3:  o = 0x006000  l = 0x002000  /* 8kB Dual Access RAM 3 */

SECTIONS            
{                   
    vectors        >  DARAM1  /* If MPNMC = 1, remove the NOLOAD directive */
    .cinit         >  DARAM0
    .text          >  DARAM1
    .stack         >  DARAM0
    .sysstack      >  DARAM0
    .sysmem        >  DARAM4
    .data          >  DARAM4
    .cio           >  DARAM0
    .bss           >  DARAM5
    .const         >  DARAM0
}

The program built correctly and I checked the .map file and all the codes located to the correctly memory regions.  When I ran the program and after the "Hello World!" message was displayed, somehow the program jumped to some no code memory location (0x7f4865).

I traced through the assembly codes and found:

After the message was printed, the program jumped to location 005151. It looped from 005151 to 005153 2 times and when RET was executed, program jumped to 7f4865.  I couldn't figure out what's wrong!

        _eqld:
005125:   1a0020                   OR #0,AC0,AC2
005128:   1a0001                   OR #0,AC1,AC0
00512b:   1a0012                   OR #0,AC2,AC1
00512e:   2c01                     XOR AC0,AC1
005130:   65d1                     BCC #0x00513d,AC1 >= #0
005132:   7a80000a_2b02            MOV #-32768 << #16,AC0 || OR AC0,AC2
005138:   122c04                   CMPU AC2 != AC0, TC1
00513b:   4a14                     B #0x005151
00513d:   122000                   CMP AC2 == AC0, TC1
005140:   3c04_9ef4                XCCPART !TC1 || MOV #0,T0
005144:   047410                   BCC #0x005157,!TC1
005147:   7a7f800a                 MOV #32640 << #16,AC0
00514b:   ec3e22                   BCLR *SP(#1fh),AC2
00514e:   120424                   CMPU AC0 < AC2, TC1
005151:   3c04                     MOV #0,T0
005153:   3c14_9ef4                XCCPART !TC1 || MOV #1,T0
005157:   4804                     RET



7f4861:   ff                       .byte 0xff
7f4862:   003000                   RPTCC #0, AC0 <= #0
7f4865:   000000                   RPTCC #0, AC0 == #0
7f4868:   002200                   RPTCC #0, AC2 < #0
7f486b:   000020                   RPTCC #32, AC0 == #0
7f486e:   000000                   RPTCC #0, AC0 == #0

Partial Linker Map:

******************************************************************************
              TMS320C55x Linker PC v4.4.1                      
******************************************************************************
>> Linked Thu Apr 16 11:39:07 2015

OUTPUT FILE NAME:   <Hello.out>
ENTRY POINT SYMBOL: "_c_int00"  address: 00005f3b


MEMORY CONFIGURATION

         name            origin    length      used     unused   attr    fill
                        (bytes)   (bytes)    (bytes)   (bytes)
----------------------  --------  ---------  --------  --------  ----  --------
  MMR                   00000000   000000c0  00000000  000000c0  RWIX
  DARAM0                000000c0   00001f40  000009c0  00001580  RWIX
  DARAM1                00002000   00006000  00004170  00001e90  RWIX
  DARAM4                00008000   00002000  00000400  00001c00  RWIX
  DARAM5                0000a000   00002000  000004d4  00001b2c  RWIX
  DARAM6                0000c000   00002000  00000000  00002000  RWIX

.text        0     00002000  [ 00001000 ] 00004070          *   
                   00002000  [ 00001000 ] 000015a4          *   rts55x.lib : _printfi.obj (.text)
                   000035a4  [ 00001ad2 ] 00000543          *              : lowlev.obj (.text)
                   00003ae7  [ 00001d73+] 00000528          *              : trgdrv.obj (.text)
                   0000400f  [ 00002007+] 000004b5          *              : memory.obj (.text)
                   000044c4  [ 00002262 ] 000003cc          *              : divd.obj (.text)
                   00004890  [ 00002448 ] 0000027f          *              : fopen.obj (.text)
                   00004b0f  [ 00002587+] 0000025e          *              : llmpy.obj (.text)
                   00004d6d  [ 000026b6+] 0000025a          *              : addd.obj (.text)
                   00004fc7  [ 000027e3+] 000001ea          *              : cmpd.obj (.text)
                   000051b1  [ 000028d8+] 00000163          *              : fputs.obj (.text)
                   00005314  [ 0000298a ] 0000014c          *              : mpyd.obj (.text)
                   00005460  [ 00002a30 ] 000000e6          *              : setvbuf.obj (.text)
                   00005546  [ 00002aa3 ] 000000dd          *              : _io_perm.obj (.text)
                   00005623  [ 00002b11+] 000000c2          *              : fflush.obj (.text)
                   000056e5  [ 00002b72+] 000000ba          *              : trgmsg.obj (.text:CIO_breakpoint)
                   0000579f  [ 00002bcf+] 000000a6          *              : fputc.obj (.text)
                   00005845  [ 00002c22+] 000000a1          *              : divul.obj (.text)
                   000058e6  [ 00002c73 ] 0000007d          *              : ltoa.obj (.text)
                   00005963  [ 00002cb1+] 0000007b          *              : fclose.obj (.text)
                   000059de  [ 00002cef ] 00000076          *              : frcmpyd.obj (.text)
                   00005a54  [ 00002d2a ] 00000073          *              : frcmpyd_div.obj (.text)
                   00005ac7  [ 00002d63+] 00000072          *              : remul.obj (.text)
                   00005b39  [ 00002d9c+] 0000006f          *              : fixdli.obj (.text)
                   00005ba8  [ 00002dd4 ] 0000006d          *              : trgmsg.obj (.text)
                   00005c15  [ 00002e0a+] 0000006b          *              : fseek.obj (.text)
                   00005c80  [ 00002e40 ] 00000067          *              : fltlid.obj (.text)
                   00005ce7  [ 00002e73+] 0000005c          *              : atoi.obj (.text)
                   00005d43  [ 00002ea1+] 00000050          *              : printf.obj (.text)
                   00005d93  [ 00002ec9+] 0000004d          *              : autoinit.obj (.text)
                   00005de0  [ 00002ef0 ] 0000004b          *              : args_main.obj (.text)
                   00005e2b  [ 00002f15+] 0000004b          *              : remli.obj (.text)
                   00005e76  [ 00002f3b ] 00000048          *              : divli.obj (.text)
                   00005ebe  [ 00002f5f ] 0000003f          *              : memcpy.obj (.text)
                   00005efd  [ 00002f7e+] 0000003e          *              : exit.obj (.text)
                   00005f3b  [ 00002f9d+] 00000034          *              : boot.obj (.text)
                   00005f6f  [ 00002fb7+] 0000002a          *              : fixdi.obj (.text)
                   00005f99  [ 00002fcc+] 0000002a          *              : udiv.obj (.text)
                   00005fc3  [ 00002fe1+] 00000023          *              : memccpy.obj (.text)
                   00005fe6  [ 00002ff3 ] 0000001a          *              : isinf.obj (.text)
                   00006000  [ 00003000 ] 00000014          *              : subd.obj (.text)
                   00006014  [ 0000300a ] 00000013          *   hello.obj (.text)
                   00006027  [ 00003013+] 00000013          *   rts55x.lib : lmpy.obj (.text)
                   0000603a  [ 0000301d ] 00000012          *              : _lock.obj (.text)
                   0000604c  [ 00003026 ] 00000010          *              : negd.obj (.text)
                   0000605c  [ 0000302e ] 0000000a          *              : remove.obj (.text)
                   00006066  [ 00003033 ] 00000007          *              : exit.obj (.text:CIO_breakpoint)
                   0000606d  [ 00003036+] 00000002          *              : vectors.obj (.text)
                   0000606f  [ 00003037 ] 00000001          *   --HOLE-- [fill = 20]