Author Topic: SW upload via Web post  (Read 11589 times)

Offline johnr

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
SW upload via Web post
« on: November 12, 2007, 10:46:24 PM »
Hi, I'm trying to do a SW upload via a Web Post after increasing the
code size from 96K to 104K. I do not have SPI_SW_upload enabled. When I leave the code size at 96K I can do the upload and see the new version displayed. I increase the code size in app_hw_m5233x.h as follows:

Code: [Select]
// FLASH based File System setup
//
#ifdef FLASH_FILE_SYSTEM
    // #define uFILE_START 0x18000                                          // FLASH location at 96k start
    #define uFILE_START 0x1A000                                          // FLASH location at 104k start

    #define SINGLE_FILE_SIZE (1*FLASH_GRANULARITY)                       // each file a multiple of 2k
    //#define FILE_SYSTEM_SIZE (80*SINGLE_FILE_SIZE)                       // 160k reserved for file system (including parameter blocks)
    #define FILE_SYSTEM_SIZE (76*SINGLE_FILE_SIZE)                       // 152k reserved for file system (including parameter blocks)
#

 I change every instance of 160*1024  as follows in webinterface.c

//#if FILE_SYSTEM_SIZE >= (160*1024)                                   // support posting new firmware only with large file system
    #if FILE_SYSTEM_SIZE >= (152*1024)                                   // support posting new firmware only with large file system
 

 After changing the file system size I erase the whole flash and program
in the boot loader and BM code.  I then change the version number,
run make and bm_convert.bat to generate the H_Upload.bin.
After selecting the file and hitting the upload button it says
upload successfull, reboot in 10 sec. After rebooting it displays the old
version. Am I missing something in the code ?


 Thanks,
 John
« Last Edit: November 12, 2007, 10:47:59 PM by johnr »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: SW upload via Web post
« Reply #1 on: November 13, 2007, 02:30:30 AM »
Hi John

If the SW upload works correctly and the board resets afterwards but boots 'too' quickly (i.e. immediately rather than taking a few seconds to delete the old code and program the new code) it means that the new code has not been recognised as being valid. If you look in the file system using FTP you will then see the uploaded file there (eg. H.bin) - this confirms that it is being treated as a normal file and not as a file to start the SW upload sequence.

The happens if the header of the file doesn't correspond to the settings in the boot software (its magic number, its encrypted state, etc.).

Take a look at the boot software project in the file uTaskerBootLoader.c.

At the start of the file you will find its set up. Make sure that you have also adjusted this to suit your project (then compile and load):
Code: [Select]
        #define UPLOAD_FILE_LOCATION   (unsigned char *)0x21800          // location in internal FLASH
        #define UTASKER_APP_START      0x800                             // Internal FLASH solution requires one FLASH block for the boot code
        #define UTASK_APP_LENGTH       (MAX_FILE_LENGTH)(0x18000 - 0x800)// 94k
    static const unsigned char ucKey[] = {0xa7, 0x48, 0xb6, 0x53, 0x11, 0x24};
        #define VALID_VERSION_MAGIC_NUMBER  0x1234

Check that you have adjusted this also to match:
        #define UTASK_APP_LENGTH       (MAX_FILE_LENGTH)(0x20000 - 0x800)// 126k
 
If the file size is larger than expected it will be rejected. I am not sure exactly which location your upload file is at but this will (probably) have to be adjusted too.

In any case, ensure that the file which you are loading is posted to a suitable location. If you have a large length it will have to be posted to somewhere around the start of the file system so that it fits (otherwise its end will be cut off and its CRC will also not be correct). For example, the bm_convert.bat file can be modified to create a different file name:

To use for example the file A_Upload.bin (will start at the 'A' address)
uTaskerConvert.exe uTasker_BM.elf.bin A_Upload.bin -0x1234 -a748b6531124

In the html file for the post (admin side in the demo project), you can force all uploads to the same location by changing

<form action=HS.bin enctype="multipart/form-data" method="post">
to
<form action=AS.bin enctype="multipart/form-data" method="post">

Note that the post method 'forces' the final location and so the name of the file to post doesn't actually matter.
In the case of copying the file via FTP it is the name which defines its location and so the correct name can be important.

For full details of how the uFileSystem operates consult the document:
http://www.utasker.com/docs/uTasker/uTaskerFileSystem.PDF
For more details about the boot loader check out:
http://www.utasker.com/docs/uTasker/uTaskerBoot_003.PDF and
http://www.utasker.com/docs/uTasker/BM-Booloader_for_M5223X.PDF

Good luck!!

Regards

Mark



Offline johnr

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
Re: SW upload via Web post
« Reply #2 on: November 13, 2007, 06:02:44 PM »
Mark, I made the changes in uTaskerBootLoader.c to reflect the new code size.
I am starting the File system at 0x1E000 which gives me 120K of code and I'm
loading it at 0x1F000, which is above the parameter blocks. Everything works
OK now. When we go with a SPI EEPROM I can increase the code some more
if we need to until we run out of file system space. What is the largest
EEPROM you would recommend that we use ? We plan on do some datalogging
and storing the data on top of the SW upload area.


 Thanks for the help,
 John

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: SW upload via Web post
« Reply #3 on: November 13, 2007, 06:18:59 PM »
Hi John

The largest SPI EEPROM that I know is 64k.

The SPI FLASH chips are available from 128k up to (about) 8MByte.

The size of the chip is basically a configuration, so all are suitable. The smallest is probably hardly less expensive that a middle sized one - I would go for one which is readily available and has some room for expansion if required.

The development version (input to next SP release) can handle multiple chips so several could also be used to increase the memory size.

Regards

Mark

Offline johnr

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
Re: SW upload via Web post
« Reply #4 on: November 13, 2007, 07:48:34 PM »
Thanks Mark, We'll probably use one of the larger flash chips.

 John