|
1 // |
|
2 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 // All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of "Eclipse Public License v1.0" |
|
6 // which accompanies this distribution, and is available |
|
7 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 // |
|
9 // Initial Contributors: |
|
10 // Nokia Corporation - initial contribution. |
|
11 // |
|
12 // Contributors: |
|
13 // |
|
14 // Description: |
|
15 // |
|
16 ////////////////////////////////////////////////////////////////////////////// |
|
17 // |
|
18 // NaviEngine NOR flash download script |
|
19 // |
|
20 // Change History: |
|
21 // |
|
22 // 11/11/2008 1.0 : Initial version |
|
23 // 12/02/2009 1.1 : Merged working script in from old naviengine_flash.cmm |
|
24 // 08/05/2009 1.2 : Updated to accept the image name and address passed as parameters |
|
25 // |
|
26 ////////////////////////////////////////////////////////////////////////////// |
|
27 |
|
28 &scriptversion=1.2 |
|
29 entry &imageName &imageAddr &skipHeader |
|
30 |
|
31 print "=======================================================================" |
|
32 print "&Platform NOR flashing script &scriptversion" |
|
33 |
|
34 ; Stop all CPU cores on the board to prevent them interfering with the flashing |
|
35 do &PlatformsDir\&Platform\stopcpus.cmm |
|
36 |
|
37 ; Reset the Lauterbach flash configuration |
|
38 flash.reset |
|
39 |
|
40 ; Configure the flash to either use a helper executable on the machine (faster) or |
|
41 ; to use the Lauterbach (slower) to perform the writing |
|
42 if "&FlashOptionTarget"=="yes" |
|
43 ( |
|
44 ; Target controlled flashing requires a binary downloaded to the development board |
|
45 print "Using target assisted flashing" |
|
46 flash.create 1. &FlashStart--&FlashEnd &FlashBlockSize TARGET &FlashWidth |
|
47 |
|
48 ; Determine where to store the target binary (and how big it is) |
|
49 flash.target &RamAddr &RamAddr+0x1000 0x1000 ../demo/arm/flash/&FlashWidth/&FlashType.bin |
|
50 ) |
|
51 else |
|
52 ( |
|
53 ; Emulator controlled flashing is controlled from the host and is a lot slower |
|
54 print "Using basic emulator flashing (slow)" |
|
55 flash.create 1. &FlashStart--&FlashEnd &FlashBlockSize &FlashType &FlashWidth |
|
56 ) |
|
57 |
|
58 ; Determine the size of the image to be written |
|
59 &fileSize=os.file.size(&imageName) |
|
60 |
|
61 print "Flash Configuration:" |
|
62 print "-----------------------------" |
|
63 print "RAM address: &RamAddr" |
|
64 print "Image name: &imageName" |
|
65 print "Image Size: &fileSize" |
|
66 print "Image Skip Header: &skipHeader" |
|
67 print "Flash Start: &imageAddr" |
|
68 print "Flash End: &FlashEnd" |
|
69 print "Flash Type: &FlashType" |
|
70 print "Flash Block Size: &FlashBlockSize" |
|
71 print "Flash Width: &FlashWidth" |
|
72 print "-----------------------------" |
|
73 |
|
74 flash.unlock &imageAddr++&fileSize |
|
75 flash.erase &imageAddr++&fileSize |
|
76 flash.program &imageAddr++&fileSize |
|
77 |
|
78 if "&skipHeader"=="true" |
|
79 ( |
|
80 print "Skipping EPOC header" |
|
81 data.load.binary "&imageName" &imageAddr /SKIP 100 |
|
82 ) |
|
83 else |
|
84 ( |
|
85 data.load.binary &imageName &imageAddr /WORD |
|
86 ) |
|
87 |
|
88 ; Programming done, relock the flash |
|
89 flash.program off |
|
90 flash.lock 1. |
|
91 |
|
92 ; Compare what we wrote against what is there now |
|
93 print "Verifying image..." |
|
94 if "&skipHeader"=="true" |
|
95 ( |
|
96 data.load.binary "&imageName" &imageAddr /SKIP 100 /compare |
|
97 ) |
|
98 else |
|
99 ( |
|
100 data.load.binary "&imageName" &imageAddr /compare |
|
101 ) |
|
102 |
|
103 ; On an error the script will abort before printing OK (and print the error) |
|
104 print "Verified OK. Flash programming completed" |
|
105 |
|
106 ; Disconnect the JTAG as the user is likely to power cycle the board and it might confuse us |
|
107 sys.down |
|
108 |
|
109 enddo |