Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FlashCat USB scripts (.fcs) error
#1
hey fellaz,

got the sb5100mod up n running:

sb5100mod screenshot

I had to modify BCUSB script for some strange reason their if statements stop the read/write to bootloader and read/write firmware option.

This is the details if anyone is experiencing this same issue with their script. I know the sb5100 is pretty much dead but I don't know maybe someone falls into the same scenarios as me:

my equipment:
Modem: SB5100
Programmer: Flashcat usb board version 2.1 (create by embeddedcomputers)
Software package: FCUSB.RC17.350
Flashing software: FlashcatUSB build 350 (found in the software package)

The original script was as follow:
BCM3348_JTAG.fcs
Code:
# Script file for BCM3348 - 0x334817F

MyDevice = "Broadcom BCM3348"    #Name of device
BootSize = 32768        #Size of bootloader (in bytes)

SetParam(1,100)    #Sets the Intel flash delay
SetParam(2,250) #Sets the AMD flash delay
SetParam(3,100) #Sets the DMA read delay

JTAG.BigEndian    #Sets the device endian

JTAG.MemoryAddress(0x0)
JTAG.MemoryType("RAM")
JTAG.MemorySize(0x800000)
CFGMEM = JTAG.MemoryInit()
JTAG.MemoryAddress(0x1FC00000)
JTAG.MemoryType("CFI")
CFGFLASH = JTAG.MemoryInit()

Legacy.SetFlash(CFGFLASH)
MYFIRMNAME = Legacy.GetFwName()

t1 = Tab.Create(MyDevice)
Tab(t1).AddGroup("Bootloader",10,10,420,54)
Tab(t1).AddGroup("Firmware",10,70,420,80)
Tab(t1).AddText("MSG1","This changes the default bootloader",20,36)
Tab(t1).AddButton("ReadBoot","Read",250,30)
Tab(t1).AddButton("WriteBoot","Write",340,30)
Tab(t1).AddText("FWTITLE","Currently installed:",18,92)
Tab(t1).AddText("FW",MYFIRMNAME,18,106)
Tab(t1).AddButton("SaveFirmware","Save",250,98)
Tab(t1).AddButton("WriteFirmware","Change",340,98)

CreateEvent(ReadBoot)    #This reads the bootloader
    Status("Reading the BCM3348 Bootloader")
        Tab(t1).ButtonDisable()
    MyData = Memory(CFGFLASH).Read(0,BootSize,False)
    Prompt = "Choose filename to save bootloader"    
    SaveFile(MyData,Prompt,"BCM3348.Bootloader.bin")
    Status("Successfully read bootloader from Flash")
        Tab(t1).ButtonEnable()
EndEvent

CreateEvent(WriteBoot)
        Tab(t1).ButtonDisable()
    Prompt = "Choose a bootloader to write into Flash"    
    MyData = OpenFile(Prompt,"Bootloader files (*.bin)|*.bin")
    if (MyData = Nothing)
        goto    WriteBootExit
    endif
    if not (Len(MyData) = BootSize)
        Status("Error: File is not the size of the bootloader")
        goto    WriteBootExit
    endif
    Memory(CFGFLASH).Write(MyData,0,BootSize)
    Status("New bootloader successfully written")
WriteBootExit:
        Tab(t1).ButtonEnable()
EndEvent

CreateEvent(SaveFirmware)
    Status("Saving the BCM3348's Firmware")
        Tab(t1).ButtonDisable()
    FwStart = Legacy.GetFwLocation()
    FwLen = Legacy.GetFwLen()
    FwLen += 92                      #Need to add 92 bytes to cover the fw header
    MyData = Memory(CFGFLASH).ReadVerify(FwStart,FwLen)   #ReadFlashVerify
        if (MyData = Nothing)
        Status("Error: data read was corrupted")
            Tab(t1).ButtonEnable()
        Exit Event
    endif
    Prompt = "Choose filename to save the firmware"
    SaveFile(MyData,Prompt,MYFIRMNAME)
    Status("Successfully read firmware from Flash")
        Tab(t1).ButtonEnable()
