diff --git a/arch b/arch index 8d559bd232..24f87df3fa 160000 --- a/arch +++ b/arch @@ -1 +1 @@ -Subproject commit 8d559bd23293adb14d68d7d6111ecbab40986a5a +Subproject commit 24f87df3fa8d9fec9044e2c2bb37d12260fd02de diff --git a/configs b/configs index 0282533628..2a4b5e665a 160000 --- a/configs +++ b/configs @@ -1 +1 @@ -Subproject commit 028253362897e3ca895cf772dc817423842e8915 +Subproject commit 2a4b5e665ac98b72920739eb12144462ca38e675 diff --git a/drivers/mtd/mtd_progmem.c b/drivers/mtd/mtd_progmem.c index 6fde9e6975..ac9be0f497 100644 --- a/drivers/mtd/mtd_progmem.c +++ b/drivers/mtd/mtd_progmem.c @@ -374,14 +374,23 @@ FAR struct mtd_dev_s *progmem_initialize(void) if (!g_progmem.initialized) { - size_t nblocks = up_progmem_npages(); - blkshift = progmem_log2(nblocks); + /* Get the size of one block. Here we assume that the block size is + * uniform and that the size of block0 is the same as the size of any + * other block. + */ + size_t blocksize = up_progmem_pagesize(0); + + /* Calculate Log2 of the flash block size */ + + blkshift = progmem_log2(blocksize); if (blkshift < 0) { return NULL; } + /* Save the configuration data */ + g_progmem.blkshift = blkshift; g_progmem.initialized = true; }