Here described steps to migrate NetSoM from 16 Mb to 32 Mb flash IC. OpenWrt 32mb flash size migration story. The thing looked simple at first glance became to kernel patching.
Few weeks ago we added Amazon voice SDK and Tensorflow-lite to our development process roadmap. After making first steps we faced an issue of huge memory requirements to deal with that libraries so we decided to switch from 16 Mb flash IC on board of NetSoM to 32 Mb. We already had an experience of migration from 8Mb to 16Mb few months ago and it was pretty simple: here, here and here. So our first steps was similar in a case of migration to 32 Mb. But warning u-boot message on power up:
and hang up on reboot when device logs:
but not followed with U-boot loading log messages lead to an additional investigation.
First issue was fixed by simple enabling mentioned macro:
But second one forced as for few hours of googling for the whole internet. Finally we found an issue description looking very similar to our and moreover solution by kernel patching. So we tried to make similar patch for our sources considering the fact of using newer kernel version (4.14.199). The issue of described bug was modification SPI flash IC registers to switch from 3-bit addressing to 4-bit addressing to cover upper half of memory while fsbl communicates with SPI flash IC using 3-bit addressing mode. So after rebooting IC keeps in 4-bit addressing mode and FSBL doesn’t have any chance to read memory to load U-boot. So the fix is resetting flash IC registers on rebooting.
Preferred way to implement OpenWrt source patching is using quilt utility. Quite simple and straightforward process described well. In our case it was looked like this.
First environment need to be prepared:
is path to folder with repository was cloned.
Next step is code modification we need to be done:
and final step is registration of patch:
so here is changes made in m25p80.c:
final patch might be found here.
And it helped! Device started to reboot properly. It gave as properly working 32 Mb flash IC that opens door for more complex SW/HW solutions that might be implemented using NetSoM.