Author Topic: bootloader load new software in file system in SPI?  (Read 10618 times)

Offline benoit

  • Newbie
  • *
  • Posts: 8
    • View Profile
bootloader load new software in file system in SPI?
« on: August 28, 2009, 02:10:17 PM »
Hi Mark,
It is possible to load a new software .bin in the filesystem on FLASH SPI(m25p16),
and after load it with the bootloader. the goal is to use internal flash to uTasker and the program
and SPI flash to upload software and file system.

I use the vesion SP8
thanks 

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: bootloader load new software in file system in SPI?
« Reply #1 on: August 28, 2009, 10:21:22 PM »
Hi

Yes this is possible (see also http://www.utasker.com/docs/uTasker/uTaskerBoot_003.PDF).
The application can be configured to have the uFileSystem in SPI FLASH and a reserved area for uploading (SPI_FILE_SYSTEM + FLASH_FILE_SYSTEM, don't use SPI_SW_UPLOAD).
The boot project must be configured with SPI_SW_UPLOAD and the location to check for new firmware.

Regards

Mark

Offline benoit

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: bootloader load new software in file system in SPI?
« Reply #2 on: August 31, 2009, 07:54:59 AM »
thanks for this informations.

the reserved area for uploading it is in the SPI file system?

my configuration is, for the application : SPI_FILE_SYSTEM + FLASH_FILE_SYSTEM.
for  boot project, SPI_FILE_SYSTEM + FLASH_FILE_SYSTEM + SPI_SW_UPLOAD, it is possible or i must use SPI_SW_UPLOAD only.

when i run bootloader project in debug codewarrior say  "Exception vector name: Adresse Error"
and when i run application in debug application start but don't run.

Thanks

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: bootloader load new software in file system in SPI?
« Reply #3 on: August 31, 2009, 01:53:43 PM »
Hi

Yes, the reserved area for uploads in in the SPI FLASH.

The boot loader requires SPI_SW_UPLOAD and FLASH_FILE_SYSTEM only. SPI_FILE_SYSTEM should not be set.

[Historically there was a first phase of the use of SPi FLASH for upload, before the uFileSystem was generally supported in it, in which case both used SPI_SW_UPLOAD. The use of SPI_SW_UPLOAD in the application has probably become redundant in the meantime but is still used by the boot code since it never actually uses the uFileSystem; it works with fixed addresses].

Note that both boot loader and application must be loaded for the SW to be able to run. The boot loader checks for new code and jumps to the application. If the application is not loaded as well it will jump to the application area and immediately crash.
Also ensure that both boot and application are configured correctly, including the linker script. The linker script for the M522XX project needs to be set for the application to start at 0x1000 (the boot code is 4k when SPI FLASH is supported). If using the uTaskerV1.4 project there are specific targets prepared for this - eg. M5223X_BM_SPI_ROM which uses the M52235EVB_BOOT_APP_FLASH_SPI.lcf linker script. If using uTasketV1.3, or a project for a different processor, it may be necessary to modify the script from 0x800 to 0x1000 start address to suit.

Regards

Mark

Offline benoit

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: bootloader load new software in file system in SPI?
« Reply #4 on: August 31, 2009, 03:24:18 PM »
Hi,

Thanks, I have not change 0x800 to 0x1000 in the linker.

now the bootloader and the application run.

But the new software load don't replace actually software at the reset of card.

I load new software Q.bin at SPI at adress 0x1E1000.

I have the fallowing code :

#if defined (_M5223X)
    #ifdef SPI_SW_UPLOAD
        //#define UPLOAD_FILE_LOCATION   (uFILE_SYSTEM_END + 0)            // start of SPI FLASH {3}
        #define UPLOAD_FILE_LOCATION   (unsigned char *)0x1E1000
        #define UTASKER_APP_START      0x1000                            // external SPI FLASH solution requires two FLASH block for the boot code because it needs both FLASH and SPI drivers
        #define UTASK_APP_LENGTH       (MAX_FILE_LENGTH)(0x18000 - UTASKER_APP_START)// 92k
    #else
    ...
    #end if
#end if


I have fogotten something? or it is not possible to load new software in file system when using FLASH_FILE_SYSTEM and SPI_SW_UPLOAD?

benoit

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: bootloader load new software in file system in SPI?
« Reply #5 on: August 31, 2009, 03:50:26 PM »
Hi Benoit

If you can see the uploaded file (eg. when connecting and performing DIR via FTP) it means that the upload worked but the boot loader doesn't accept the content.

Check the following:
- BM-Convert.bat - when using this the file is not encrypted. Make sure that #define _ENCRYPTED is not active in the boot loader.
- BM-Convert_Encrypt.bat - when using this the file is encrypted. make sure that the define _ENCRYPTED is active in the boot loader.

In both cases make sure that the conversion parameters in the conversion utility bat files match those in the boot loader. Also ensure that both application and boot are set for the same SPI FLASH chip type!

Regards

Mark

PS. When working with the simulator mis-match problems can be easily checked as follows:
1) Run the application simulation project and test the firmware upload. Quit the simulator (after a web upload it will reset itself automatically)
2) Copy the FLASH content (eg. STM25PXXX.ini or other SPI FLASH being used) from the simulation directory in the application project to the simulation director in the boot project.
3) Run the boot simulator and step through the uTaskerBoot() code. It will check the SPI FLASH content and calculate its check-sum before verifying this with the expected values. It is very easy to see whether it is looking at the wrong location in FLASH, finding a bad magic-number or getting a bad checksum, etc.