The flash command program available flash memory
flash [-qev] [-p page] flashaddr [size[dataaddr]]
|-q||query available flash devices|
|-p||when the flash is paged, selects the page|
|flashaddr||first address in flash to erase and/or program|
|size||size to erase and/or program|
|dataaddr||first address of data to program|
The flash command programs flash memory on the target board. The available flash memories can be queried by typing the flash command without any parameters or with the -q option. The output from the query is target system dependent but might look like:
PMON> flash -q Available FLASH memory Start Size Width Sectorsize Type ff000000 00800000 8*8 00040000 i28F160 fff00000 00080000 1*8 00010000 Am29F040 PMON>
The start address is where in the memory map the flash area starts. The size is the size in the memory map that this flash device occupies. This may be less than the actual flash size if the device is paged. The width indicates how many flash devices and what width each device have. The first value is the number of devices and the second is the width in bits of each device. The total word length can be determined by multiplying the width with the number of devices. The sector size is the minimum size that can be erased and reprogrammed without affecting any other data in the flash. Finally the type indicates what type of devices the flash area is built of.
The -e option should be used to erase the entire flash or a part of a flash area. To erase the entire flash area only the start address of the area has to be given. To erase a part of a flash area the start address and the desired size should be given. Remember though that the erase operation takes place in multiples of the sector size.
On some targets a flash memory can be paged. This means that the entire flash chip is not accessible at the same time but instead a part or page of the flash can be selected at a time. To select a page the command
PMON> flash -p <n>
where n is the desired page number should be used. If more than one flash area uses paged flash devices and each area has individual page selects the base address of the area must be given as well.
To program a flash area the flash command require three arguments, the flashaddr, the size and the dataaddr arguments. The flashaddr argument determines where in the flash area the programming should start, the size argument determines the number of bytes that should be programmed and the dataaddr argument tells where the data to program into the flash is found. Unless the -e option is given programming is performed in 'patch' mode. Normally the -e option should be used to erase the flash before programming.
Some target systems have HW write protect features. When PMON2000 can determine whether a non software controllable HW write protect is on or off it will display this information. If the HW write protect feature can be controlled by software PMON2000 will take the required action to turn off write protection before programming and turn on protection again after programming.
The command uses no environment variable.