EndEvent

CreateEvent(WriteFirmware)
    Status("Programming the BCM3348's Firmware")
        Tab(t1).ButtonDisable()
    Prompt = "Choose a firmware to install"    
    MyData = OpenFile(Prompt,"Firmware files (*.bin,*.p7)|*.bin;*.p7")
    if (MyData = Nothing)
        WriteErr = "User cancelled opperation"
        goto    ExitWriteFwErr
    endif
    If (HWORD(MyData,0) = 12418)        #Remove header if .p7 fw
        Writeline("Removing .p7 firmware header")
        HeadLen = HWORD(MyData,2) + 7    #increases Headlen by 7
        NewLen = Len(MyData) - HeadLen
        Resize(MyData,HeadLen,NewLen)    #Removes the p7 header
    endif
    FwLen = Len(MyData)
    FwStart = Legacy.GetFwLocation()
    If (FwStart = 0)
        WriteErr = "Error: Firmware destination not found"
        goto    ExitWriteFwErr
    endif
    If (FwLen > 600000)
        goto    BeginWrite
    endif
    If not Ask("File is smaller than a typical firmware. Write Anyways?")
            WriteErr = "Cancelled firmware update"
        goto    ExitWriteFwErr
    endif
BeginWrite:
    Memory(CFGFLASH).Write(MyData,FwStart,FwLen)
    Status("New firmware successfully installed")
    MYFIRMNAME = Legacy.GetFwName()
    Tab(t1).SetText("FW",MYFIRMNAME)
        Tab(t1).ButtonEnable()
        Exit
  ExitWriteFwErr:
    Status(WriteErr)
        Tab(t1).ButtonEnable()
EndEvent

I just commented out the if statements for the write events for the bootloader and the firmware option and the flashcatusb did its job.

BUT BE AWARE that the if statements as you can see do some validation to ensure that the bootloader and firmware you are using are legit. So commenting these out means that you trust that the bootloader and firmware you are flashing your modem with is without a doubt correct.

Modified script:
Code:
# Script file for BCM3348 - 0x334817F

MyDevice = "Broadcom BCM3348"    #Name of device
BootSize = 32768        #Size of bootloader (in bytes)

SetParam(1,100)    #Sets the Intel flash delay
SetParam(2,250) #Sets the AMD flash delay
SetParam(3,100) #Sets the DMA read delay

JTAG.BigEndian    #Sets the device endian

JTAG.MemoryAddress(0x0)
JTAG.MemoryType("RAM")
JTAG.MemorySize(0x800000)
CFGMEM = JTAG.MemoryInit()
JTAG.MemoryAddress(0x1FC00000)
JTAG.MemoryType("CFI")
CFGFLASH = JTAG.MemoryInit()

Legacy.SetFlash(CFGFLASH)
MYFIRMNAME = Legacy.GetFwName()

t1 = Tab.Create(MyDevice)
Tab(t1).AddGroup("Bootloader",10,10,420,54)
Tab(t1).AddGroup("Firmware",10,70,420,80)
Tab(t1).AddText("MSG1","This changes the default bootloader",20,36)
Tab(t1).AddButton("ReadBoot","Read",250,30)
Tab(t1).AddButton("WriteBoot","Write",340,30)
Tab(t1).AddText("FWTITLE","Currently installed:",18,92)
Tab(t1).AddText("FW",MYFIRMNAME,18,106)
Tab(t1).AddButton("SaveFirmware","Save",250,98)
Tab(t1).AddButton("WriteFirmware","Change",340,98)

