; -------------------------------------------------------------------------------- ; @Title: TMS470 internal flash of TMS470R1A256 ; ; @Description: ; Script arguments: ; ; DO tms470r1a256 [PREPAREONLY] ; ; PREPAREONLY only declares flash but does not execute flash programming ; ; Example: ; ; DO ~~/demo/arm/flash/tms470r1a256 PREPAREONLY ; ; Flash size is 256 kBytes. ; RAM size is 12 kBytes. ; ; @Author: WRD ; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only ; @Chip: TMS470R1A256 ; -------------------------------------------------------------------------------- ; $Rev: 10516 $ ; $Id: tms470r1a256.cmm 10516 2022-02-02 11:39:30Z bschroefel $ LOCAL ¶meters ENTRY %LINE ¶meters LOCAL ¶m_prepareonly ¶m_prepareonly=(STRing.SCAN(STRing.UPpeR("¶meters"),"PREPAREONLY",0)!=-1) ; -------------------------------------------------------------------------------- ; Module configuration ; Flash control register base address &FlashControl_Base=0xffe88000 ; Flash clock setup &Frequency="12MHz" ; Flash protection &Protection_Keys=0x00001FF0 ; Protection key location in first sector of flash ; JSM - JTAG Security Module &JTAG_Security_Keys=0x0 ; JSM is not available ; MSM - Memory Security Module 1 &Memory_Security_1_Keys=0x0 ; MSM is not available ; RAM configuration &RamStart=0x01000000 &RamSize=0x00003000 ; -------------------------------------------------------------------------------- ; Setup CPU DO ~~~~/tms470r1-func Setup_CPU TMS470R1A256 ; -------------------------------------------------------------------------------- ; Initialization &MFBAHR2=&RamStart>>16. &MFBALR2=(&RamStart&0x0000fc00)|0x50 ; Bus configuration Data.Set 0xFFFFFE00 %Long 0x00000000 0x00000090 ; MFBAxR0 - 256 kByte flash at 0x00000000 Data.Set 0xFFFFFE08 %Long 0x00000000 0x00000000 ; MFBAxR1 Data.Set 0xFFFFFE10 %Long &MFBAHR2 &MFBALR2 ; MFBAxR2 - 12 kByte RAM at &RamStart Data.Set 0xFFFFFE18 %Long 0x00000000 0x00000000 ; MFBAxR3 Data.Set 0xFFFFFE04 %Long Data.Long(SD:0xFFFFFE04)|0x100 ; MFBAxR0 - Enable memory map ; Configure PLL Data.Set 0xFFFFFFDC %Long 0x00000007 ; -------------------------------------------------------------------------------- ; Flash declaration FLASH.RESet ; addr size core sector DO ~~~~/tms470r1-func DeclareSector 0x00000000 0x2000 0x00 0x00 DO ~~~~/tms470r1-func DeclareSector 0x00002000 0x2000 0x00 0x01 DO ~~~~/tms470r1-func DeclareSector 0x00004000 0x2000 0x00 0x02 DO ~~~~/tms470r1-func DeclareSector 0x00006000 0x2000 0x00 0x03 DO ~~~~/tms470r1-func DeclareSector 0x00008000 0x8000 0x00 0x04 DO ~~~~/tms470r1-func DeclareSector 0x00010000 0x8000 0x00 0x05 DO ~~~~/tms470r1-func DeclareSector 0x00018000 0x8000 0x00 0x06 DO ~~~~/tms470r1-func DeclareSector 0x00020000 0x8000 0x00 0x07 DO ~~~~/tms470r1-func DeclareSector 0x00028000 0x8000 0x00 0x08 DO ~~~~/tms470r1-func DeclareSector 0x00030000 0x8000 0x00 0x09 DO ~~~~/tms470r1-func DeclareSector 0x00038000 0x2000 0x00 0x0a DO ~~~~/tms470r1-func DeclareSector 0x0003a000 0x2000 0x00 0x0b DO ~~~~/tms470r1-func DeclareSector 0x0003c000 0x2000 0x00 0x0c DO ~~~~/tms470r1-func DeclareSector 0x0003e000 0x2000 0x00 0x0d DO ~~~~/tms470r1-func DeclareAlgorithm &RamStart &RamSize FLASH.CLocK &Frequency ; -------------------------------------------------------------------------------- ; Unprotect flash DO ~~~~/tms470r1-func FlashProtection 0xffffffff 0xffffffff 0xffffffff 0xffffffff ; Flash script ends here if called with parameter PREPAREONLY IF ¶m_prepareonly ENDDO PREPAREDONE ; -------------------------------------------------------------------------------- ; Flash programming example ; FLASH.List ; DIALOG.YESNO "Program flash memory?" ENTRY &progflash IF &progflash ( FLASH.Erase ALL FLASH.Program ALL Data.LOAD.auto * /Word FLASH.Program off Data.LOAD.auto * /ComPare ) ENDDO