Reply by Richard Williams August 3, 20082008-08-03
Z,

THe .out file is not an executable image.

The .out file contains relocation info, string table info, location info for all
variables, 1 or 2 header sections, the actual .text area, constant values, and
much more.
The actual contents of the .text area depend on if the link was a relocatable or
a fixed location link and if the initialization of constants, etc is performed
at load time or at run time.

The best way, that I know of, to produce a executable image is:
link for a specific fixed location
select initialization at run time
use the hex... executable utility to convert the .out file to some format that
your code knows how to load. Ascii hex works ok.

again, the .out file is NOT an executable image. The CCS loader utility knows
how to massage the .out file into the actual image in memory; but that will do
your code no good.

BTW
the format of the .out file is COFF2. Just in case you decide to write a boot
loader that can handle that format.
COFF2 is NOT the same as COFF, for which there are several source and executable
utilities available on-line to handle COFF.

R. Williams

---------- Original Message -----------
From: z...@yahoo.com
To: c...
Sent: Mon, 28 Jul 2008 07:04:41 -0400
Subject: [c6x] flash programming and bootloader for dsk6713

> Hi,
> For DSK6713 flash programming, I write a program that read main code
> as a input file then write to flash. Input file contain the hex code
> of out file according to data file formats in CCS3.1. But after reset,
> program doesn't run correctly on DSP. I am confused and thanks for any
> guidance Zahra
------- End of Original Message -------
Reply by christophe blouet July 30, 20082008-07-30
After reset 0x400 bytes are copied from Flash to IRAM, this means 1kb, this is done by Hardware.
In those 0x400 bytes you must find the interrupt vectors especially the reset vector at address 0x0.
You have also to find your own copy program (secondary boot loader) that will copy the rest of your code to its place in IRAM or SRAM and the EMIF init.
and then a call to c_int00 (B c_int00).
the c_int00 is setting the differents sections of your code, bss, data, etc...and then call main function with parameters and allow to exit from it.

All this is detalied in spra999a

I am not sure your firstloop in your boot code is necessary.

Date: Tue, 29 Jul 2008 05:01:21 -0700From: z...@yahoo.comSubject: RE: [c6x] flash programming and bootloader for dsk6713To: c...@hotmail.com; m...@gmail.comCC: c...

--- On Tue, 29/7/08, christophe blouet wrote:
From: christophe blouet Subject: RE: [c6x] flash programming and bootloader for dsk6713To: "Michael Dunn" , z...@yahoo.comCc: c...Date: Tuesday, 29 July, 2008, 7:17 AM
Yes, I guess you're talking about HW breakpoints, in the first boot stage... Zahra, can you me more specific when you say it's not working?
is it copying your application into RAM ?
fter reset cpu (debug->reset cpu) 1KB of flash copy to first 1 KB of IRAM and didnt copy flash data after address: 0x90000400 to IRAM after 0x00000400.(IRAM section is in 0x00000400 to 0x0002fc00)

Data in IRAM is beyond to previous program that was loaded to DSP before reset cpu.

Now a question: when do boot loader copy data to IRAM and how?
Or what am I doing after this?
In many documents said: jump to c_int00, but how?

What operation be done in c_int00? Is it only reset?
Is it possible to change in c_int00 function?
is it setting PLL properly, is it setting EMIF properly?

PLL is set in main and EMIF is set in bootloader .

For more details this is my bootloader code:
;
; ======== boot_c671x.s62 =======;
.title "Flash bootup utility"
.option D,T
.length 102
.width 140

; global EMIF symbols defined for the c671x family
.include boot_c671x.h62

; Address of the generated boot-table
COPY_TABLE .equ 0x90000400

.sect ".boot_load"
.global _boot

_boot:
;************************************************************************
;* DEBUG LOOP - COMMENT OUT B FOR NORMAL OPERATION
;************************************************************************

zero B1
_myloop: ; [!B1] B _myloop
nop 5
_myloopend: nop

;************************************************************************
;* CONFIGURE EMIF
;************************************************************************

;****************************************************************
; *EMIF_GCTL = EMIF_GCTL_V;
;****************************************************************

mvkl EMIF_GCTL,A4
|| mvkl EMIF_GCTL_V,B4

mvkh EMIF_GCTL,A4
|| mvkh EMIF_GCTL_V,B4

stw B4,*A4

;****************************************************************
; *EMIF_CE0 = EMIF_CE0_V
;****************************************************************

mvkl EMIF_CE0,A4
|| mvkl EMIF_CE0_V,B4

mvkh EMIF_CE0,A4
|| mvkh EMIF_CE0_V,B4

stw B4,*A4

;****************************************************************
; *EMIF_CE1 = EMIF_CE1_V (setup for 8-bit async)
;****************************************************************

