AI7688 update issue

Okk I will go through it and let you know about the same

I have gone through the link but the firmware is also not working.

The cp.linux command is not working.
When I am using bootm command then its booting the firmware from the 0x80a00000 where the firmware is loadedd.

It's not copying the image to the defult booting location.
Due to this an issue is occured. Please provide the solution To update the firmwre in AI7688H module using serial communication.

Below steps shows the firmware is not getting cpoied to the default address at bc050000.

U-Boot 1.1.3 for AI7688H-64MB (Feb 16 2017 - 08:19:34)

Board: Ralink APSoC
DRAM:  128 MB
relocate_code Pointer at: 87f68000
flash manufacture id: c2, device id 20 1a
find flash: MX25L51245G
============================================ 
Ralink UBoot Version: 4.3.0.0
-------------------------------------------- 
ASIC 7628_MP (Port5<->None)
DRAM component: 1024 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 128 MBytes
Flash component: SPI Flash
Date:Feb 16 2017  Time:08:19:34
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 

 ##### The CPU freq = 580 MHZ #### 
 estimate memory size =128 Mbytes
RESET MT7628 PHY!!!!!!

GPIOMODE --> 50054404

GPIOMODE2 --> 5540551

Please choose the operation: 
   1: Load system code to SDRAM via TFTP. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial. 
   9: Load Boot Loader code then write to Flash via TFTP. 

You choosed 4

 0 

   
4: System Enter Boot Command Line Interface.

U-Boot 1.1.3 for AI7688H-64MB (Feb 16 2017 - 08:19:34)
MT7628 # 
MT7628 # 
MT7628 # 
MT7628 # loadb 0x80000000 57600
## Ready for binary (kermit) download to 0x80000000 at 57600 bps...
## Total Size      = 0x00540164 = 5505380 Bytes
## Start Addr      = 0x80000000
MT7628 # help erase
erase 
erase all
    - erase all FLASH banks
erase uboot
    - erase uboot block
erase linux
    - erase linux kernel block

MT7628 # erase linux

 Erase linux kernel block !!
From 0x50000 length 0x3FB0000
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
MT7628 # help cp
cp 
cp.uboot
    - copy uboot block
cp.linux
    - copy linux kernel block

MT7628 # cp.linux 

 Copy linux image[1431655765 byte] to SPI Flash[0x00050000].... 
MT7628 # 

MT7628 # reset
[04050C09][04050C0D]
DDR Calibration DQS reg = 00008987


U-Boot 1.1.3 for AI7688H-64MB (Feb 16 2017 - 08:19:34)

Board: Ralink APSoC
DRAM:  128 MB
relocate_code Pointer at: 87f68000
******************************
Software System Reset Occurred
******************************
flash manufacture id: c2, device id 20 1a
find flash: MX25L51245G
============================================ 
Ralink UBoot Version: 4.3.0.0
-------------------------------------------- 
ASIC 7628_MP (Port5<->None)
DRAM component: 1024 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 128 MBytes
Flash component: SPI Flash
Date:Feb 16 2017  Time:08:19:34
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 

 ##### The CPU freq = 580 MHZ #### 
 estimate memory size =128 Mbytes
RESET MT7628 PHY!!!!!!

GPIOMODE --> 50054404

GPIOMODE2 --> 5540551

Please choose the operation: 
   1: Load system code to SDRAM via TFTP. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial. 
   9: Load Boot Loader code then write to Flash via TFTP. 
 2  1  0 
   
3: System Boot system code via Flash.
## Booting image at bc050000 ...
Bad Magic Number,FFFFFFFF 
[04050C09][04050C0E]
DDR Calibration DQS reg = 00008987

So, please provide the steps to update the firmware (kernel and rootfs) in AI7688H module using serail connection.

Seems there's a discrepancy here ....

Can you please provide the steps to update firmware using serial connection in AI7688H module...

Why do you think it should be copied to that address? The kernel log in your first post rather clearly says the firmware-partition starts at 0x50000 and according to the log, it is being written to the correct location, too.

Yes, bootm boots from RAM. It is working as intended.

1 Like

Just to clarify, you are trying to install AcSip's own, custom firmware and not official OpenWrt?

What I have gathered from these posts:

  • You are attempting to boot a kernel that is not for your device, which entails that the entire image isn't for your device. The kernel expects a 32MB flash, whereas your device has a 64MB one -- the kernel will work fine, but half the flash will go to waste.
  • Uboot's cp.linux only seems to copy the kernel, instead of the entire image, meaning that no rootfs gets copied?
  • When uboot complains that there's a bad magic number and can't boot from 0xBC050000, it doesn't refer to the address on the SPI flash, but instead a RAM-address. Why it fails to load the kernel to that address, I don't know, but it probably has something to do with the image being wrong.
1 Like

I have created image for 64mb flash. I need to update the firmware through loadb command.

File is getting downloaded using loadb command, but while using cp.linux command the binary is not getting copied to the flash location.

Due to which the firmware is not getting booted.

I am uploading sysupgrade image. So please let me knwo at which addres i need to upload the binary so that cp.linux command works successfully.

I think it would be far better for you to download an initramfs image, not sysupgrade image, and then use bootm to boot into the initramfs image. You can then download the sysupgrade image from there and just use the sysupgrade-command.

1 Like

@WereCatf ,

Thanks for your kind support and providing response as per query.

Myself Ritesh Prajapati working with Dhawal into same project

Here, We are struggling to flash kernel image or sysfsupgrade image from Boot Loader itself in which we are using cp.linux command from boot loader which has been already flashed by module manufacture using below link

