navienginebsp/tools/testreference/lauterbach/Platforms/ne1_tb/flasherase.cmm
author Ryan Harkin <ryan.harkin@nokia.com>
Tue, 28 Sep 2010 18:00:05 +0100
changeset 0 5de814552237
permissions -rw-r--r--
Initial contribution supporting NaviEngine 1 This package_definition.xml will build support for three memory models - Single (sne1_tb) - Multiple (ne1_tb) - Flexible (fne1_tb)

//
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:  
//
//////////////////////////////////////////////////////////////////////////////
//
// NaviEngine NOR flash erasing script.
//
// Change History:
//
// 11/11/2008 1.0 : Initial version
// 08/05/2009 1.1 : Tidied up in readiness for putting into Nokia's distribution system
//
//////////////////////////////////////////////////////////////////////////////

&scriptversion=1.1

print "======================================================================="
print "&Platform NOR flash erasing script &scriptversion"

; Stop all CPU cores on the board to prevent them interfering with the flashing
do &PlatformsDir\&Platform\stopcpus.cmm

; Reset the Lauterbach flash configuration
flash.reset

; Configure the flash to either use a helper executable on the machine (faster) or
; to use the Lauterbach (slower) to perform the writing
if "&FlashOptionTarget"=="yes"
	(
		; Target controlled flashing requires a binary downloaded to the development board
		print "Using target assisted flashing"
		flash.create 1. &FlashStart--&FlashEnd &FlashBlockSize TARGET Word

		; Determine where to store the target binary (and how big it is)
		flash.target &RamAddr &RamAddr+0x1000 0x1000 ../demo/arm/flash/&FlashWidth/&FlashType.bin
	)
	else
	(
		; Emulator controlled flashing is controlled from the host and is a lot slower
		print "Using basic emulator flashing (slow)"
		flash.create 1. &FlashStart--&FlashEnd &FlashBlockSize &FlashType &FlashWidth
	)

print "Flash Configuration:"
print "---------------------------------"
print "Flash Start:      &FlashStart"
print "Flash Length:     &FlashLength"
print "Flash End:        &FlashEnd"
print "Flash Type:       &FlashType"
print "Flash Block Size: &FlashBlockSize"
print "Flash Width:      &FlashWidth"
print "---------------------------------"

flash.unlock &FlashStart++&FlashLength
flash.erase &FlashStart++&FlashLength

; Programming done, relock the flash
flash.program off
flash.lock 1.

; On an error the script will abort before printing OK (and print the error)
print "Flash programming completed OK"

; Disconnect the JTAG as the user is likely to power cycle the board and it might confuse us
sys.down

enddo