On 06.05.22 11:05, Pali Rohár wrote:
When this option is set then ARM _main() function would call
arch_very_early_init() function at the beginning. It would be before
calling any other functions like debug_uart_init() and also before
initializing C runtime environment.

Signed-off-by: Pali Rohár <p...@kernel.org>

Reviewed-by: Stefan Roese <s...@denx.de>

Thanks,
Stefan

---
  arch/arm/Kconfig    | 6 ++++++
  arch/arm/lib/crt0.S | 5 +++++
  2 files changed, 11 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0afec5155b1b..9898c7d68e1b 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -401,6 +401,12 @@ config SYS_ARM_CACHE_WRITEALLOC
          write is performed.
  endchoice
+config ARCH_VERY_EARLY_INIT
+       bool
+
+config SPL_ARCH_VERY_EARLY_INIT
+       bool
+
  config ARCH_CPU_INIT
        bool "Enable ARCH_CPU_INIT"
        help
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
index ba312901f331..612a2d5b698e 100644
--- a/arch/arm/lib/crt0.S
+++ b/arch/arm/lib/crt0.S
@@ -90,6 +90,11 @@ clbss_l:cmp  r0, r1                  /* while not at end of 
BSS */
ENTRY(_main) +/* Call arch_very_early_init before initializing C runtime environment. */
+#if CONFIG_IS_ENABLED(ARCH_VERY_EARLY_INIT)
+       bl      arch_very_early_init
+#endif
+
  /*
   * Set up initial C runtime environment and call board_init_f(0).
   */

Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de

Reply via email to