summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAravind Batni2012-08-29 18:23:11 -0500
committerAravind Batni2012-08-29 18:23:11 -0500
commit41498e30596fbf4e0c61c37db4c6def60eac3b5b (patch)
treee9206644334fc89aeef5ed14fb99f95b494c21f6
parent4a9369db86cbce3e8a626dba04afa90d64541480 (diff)
downloadmcsdk-tools-41498e30596fbf4e0c61c37db4c6def60eac3b5b.tar.gz
mcsdk-tools-41498e30596fbf4e0c61c37db4c6def60eac3b5b.tar.xz
mcsdk-tools-41498e30596fbf4e0c61c37db4c6def60eac3b5b.zip
updated program evm and nand writer for getting the nand format support
-rwxr-xr-x[-rw-r--r--]program_evm/program_evm.js125
-rwxr-xr-x[-rw-r--r--]writer/nand/evmc6657l/bin/nand_writer_input.txt2
-rwxr-xr-x[-rw-r--r--]writer/nand/src/nandwriter.c39
3 files changed, 132 insertions, 34 deletions
diff --git a/program_evm/program_evm.js b/program_evm/program_evm.js
index e5b9039..3bc06d2 100644..100755
--- a/program_evm/program_evm.js
+++ b/program_evm/program_evm.js
@@ -381,41 +381,104 @@ if(writeAll || writerImages.match(/eeprom51/))
381//NAND 381//NAND
382if(writeAll || writerImages.match(/nand/)) 382if(writeAll || writerImages.match(/nand/))
383{ 383{
384 384 if (writerImages.match(/format/))
385 start_nand = localTime(); 385 {
386 script.traceWrite("Writer:" + nandwriterbinary + "\r\n"); 386 /* No action is taken for NAND since it is format*/
387 script.traceWrite("NAND:" + nand + "\r\n"); 387 }
388 if (isFile(nand) && isFile(nandwriterbinary)) 388 else
389 { 389 {
390 debugSession.memory.loadProgram(nandwriterbinary); 390 start_nand = localTime();
391 var nPage = 0x0; 391 script.traceWrite("Writer:" + nandwriterbinary + "\r\n");
392 // var nAddress = 0x80000000; 392 script.traceWrite("NAND:" + nand + "\r\n");
393 var sFilename = nand; 393 if (isFile(nand) && isFile(nandwriterbinary))
394 var nTypeSize = 32; 394 {
395 var bByteSwap = false; 395 debugSession.memory.loadProgram(nandwriterbinary);
396 396 var nPage = 0x0;
397 try 397 // var nAddress = 0x80000000;
398 { 398 var sFilename = nand;
399 script.traceWrite("Start loading nand.bin"); 399 var nTypeSize = 32;
400 debugSession.memory.loadRaw(nPage, nandNorAddress, sFilename, nTypeSize, bByteSwap); 400 var bByteSwap = false;
401
402 try
403 {
404 script.traceWrite("Start loading nand.bin");
405 debugSession.memory.loadRaw(nPage, nandNorAddress, sFilename, nTypeSize, bByteSwap);
406
407 }
408 catch (ex)
409 {
410 errCode = getErrorCode(ex);
411 script.traceWrite("Error code #" + errCode + ", could not load file " + sFilename +
412 " to target memory!");
413 }
414 script.traceWrite("Start programming NAND");
415 debugSession.target.run()
416 script.traceWrite("End programming NAND");
417 end_nand = localTime();
418 }
419 else
420 {
421 script.traceWrite("Required NAND files does not exist in " + board_binaries + "\n");
422
423 }
424 }
425}
401 426
402 } 427//FORMAT the flash
403 catch (ex) 428if (writerImages.match(/format/))
404 { 429{
405 errCode = getErrorCode(ex); 430//NAND Erase all
406 script.traceWrite("Error code #" + errCode + ", could not load file " + sFilename + 431 if (writerImages.match(/nand/))
407 " to target memory!"); 432 {
408 } 433 start_nand = localTime();
409 script.traceWrite("Start programming NAND"); 434 script.traceWrite("Writer:" + nandwriterbinary + "\r\n");
410 debugSession.target.run() 435 if (isFile(nandwriterbinary))
411 script.traceWrite("End programming NAND"); 436 {
412 end_nand = localTime(); 437 debugSession.memory.loadProgram(nandwriterbinary);
413 } 438 var nPage = 0x0;
439 var nValue = 0x12345678;
440
441 try
442 {
443 script.traceWrite("Formatting NAND device ... Initiated");
444 // Get the address of that symbol
445 var flag_address = debugSession.symbol.getAddress("nand_erase_flag")
446 debugSession.memory.writeWord(nPage, flag_address, nValue);
447 }
448 catch (ex)
449 {
450 errCode = getErrorCode(ex);
451 script.traceWrite("Error code #" + errCode + ", could not set the nandwriter for erasing all nand blocks! ");
452 }
453 debugSession.target.run()
454 script.traceWrite("Formatting NAND device ...Completed");
455 end_nand = localTime();
456 }
457 else
458 {
459 script.traceWrite("Required NAND binary does not exist in " + board_binaries + "\n");
460
461 }
462 }
414 else 463 else
415 { 464 {
416 script.traceWrite("Required NAND files does not exist in " + board_binaries + "\n"); 465 /* No action is taken */
417 466 script.traceWrite("FLASH FORMAT - No Action is taken, please provide the supported format command string, e.g., format-nand");
418 } 467 }
468
469 if (testEnv.cioFile != null)
470 {
471 // Stop CIO logging.
472 debugSession.endCIOLogging();
473 }
474
475 debugSession.terminate();
476 debugServer.stop()
477
478 // Stop logging and exit.
479 script.traceEnd();
480 java.lang.System.exit(0);
481
419} 482}
420 483
421//NOR 484//NOR
diff --git a/writer/nand/evmc6657l/bin/nand_writer_input.txt b/writer/nand/evmc6657l/bin/nand_writer_input.txt
index 009e6a1..75b6ee5 100644..100755
--- a/writer/nand/evmc6657l/bin/nand_writer_input.txt
+++ b/writer/nand/evmc6657l/bin/nand_writer_input.txt
@@ -1,5 +1,5 @@
1file_name = app.bin 1file_name = app.bin
2start_addr = 16384 2start_addr = 131072
3 3
4 4
5 5
diff --git a/writer/nand/src/nandwriter.c b/writer/nand/src/nandwriter.c
index 09897f2..83da160 100644..100755
--- a/writer/nand/src/nandwriter.c
+++ b/writer/nand/src/nandwriter.c
@@ -47,12 +47,13 @@
47#include "types.h" 47#include "types.h"
48 48
49/* NAND writer utility version */ 49/* NAND writer utility version */
50char version[] = "01.00.00.00"; 50char version[] = "01.00.00.01";
51 51
52/* The input file name is hard coded */ 52/* The input file name is hard coded */
53char *input_file = "nand_writer_input.txt"; 53char *input_file = "nand_writer_input.txt";
54 54
55uint32_t swap_byte = 0; 55uint32_t swap_byte = 0;
56volatile uint32_t nand_erase_flag = 0;
56 57
57/* Parameters defined in the input_file */ 58/* Parameters defined in the input_file */
58#define FILE_NAME "file_name" 59#define FILE_NAME "file_name"
@@ -490,6 +491,25 @@ find_file_length
490 return TRUE; 491 return TRUE;
491} 492}
492 493
494static Bool
495nand_erase_all_blks(PLATFORM_DEVICE_info *p_device)
496{
497 uint32_t block;
498 uint32_t max_blks;
499
500 max_blks = p_device->block_count;
501
502 for (block=0; block<max_blks;block++)
503 {
504 printf (".");
505 if (platform_device_erase_block(p_device->handle, block) != Platform_EOK)
506 return FALSE;
507 }
508
509 printf ("\nFormatted %d nand blocks \n", block);
510 return (TRUE);
511}
512
493/****************************************************************************** 513/******************************************************************************
494 * Function: main 514 * Function: main
495 ******************************************************************************/ 515 ******************************************************************************/
@@ -553,6 +573,22 @@ void main ()
553 return; 573 return;
554 } 574 }
555 575
576 /* Check if we need to erase the nand completely */
577 if (nand_erase_flag == 0x12345678)
578 {
579 if (nand_erase_all_blks(p_device) == FALSE)
580 {
581 printf ("Formatting all nand blocks - failed \n");
582 }
583 else
584 {
585 printf ("Formatting all nand blocks - Successful\n");
586 }
587 platform_device_close(p_device->handle);
588 /* Operation Complete */
589 return;
590 }
591
556 /* Open and find the length of the data file */ 592 /* Open and find the length of the data file */
557 fp = fopen (nandWriterInfo.file_name, "rb"); 593 fp = fopen (nandWriterInfo.file_name, "rb");
558 if (fp == NULL) 594 if (fp == NULL)
@@ -571,7 +607,6 @@ void main ()
571 platform_device_close(p_device->handle); 607 platform_device_close(p_device->handle);
572 return; 608 return;
573 } 609 }
574
575 610
576 /* Write the flash, verify the results. On read back failure mark 611 /* Write the flash, verify the results. On read back failure mark
577 * the block as bad and try rewriting again */ 612 * the block as bad and try rewriting again */