Hi
Sorry, I missed the parameter block setting.
There are two memory maps which can be used as reference: in
LPC23XX.c #define FLASH_START_ADDRESS 0 // up to 512k
#define START_OF_FLASH FLASH_START_ADDRESS
#define RAM_START_ADDRESS 0x40000000 // up to 64k
#define ETHERNET_RAM_START_ADDRESS 0x7fe00000 // 16k
#define ETHERNET_RAM_SIZE (16 * 1024)
#define USB_RAM_START 0x7fd00000 // 8k
#define USB_RAM_SIZE (8 * 1024)
#define FLASH_GRANULARITY_SMALL (4*1024) // small blocks
#define FLASH_GRANULARITY_LARGE (32*1024) // large blocks
#define FLASH_SECTOR_0_OFFSET 0
#define FLASH_SECTOR_SIZE_0 FLASH_GRANULARITY_SMALL // initially small blocks
#define FLASH_SECTOR_1_OFFSET 0x1000
#define FLASH_SECTOR_SIZE_1 FLASH_GRANULARITY_SMALL
#define FLASH_SECTOR_2_OFFSET 0x2000
#define FLASH_SECTOR_SIZE_2 FLASH_GRANULARITY_SMALL
#define FLASH_SECTOR_3_OFFSET 0x3000
#define FLASH_SECTOR_SIZE_3 FLASH_GRANULARITY_SMALL
#define FLASH_SECTOR_4_OFFSET 0x4000
#define FLASH_SECTOR_SIZE_4 FLASH_GRANULARITY_SMALL
#define FLASH_SECTOR_5_OFFSET 0x5000
#define FLASH_SECTOR_SIZE_5 FLASH_GRANULARITY_SMALL
#define FLASH_SECTOR_6_OFFSET 0x6000
#define FLASH_SECTOR_SIZE_6 FLASH_GRANULARITY_SMALL
#define FLASH_SECTOR_7_OFFSET 0x7000
#define FLASH_SECTOR_SIZE_7 FLASH_GRANULARITY_SMALL
#define FLASH_SECTOR_8_OFFSET 0x8000 // end large blocks
#define FLASH_SECTOR_SIZE_8 FLASH_GRANULARITY_LARGE // last sector in 64k part
#define FLASH_SECTOR_9_OFFSET 0x10000
#define FLASH_SECTOR_SIZE_9 FLASH_GRANULARITY_LARGE
#define FLASH_SECTOR_10_OFFSET 0x18000
#define FLASH_SECTOR_SIZE_10 FLASH_GRANULARITY_LARGE // last sector in 128k part
#define FLASH_SECTOR_11_OFFSET 0x20000
#define FLASH_SECTOR_SIZE_11 FLASH_GRANULARITY_LARGE
#define FLASH_SECTOR_12_OFFSET 0x28000
#define FLASH_SECTOR_SIZE_12 FLASH_GRANULARITY_LARGE
#define FLASH_SECTOR_13_OFFSET 0x30000
#define FLASH_SECTOR_SIZE_13 FLASH_GRANULARITY_LARGE
#define FLASH_SECTOR_14_OFFSET 0x38000
#define FLASH_SECTOR_SIZE_14 FLASH_GRANULARITY_LARGE // last sector in 256k part
#define FLASH_SECTOR_15_OFFSET 0x40000
#define FLASH_SECTOR_SIZE_15 FLASH_GRANULARITY_LARGE
#define FLASH_SECTOR_16_OFFSET 0x48000
#define FLASH_SECTOR_SIZE_16 FLASH_GRANULARITY_LARGE
#define FLASH_SECTOR_17_OFFSET 0x50000
#define FLASH_SECTOR_SIZE_17 FLASH_GRANULARITY_LARGE
#define FLASH_SECTOR_18_OFFSET 0x58000
#define FLASH_SECTOR_SIZE_18 FLASH_GRANULARITY_LARGE
#define FLASH_SECTOR_19_OFFSET 0x60000
#define FLASH_SECTOR_SIZE_19 FLASH_GRANULARITY_LARGE
#define FLASH_SECTOR_20_OFFSET 0x68000
#define FLASH_SECTOR_SIZE_20 FLASH_GRANULARITY_LARGE
#define FLASH_SECTOR_21_OFFSET 0x70000
#define FLASH_SECTOR_SIZE_21 FLASH_GRANULARITY_LARGE
#define FLASH_SECTOR_22_OFFSET 0x78000 // further small blocks
#define FLASH_SECTOR_SIZE_22 FLASH_GRANULARITY_SMALL
#define FLASH_SECTOR_23_OFFSET 0x79000
#define FLASH_SECTOR_SIZE_23 FLASH_GRANULARITY_SMALL
#define FLASH_SECTOR_24_OFFSET 0x7a000
#define FLASH_SECTOR_SIZE_24 FLASH_GRANULARITY_SMALL
#define FLASH_SECTOR_25_OFFSET 0x7b000
#define FLASH_SECTOR_SIZE_25 FLASH_GRANULARITY_SMALL
#define FLASH_SECTOR_26_OFFSET 0x7c000
#define FLASH_SECTOR_SIZE_26 FLASH_GRANULARITY_SMALL
#define FLASH_SECTOR_27_OFFSET 0x7d000
#define FLASH_SECTOR_SIZE_27 FLASH_GRANULARITY_SMALL // last sector in 512k part - last 8k are occupied by ISP routines
#
and in the documents about the file system layout in
\Applications\uTaskerV1.4\WebPages\WebPagesLPC23xxThe header is however probably the easiest overview of where the FLASH blocks are in the different chips.
For a 256k chip it can be set to
#define PARAMETER_BLOCK_START FLASH_SECTOR_13_OFFSETto position the parameter block start to two sectors before the end of the internal FLASH - 192k.
This is however not a small (4k) block but a large (32k) block, which also requires
#define PARAMETER_BLOCK_GRANULARITY FLASH_GRANULARITY_LARGEHowever again (unfortunately) there is a complication due to the LPC2XXX family which needs to be discussed. This is indeed not always the easiest FLASH to work with due to several reasons:
1) it has quite a large FLASH granularity of 32k (the file system usually uses large-granularity mode as described in the documents in the directory above)
2) the FLASH granularity is not constant and also device dependent. There are 8 x 4k sectors at the start of FLASH and the 512k device also has 6 x 4k sectors at the end. The smaller sectors are more suitable for use as parameter blocks (that is why they are positioned there in the existing board setups), but your chip doesn't have the 4k there so will be using large sectors -
probably not that efficient.
What you can do is define to use small blocks at the start but in this case there is more work (possibly compiler specific too) because the linker script will need to be manipulated to that these blocks are left free of any code... possibly there are also more difficulties involved in this case to to the fact that downloading code may cause these sectors to be overwritten by the downloading program (depending on how intelligent it is)...
Note that, if the bare-minimum boot loader configuration is used this can also resolve any potential difficulties of positioning the parameter blocks at the start of memory. The boot loader occupies the first small sector so by linking the application just after the parameter block area rather than right after the boot block sector (plus change the boot load application start address to suit) there will automatically be a space between the boot loader code and the application code for use by the parameter blocks.If you prefer to you can also remove the parameter system by commenting out
USE_PARAMETER_BLOCK in
config.h. In this case the fixed default parameter values will always be used and can not be changed but you won't need to worry about the internal FLASH workings for a demo.
3) See
http://www.utasker.com/forum/index.php?topic=136.0 for more background details about the FLASh technology used in the LPC2XXX family, including a link to a Philips Apps note giving otherwise generally undisclosed internal details - this was very useful when starting with the original LPC2106 back in 2004.
FLASH_SECTOR_22_OFFSETI see no problems with the routine using the
FLASH_SECTOR_22_OFFSET since this is a generic routine used by the FLASH driver to work out which FLASH sector an address is in. This is the cut off sector between the large blocks and the final small blocks. If you are using a smaller chip it will never get to this comparison (it is an address reference and not an address access so can not fail):
static unsigned long fnGetFlashSector(unsigned long FlashAddress)
{
FlashAddress -= FLASH_START_ADDRESS;
if (FlashAddress < FLASH_SECTOR_8_OFFSET) { // one of the first small sectors
return (FlashAddress/FLASH_GRANULARITY_SMALL);
}
else if (FlashAddress < FLASH_SECTOR_22_OFFSET) { // one of the middle large sectors
FlashAddress -= FLASH_SECTOR_8_OFFSET;
return ((FlashAddress/FLASH_GRANULARITY_LARGE) + 8);
}
else { // one of the last small sectors
FlashAddress -= FLASH_SECTOR_22_OFFSET;
return ((FlashAddress/FLASH_GRANULARITY_SMALL) + 22);
}
}
It would be possible to remove the last comparison by making the final check conditional on the chip size
#if SIZE_OF_FLASH > (254*1024)
else { // one of the last small sectors
FlashAddress -= FLASH_SECTOR_22_OFFSET;
return ((FlashAddress/FLASH_GRANULARITY_SMALL) + 22);
}
#else
return 0; // error - access outside of FLASH area
#endifbut there is no real advantage since an attempted access outside of the FLASH area is incorrect in both cases...
You can completely remove the uFileSystem by disabling
FLASH_FILE_SYSTEM in
config.h. Since the FTP requires this you will have to disable it too. However I don't think that there is any real reason to do this - the parameter system define has nothing to do with the file system and the file system can live without the parameter system if you don't want to get involved with the best parameter system configuration.
Note also that the web server can run from embedded file - rather than files situated in the uFileSystem so a web server based application can also exist without any file system, - this is described here: http://www.utasker.com/docs/uTasker/uTaskerUserFiles.PDFIf you do decide to use both make sure that the parameter block and the file system contents don't overlap with each other and that the code doesn't grow large enough to overlap with the start of the file system space - the documents in the directory above serves as a template for verifying this when designing new layouts.
Regards
Mark