DSP2812 Learning notes-Internal flash boot process

Source: Internet
Author: User

2812 detailed process instructions for booting from internal flash:

A) program hardware reset or software reset

b) Determine if the MP/MC is 0, 0 is booting from the boot ROM, otherwise from the external boot (see Appendix 1)

c) Remove the reset vector to the boot ROM's 0x3fffc0 and jump to the boot function

d) Capture IO pin status and select boot mode based on IO status (see Appendix 2)

e) If it is flash, the program exits the boot function and jumps to 0x3f7ff6

f) Take out the jump instruction and jump to your designated address or C-initialized entry _c_int00

g) At the entrance of the C initialization _c_int00 the necessary settings for some variables, stacks, and registers, which are within the library function of C

h) Enter main function

(a)After power-on reset,(c)The reset vector is pointing to the on-chip Flash 0x3fffc0,2812 has a flash address from the 0X3FF000-0X3FFFFF at the factory has cured the boot program. At 0X3FFFC0 is a jump instruction that jumps to Iniboot (address 0x3f FC00) function is executed atIniboot code, the Iniboot code isTIin theDSP is factory-cured in Flash.(d)Initboot Assembly routine will select the Selectbootmode function startup mode functions. This function determines the startup type by the state of the GPIO pin (see Appendix 2). Once the start is complete, select the Start Mode function to return an entry address to the Initboot function. The entry address is the starting point for code execution after exiting bootloader. Initboot will then invoke the Exitboot subroutine to restore the state of the CPU register to the reset state. such as flash boot mode,(e)Then jump to 0x3f7ff6 at the end of initboot execution.(Codestart Office), this location is just128-bit (CSM) password location,(f)You have to place a jump command at 0X3F7FF6 (see Appendix 3) to jump to where you want to go, such as a boot loader or app code, and the usual jump destination is _c_int00.(g)The above code executes after jumping to the C-initialized entry _c_int00 (0x3f6000), at the C-initialized entry, _c_int00 the necessary settings for some variables, stacks, and registers (see Appendix 4).(h)CallThe main function starts to run the C program.

Appendix 1:XMP/~MC

When the pin for high-level is indicated by the microprocessor mode (microprocessor), for low-current to indicate the micro-computer mode (microcomputer), when the microprocessor mode, 2812 internal bootrom is forbidden, through the Zone7 (0x3F C000) starts from the external tuning boot program. 2812 after reset, its reset vector is a fixed 0x3fffc0, if it is a microprocessor mode, then reset after resetting the vector point to the external address, that is, 0X3FFFC0 is Zone7 address, if it is a micro-computer mode, So 0x3fffc0 points to the 2812 on-chip flash address.

Appendix 2: Boot Mode selection

GPIOF4

GPIOF12

GPIOF3

GPIOF2

(SCITXDA)

(MDXA)

(Spistea)

(SPICLK)

Pu

No PU

No PU

No PU

Mode Selected

1

X

X

X

Jump to flash with address 0x3f7ff6, where the user must write a branch statement that takes precedence over the reset to reposition the execution of the code as needed.

0

1

X

X

Call Spi_boot to load from an external EEPROM

0

0

1

1

Call Sci_boot to load from sci-a

0

0

1

0

J Jump to H0 SARAM 0x3F 8000

0

0

0

1

Jump to OTP address 0x3d 7800

0

0

0

0

Call Parallel_boot to load from Gpio Port B

Appendix 3: Placing a jump instruction at 0x3f 7ff6, jumping to the portal of C initialization _c_int00 (0x3f6000)

(In Dsp281x_codestartbranch.asm):
. Sect "Codestart"
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
. if wd_disable = = 1
. text
Wd_disable:
SetC Objmode
Eallow
Movz DP, #7029h >>6
MOV @7029h, #0068h
EDIS
LB _c_int00
. endif
. end

The corresponding location in the cmd file

Memery
{
Page 0:
...........

Raml0:origin = 0x008000, length = 0x001000/* on-chip RAM block L0 */

Otp:origin = 0x3d7800, length = 0x000400/* on-chip OTP */

Flashd:origin = 0x3f0000, length = 0x002000/* on-chip FLASH */

Flashc:origin = 0x3f2000, length = 0x002000/* on-chip FLASH */

Flasha:origin = 0x3f6000, length = 0x001f80/* on-chip FLASH */

Csm_rsvd:origin = 0x3f7f80, length = 0x000076

Begin:origin = 0x3f7ff6, length = 0x000002

...........
}
SECTIONS
{ ..........
/* Allocate Program areas: */

. cinit: > Flasha PAGE = 0

. Pinit: > Flasha, PAGE = 0

. Text: > FLASHC PAGE = 0

codestart : > BEGIN PAGE = 0

Ramfuncs:load = Flashd,

RUN = RAML0,

Load_start (_ramfuncsloadstart),

Load_end (_ramfuncsloadend),

Run_start (_ramfuncsrunstart),

PAGE = 0

Csmpasswds: > Csm_pwl PAGE = 0

CSM_RSVD: > Csm_rsvd PAGE = 0

/* Allocate uninitalized Data sections: */

. stack: > RAMM0 PAGE = 1

. EBSS: > RAML1 PAGE = 1

. Esysmem: > RAML1 PAGE = 1

/* for Sdflash to program these, they must is allocated to page 0 */

. econst: > Flasha PAGE = 0

. Switch: > Flasha PAGE = 0
..........
}

Appendix 4:_c_int00

This function in the Run Support Library (rts.lib) ,the _c_int00 function for the establishment of the C Runtime Environment, the following work is required:

1. Generate a . stack block for the system stack and initialize the stack pointer;

2. Copy the initialization data from the . Cinit block to the corresponding variable in the . BSS Block;

3. Make the necessary configuration of the register, call the main function to start the C program;

DSP2812 Learning notes-Internal flash boot process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.