Jon Povey wrote:
> Here's me erasing one block:
> 
> > nand erase 0 0x1e0000 0x20000
> erased blocks 15 to 16 on NAND flash device #0 'NAND 1GiB 3,3V 8-bit'
> 
> I think this should report "Erased block 15 on NAND..." (block 16
> was NOT erased).

Sounds right to me.


> Also here erasing the top two blocks (BBT):
> 
> > nand erase 0 0x3ffc0000 0x40000
> erased blocks 8190 to 8192 on NAND flash device #0 'NAND 1GiB 3,3V 8-bit'
> 
> There is no block 8192. 8191 is the highest block number.

So the first number is inclusive and the second is exclusive. Off by one.

Rather than calculating
last block = (start address + erase_length) / block_size

it could be calculated as
last block = (first block + num_blocks)

where
num_blocks = ((erase_length + block_size - 1) / block_size) - 1

(Disclaimer: I haven't actually looked at the code so the above
assumption about present calculation may be all wrong.)


//Peter
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to