<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pine64.org/index.php?action=history&amp;feed=atom&amp;title=Talk%3APineTime_external_flash_partitioning</id>
	<title>Talk:PineTime external flash partitioning - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pine64.org/index.php?action=history&amp;feed=atom&amp;title=Talk%3APineTime_external_flash_partitioning"/>
	<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=Talk:PineTime_external_flash_partitioning&amp;action=history"/>
	<updated>2026-05-25T10:34:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=Talk:PineTime_external_flash_partitioning&amp;diff=8340&amp;oldid=prev</id>
		<title>JF: /* Application */</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=Talk:PineTime_external_flash_partitioning&amp;diff=8340&amp;oldid=prev"/>
		<updated>2020-11-30T19:25:49Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Application&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:25, 30 November 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l25&quot;&gt;Line 25:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 25:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Application===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Application===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The application firmwares, on the other side, can be more flexible, and a common partitioning scheme can have some sense '''if multiple firmware developers agree to implement it'''. They would have to agree on a partition table scheme, file system, file formats,... That won't be easy, but that's possible. In this case, the partition table can be stored in the FS section at offset 0xb4000, and the bootloader won't have any knowledge of it. As the external spi memory flash is mostly unused (to my knowledge, only wasp-os uses it), everything is still possible on that part of the memory.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The application firmwares, on the other side, can be more flexible, and a common partitioning scheme can have some sense '''if multiple firmware developers agree to implement it'''. They would have to agree on a partition table scheme, file system, file formats,... That won't be easy, but that's possible. In this case, the partition table can be stored in the FS section at offset 0xb4000, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;and the bootloader won't have any knowledge of it&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;. As the external spi memory flash is mostly unused (to my knowledge, only wasp-os uses it), everything is still possible on that part of the memory.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;But... do we really need to share data between multiple firmwares installation? Let's compare with the PinePhone : when you install a new OS image on the EMMC or on the SD card, the user settings (wifi password, timezone, applications,...) won't be kept. If the user wants to keep files in the process, they have to backup them manually (on the SD card or on a computer) before flashing the new firmware and then restore them manually.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;But... do we really need to share data between multiple firmwares installation? Let's compare with the PinePhone : when you install a new OS image on the EMMC or on the SD card, the user settings (wifi password, timezone, applications,...) won't be kept. If the user wants to keep files in the process, they have to backup them manually (on the SD card or on a computer) before flashing the new firmware and then restore them manually.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wikidb:diff::1.12:old-8339:rev-8340 --&gt;
&lt;/table&gt;</summary>
		<author><name>JF</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=Talk:PineTime_external_flash_partitioning&amp;diff=8339&amp;oldid=prev</id>
		<title>JF: Created page with &quot;==From JF:== In my opinion, we should draw a hard line between the bootloader and the application firmwares.  ===Bootloader=== The bootloader '''cannot fail'''. If it fails, t...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=Talk:PineTime_external_flash_partitioning&amp;diff=8339&amp;oldid=prev"/>
		<updated>2020-11-30T19:24:35Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==From JF:== In my opinion, we should draw a hard line between the bootloader and the application firmwares.  ===Bootloader=== The bootloader &amp;#039;&amp;#039;&amp;#039;cannot fail&amp;#039;&amp;#039;&amp;#039;. If it fails, t...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==From JF:==&lt;br /&gt;
In my opinion, we should draw a hard line between the bootloader and the application firmwares.&lt;br /&gt;
&lt;br /&gt;
===Bootloader===&lt;br /&gt;
The bootloader '''cannot fail'''. If it fails, the device is bricked. One way to achieve this is to make it as simple as possible. If the bootloader have to take a partition table into account, it also have to handle degraded cases : it's got corrupted by a bug in a firmware, bad crc, incorrect offset/size mentionned,... &lt;br /&gt;
It turns out that the bootloader cannot recover from these degraded cases. Taking the partition table into account just adds some code (retrieve the partition table, search for partitions, process CRC, handles error codes,...) that will not be complete : there's no way we will write something meaningful in this code, for example:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;if(!check_crc(&amp;amp;data)) {&lt;br /&gt;
// ???&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Why not assume the data is where we expect it to be and coherent? The result will be the same : if the data is OK, it works, if the data is corrupt... the bootloader cannot do anything. Handling the partition table just gives the bootloader '''more chances to fail'''.&lt;br /&gt;
&lt;br /&gt;
With that in mind, I'm still convinced that the bootloader should just look for its data at fixed and hardcoded values : &lt;br /&gt;
&lt;br /&gt;
* bootloader code : internal flash 0 -&amp;gt; 0x7000&lt;br /&gt;
* primary slot : internal flash 0x8000 -&amp;gt; 0x7f000&lt;br /&gt;
* scratch : internal flash : 0x7f000 -&amp;gt; 0x80000&lt;br /&gt;
* factory firmware : external flash 0 -&amp;gt; 0x40000&lt;br /&gt;
* secondary slot : external flash 0x40000 -&amp;gt; 0xb4000&lt;br /&gt;
&lt;br /&gt;
There's no point to change these values : the internal flash is 100% allocated, the reloader cannot handle firmwares &amp;gt; ~180kB and the secondary slot must be the same size as the primary slot.&lt;br /&gt;
&lt;br /&gt;
The only '''shared knowledge''' between the bootloader and the application firmwares is that the application must be linked at offset 0x8000, should copy the OTA image in external flash at offset 0x40000, can use the external flash from offset 0xb4000 and must refresh the watchdog periodically.&lt;br /&gt;
&lt;br /&gt;
===Application===&lt;br /&gt;
The application firmwares, on the other side, can be more flexible, and a common partitioning scheme can have some sense '''if multiple firmware developers agree to implement it'''. They would have to agree on a partition table scheme, file system, file formats,... That won't be easy, but that's possible. In this case, the partition table can be stored in the FS section at offset 0xb4000, and the bootloader won't have any knowledge of it. As the external spi memory flash is mostly unused (to my knowledge, only wasp-os uses it), everything is still possible on that part of the memory.&lt;br /&gt;
&lt;br /&gt;
But... do we really need to share data between multiple firmwares installation? Let's compare with the PinePhone : when you install a new OS image on the EMMC or on the SD card, the user settings (wifi password, timezone, applications,...) won't be kept. If the user wants to keep files in the process, they have to backup them manually (on the SD card or on a computer) before flashing the new firmware and then restore them manually.&lt;br /&gt;
&lt;br /&gt;
Why would we want to solve issues that even more complex devices do not solve? Even Windows have a hard-time upgrading major versions of the OS while keeping applications and users settings untouched.&lt;br /&gt;
&lt;br /&gt;
Yet, this is still possible to do, but I wonder how firmwares will actually integrate this partition table? How will they know that they can use and existing partition or create a new one? What if there is not enough space available for the firmware you've just installed?&lt;/div&gt;</summary>
		<author><name>JF</name></author>
	</entry>
</feed>