mvkl EMIF_CE1,A4
|| mvkl EMIF_CE1_V,B4

mvkh EMIF_CE1,A4
|| mvkh EMIF_CE1_V,B4

stw B4,*A4

;****************************************************************
; *EMIF_CE2 = EMIF_CE2_V (setup for 32-bit async)
;****************************************************************

mvkl EMIF_CE2,A4
|| mvkl EMIF_CE2_V,B4

mvkh EMIF_CE2,A4
|| mvkh EMIF_CE2_V,B4

stw B4,*A4

;****************************************************************
; *EMIF_CE3 = EMIF_CE3_V (setup for 32-bit async)
;****************************************************************

|| mvkl EMIF_CE3,A4
|| mvkl EMIF_CE3_V,B4 ;

mvkh EMIF_CE3,A4
|| mvkh EMIF_CE3_V,B4

stw B4,*A4

;****************************************************************
; *EMIF_SDRAMCTL = EMIF_SDRAMCTL_V
;****************************************************************
|| mvkl EMIF_SDRAMCTL,A4
|| mvkl EMIF_SDRAMCTL_V,B4 ;

mvkh EMIF_SDRAMCTL,A4
|| mvkh EMIF_SDRAMCTL_V,B4

stw B4,*A4

;****************************************************************
; *EMIF_SDRAMTIM = EMIF_SDRAMTIM_V
;****************************************************************
|| mvkl EMIF_SDRAMTIM,A4
|| mvkl EMIF_SDRAMTIM_V,B4 ;

mvkh EMIF_SDRAMTIM,A4
|| mvkh EMIF_SDRAMTIM_V,B4

stw B4,*A4

;****************************************************************
; *EMIF_SDRAMEXT = EMIF_SDRAMEXT_V
;****************************************************************
|| mvkl EMIF_SDRAMEXT,A4
|| mvkl EMIF_SDRAMEXT_V,B4 ;

mvkh EMIF_SDRAMEXT,A4
|| mvkh EMIF_SDRAMEXT_V,B4

stw B4,*A4

;****************************************************************************
; copy sections
;****************************************************************************
mvkl COPY_TABLE, a3 ; load table pointer
mvkh COPY_TABLE, a3

ldw *a3++, b1 ; Load entry point

copy_section_top:
ldw *a3++, b0 ; byte count
ldw *a3++, a4 ; ram start address
nop 3

[!b0] b copy_done ; have we copied all sections?
nop 5

copy_loop:
ldb *a3++,b5
sub b0,1,b0 ; decrement counter
[ b0] b copy_loop ; setup branch if not done
[!b0] b copy_section_top
zero a1
[!b0] and 3,a3,a1
stb b5,*a4++
[!b0] and -4,a3,a5 ; round address up to next multiple of 4
[ a1] add 4,a5,a3 ; round address up to next multiple of 4

;****************************************************************************
; jump to entry point
;****************************************************************************
copy_done:
b .S2 b1
nop 5

This can be observed with a scope...to debug, you can load only the symbols, so you can have a link to your original C code but continue to debug the code stored in Flash.

which symbols? how?
regards
Zahra Hope it helps
Messenger blocked? Want to chat? Here is the solution.
Reply by christophe blouet July 29, 20082008-07-29
Yes, I guess you're talking about HW breakpoints, in the first boot stage...

Zahra, can you me more specific when you say it's not working?
is it copying your application into RAM ?
is it setting PLL properly, is it setting EMIF properly? This can be observed with a scope...
to debug, you can load only the symbols, so you can have a link to your original C code but continue to debug the code stored in Flash.

Hope it helps
Reply by Michael Dunn July 28, 20082008-07-28
Zahra,

Please do not break an existing tread. Reply to the last email.

See comments below.

On Mon, Jul 28, 2008 at 6:04 AM, wrote:
> Hi,
> For DSK6713 flash programming, I write a program that read main code as a
> input file then write to flash. Input file contain the hex code of out file
> according to data file formats in CCS3.1.
> But after reset, program doesn't run correctly on DSP.
> I am confused and thanks for any guidance
> Zahra

Christophe provided a very good suggestion.

1. select cpu->reset in CCS. This will boot the initial code and set
the PC to 0.
2. You can step from there or set a BP in your code and hit run. If
you are patient, you can step through your entire boot loader.

mikedunn

--
www.dsprelated.com/blogs-1/nf/Mike_Dunn.php
Reply by z_11...@yahoo.com July 28, 20082008-07-28
Hi,
For DSK6713 flash programming, I write a program that read main code as a input file then write to flash. Input file contain the hex code of out file according to data file formats in CCS3.1.
But after reset, program doesn't run correctly on DSP.
I am confused and thanks for any guidance
Zahra