GitHub - AcSiP/linkit-smart-7688-uboot at AI7688H__64MB

So, We just need one help regarding actual load address and flash address using which we can able to flash images using cp.linux command as flash is already erased except u-boot partition?

We have checked cp.linux command source code into boot loader but didn;t get exact address location from where it is going to copy image from RAM location to Flash Location. SO It would be good if you can provide some help for the understanding.

Let me know if need anything else from my end to understand issue

Regards,
Ritesh Prajapati

Is there some good reason why you are refusing to do it from initramfs?

I hope you didn't erase the factory partition.

cp.linux does write to the correct address on the SPI flash, but from the logs it looks like it is only writing the kernel, not the entire image, which is why I suggest doing it from initramfs instead. If you insist on not using initramfs, I suggest you check what help spi gives you instead -- maybe you can use those commands to write the full image instead of cp.linux

Another option would be to replace entire uboot itself with a newer one, like e.g. the Onion Omega - project has a far more user-friendly and capable uboot that you could use at https://github.com/OnionIoT/omega2-bootloader (though you'd have to modify it to support a 64MB flash as well and you might want to replace any Onion Omega - pictures and references with your company's ones)

1 Like

@WereCatf ,

It seems like default factory partition has been erased as per erase command executed so far..Only Boot loader partition is remained as it is.

But now we have to flash Kernel and File System as seperate image or combined sysfc upgrade image from provided boot loader but some how it seems like cp.linux command is not working or getting wrong address or don;t know exact load address because cp.linux command is return within one or less second after executing it

So, Don;t know like where exectly issue is like boot loader issue or memory address issue or loading address issue..

Regards,
Ritesh Prajapati

I already told you: it looks like cp.linux is useless and you need to either look at the spi commands of uboot or you need to replace the installed uboot with a better version.

Thanks @WereCatf for providing quick response.

We will check SPI related commands and let you know further updates with results for the same.

Regards,
Ritesh Prajapati

Hello @WereCatf ,

We have checked SPI commands as well but seems to be no any proper support or not working. Then we have dig into boot loader source code and found that option 0 is disabled to showcase into help of image flash loading option.

So, We have added and used that option which is working fine to update sysupgrade image into SPI Flash Memory

Thanks for providing support and help for the same.

Regards,
Ritesh Prajapati

That's good. It would be helpful, if you documented exactly what you changed, so if someone else has the same problem, they might find this thread via Google.

@WereCatf ,

We have checked into boot loader source and found that there is option 0 available but not shown into choose options

File Name - (https://github.com/AcSiP/linkit-smart-7688-uboot/blob/AI7688H__64MB/lib_mips/board.c)

#define SEL_LOAD_LINUX_WRITE_FLASH_BY_SERIAL 0
#define SEL_LOAD_LINUX_SDRAM 1
#define SEL_LOAD_LINUX_WRITE_FLASH 2
#define SEL_BOOT_FLASH 3
#define SEL_ENTER_CLI 4
#define SEL_LOAD_BOOT_WRITE_FLASH_BY_SERIAL 7
#define SEL_LOAD_BOOT_SDRAM 8
#define SEL_LOAD_BOOT_WRITE_FLASH 9

void OperationSelect(void)
{
printf("\nPlease choose the operation: \n");
printf(" %d: Load system code to SDRAM via TFTP. \n", SEL_LOAD_LINUX_SDRAM);
printf(" %d: Load system code then write to Flash via TFTP. \n", SEL_LOAD_LINUX_WRITE_FLASH);
printf(" %d: Boot system code via Flash (default).\n", SEL_BOOT_FLASH);
#ifdef RALINK_CMDLINE
printf(" %d: Entr boot command line interface.\n", SEL_ENTER_CLI);
#endif // RALINK_CMDLINE //
#ifdef RALINK_UPGRADE_BY_SERIAL
printf(" %d: Load Boot Loader code then write to Flash via Serial. \n", SEL_LOAD_BOOT_WRITE_FLASH_BY_SERIAL);
#endif // RALINK_UPGRADE_BY_SERIAL //
printf(" %d: Load Boot Loader code then write to Flash via TFTP. \n", SEL_LOAD_BOOT_WRITE_FLASH);
}

As you can see above that there are all options defined for Linux Image write into Flash Memory and Boot Loader Image into Flash Memory

#define SEL_LOAD_LINUX_WRITE_FLASH_BY_SERIAL 0
#define SEL_LOAD_BOOT_WRITE_FLASH_BY_SERIAL 7

So, Above both option will be useful to write boot loader and sysupgrade images into flash memory from boot loader through serial

We got success to flash both boot loader and sysfsupgrade images successfully into flash memory

Let me know if need anything else from my end

Regards,
Ritesh Prajapati

2 Likes

Hi all,

Issue is resolved by using the hidden option as provided by @Ritesh sir.

Now we can use the above hidden options to update the sysupgrade image in AI7688 module.

Thanks,
Lad Dhawal Umesh

1 Like

Hello @WereCatf ,

Let us know if need anything else or if we are missing anything to include as per solution details provided into last thread.

Regards,
Ritesh Prajapati

hello @dhawal

I try to upload firmware by loadb command using minicom kermit but it's not work.
what tool I should use?

Thank you

Hi @wattzhang,

Which option you are usuing to upload the firmware from uboot

There is one hidden option to upload the firmware. Instead of going in u-boot mode you can select the option 0, and directly select the file and upload the firmware. Rest of the stuf will be done by u-boot itself.

Thaknks,
Lad Dhawal Umesh