; -------------------------------------------------------------------------------- ; @Title: TMS470MSF541 internal flash setup ; ; @Description: ; Script arguments: ; ; DO tms470msf541 [CPU=|] [PREPAREONLY] ; ; CPU= selects CPU derivative ; selects CPU derivative (obsolete syntax) ; ; PREPAREONLY only declares flash but does not execute flash programming ; ; Example: ; ; DO ~~/demo/arm/flash/tms470msf541 CPU=TMS470MSF541 PREPAREONLY ; ; @Author: WRD ; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only ; @Chip: TMS470MSF541 ; -------------------------------------------------------------------------------- ; $Rev: 10516 $ ; $Id: tms470msf541.cmm 10516 2022-02-02 11:39:30Z bschroefel $ LOCAL ¶meters ENTRY %LINE ¶meters LOCAL &cpu ¶m_prepareonly ¶m_prepareonly=(STRing.SCAN(STRing.UPpeR("¶meters"),"PREPAREONLY",0)!=-1) IF STRing.SCAN(STRing.UPpeR("¶meters"),"TMS470MSF542",0)!=-1 &cpu="TMS470MSF542" ELSE &cpu="TMS470MSF541" ; -------------------------------------------------------------------------------- ; Init script variables DO ~~~~/tms470-func Init ; -------------------------------------------------------------------------------- ; Setup CPU IF SYStem.MODE()<5 ( SYStem.RESet SYStem.CPU &cpu SYStem.Option.BigEndian ON SYStem.Up ) ; -------------------------------------------------------------------------------- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Config for TMS470MSF541/542 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; actual device ID is 0x00246D05 (Unique id is bits 30-17, revision is bits 7-3) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Device ID: 0x0012 TMS470MSF541/542 ; ProgVersion: 0.08 ; Library Version ; ProgRoutines: pf035c.lib ; Platform library archive ; With revision 1.02 the pf035a, pf035b and pf035c libraries are unified into the pf035a library. ; M3 core is needing flash algorithm in Thumb mode, pf035a_cortexm3.bin. LOCAL &ProgRoutines &ProgRoutines="pf035a_cortexm3" ; Frequency: 80 Range: 10.0 - 84.0 ; Minor Revisions: 1 ; 0 "TMS470MSF541 Rev 0" ; Ram Config: 0x08000000 0x000010000 ; 64k RAM LOCAL &RamStart &RamSize &RamStart=0x08000000 &RamSize=0x000010000 ; Initialization: 8 ; 0xffffff48: 0x00000000 ; set GHVSRC to OSCIN clock source ; 0xfff87000: 0x04000201 ; enable pipeline mode and set 2 waitstates ; 0xffffffd0: 0x01010000 ; Disable peripherals ; 0xffffffd0: 0x01010100 ; Enable peripherals ; 0xffffff74: 0x00000000 ; FMENA off ; 0xfff87040: 0x000000ff ; force active mode for all banks ; 0xfff87008: 0x000A0005 ; disable flash ECC ; 0xffffffc4: 0x0000000A ; MEMSW='1010' => Flash at 0x00000000, RAM at 0x08000000) Data.Set 0xffffff48 %Long 0x00000000 ; set GHVSRC to OSCIN clock source Data.Set 0xfff87000 %Long 0x04000201 ; enable pipeline mode and set 2 waitstates Data.Set 0xffffffd0 %Long 0x01010000 ; Disable peripherals Data.Set 0xffffffd0 %Long 0x01010100 ; Enable peripherals Data.Set 0xffffff74 %Long 0x00000000 ; FMENA off Data.Set 0xfff87040 %Long 0x000000ff ; force active mode for all banks Data.Set 0xfff87008 %Long 0x000A0005 ; disable flash ECC Data.Set 0xffffffc4 %Long 0x0000000A ; MEMSW='1010' => Flash at 0x00000000, RAM at 0x08000000) ; PLL Config: 0xffffff70 0x21046300 0xffbfffff 0xffffff74 0x3FC0023D 0xffffffff ; configure 80 MHz (assuming 16.0 MHz OSCIN) Data.Set 0xffffff70 %Long 0x21046300|(Data.Long(SD:0xffffff70)&~0xffbfffff) Data.Set 0xffffff74 %Long 0x3FC0023D|(Data.Long(SD:0xffffff74)&~0xffffffff) &FlashClock_Frequency="80MHz" ; Engr ID: 0xfff87000 0x00000000 ; Number of Blocks: 30 FLASH.RESet &FlashType="FLASHECC" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; bank 0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DO ~~~~/tms470-func DeclareSector Type: FLASH Start: 0x00000000 Length: 0x00004000 Control: 0xfff87000 Core: 0x00 Sector: 0x00 DO ~~~~/tms470-func DeclareSector Type: FLASH Start: 0x00004000 Length: 0x00004000 Control: 0xfff87000 Core: 0x00 Sector: 0x01 DO ~~~~/tms470-func DeclareSector Type: FLASH Start: 0x00008000 Length: 0x00008000 Control: 0xfff87000 Core: 0x00 Sector: 0x02 DO ~~~~/tms470-func DeclareSector Type: FLASH Start: 0x00010000 Length: 0x00010000 Control: 0xfff87000 Core: 0x00 Sector: 0x03 DO ~~~~/tms470-func DeclareSector Type: FLASH Start: 0x00020000 Length: 0x00010000 Control: 0xfff87000 Core: 0x00 Sector: 0x04 DO ~~~~/tms470-func DeclareSector Type: FLASH Start: 0x00030000 Length: 0x00010000 Control: 0xfff87000 Core: 0x00 Sector: 0x05 DO ~~~~/tms470-func DeclareSector Type: FLASH Start: 0x00040000 Length: 0x00010000 Control: 0xfff87000 Core: 0x00 Sector: 0x06 DO ~~~~/tms470-func DeclareSector Type: FLASH Start: 0x00050000 Length: 0x00010000 Control: 0xfff87000 Core: 0x00 Sector: 0x07 DO ~~~~/tms470-func DeclareSector Type: FLASH Start: 0x00060000 Length: 0x00010000 Control: 0xfff87000 Core: 0x00 Sector: 0x08 DO ~~~~/tms470-func DeclareSector Type: FLASH Start: 0x00070000 Length: 0x00010000 Control: 0xfff87000 Core: 0x00 Sector: 0x09 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; bank 1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DO ~~~~/tms470-func DeclareSector Type: FLASH Start: 0x00080000 Length: 0x00004000 Control: 0xfff87000 Core: 0x01 Sector: 0x00 DO ~~~~/tms470-func DeclareSector Type: FLASH Start: 0x00084000 Length: 0x00004000 Control: 0xfff87000 Core: 0x01 Sector: 0x01 DO ~~~~/tms470-func DeclareSector Type: FLASH Start: 0x00088000 Length: 0x00004000 Control: 0xfff87000 Core: 0x01 Sector: 0x02 DO ~~~~/tms470-func DeclareSector Type: FLASH Start: 0x0008C000 Length: 0x00004000 Control: 0xfff87000 Core: 0x01 Sector: 0x03 DO ~~~~/tms470-func DeclareSector Type: FLASH Start: 0x00090000 Length: 0x00010000 Control: 0xfff87000 Core: 0x01 Sector: 0x04 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ECC ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DO ~~~~/tms470-func DeclareSector Type: FLASHECC Start: 0x00400000 Length: 0x00002000 Control: 0xfff87000 Core: 0x00 Sector: 0x00 DO ~~~~/tms470-func DeclareSector Type: FLASHECC Start: 0x00402000 Length: 0x00002000 Control: 0xfff87000 Core: 0x00 Sector: 0x01 DO ~~~~/tms470-func DeclareSector Type: FLASHECC Start: 0x00404000 Length: 0x00004000 Control: 0xfff87000 Core: 0x00 Sector: 0x02 DO ~~~~/tms470-func DeclareSector Type: FLASHECC Start: 0x00408000 Length: 0x00008000 Control: 0xfff87000 Core: 0x00 Sector: 0x03 DO ~~~~/tms470-func DeclareSector Type: FLASHECC Start: 0x00410000 Length: 0x00008000 Control: 0xfff87000 Core: 0x00 Sector: 0x04 DO ~~~~/tms470-func DeclareSector Type: FLASHECC Start: 0x00418000 Length: 0x00008000 Control: 0xfff87000 Core: 0x00 Sector: 0x05 DO ~~~~/tms470-func DeclareSector Type: FLASHECC Start: 0x00420000 Length: 0x00008000 Control: 0xfff87000 Core: 0x00 Sector: 0x06 DO ~~~~/tms470-func DeclareSector Type: FLASHECC Start: 0x00428000 Length: 0x00008000 Control: 0xfff87000 Core: 0x00 Sector: 0x07 DO ~~~~/tms470-func DeclareSector Type: FLASHECC Start: 0x00430000 Length: 0x00008000 Control: 0xfff87000 Core: 0x00 Sector: 0x08 DO ~~~~/tms470-func DeclareSector Type: FLASHECC Start: 0x00438000 Length: 0x00008000 Control: 0xfff87000 Core: 0x00 Sector: 0x09 DO ~~~~/tms470-func DeclareSector Type: FLASHECC Start: 0x00440000 Length: 0x00002000 Control: 0xfff87000 Core: 0x01 Sector: 0x00 DO ~~~~/tms470-func DeclareSector Type: FLASHECC Start: 0x00442000 Length: 0x00002000 Control: 0xfff87000 Core: 0x01 Sector: 0x01 DO ~~~~/tms470-func DeclareSector Type: FLASHECC Start: 0x00444000 Length: 0x00002000 Control: 0xfff87000 Core: 0x01 Sector: 0x02 DO ~~~~/tms470-func DeclareSector Type: FLASHECC Start: 0x00446000 Length: 0x00002000 Control: 0xfff87000 Core: 0x01 Sector: 0x03 DO ~~~~/tms470-func DeclareSector Type: FLASHECC Start: 0x00448000 Length: 0x00008000 Control: 0xfff87000 Core: 0x01 Sector: 0x04 DO ~~~~/tms470-func DeclareFlashAlgortihm &ProgRoutines &RamStart &RamSize &FlashClock_Frequency ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; End of flash.cfg ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Flash script ends here if called with parameter PREPAREONLY IF ¶m_prepareonly ENDDO PREPAREDONE ; -------------------------------------------------------------------------------- ; Flash programming example ; FLASH.List ; DIALOG.YESNO "Program flash memory?" LOCAL &progflash ENTRY &progflash IF &progflash ( FLASH.ReProgram ALL ; Optional: setup erased flash values ;Data.Set 0x0--0x9ffff %Long 0xffffffff Data.LOAD.auto * FLASH.ReProgram off ;Data.LOAD.auto * /ComPare ) ENDDO