Other Parts Discussed in Thread: C2000WARE
Tool/software:
Hello,
I have been going through the other threads on this topic and I am still not quite understanding some things.
I am wanting to create a custom SPI bootloader for the 280039C. I want this custom SPI bootloader to be in the first FLASH sector right after the
BEGIN : origin = 0x00080000, length = 0x00000002
/* Flash sectors */
/* BANK 0 */
SPI_BOOT_LOADER : origin = 0x080002, length = 0x000FFE
I am using the Boot ROM code found at: C:\ti\c2000\C2000Ware_5_02_00_00\libraries\boot_rom\f28003x as a starting point for the bootloader.
I am trying to understand the sequence of how this would all work. I stepped through an existing C2000Ware project.
In the linker.cmd file you have the following section at the beginning of the FLASH
BEGIN : origin = 0x00080000, length = 0x00000002
SECTIONS
{
codestart : > BEGIN, ALIGN(8)
Looking at this location in a downloaded application you see the following:

where there is an OP code for a jump to 0x8324D which is where f28003x_codestartbranch.asm resides.
0008324d 00000008 f28003x_codestartbranch.obj (.text)
where it has the following code:
WD_DISABLE .set 1 ;set to 1 to disable WD, else set to 0
.ref _c_int00
.global code_start
***********************************************************************
* Function: codestart section
*
* Description: Branch to code starting point
***********************************************************************
.sect "codestart"
.retain
code_start:
.if WD_DISABLE == 1
LB wd_disable ;Branch to watchdog disable code
.else
LB _c_int00 ;Branch to start of boot._asm in RTS library
.endif
;end codestart section
***********************************************************************
* Function: wd_disable
*
* Description: Disables the watchdog timer
***********************************************************************
.if WD_DISABLE == 1
.text
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 _c_int00 ;Branch to start of boot._asm in RTS library
.endif
;end wd_disable
.end
QUESTION: So having the following in the linker.cmd file - codestart : > BEGIN, ALIGN(8) - and code_start in f28003x_codestartbranch.asm (see code above) puts the address of f28003x_codestartbranch.asm at BEGIN 0x80000? Not quite sure how this works?
From here it branches to LB _c_int00 ;Branch to start of boot._asm in RTS library in boot28.asm. This initializes a bunch of things before jumping to main:
LCR __args_main ; execute main()
QUESTION: I am not sure what I need to do to upon power up jump to the custom bootloader code at 0x080002?
QUESTION It looks like the f28003x_codestartbranch.asm and boot28.asm are needed in the bootup sequence? If the answer is yes, they currently reside in .text section outside of my SPI_BOOT_LOADER section. How would I move them into my SPI_BOOT_LOADER section?
Thank you for any help,
Brent