SPRAAU8A March 2008 – August 2017 TMS320F2801 , TMS320F2801 , TMS320F2801-Q1 , TMS320F2801-Q1 , TMS320F28015 , TMS320F28015 , TMS320F28016 , TMS320F28016 , TMS320F28016-Q1 , TMS320F28016-Q1 , TMS320F2802 , TMS320F2802 , TMS320F2802-Q1 , TMS320F2802-Q1 , TMS320F28044 , TMS320F28044 , TMS320F2806 , TMS320F2806 , TMS320F2806-Q1 , TMS320F2806-Q1 , TMS320F28062 , TMS320F28062 , TMS320F28062-Q1 , TMS320F28062-Q1 , TMS320F28062F , TMS320F28062F , TMS320F28062F-Q1 , TMS320F28062F-Q1 , TMS320F28063 , TMS320F28063 , TMS320F28064 , TMS320F28064 , TMS320F28065 , TMS320F28065 , TMS320F28066 , TMS320F28066 , TMS320F28066-Q1 , TMS320F28066-Q1 , TMS320F28067 , TMS320F28067 , TMS320F28067-Q1 , TMS320F28067-Q1 , TMS320F28068F , TMS320F28068F , TMS320F28068M , TMS320F28068M , TMS320F28069 , TMS320F28069 , TMS320F28069-Q1 , TMS320F28069-Q1 , TMS320F28069F , TMS320F28069F , TMS320F28069F-Q1 , TMS320F28069F-Q1 , TMS320F28069M , TMS320F28069M , TMS320F28069M-Q1 , TMS320F28069M-Q1 , TMS320F2808 , TMS320F2808 , TMS320F2808-Q1 , TMS320F2808-Q1 , TMS320F2809 , TMS320F2809 , TMS320F2810 , TMS320F2810 , TMS320F2810-Q1 , TMS320F2810-Q1 , TMS320F2811 , TMS320F2811 , TMS320F2811-Q1 , TMS320F2811-Q1 , TMS320F2812 , TMS320F2812 , TMS320F2812-Q1 , TMS320F2812-Q1 , TMS320F28232 , TMS320F28232 , TMS320F28232-Q1 , TMS320F28232-Q1 , TMS320F28234 , TMS320F28234 , TMS320F28234-Q1 , TMS320F28234-Q1 , TMS320F28235 , TMS320F28235 , TMS320F28235-Q1 , TMS320F28235-Q1 , TMS320F28332 , TMS320F28332 , TMS320F28333 , TMS320F28333 , TMS320F28334 , TMS320F28334 , TMS320F28335 , TMS320F28335 , TMS320F28335-Q1 , TMS320F28335-Q1
The copy_sections routine is provided in the DSP28xxx_SectionCopy_nonBIOS.asm file. Once execution is to this phase, the watchdog has been disabled and the sections are ready to be copied. The copy for each section is prepared by storing the size of the section into the accumulator followed by storing the load address and run address into the XAR6 and XAR7 registers, respectively. An example of this functionality is as follows:
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
NOTE
The size, loadstart, and runstart symbols are all generated by the linker. This is discussed in the Memory Allocation – Linker Command Files section.
After the addresses and size has been stored, the copy subroutine is called to determine if the section was created by the compiler. This is tested by determining if the accumulator is 0:
copy:
B return,EQ ; Return if ACC is Zero (No section to copy)
SUBB ACC,#1
RPT AL ; Copy Section From Load Address to
|| PWRITE *XAR7, *XAR6++ ; Run Address
return:
LRETR ; Return
If the accumulator is 0, execution is returned to the calling address. If the accumulator is not zero, the section needs to be copied. This is performed by the PWRITE instruction as shown above. The PWRITE copies the memory pointed to by XAR6 to XAR7. In this case, from the load address to the run address. This continues until the accumulator is zero indicating the end of the section. Once all sections have been copied, a branch to the c_int00 routine is performed as shown.
LB _c_int00 ; Branch to start of boot.asm in RTS library
At this point, the C environment is setup and main() is entered. For complete copy_sections routine listing, see the DSP28xxx_SectionCopy_nonBIOS.asm file in the associated code files.