PEmicro logo
Cart New Account Login

Logo image
HomeAbout usProductsSupportForumsBlogCustomer Service

search inside this forum
search inside all forums
Programming from DOS shell MCU MM9Z1J638 problem
. Jun 18, 2021 at 02:18 AM (02:18 hours)
Staff: Takao Y.

  • Hi Team, 

    could you please advise with a following issue?

    I try to programming MM9Z1J638 from DOS shell. I use CW 11.1 and programmer Multilink Universal FX.

    I made tcl file for that:

    fl::disconnect
    fl::target -lc "LC for Simple Flash"
    fl::target -b 0x1000 0x2000
    fl::target -v off -l off
    cmdwin::fl::device -d "MM9Z1J638_FLASH" -o "128Kx32x1" -a 0xfe0000 0xffffff
    cmdwin::fl::protect all off
    cmdwin::fl::device -d "MM9Z1J638_EEPROM" -o "4Kx32x1" -a 0x100000 0x100fff
    cmdwin::fl::protect all off
    cmdwin::fl::device -d "MM9Z1J638_FLASH" -o "128Kx32x1" -a 0xfe0000 0xffffff
    cmdwin::fl::image -f "C:\\LEM\\IN200\\BATS2_prj\\G16001C-Volvo-embBoot.elf" -t "Auto Detect" -re on -r 0xfe0000 0xffffff -oe off
    cmdwin::fl::erase image
    cmdwin::fl::write
    cmdwin::fl::device -d "MM9Z1J638_EEPROM" -o "4Kx32x1" -a 0x100000 0x100fff
    cmdwin::fl::image -f "C:\\LEM\\IN200\\BATS2_prj\\G16001C-Volvo-embBoot.elf" -t "Auto Detect" -re on -r 0x100000 0x100fff -oe off
    cmdwin::fl::erase image
    cmdwin::fl::write
    fl::disconnect
    quitIDE
    exit

    But after run this script I receive error:

    CodeWarrior Debugger Shell v1.0
    %>source C:\LEM\IN200\BATS2_prj\bats2\b_t.tcl
    cmdwin::fl::disconnect
    cmdwin::fl::target -lc LC for Simple Flash
    cmdwin::fl::target -b 0x1000 0x2000
    cmdwin::fl::target -v off -l off
    cmdwin::fl::device -d MM9Z1J638_FLASH -o 128Kx32x1 -a 0xfe0000 0xffffff
    cmdwin::fl::protect all off
    Flash Programmer internal error: connection list is empty
    Beginning Operation ...
    -------------------------
    Error: Operation failed. GetFlashDriverFile: Algorithm file C:\Freescale\CW MCU
    v11.1\MCU\bin\Plugins\Support\Flash_Programme
    r\ is not an elf file. Flash drivers must be elf images.
    Error: Couldn't open flash driver file.
    Error: Operation failed.GetFlashDriverFile: Algorithm file C:\Freescale\CW MCU
    v11.1\MCU\bin\Plugins\Support\Flash_Programmer\ is
    not an elf file. Flash drivers must be elf images.

    What I can do with that or where I make a mistake?

    With Best Regards,
    Jozef




    Comments

  • Greetings,

    Could you show me the contents of b_t.tcl so I can take a look at whether the tickle script has the right commands?


    Takao

    • Hi Takao,

      thank you for your answer. Please see below the required tcl command.

      fl::disconnect
      fl::target -lc "LC for Simple Flash"
      fl::target -b 0x1000 0x2000
      fl::target -v off -l off
      cmdwin::fl::device -d "MM9Z1J638_FLASH" -o "128Kx32x1" -a 0xfe0000 0xffffff
      cmdwin::fl::protect all off
      cmdwin::fl::device -d "MM9Z1J638_EEPROM" -o "4Kx32x1" -a 0x100000 0x100fff
      cmdwin::fl::protect all off
      cmdwin::fl::device -d "MM9Z1J638_FLASH" -o "128Kx32x1" -a 0xfe0000 0xffffff
      cmdwin::fl::image -f "C:\\LEM\\IN200\\BATS2_prj\\G16001C-Volvo-embBoot.elf" -t "Auto Detect" -re on -r 0xfe0000 0xffffff -oe off
      cmdwin::fl::erase image
      cmdwin::fl::write
      cmdwin::fl::device -d "MM9Z1J638_EEPROM" -o "4Kx32x1" -a 0x100000 0x100fff
      cmdwin::fl::image -f "C:\\LEM\\IN200\\BATS2_prj\\G16001C-Volvo-embBoot.elf" -t "Auto Detect" -re on -r 0x100000 0x100fff -oe off
      cmdwin::fl::erase image
      cmdwin::fl::write
      fl::disconnect
      quitIDE

      With Best Regards,
      Jozef

  • Greetings,

    Sorry, I did not realize that is TCL script because I am not familiar with the syntax you are using. The way I have ran TCL scripts is by simply calling the debug configuration and launching it. The debug config already holds all the information you need for what flash driver to run and what ELF file to load, which PEmicro hardware interface to use, etc. We used to use TCL scripts for automated testing of our debugging capabilities. Here is an example I wrote for testing a specific device (it is not a S12Z device, but concept is exactly the same). Maybe you can extract some useful stuff from here:

    set launchList(1) "MC9RS08KA8_FLASH_PnE U-MultiLink"
    log s "C:\\TCL_project\\log_mc9rs08ka8_14_1_2.log"
    if {[catch {
    foreach launch [array names launchList] {
       puts "LAUNCHING DEBUG SESSION $launchList($launch)"
       debug "$launchList($launch)"
       restart
       puts "Testing STEP"
       bp all off
       bp increment_ij
       go
       set a [var i]
       puts "Var i should be \$0000"
       set b [var j]
       puts "Var j should be \$0003"
       if {([string trim $a] != "\$0000") + ([string trim $b] != "\$0003")} then {puts "ERROR!!"}
       wait 1000
       step
       set a [var i]
       puts "Var i should be \$0001"
       set b [var j]
       puts "Var j should be \$0003"
       if {([string trim $a] != "\$0001") + ([string trim $b] != "\$0003")} then {puts "ERROR!!"}
       wait 1000
       step
       set a [var i]
       puts "Var i should be \$0001"
       set b [var j]
       puts "Var j should be \$0004"
       if {([string trim $a] != "\$0001") + ([string trim $b] != "\$0004")} then {puts "ERROR!!"}
       bp all off
       restart

       puts "Testing GO and STOP"
       bp all off
       bp increment_ij
       go
       set s [status]
       puts "Status should be Stopped"
       if {[string first "Stopped" $s] == -1} then {puts "ERROR!!"}
       set a [var i]
       puts "Var i should be \$0000"
       set b [var j]
       puts "Var j should be \$0003"
       if {([string trim $a] != "\$0000") + ([string trim $b] != "\$0003")} then {puts "ERROR!!"}
       wait 1000
       bp all off
       bp increment_k
       wait 1000
       go
       set s [status]
       puts "Status should be Stopped"
       if {[string first "Stopped" $s] == -1} then {puts "ERROR!!"}
       set a [var i]
       puts "Var i should be \$0003"
       set b [var j]
       puts "Var j should be \$0006"
       if {([string trim $a] != "\$0003") + ([string trim $b] != "\$0006")} then {puts "ERROR!!"}
       bp all off
       restart

       puts "Testing BREAKPOINT"
       bp all off
       bp increment_k
       set a [var i]
       puts "Var i should be \$0000"
       set b [var j]
       puts "Var j should be \$0003"
       if {([string trim $a] != "\$0000") + ([string trim $b] != "\$0003")} then {puts "ERROR!!"}
       go
       set a [var i]
       puts "Var i should be \$0003"
       set b [var j]
       puts "Var j should be \$0006"
       if {([string trim $a] != "\$0003") + ([string trim $b] != "\$0006")} then {puts "ERROR!!"}
       bp all off
       restart

       puts "Testing Read/Write RAM, byte"
       set m [var temp_byte]
       puts "temp_byte should be \$00"
       set n [var &temp_byte]
       if {[string trim $m] != "\$00"} then {puts "ERROR!!"}
       mem [string trim $n] x1h1=0x01
       set m [var temp_byte]
       puts "temp_byte should now be \$01"
       if {[string trim $m] != "\$01"} then {puts "ERROR!!"}

       puts "Testing Read/Write RAM, word"
       set o [var temp_word]
       puts "temp_word should be \$0000"
       set p [var &temp_word]
       if {[string trim $o] != "\$0000"} then {puts "ERROR!!"}
       mem [string trim $p] x2h2=0x02
       set o [var temp_word]
       puts "temp_word should now be \$0002"
       if {[string trim $o] != "\$0002"} then {puts "ERROR!!"}

       puts "Testing Read/Write RAM, long"
       set q [var temp_long]
       puts "temp_long should be \$00000000"
       set r [var &temp_long]
       if {[string trim $q] != "\$00000000"} then {puts "ERROR!!"}
       mem [string trim $r] x4h4=0x03
       set q [var temp_long]
       puts "temp_long should now be \$00000003"
       if {[string trim $q] != "\$00000003"} then {puts "ERROR!!"}

       puts "Testing Restart"
       restart
       bp all off
       set pc1 [reg pc]
       set m [var main]
       set q [string replace $pc1 0 end-4]
       set r [string trim $m]
       set r [string replace $r 0 end-4]
       puts "pc1 and main should be equal"
       if {[string compare $q $r] != 0} then {puts "ERROR!!"}
       restart
       set pc2 [reg pc]
       puts "pc1 and pc2 should be equal"
       if {[string compare $pc1 $pc2] != 0} then {puts "ERROR!!"}

       puts "DONE DONE DONE DONE!!!!"
       puts "DONE DONE DONE DONE!!!!"
       puts "DONE DONE DONE DONE!!!!"
       kill
       }
    } result]} {
       test fail "Unexpectedly failed" $result
    }
    log off all
    quitIDE

Add comment


   Want to comment? Please login or create a new PEmicro account.







© 2021 P&E Microcomputer Systems Inc.
Website Terms of Use and Sales Agreement