embedded programmer problem copying to flash address 0...

Started by deeeed, July 19, 2007, 07:51:59 AM

Previous topic - Next topic

deeeed

Hello,
i don't understand how to compute the first 512 bytes from my hex files. I think i have to compute something relative to "Criterion for Valid User Code" :
4.1.1 Criterion for Valid User Code
      Criterion for valid user code: The reserved ARM interrupt vector location (0x0000 0014)
      should contain the 2's complement of the check-sum of the remaining interrupt vectors.
      This causes the checksum of all of the vectors together to be 0. The boot loader code
      disables the overlaying of the interrupt vectors from the boot block, then checksums the
      interrupt vectors in sector 0 of the flash. If the signatures match then the execution control
      is transferred to the user code by loading the program counter with 0x0000 0000. Hence
      the user flash reset vector should contain a jump instruction to the entry point of the user
      application code.
I don't understand what it means in practise...
Here is a small example of my isp session logs for write:
Quote
[INFO] Sending command: W 1073742336 512
+ W 1073742336 512
- W 1073742336 512
0

END_W ret: 0
[INFO] Sending command: M$0``ZA3PG^44\)_E%/"?Y13PG^4``*#A$/"?Y1#PG^4X````/````$````!$
[INFO] Sending command: M````B`$``$@```#^___J_O__ZO[__^K^___J_O__ZAP!G^6J$*#C52"@XR`P
[INFO] Sending command: MH..@,8#EH#&0Y4`P$^+\__\*`3"@XPPQ@.4),*#CA#"`Y8P0@.6,((#E`3"@
[INFO] Sending command: MXX`P@.6,$(#EC""`Y8@PD.4!,Q/B_/__"H@PD.7(0)_E!#`#X`E`H.,$,#/@
[INFO] Sending command: M^?__&@0PH.,$,8#E!3"@XP@Q@.4%,Z#CJ#&`Y0`PH..L,8#E`S"@XX`P@.6,
[INFO] Sending command: M$(#EC""`Y8@`G^7;\"'C`-"@X00`0.+7\"'C`-"@X00`0.+1\"'C`-"@X00`
[INFO] Sending command: M0.+2\"'C`-"@X0$+0.+3\"'C`-"@X0$+0.+?\"'C`-"@X=/P(>,``*#C/!"?
[INFO] Sending command: MY3P@G^4"`%'A!`"!-/S__SH``*#C`!"@X0`@H.$`L*#A`'"@X1R@G^4/X*#A
[INFO] Sending command: M&O\OX?[__^H`P!_@_W__``!Q`$!8!`!`0#``0)T"```$X$[B_U\MZ0`03^$"
[INFO] Sending command: M`"WI`$#@X_\P%.4/X*#A$_\OX0`PH./_,`3E`@"]Z`'P8>'_G_WH!/!>X@3P
[INFO] Sending command: M7N(`,.#C`""@X^L_`^7_(`/E`A"@X?,O`^40,(/B`"\!Y0`^`>4$$('B@`!1
[INFO] Sending command: 1X_K__QH>_R_A`3"@XQ,PH.$`
[INFO] Sending command: 64402
+ 64402
- 6
- 4402
OK

Then i copy the ram to the flash:
Quote
[INFO] Sending command: P 0 27
+ P 0 27
- P
-  0 27
0

END_P ret: 0
[INFO] Sending command: C 0 1073742336 512
+ C 0 1073742336 512
- C
- 0 1073742336 512
0

END_C ret: 0

And finally i try to read data from ram and flash to verify if they are correctly written:
Quote
Dumping memory from ramAddress:1073742336 and flashAddress:0
[INFO] Sending command: R 1073742336 512
+ R 1073742336 512
- 0
Return Code: 0
- $0``ZA3PG^44\)_E%/"?Y13PG^4``*#A$/"?Y1#PG^4X````/````$````!$
- ````B`$``$@```#^___J_O__ZO[__^K^___J_O__ZAP!G^6J$*#C52"@XR`P
- H..@,8#EH#&0Y4`P$^+\__\*`3"@XPPQ@.4),*#CA#"`Y8P0@.6,((#E`3"@
- XX`P@.6,$(#EC""`Y8@PD.4!,Q/B_/__"H@PD.7(0)_E!#`#X`E`H.,$,#/@
- ^?__&@0PH.,$,8#E!3"@XP@Q@.4%,Z#CJ#&`Y0`PH..L,8#E`S"@XX`P@.6,
- $(#EC""`Y8@`G^7;\"'C`-"@X00`0.+7\"'C`-"@X00`0.+1\"'C`-"@X00`
- 0.+2\"'C`-"@X0$+0.+3\"'C`-"@X0$+0.+?\"'C`-"@X=/P(>,``*#C/!"?
- Y3P@G^4"`%'A!`"!-/S__SH``*#C`!"@X0`@H.$`L*#A`'"@X1R@G^4/X*#A
- &O\OX?[__^H`P!_@_W__``!Q`$!8!`!`0#``0)T"```$X$[B_U\MZ0`03^$"
- `"WI`$#@X_\P%.4/X*#A$_\OX0`PH./_,`3E`@"]Z`'P8>'_G_WH!/!>X@3P
- 7N(`,.#C`""@X^L_`^7_(`/E`A"@X?,O`^40,(/B`"\!Y0`^`>4$$('B@`!1
- X_K__QH>_R_A`3"@XQ,PH.'A
- 64402
[INFO] Sending command: OK
+ OK
- OK
-

[INFO] Sending command: R 0 512
+ R 0 512
- 0
Return Code: 0
- &$"?Y1!0G^4`8)3E!F`%X`!@A.4$\!_E0.#_?_^___\`@/\_````````````
- `````````````````````````/[__^K^___J_O__ZAP!G^6J$*#C52"@XR`P
- H..@,8#EH#&0Y4`P$^+\__\*`3"@XPPQ@.4),*#CA#"`Y8P0@.6,((#E`3"@
- XX`P@.6,$(#EC""`Y8@PD.4!,Q/B_/__"H@PD.7(0)_E!#`#X`E`H.,$,#/@
- ^?__&@0PH.,$,8#E!3"@XP@Q@.4%,Z#CJ#&`Y0`PH..L,8#E`S"@XX`P@.6,
- $(#EC""`Y8@`G^7;\"'C`-"@X00`0.+7\"'C`-"@X00`0.+1\"'C`-"@X00`
- 0.+2\"'C`-"@X0$+0.+3\"'C`-"@X0$+0.+?\"'C`-"@X=/P(>,``*#C/!"?
- Y3P@G^4"`%'A!`"!-/S__SH``*#C`!"@X0`@H.$`L*#A`'"@X1R@G^4/X*#A
- &O\OX?[__^H`P!_@_W__``!Q`$!8!`!`0#``0)T"```$X$[B_U\MZ0`03^$"
- `"WI`$#@X_\P%.4/X*#A$_\OX0`PH./_,`3E`@"]Z`'P8>'_G_WH!/!>X@3P
- 7N(`,.#C`""@X^L_`^7_(`/E`A"@X?,O`^40,(/B`"\!Y0`^`>4$$('B@`!1
- X_K__QH>_R_A`3"@XQ,PH.'A
- 62230
[INFO] Sending command: OK
+ OK
- OK

So, here we can see that the data are correct in the ram but not in the flash. I would like to understand how to modifiy my first 512 bytes to be correct after the copy to the flash. Any idea? ;)
When i look how FlashMagic send theses firsts bytes i can see that:
4D 24 30 60 60 5A 41 33 50 47 5E 34 34 5C 29 5F 45 25 2F 22 3F 59 31 33 50 47 5E 35 5F 37           M$0``ZA3PG^44\)_E%/"?Y13PG^5_7
54 22 54 24 2F 22 3F 59 31 23 50 47 5E 34 58 60 60 60 60 2F 60 60 60 60 24 60 60 60 60 21           T"T$/"?Y1#PG^4X````/````$````!
24 0D 0A                                                                                            $..

So we can see a difference "4``*#A" and 5_7T"T, I think it's something like a program checksum but i don't find a good documentation which could explain how to compute it.
Please help me ;)
Arthur

deeeed

For information, when i try to copy to flash from address 512 and more, it works correctly.
It's just for writting from flash address 0 to 512...