CreateEvent(ReadBoot)    #This reads the bootloader
    Status("Reading the BCM3348 Bootloader")
        Tab(t1).ButtonDisable()
    MyData = Memory(CFGFLASH).Read(0,BootSize,False)
    Prompt = "Choose filename to save bootloader"    
    SaveFile(MyData,Prompt,"BCM3348.Bootloader.bin")
    Status("Successfully read bootloader from Flash")
        Tab(t1).ButtonEnable()
EndEvent

CreateEvent(WriteBoot)
        Tab(t1).ButtonDisable()
    Prompt = "Choose a bootloader to write into Flash"    
    MyData = OpenFile(Prompt,"Bootloader files (*.bin)|*.bin")
    #if (MyData = Nothing)
    #    goto    WriteBootExit
    #endif
    #if not (Len(MyData) = BootSize)
    #    Status("Error: File is not the size of the bootloader")
    #    goto    WriteBootExit
    #endif
    Memory(CFGFLASH).Write(MyData,0,BootSize)
    Status("New bootloader successfully written")
WriteBootExit:
        Tab(t1).ButtonEnable()
EndEvent

CreateEvent(SaveFirmware)
    Status("Saving the BCM3348's Firmware")
        Tab(t1).ButtonDisable()
    FwStart = Legacy.GetFwLocation()
    FwLen = Legacy.GetFwLen()
    FwLen += 92                      #Need to add 92 bytes to cover the fw header
    MyData = Memory(CFGFLASH).ReadVerify(FwStart,FwLen)   #ReadFlashVerify
        #if (MyData = Nothing)
    #    Status("Error: data read was corrupted")
        #    Tab(t1).ButtonEnable()
    #    Exit Event
    #endif
    Prompt = "Choose filename to save the firmware"
    SaveFile(MyData,Prompt,MYFIRMNAME)
    Status("Successfully read firmware from Flash")
        Tab(t1).ButtonEnable()
EndEvent

CreateEvent(WriteFirmware)
    Status("Programming the BCM3348's Firmware")
        Tab(t1).ButtonDisable()
    Prompt = "Choose a firmware to install"    
    MyData = OpenFile(Prompt,"Firmware files (*.bin,*.p7)|*.bin;*.p7")
    #if (MyData = Nothing)
    #    WriteErr = "User cancelled opperation"
    #    goto    ExitWriteFwErr
    #endif
    #If (HWORD(MyData,0) = 12418)        #Remove header if .p7 fw
    #    Writeline("Removing .p7 firmware header")
    #    HeadLen = HWORD(MyData,2) + 7    #increases Headlen by 7
    #    NewLen = Len(MyData) - HeadLen
    #    Resize(MyData,HeadLen,NewLen)    #Removes the p7 header
    #endif
    FwLen = Len(MyData)
    FwStart = Legacy.GetFwLocation()
    #If (FwStart = 0)
    #    WriteErr = "Error: Firmware destination not found"
    #    goto    ExitWriteFwErr
    #endif
    #If (FwLen > 600000)
    #    goto    BeginWrite
    #endif
    #If not Ask("File is smaller than a typical firmware. Write Anyways?")
        #    WriteErr = "Cancelled firmware update"
    #    goto    ExitWriteFwErr
    #endif
BeginWrite:
    Memory(CFGFLASH).Write(MyData,FwStart,FwLen)
    Status("New firmware successfully installed")
    MYFIRMNAME = Legacy.GetFwName()
    Tab(t1).SetText("FW",MYFIRMNAME)
        Tab(t1).ButtonEnable()
        Exit
  ExitWriteFwErr:
    Status(WriteErr)
        Tab(t1).ButtonEnable()
EndEvent

Anywayz, if anyone is having issues with their flashcat usb script try debugging it by commenting out some if statements and placing sum Status("Message") function to see if the code reaches that part of the script.

I original came to ask about my SBG901 but I'll post that in another thread as this one is already huge.

I'm just leaving this here maybe it helps someone maybe it doesn't what do you think?
Reply
#2
(15-08-2015, 06:08 AM)key_rookie Wrote: hey fellaz,

