JianyuWang0623 opened a new pull request, #9936: URL: https://github.com/apache/nuttx/pull/9936
## Summary A text format partition table stored in last eraseblock. The 1st line must be "Magic+Version", current is "TXTABLE0". The 2nd (and belows) is/are partition entry/ies, in format: "%s %zx %zx"(means name, size and offset(byte)(in hex)) Size or offset can be default zero(means zero(only for 1st entry) or caculate), and will be caculated ref to previous and next entries. The last eraseblock will be registered as pseudo partition named "txtable". To avoid problems of PTABLE: In case of multiple NuttX binary, partition table maybe out of sync. And is more eaiser: 1. Text format with simple rules(name + size + offset). 2. Size or offset can be default(caculated refs to previous and next entries). 3. Support backup table(eg. /etc/txtable.txt in ROMFS) Size / Offset can be automatically calculated, case: 1. The offset of the first entry is zero, and the offset of other entries is zero: automatic calculation; 2. The size of the last entry is zero: fill to the end of the entire Flash (keep the last eraseblock); the size of other entries is zero: automatically calculated(next.offset - current.offset); 3. Typical case 1: The size of all entries is zero (calculated automatically), and the offset is non-zero; 4. Typical case 2: The size and offset of a certain entry are all zero, but the size and offset of two adjacent entries are all non-zero; ## Impact Disabled by default. ## Testing ### 1. Both size and offset are zero, and not reserve last eraseblock **txtable.txt** ``` TXTABLE0 partition1 0x6C000 0x4000 partition2 0x10000 0x70000 partition3 0x80000 0x80000 partition4 0x80000 0x100000 partition5 0x280000 0x180000 partition6 0x80000 0 partition7 0x10000 0x480000 data 0xb00000 0x500000 ``` **Parsed** Reserved last eraseblock, and gap between partition7 and data is kept. (name + offset + size:) ``` > /dev/partition1, 0x4000, 0x6c000 > /dev/partition2, 0x70000, 0x10000 > /dev/partition3, 0x80000, 0x80000 > /dev/partition4, 0x100000, 0x80000 > /dev/partition5, 0x180000, 0x280000 > /dev/partition6, 0x400000, 0x80000 > /dev/partition7, 0x480000, 0x10000 > /dev/data, 0x500000, 0xaff000 ``` ### 2. More than one not set size or offset **txtable.txt** ``` TXTABLE0 partition1 0x6C000 0x4000 partition2 0 0x70000 partition3 0 0x80000 partition4 0 0x100000 partition5 0x280000 0x180000 partition6 0x80000 0 partition7 0x10000 0x480000 data 0 0x500000 ``` **Parsed** Size of partition[2,3,4,6] and data are caculated, and gap between partition7 and data is kept. ``` > /dev/partition1, 0x4000, 0x6c000 > /dev/partition2, 0x70000, 0x10000 > /dev/partition3, 0x80000, 0x80000 > /dev/partition4, 0x100000, 0x80000 > /dev/partition5, 0x180000, 0x280000 > /dev/partition6, 0x400000, 0x80000 > /dev/partition7, 0x480000, 0x10000 > /dev/data, 0x500000, 0xaff000 ``` ### 3. Only one partition entry, and size not spec **txtable.txt** ``` TXTABLE0 partition1 0x0 0x4000 ``` **Paresd** The last eraseblock was kept, and size is correct. ``` > /dev/partition1, 0x4000, 0xffb000 ``` ### 4. Blank line && New line delim **txtable.txt** New line: CR + LF / LF ``` TXTABLE0 partition1 0x6C000 0x4000 partition2 0 0x70000 partition3 0 0x80000 partition4 0 0x100000 partition5 0x280000 0x180000 partition6 0x80000 0x400000 partition7 0x10000 0x480000 data 0 0x500000 ``` **Parsed** Blank lines are ignored, and new line of both "LF" or "CRLF" are parsed. ``` > /dev/partition1, 0x4000, 0x6c000 > /dev/partition2, 0x70000, 0x10000 > /dev/partition3, 0x80000, 0x80000 > /dev/partition4, 0x100000, 0x80000 > /dev/partition5, 0x180000, 0x280000 > /dev/partition6, 0x400000, 0x80000 > /dev/partition7, 0x480000, 0x10000 > /dev/data, 0x500000, 0xaff000 ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org