Hello,
since I have always got very helpful answers from this community I come back with my current problem:
I use the F28335ezdsp development kit. My applications works properly when
loaded to ram.
I need to copy my program from flah to ram to reach the required speed.
For code generation I use Matlab/Simulink and Target Support Package.
When I generate a RAM-Application everything works fine.
When I generate a stand-alone application it is too slow so I tried to copy the
program to ram as describe in this guide:
"Copying Compiler Sections From Flash to RAM on the
TMS320F28xxx DSCs" SPRAAU8
1) I generate a application from my simulink model.
2) Then I modified the .cmd file:
original one:
_RTDX_interrupt_mask = ~0x000000008; /* int used by RTDX */
MEMORY
{
PAGE 0:
BEGINRAM: origin=0x0, length=0x2
RAMM0: origin=0x2, length=0x3fe
OTP: origin=0x380400, length=0x400
FLASH: origin=0x300000, length=0x3fff6
BEGINFLASH: origin=0x33fff6, length=0x2
CSM_PWL: origin=0x3f7ff8, length=0x8
IQTABLES: origin=0x3fe000, length=0xb50
IQTABLES2: origin=0x3feb50, length=0x8c
FPUTABLES: origin=0x3febdc, length=0x6a0
ROM: origin=0x3ff27c, length=0xd44
RESET: origin=0x3fffc0, length=0x2
VECTORS: origin=0x3fffc2, length=0x3e
RAML4L7: origin=0xc000, length=0x4000
ADC_CAL: origin=0x380080, length=0x9
ZONE7P: origin=0x200000, length=0x10000
PAGE 1:
RAML0L3: origin=0x8000, length=0x4000
RAMM1: origin=0x400, length=0x400
ZONE7D: origin=0x210000, length=0x10000
}
SECTIONS
{
.vectors: load = 0x000000000
.text: > RAML4L7, PAGE = 0
.switch: > RAML4L7, PAGE = 0
.bss: > RAML0L3, PAGE = 1
.ebss: > RAML0L3, PAGE = 1
.far: > RAML0L3, PAGE = 1
.cinit: > RAML4L7, PAGE = 0
.pinit: > RAML4L7, PAGE = 0
.const: > RAML0L3, PAGE = 1
.econst: > RAML0L3, PAGE = 1
.reset: > RESET, PAGE = 0, TYPE = DSECT
.data: > RAML0L3, PAGE = 1
.cio: > RAML0L3, PAGE = 1
.sysmem: > RAML0L3, PAGE = 1
.esysmem: > RAML0L3, PAGE = 1
.stack: > RAMM1, PAGE = 1
.rtdx_text: > RAML4L7, PAGE = 0
.rtdx_data: > RAML0L3, PAGE = 1
IQmath: > RAML4L7, PAGE = 0
codestart: > BEGINRAM, PAGE = 0
csmpasswds: > CSM_PWL, PAGE = 0
csm_rsvd: > RAMM0, PAGE = 0
ramfuncs: > RAML4L7, PAGE = 0
.adc_cal: > ADC_CAL, PAGE = 0 , TYPE = NOLOAD
IQmathTables: > IQTABLES, PAGE = 0 , TYPE = NOLOAD
IQmathTables2: > IQTABLES2, PAGE = 0 , TYPE = NOLOAD
FPUmathTables: > FPUTABLES, PAGE = 0 , TYPE = NOLOAD
DMA_SEC_A: load = 0xFFF4, PAGE = 0
DMA_SEC_B: load = 0xFFF0, PAGE = 0
}
-l "C:\Programme\MATLAB\R2010a\toolbox\idelink\extensions\ticcs\c2000\c2833xPeripherals.cmd"
modified one:
_RTDX_interrupt_mask = ~0x000000008; /* int used by RTDX */
MEMORY
{
PAGE 0:
BEGINRAM: origin=0x0, length=0x2
RAMM0: origin=0x2, length=0x3fe
OTP: origin=0x380400, length=0x400
FLASH: origin=0x300000, length=0x3fff6
BEGINFLASH: origin=0x33fff6, length=0x2
CSM_PWL: origin=0x3f7ff8, length=0x8
IQTABLES: origin=0x3fe000, length=0xb50
IQTABLES2: origin=0x3feb50, length=0x8c
FPUTABLES: origin=0x3febdc, length=0x6a0
ROM: origin=0x3ff27c, length=0xd44
RESET: origin=0x3fffc0, length=0x2
VECTORS: origin=0x3fffc2, length=0x3e
RAML4L7: origin=0xc000, length=0x4000
ADC_CAL: origin=0x380080, length=0x9
ZONE7P: origin=0x200000, length=0x10000
PAGE 1:
RAML0L3: origin=0x8000, length=0x4000
RAMM1: origin=0x400, length=0x400
ZONE7D: origin=0x210000, length=0x10000
}
SECTIONS
{
.vectors: load = 0x000000000
.text: LOAD=FLASH, PAGE = 0
RUN=RAML4L7, PAGE=0
LOAD_START(_text_loadstart),
RUN_START(_text_runstart),
SIZE(_text_size)
.switch: LOAD=FLASH, PAGE = 0
RUN=RAML4L7, PAGE=0
LOAD_START(_switch_loadstart),
RUN_START(_switch_runstart),
SIZE(_switch_size)
.bss: > RAML0L3, PAGE = 1
.ebss: > RAML0L3, PAGE = 1
.far: > RAML0L3, PAGE = 1
.cinit: LOAD=FLASH, PAGE = 0
RUN=RAML4L7, PAGE=0
LOAD_START(_cinit_loadstart),
RUN_START(_cinit_runstart),
SIZE(_cinit_size)
.pinit: LOAD=FLASH, PAGE = 0
RUN=RAML4L7, PAGE=0
LOAD_START(_pinit_loadstart),
RUN_START(_pinit_runstart),
SIZE(_pinit_size)
.const: LOAD=FLASH, PAGE = 0
RUN=RAML0L3, PAGE=0
LOAD_START(_const_loadstart),
RUN_START(_const_runstart),
SIZE(_const_size)
.econst: LOAD=FLASH, PAGE = 0
RUN=RAML0L3, PAGE=0
LOAD_START(_econst_loadstart),
RUN_START(_econst_runstart),
SIZE(_econst_size)
.reset: > RESET, PAGE = 0, TYPE = DSECT
.data: > RAML0L3, PAGE = 1
.cio: > RAML0L3, PAGE = 1
.sysmem: > RAML0L3, PAGE = 1
.esysmem: > RAML0L3, PAGE = 1
.stack: > RAMM1, PAGE = 1
.rtdx_text: > FLASH, PAGE = 0
.rtdx_data: > RAML0L3, PAGE = 1
IQmath: > FLASH, PAGE = 0
codestart: > BEGINFLASH, PAGE = 0
wddisable: > FLASH, PAGE=0
copysections: > FLASH, PAGE=0
csmpasswds: > CSM_PWL, PAGE = 0
csm_rsvd: > RAMM0, PAGE = 0
ramfuncs: LOAD = FLASH,
RUN = RAMM0,
LOAD_START(_RamfuncsLoadStart),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
PAGE = 0
.adc_cal: > ADC_CAL, PAGE = 0 , TYPE = NOLOAD
IQmathTables: > IQTABLES, PAGE = 0 , TYPE = NOLOAD
IQmathTables2: > IQTABLES2, PAGE = 0 , TYPE = NOLOAD
FPUmathTables: > FPUTABLES, PAGE = 0 , TYPE = NOLOAD
DMA_SEC_A: load = 0xFFF4, PAGE = 0
DMA_SEC_B: load = 0xFFF0, PAGE = 0
}
-l "C:\Programme\MATLAB\R2010a\toolbox\idelink\extensions\ticcs\c2000\c2833xPeripherals.cmd"
3) I replace the Code_Start_Branch.asm with this file (from SPRAAU8)
WD_DISABLE .set 1 ;set to 1 to disable WD, else set to 0
.ref copy_sections
.global code_start
***********************************************************************
* Function: codestart section
*
* Description: Branch to code starting point
***********************************************************************
.sect "codestart"
code_start:
.if WD_DISABLE == 1
LB wd_disable ;Branch to watchdog disable code
.else
LB copy_sections ;Branch to copy_sections
.endif
;end codestart section
***********************************************************************
* Function: wd_disable
*
* Description: Disables the watchdog timer
***********************************************************************
.if WD_DISABLE == 1
.sect "wddisable"
wd_disable:
SETC OBJMODE ;Set OBJMODE for 28x object code
EALLOW ;Enable EALLOW protected register access
MOVZ DP, #7029h>>6 ;Set data page for WDCR register
MOV @7029h, #0068h ;Set WDDIS bit in WDCR to disable WD
EDIS ;Disable EALLOW protected register access
LB copy_sections ;Branch to copy_sections
.endif
;end wd_disable
.end
4) and add the file "SectionCopy_nonBios.asm"
;############################################################################
;
; FILE: DSP28xxx_SectionCopy_nonBIOS.asm
;
; DESCRIPTION: Provides functionality for copying intialized sections from
; flash to ram at runtime before entering the _c_int00 startup
; routine
;############################################################################
; Author: Tim Love
; Release Date: March 2008
;############################################################################
.ref _c_int00
.global copy_sections
.global _cinit_loadstart, _cinit_runstart, _cinit_size
.global _const_loadstart, _const_runstart, _const_size
.global _econst_loadstart, _econst_runstart, _econst_size
.global _pinit_loadstart, _pinit_runstart, _pinit_size
.global _switch_loadstart, _switch_runstart, _switch_size
.global _text_loadstart, _text_runstart, _text_size
***********************************************************************
* Function: copy_sections
*
* Description: Copies initialized sections from flash to ram
***********************************************************************
.sect "copysections"
copy_sections:
MOVL XAR5,#_const_size ; Store Section Size in XAR5
MOVL ACC,@XAR5 ; Move Section Size to ACC
MOVL XAR6,#_const_loadstart ; Store Load Starting Address in XAR6
MOVL XAR7,#_const_runstart ; Store Run Address in XAR7
LCR copy ; Branch to Copy
MOVL XAR5,#_econst_size ; Store Section Size in XAR5
MOVL ACC,@XAR5 ; Move Section Size to ACC
MOVL XAR6,#_econst_loadstart ; Store Load Starting Address in XAR6
MOVL XAR7,#_econst_runstart ; Store Run Address in XAR7
LCR copy ; Branch to Copy
MOVL XAR5,#_pinit_size ; Store Section Size in XAR5
MOVL ACC,@XAR5 ; Move Section Size to ACC
MOVL XAR6,#_pinit_loadstart ; Store Load Starting Address in XAR6
MOVL XAR7,#_pinit_runstart ; Store Run Address in XAR7
LCR copy ; Branch to Copy
MOVL XAR5,#_switch_size ; Store Section Size in XAR5
MOVL ACC,@XAR5 ; Move Section Size to ACC
MOVL XAR6,#_switch_loadstart ; Store Load Starting Address in XAR6
MOVL XAR7,#_switch_runstart ; Store Run Address in XAR7
LCR copy ; Branch to Copy
MOVL XAR5,#_text_size ; Store Section Size in XAR5
MOVL ACC,@XAR5 ; Move Section Size to ACC
MOVL XAR6,#_text_loadstart ; Store Load Starting Address in XAR6
MOVL XAR7,#_text_runstart ; Store Run Address in XAR7
LCR copy ; Branch to Copy
MOVL XAR5,#_cinit_size ; Store Section Size in XAR5
MOVL ACC,@XAR5 ; Move Section Size to ACC
MOVL XAR6,#_cinit_loadstart ; Store Load Starting Address in XAR6
MOVL XAR7,#_cinit_runstart ; Store Run Address in XAR7
LCR copy ; Branch to Copy
LB _c_int00 ; Branch to start of boot.asm in RTS library
copy:
B return,EQ ; Return if ACC is Zero (No section to copy)
RPT AL ; Copy Section From Load Address to
|| PWRITE *XAR7, *XAR6++ ; Run Address
return:
LRETR ; Return
.end
;//===========================================================================
;// End of file.
;//===========================================================================
5) my program however does not start working properly
I think it does not jumpt to the program start or something like this.
Does anyone have an idea where I went wrong?
Thank you
Thomas