got the sb5100mod up n running:

sb5100mod screenshot

I had to modify BCUSB script for some strange reason their if statements stop the read/write to bootloader and read/write firmware option.

This is the details if anyone is experiencing this same issue with their script. I know the sb5100 is pretty much dead but I don't know maybe someone falls into the same scenarios as me:

my equipment:
Modem: SB5100
Programmer: Flashcat usb board version 2.1 (create by embeddedcomputers)
Software package: FCUSB.RC17.350
Flashing software: FlashcatUSB build 350 (found in the software package)

The original script was as follow:
BCM3348_JTAG.fcs
Code:
# Script file for BCM3348 - 0x334817F

MyDevice = "Broadcom BCM3348"    #Name of device
BootSize = 32768        #Size of bootloader (in bytes)

SetParam(1,100)    #Sets the Intel flash delay
SetParam(2,250) #Sets the AMD flash delay
SetParam(3,100) #Sets the DMA read delay

JTAG.BigEndian    #Sets the device endian

JTAG.MemoryAddress(0x0)
JTAG.MemoryType("RAM")
JTAG.MemorySize(0x800000)
CFGMEM = JTAG.MemoryInit()
JTAG.MemoryAddress(0x1FC00000)
JTAG.MemoryType("CFI")
CFGFLASH = JTAG.MemoryInit()

Legacy.SetFlash(CFGFLASH)
MYFIRMNAME = Legacy.GetFwName()

t1 = Tab.Create(MyDevice)
Tab(t1).AddGroup("Bootloader",10,10,420,54)
Tab(t1).AddGroup("Firmware",10,70,420,80)
Tab(t1).AddText("MSG1","This changes the default bootloader",20,36)
Tab(t1).AddButton("ReadBoot","Read",250,30)
Tab(t1).AddButton("WriteBoot","Write",340,30)
Tab(t1).AddText("FWTITLE","Currently installed:",18,92)
Tab(t1).AddText("FW",MYFIRMNAME,18,106)
Tab(t1).AddButton("SaveFirmware","Save",250,98)
Tab(t1).AddButton("WriteFirmware","Change",340,98)

CreateEvent(ReadBoot)    #This reads the bootloader
    Status("Reading the BCM3348 Bootloader")
        Tab(t1).ButtonDisable()
    MyData = Memory(CFGFLASH).Read(0,BootSize,False)
    Prompt = "Choose filename to save bootloader"    
    SaveFile(MyData,Prompt,"BCM3348.Bootloader.bin")
    Status("Successfully read bootloader from Flash")
        Tab(t1).ButtonEnable()
EndEvent

CreateEvent(WriteBoot)
        Tab(t1).ButtonDisable()
    Prompt = "Choose a bootloader to write into Flash"    
    MyData = OpenFile(Prompt,"Bootloader files (*.bin)|*.bin")
    if (MyData = Nothing)
        goto    WriteBootExit
    endif
    if not (Len(MyData) = BootSize)
        Status("Error: File is not the size of the bootloader")
        goto    WriteBootExit
    endif
    Memory(CFGFLASH).Write(MyData,0,BootSize)
    Status("New bootloader successfully written")
WriteBootExit:
        Tab(t1).ButtonEnable()
EndEvent

CreateEvent(SaveFirmware)
    Status("Saving the BCM3348's Firmware")
        Tab(t1).ButtonDisable()
    FwStart = Legacy.GetFwLocation()
    FwLen = Legacy.GetFwLen()
    FwLen += 92                      #Need to add 92 bytes to cover the fw header
    MyData = Memory(CFGFLASH).ReadVerify(FwStart,FwLen)   #ReadFlashVerify
        if (MyData = Nothing)
        Status("Error: data read was corrupted")
            Tab(t1).ButtonEnable()
        Exit Event
    endif
    Prompt = "Choose filename to save the firmware"
    SaveFile(MyData,Prompt,MYFIRMNAME)
    Status("Successfully read firmware from Flash")
        Tab(t1).ButtonEnable()
