os/kernel/init: Load app elf from flash partition
This commit includes temporary code to load apps from os_bringup.
This is done for testing purpose. After implementation of Binary
Manager is done, this code must be reverted.
@@ -324,6 +324,26 @@ static inline void os_do_appstart(void)
pid = task_create("appmain", SCHED_PRIORITY_DEFAULT, CONFIG_USERMAIN_STACKSIZE, (main_t)CONFIG_USER_ENTRYPOINT, (FAR char *const *)NULL);
#endif
ASSERT(pid > 0);
+
+
+ /* Code for testing loadable apps in NXP using flash partitions.
+ * This is a temporary implementation. In the final implementation the apps will
+ * be loaded by the Binary manager. This code will be removed after implementation
+ * of Binary Manager module.
+ *
+ * The mtdblock and size of elf file has been hardcoded here.
+ * If there is a change in elf file size during build, the below value needs modification.
+ * When Binary Manager is implemented, these values will be obtained from the
+ * binary header and passed to the elf loader.
+ */
+
+#if defined(CONFIG_APP_BINARY_SEPARATION) && defined(CONFIG_ARCH_BOARD_IMXRT1050_EVK)
+ pid = load_binary("/dev/mtdblock2", 148096, 0, 20 * 1024);
+ svdbg("Loaded Micomapp pid = %d\n", pid);
+
+ pid = load_binary("/dev/mtdblock3", 148096, 0, 20 * 1024);
+ svdbg("Loaded Wifiapp pid = %d\n", pid);
+#endif
}
#elif defined(CONFIG_INIT_NONE)
