main: move task start from SYS_INIT to main

We will need to perform initialization tasks before we start the EC
tasks. Using SYS_INIT limits our ability to sequence properly. We would
also need to use SYS_INIT for all of our other initialization. Let use
main instead.

BUG=none
TEST=runs on volteer

Cq-Depend: chromium:2523380
Change-Id: I7917cd5ac5f814dce21b39f8601c39f2dce7f323
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/zephyr-chrome/+/2523462
Tested-by: Jett Rink <jettrink@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Queue: Jett Rink <jettrink@chromium.org>
diff --git a/app/ec/main.c b/app/ec/main.c
index 8afccfc..1249a33 100644
--- a/app/ec/main.c
+++ b/app/ec/main.c
@@ -6,9 +6,22 @@
 #include <sys/printk.h>
 #include <zephyr.h>
 
+#include "ec_tasks.h"
+#include "hooks.h"
+
 void main(void)
 {
 	printk("Hello from a Chrome EC!\n");
 	printk("  BOARD=%s\n", CONFIG_BOARD);
 	printk("  ACTIVE_COPY=%s\n", CONFIG_CROS_EC_ACTIVE_COPY);
+
+	/* Call init hooks before main tasks start */
+	if (IS_ENABLED(CONFIG_PLATFORM_EC_HOOKS)) {
+		hook_notify(HOOK_INIT);
+	}
+
+	/* Start the EC tasks after performing all main initialization */
+	if (IS_ENABLED(CONFIG_SHIMMED_TASKS)) {
+		start_ec_tasks();
+	}
 }