EndEvent

CreateEvent(WriteFirmware)
    Status("Programming the BCM3348's Firmware")
        Tab(t1).ButtonDisable()
    Prompt = "Choose a firmware to install"    
    MyData = OpenFile(Prompt,"Firmware files (*.bin,*.p7)|*.bin;*.p7")
    if (MyData = Nothing)
        WriteErr = "User cancelled opperation"
        goto    ExitWriteFwErr
    endif
    If (HWORD(MyData,0) = 12418)        #Remove header if .p7 fw
        Writeline("Removing .p7 firmware header")
        HeadLen = HWORD(MyData,2) + 7    #increases Headlen by 7
        NewLen = Len(MyData) - HeadLen
        Resize(MyData,HeadLen,NewLen)    #Removes the p7 header
    endif
    FwLen = Len(MyData)
    FwStart = Legacy.GetFwLocation()
    If (FwStart = 0)
        WriteErr = "Error: Firmware destination not found"
        goto    ExitWriteFwErr
    endif
    If (FwLen > 600000)
        goto    BeginWrite
    endif
    If not Ask("File is smaller than a typical firmware. Write Anyways?")
            WriteErr = "Cancelled firmware update"
        goto    ExitWriteFwErr
    endif
BeginWrite:
    Memory(CFGFLASH).Write(MyData,FwStart,FwLen)
    Status("New firmware successfully installed")
    MYFIRMNAME = Legacy.GetFwName()
    Tab(t1).SetText("FW",MYFIRMNAME)
        Tab(t1).ButtonEnable()
        Exit
  ExitWriteFwErr:
    Status(WriteErr)
        Tab(t1).ButtonEnable()
EndEvent

I just commented out the if statements for the write events for the bootloader and the firmware option and the flashcatusb did its job.

BUT BE AWARE that the if statements as you can see do some validation to ensure that the bootloader and firmware you are using are legit. So commenting these out means that you trust that the bootloader and firmware you are flashing your modem with is without a doubt correct.

Modified script:
Code:
# Script file for BCM3348 - 0x334817F

MyDevice = "Broadcom BCM3348"    #Name of device
BootSize = 32768        #Size of bootloader (in bytes)

SetParam(1,100)    #Sets the Intel flash delay
SetParam(2,250) #Sets the AMD flash delay
SetParam(3,100) #Sets the DMA read delay

JTAG.BigEndian    #Sets the device endian

JTAG.MemoryAddress(0x0)
JTAG.MemoryType("RAM")
JTAG.MemorySize(0x800000)
CFGMEM = JTAG.MemoryInit()
JTAG.MemoryAddress(0x1FC00000)
JTAG.MemoryType("CFI")
CFGFLASH = JTAG.MemoryInit()

Legacy.SetFlash(CFGFLASH)
MYFIRMNAME = Legacy.GetFwName()

t1 = Tab.Create(MyDevice)
Tab(t1).AddGroup("Bootloader",10,10,420,54)
Tab(t1).AddGroup("Firmware",10,70,420,80)
Tab(t1).AddText("MSG1","This changes the default bootloader",20,36)
Tab(t1).AddButton("ReadBoot","Read",250,30)
Tab(t1).AddButton("WriteBoot","Write",340,30)
Tab(t1).AddText("FWTITLE","Currently installed:",18,92)
Tab(t1).AddText("FW",MYFIRMNAME,18,106)
Tab(t1).AddButton("SaveFirmware","Save",250,98)
Tab(t1).AddButton("WriteFirmware","Change",340,98)

