92 lines
3.2 KiB
Plaintext
92 lines
3.2 KiB
Plaintext
; --------------------------------------------------------------------------------
|
|
; @Title: Flash declaration of NXP Semiconductor QN908x internal flash.
|
|
; @Description:
|
|
; Board info: Tested on QN9080 DK-V1.2 evaluation board
|
|
; Flash info: Internal Flash
|
|
; Script arguments: [PREPAREONLY] Only declares flash but does not execute flash
|
|
; programming
|
|
; CPU=<cpu> selects CPU derivative <cpu>
|
|
; @Keywords:
|
|
; @Author: mmauser
|
|
; @Board: QN9080 DK-V1.2
|
|
; @Chip: QN9080DHN QN9083DUK
|
|
; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only
|
|
; --------------------------------------------------------------------------------
|
|
; $Id: qn908x.cmm 10516 2022-02-02 11:39:30Z bschroefel $
|
|
|
|
PRIVATE ¶meters ¶m_prepareonly ¶m_cpu
|
|
ENTRY %LINE ¶meters
|
|
|
|
¶m_prepareonly=(STRing.SCAN(STRing.UPpeR("¶meters"),"PREPAREONLY",0)!=-1)
|
|
¶m_cpu=STRing.SCANAndExtract(STRing.UPpeR("¶meters"),"CPU=","")
|
|
|
|
PRIVATE &ram_start &flashDriverSize &bufferSize
|
|
PRIVATE &flash0_start &flash1_start &flash2_start &flashsize &pagesize
|
|
|
|
; ------------------------------------------------------------------------------
|
|
; Setup CPU
|
|
IF !SYStem.Up()
|
|
(
|
|
SYStem.RESet
|
|
if "¶m_cpu"==""
|
|
if !CPUIS(QN908*)
|
|
¶m_cpu="QN9080DHN"
|
|
SYStem.CPU ¶m_cpu
|
|
SYStem.CONFIG.DEBUGPORTTYPE SWD
|
|
SYStem.Up
|
|
)
|
|
; ------------------------------------------------------------------------------
|
|
; Setup flash configuration
|
|
&ram_start=0x04000000 ; internal RAM: 0x04000000 (SRAM 128K)
|
|
&flashDriverSize=0x1000 ; (<flash_algorithm>) + 32 byte
|
|
&bufferSize=0x1000
|
|
|
|
&flash0_start=0x01000000
|
|
&flash1_start=0x01040000
|
|
|
|
&flashsize=0x40000 // 256k flash size is the same for all onchip flashes.
|
|
§rorsize=0x800 // 2k sector size
|
|
|
|
; ------------------------------------------------------------------------------
|
|
; Flash declaration
|
|
|
|
FlashDeclaration:
|
|
|
|
FLASH.RESet
|
|
|
|
FLASH.Create 1. &flash0_start++(&flashsize-1) §rorsize TARGET Long /CENSORSHIP 0x1000020--0x1000023 ; in principle offset 0x110 should also be protected with /censorship but currently only one /censorship range per section is posible. On the other hand 0x110 is not as critical as 0x20 because the "dangerous" value is b1010101.... instead of 0x00000000 or 0xffffff
|
|
FLASH.Create 2. &flash1_start++(&flashsize-1) §rorsize TARGET Long /CENSORSHIP 0x107F800--0x107F823 /KEEP 0x107F824--0x107FBFF /KEEP 0x107FC00--0x107FFFF
|
|
|
|
FLASH.CreateALIAS 0x21000000--0x2107FFFF 0x1000000
|
|
FLASH.CreateALIAS 0x31000000--0x3107FFFF 0x1000000
|
|
|
|
FLASH.TARGET &ram_start (&ram_start+&flashDriverSize) &bufferSize ~~/demo/arm/flash/long/qn9080.bin /DualPort
|
|
|
|
; Flash script ends here if called with parameter PREPAREONLY
|
|
IF ¶m_prepareonly
|
|
ENDDO PREPAREDONE
|
|
|
|
; ------------------------------------------------------------------------------
|
|
; Flash programming example
|
|
|
|
DIALOG.YESNO "Program flash memory?"
|
|
LOCAL &progflash
|
|
ENTRY &progflash
|
|
IF &progflash
|
|
(
|
|
FLASH.Erase.ALL
|
|
FLASH.ReProgram.ALL
|
|
Data.LOAD.auto * /Long
|
|
; write legacy header information
|
|
Data.SUM 0x01000000--0x0100001B /Long ; Calculate checksum of all (other) vectors
|
|
Data.Set 0x0100001C %Long -Data.SUM() ; Write the 2's complement in reserved vector's spot
|
|
|
|
FLASH.ReProgram.off
|
|
|
|
; Reset device
|
|
SYStem.Down
|
|
SYStem.Up
|
|
)
|
|
|
|
ENDDO
|