; -------------------------------------------------------------------------------- ; @Title: TMS470 internal flash of TMS470R1B1M ; ; @Description: ; Script arguments: ; ; DO tms470r1b1m [PREPAREONLY] ; ; PREPAREONLY only declares flash but does not execute flash programming ; ; Example: ; ; DO ~~/demo/arm/flash/tms470r1b1m PREPAREONLY ; ; Flash size is 1 MBytes. ; RAM size is 64 kBytes. ; ; @Author: WRD ; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only ; @Chip: TMS470R1B1M ; -------------------------------------------------------------------------------- ; $Rev: 10516 $ ; $Id: tms470r1b1m.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="7.5MHz" ; Flash protection &Protection_Keys=0x0000fff0 ; Protection key location in first sector of flash ; JSM - JTAG Security Module &JTAG_Security_Keys=0x00000000 ; JSM unlock code is in OTP sector ; MSM - Memory Security Module 1 &Memory_Security_1_Keys=0x0000ffe0 ; MSM key location in first sector of flash ; RAM configuration &RamStart=0x01000000 &RamSize=0x00010000 ; -------------------------------------------------------------------------------- ; Setup CPU DO ~~~~/tms470r1-func Setup_CPU TMS470R1B1M ; -------------------------------------------------------------------------------- ; MSM - Memory security module handling DO ~~~~/tms470r1-func Memory_Security_1 0xffffffff 0xffffffff 0xffffffff 0xffffffff ; -------------------------------------------------------------------------------- ; Initialization &MFBAHR2=&RamStart>>16. &MFBALR2=(&RamStart&0x0000fc00)|0x70 ; Bus configuration Data.Set 0xFFFFFE00 %Long 0x00000000 0x000000b0 ; MFBAxR0 - 1 MByte flash at 0x00000000 Data.Set 0xFFFFFE08 %Long 0x00000000 0x00000000 ; MFBAxR1 Data.Set 0xFFFFFE10 %Long &MFBAHR2 &MFBALR2 ; MFBAxR2 - 64 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 0x10000 0x00 0x00 DO ~~~~/tms470r1-func DeclareSector 0x00010000 0x10000 0x00 0x01 DO ~~~~/tms470r1-func DeclareSector 0x00020000 0x10000 0x00 0x02 DO ~~~~/tms470r1-func DeclareSector 0x00030000 0x10000 0x00 0x03 DO ~~~~/tms470r1-func DeclareSector 0x00040000 0x10000 0x00 0x04 DO ~~~~/tms470r1-func DeclareSector 0x00050000 0x10000 0x00 0x05 DO ~~~~/tms470r1-func DeclareSector 0x00060000 0x10000 0x00 0x06 DO ~~~~/tms470r1-func DeclareSector 0x00070000 0x10000 0x00 0x07 DO ~~~~/tms470r1-func DeclareSector 0x00080000 0x10000 0x01 0x00 DO ~~~~/tms470r1-func DeclareSector 0x00090000 0x10000 0x01 0x01 DO ~~~~/tms470r1-func DeclareSector 0x000a0000 0x10000 0x01 0x02 DO ~~~~/tms470r1-func DeclareSector 0x000b0000 0x10000 0x01 0x03 DO ~~~~/tms470r1-func DeclareSector 0x000c0000 0x10000 0x01 0x04 DO ~~~~/tms470r1-func DeclareSector 0x000d0000 0x10000 0x01 0x05 DO ~~~~/tms470r1-func DeclareSector 0x000e0000 0x10000 0x01 0x06 DO ~~~~/tms470r1-func DeclareSector 0x000f0000 0x10000 0x01 0x07 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 * /Word /ComPare ) ENDDO