CreateEvent(ReadBoot)    #This reads the bootloader
    Status("Reading the BCM3348 Bootloader")
        Tab(t1).ButtonDisable()
    MyData = Memory(CFGFLASH).Read(0,BootSize,False)
    Prompt = "Choose filename to save bootloader"    
    SaveFile(MyData,Prompt,"BCM3348.Bootloader.bin")
    Status("Successfully read bootloader from Flash")
        Tab(t1).ButtonEnable()
EndEvent

CreateEvent(WriteBoot)
        Tab(t1).ButtonDisable()
    Prompt = "Choose a bootloader to write into Flash"    
    MyData = OpenFile(Prompt,"Bootloader files (*.bin)|*.bin")
    #if (MyData = Nothing)
    #    goto    WriteBootExit
    #endif
    #if not (Len(MyData) = BootSize)
    #    Status("Error: File is not the size of the bootloader")
    #    goto    WriteBootExit
    #endif
    Memory(CFGFLASH).Write(MyData,0,BootSize)
    Status("New bootloader successfully written")
WriteBootExit:
        Tab(t1).ButtonEnable()
EndEvent

CreateEvent(SaveFirmware)
    Status("Saving the BCM3348's Firmware")
        Tab(t1).ButtonDisable()
    FwStart = Legacy.GetFwLocation()
    FwLen = Legacy.GetFwLen()
    FwLen += 92                      #Need to add 92 bytes to cover the fw header
    MyData = Memory(CFGFLASH).ReadVerify(FwStart,FwLen)   #ReadFlashVerify
        #if (MyData = Nothing)
    #    Status("Error: data read was corrupted")
        #    Tab(t1).ButtonEnable()
    #    Exit Event
    #endif
    Prompt = "Choose filename to save the firmware"
    SaveFile(MyData,Prompt,MYFIRMNAME)
    Status("Successfully read firmware from Flash")
        Tab(t1).ButtonEnable()
EndEvent

CreateEvent(WriteFirmware)
    Status("Programming the BCM3348's Firmware")
        Tab(t1).ButtonDisable()
    Prompt = "Choose a firmware to install"    
    MyData = OpenFile(Prompt,"Firmware files (*.bin,*.p7)|*.bin;*.p7")
    #if (MyData = Nothing)
    #    WriteErr = "User cancelled opperation"
    #    goto    ExitWriteFwErr
    #endif
    #If (HWORD(MyData,0) = 12418)        #Remove header if .p7 fw
    #    Writeline("Removing .p7 firmware header")
    #    HeadLen = HWORD(MyData,2) + 7    #increases Headlen by 7
    #    NewLen = Len(MyData) - HeadLen
    #    Resize(MyData,HeadLen,NewLen)    #Removes the p7 header
    #endif
    FwLen = Len(MyData)
    FwStart = Legacy.GetFwLocation()
    #If (FwStart = 0)
    #    WriteErr = "Error: Firmware destination not found"
    #    goto    ExitWriteFwErr
    #endif
    #If (FwLen > 600000)
    #    goto    BeginWrite
    #endif
    #If not Ask("File is smaller than a typical firmware. Write Anyways?")
        #    WriteErr = "Cancelled firmware update"
    #    goto    ExitWriteFwErr
    #endif
BeginWrite:
    Memory(CFGFLASH).Write(MyData,FwStart,FwLen)
    Status("New firmware successfully installed")
    MYFIRMNAME = Legacy.GetFwName()
    Tab(t1).SetText("FW",MYFIRMNAME)
        Tab(t1).ButtonEnable()
        Exit
  ExitWriteFwErr:
    Status(WriteErr)
        Tab(t1).ButtonEnable()
EndEvent

Anywayz, if anyone is having issues with their flashcat usb script try debugging it by commenting out some if statements and placing sum Status("Message") function to see if the code reaches that part of the script.

I original came to ask about my SBG901 but I'll post that in another thread as this one is already huge.

I'm just leaving this here maybe it helps someone maybe it doesn't what do you think?

hi -can you modify a script for sbg6..580?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)