Author Topic: Flash memory layout  (Read 3840 times)

Offline johnr

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
Flash memory layout
« on: November 02, 2007, 06:43:40 PM »
Hi, I've been reading though the docs and code and have
a few questions concerning the memory layout. The code size
is limited to 96K and the file system size at 160K. Being you can
use up to 62 files, each mapped to a 2K block, this allows up
to 62*2=124K of space allocated for files. I see that the SW upload
code checks for at least 160K file size.
 Is it possible to increase the code size and decrease the file system
size and still have SW uploads ?

 Thanks,
 John


Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3068
    • View Profile
    • uTasker
Re: Flash memory layout
« Reply #1 on: November 02, 2007, 08:46:41 PM »
Hi John

The demo software contains an example of a set up, which can be modified to suit other requirements.

The code size is limited to 96K and the file system size at 160K.
This was chosen since it allows code to occupy the address range from 0..96k, then the remaining FLASH in the 52233 or 52235 to be used as a 160k file system (all together 256k). In the case of smaller FLASH devices like the 52232 the file system has to be limited to 32k. The demo web pages don't occupy more than 32k so that the demo also runs on the smaller devices without any modification.

Being you can use up to 62 files, each mapped to a 2K block, this allows up to 62*2=124K of space allocated for files.
This is correct, but don't forget that the last file can be as large as the remaining space and so all of the FLASH can still be used. In addition, the file granularity can alternatively be set to 4k, resulting in less different files but larger basic blocks, which also fills up the space. If you look in the directory \Applications\uTaskerV1.3\WebPages\WebPagesM5223X\FileSystem there is a document called FileSystemM5223X_160k.doc which illustrates these two set ups.

I see that the SW upload code checks for at least 160K file size.
Yes, this is simply to disable the upload feature should the file system be re-dimensioned for the smaller chip. It is a bit strict because often smaller file systems can be specified which still enable uploads. This can also be removed from the demo project if required - it was just to stop uploads from being able to fail due to incorrect settings. Instead, the upload is disabled on the web page and so it becomes obvious that something is not correct before it can go wrong.

Is it possible to increase the code size and decrease the file system size and still have SW uploads ?
There is some flexibility. The restriction comes from the fact that it is necessary to have the old and new code in the FLASH at the same time, plus have space for the boot loader (about 2k).
This means that in the demo set up, with 2k boot loader, the actual maximum upload size if 94k. This was configured like this for two reasons.

1. It is adequate in size for the maximum demo code plus some more experimental code.
2. It allows uploads to the file system without needing to overwrite the web page space (the file system has enough space for the new code of up to 94k plus the 32k demo web pages). [If the space has to be shared between the upload space and the web pages, it is necessary to reload the web pages after the upload as they will have been deleted during the process to make space for the software file].

This means in fact that the maximum upload size will be restricted to around 126k due to the fact that the boot loader plus 2 x program size must fit into 256k (assuming the larger device). The file system would have to be configured to be about 128k in size and its complete content will more or less be used for the upload process.

Note that if you add SPI FLASH (support in SP5) you then have the possibility of uploading up to 252k software files due to the fact that the boot loader occupies 4k, and the new code is stored externally. The down side is that if you really have 252k of code there is no more space for a file system in the internal FLASH. In many cases it is desirable to have all memory resources internal and so 126k code plus 128k file system would in fact be the perfect setup - since it is not practical to dictate code size, it is best if it is less that 126k and then all remaining can be assigned to the file system.

Regards

Mark



Offline johnr

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
Re: Flash memory layout
« Reply #2 on: November 06, 2007, 09:11:14 PM »
Hi  Mark, thanks for clearing this up. I thing 120K code should be enough for
our application, I hope :)

 John