This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit f077c0321de7a8e7dd00a532c4499215648338c4
Author: Matteo Golin <[email protected]>
AuthorDate: Wed Feb 18 22:30:50 2026 -0500

    boards/avr: Replace board_app_initialize
    
    Replaced board_app_initialize logic with board_late_initialize.
    
    Signed-off-by: Matteo Golin <[email protected]>
---
 boards/avr/at32uc3/avr32dev1/src/Makefile          |  4 +-
 boards/avr/at32uc3/avr32dev1/src/avr32_appinit.c   | 73 ----------------------
 boards/avr/at32uc3/avr32dev1/src/avr32_boot.c      | 20 ++++++
 boards/avr/at32uc3/mizar32a/src/Makefile           |  4 +-
 boards/avr/at32uc3/mizar32a/src/avr32_appinit.c    | 73 ----------------------
 boards/avr/at32uc3/mizar32a/src/avr32_boot.c       | 20 ++++++
 .../avr/at90usb/micropendous3/src/at90usb_boot.c   | 19 ++++++
 boards/avr/at90usb/teensy-2.0/src/Makefile         |  4 --
 .../avr/at90usb/teensy-2.0/src/at90usb_appinit.c   | 68 --------------------
 boards/avr/at90usb/teensy-2.0/src/at90usb_boot.c   | 19 ++++++
 boards/avr/atmega/amber/src/atmega_boot.c          | 19 ++++++
 boards/avr/atmega/arduino-mega2560/src/avr_boot.c  | 19 ++++++
 boards/avr/atmega/elegoo-mega2560r3/src/avr_boot.c | 19 ++++++
 .../avr/atmega/mega1284p-xplained/src/avr_boot.c   | 19 ++++++
 boards/avr/atmega/moteino-mega/src/avr_boot.c      | 19 ++++++
 15 files changed, 179 insertions(+), 220 deletions(-)

diff --git a/boards/avr/at32uc3/avr32dev1/src/Makefile 
b/boards/avr/at32uc3/avr32dev1/src/Makefile
index d37964d7697..2b8350fdfd6 100644
--- a/boards/avr/at32uc3/avr32dev1/src/Makefile
+++ b/boards/avr/at32uc3/avr32dev1/src/Makefile
@@ -23,13 +23,15 @@
 include $(TOPDIR)/Make.defs
 
 CSRCS = avr32_boot.c
+
 ifeq ($(CONFIG_ARCH_LEDS),y)
 CSRCS += avr32_leds.c
 endif
+
 ifeq ($(CONFIG_ARCH_BUTTONS),y)
 CSRCS += avr32_buttons.c
 endif
-CSRCS += avr32_appinit.c
+
 CSRCS += avr32_bringup.c
 
 include $(TOPDIR)/boards/Board.mk
diff --git a/boards/avr/at32uc3/avr32dev1/src/avr32_appinit.c 
b/boards/avr/at32uc3/avr32dev1/src/avr32_appinit.c
deleted file mode 100644
index 8c8592fd0e7..00000000000
--- a/boards/avr/at32uc3/avr32dev1/src/avr32_appinit.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
- * boards/avr/at32uc3/avr32dev1/src/avr32_appinit.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdint.h>
-
-#include <arch/board/board.h>
-
-#include "avr32dev1.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: board_app_initialize
- *
- * Description:
- *   Perform application specific initialization.  This function is never
- *   called directly from application code, but only indirectly via the
- *   (non-standard) boardctl() interface using the command BOARDIOC_INIT.
- *
- * Input Parameters:
- *   arg - The boardctl() argument is passed to the board_app_initialize()
- *         implementation without modification.  The argument has no
- *         meaning to NuttX; the meaning of the argument is a contract
- *         between the board-specific initialization logic and the
- *         matching application logic.  The value could be such things as a
- *         mode enumeration value, a set of DIP switch switch settings, a
- *         pointer to configuration data read from a file or serial FLASH,
- *         or whatever you would like to do with it.  Every implementation
- *         should accept zero/NULL as a default configuration.
- *
- * Returned Value:
- *   Zero (OK) is returned on success; a negated errno value is returned on
- *   any failure to indicate the nature of the failure.
- *
- ****************************************************************************/
-
-int board_app_initialize(uintptr_t arg)
-{
-#ifndef CONFIG_BOARD_LATE_INITIALIZE
-  /* Perform board initialization */
-
-  return avr32_bringup();
-#else
-  return OK;
-#endif /* CONFIG_BOARD_LATE_INITIALIZE */
-}
diff --git a/boards/avr/at32uc3/avr32dev1/src/avr32_boot.c 
b/boards/avr/at32uc3/avr32dev1/src/avr32_boot.c
index 4c6c761f647..8fcf82c82ac 100644
--- a/boards/avr/at32uc3/avr32dev1/src/avr32_boot.c
+++ b/boards/avr/at32uc3/avr32dev1/src/avr32_boot.c
@@ -68,3 +68,23 @@ void at32uc3_boardinitialize(void)
   board_autoled_initializeialize();
 #endif
 }
+
+/****************************************************************************
+ * Name: board_late_initialize
+ *
+ * Description:
+ *   If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
+ *   initialization call will be performed in the boot-up sequence to a
+ *   function called board_late_initialize(). board_late_initialize() will be
+ *   called immediately after up_initialize() is called and just before the
+ *   initial application is started.  This additional initialization phase
+ *   may be used, for example, to initialize board-specific device drivers.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+void board_late_initialize(void)
+{
+  avr32_bringup();
+}
+#endif
diff --git a/boards/avr/at32uc3/mizar32a/src/Makefile 
b/boards/avr/at32uc3/mizar32a/src/Makefile
index f714dd728cd..0a66e41f701 100644
--- a/boards/avr/at32uc3/mizar32a/src/Makefile
+++ b/boards/avr/at32uc3/mizar32a/src/Makefile
@@ -23,13 +23,15 @@
 include $(TOPDIR)/Make.defs
 
 CSRCS = avr32_boot.c
+
 ifeq ($(CONFIG_ARCH_LEDS),y)
 CSRCS += avr32_leds.c
 endif
+
 ifeq ($(CONFIG_ARCH_BUTTONS),y)
 CSRCS += avr32_buttons.c
 endif
-CSRCS += avr32_appinit.c
+
 CSRCS += avr32_bringup.c
 
 include $(TOPDIR)/boards/Board.mk
diff --git a/boards/avr/at32uc3/mizar32a/src/avr32_appinit.c 
b/boards/avr/at32uc3/mizar32a/src/avr32_appinit.c
deleted file mode 100644
index e2d62ffbc47..00000000000
--- a/boards/avr/at32uc3/mizar32a/src/avr32_appinit.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
- * boards/avr/at32uc3/mizar32a/src/avr32_appinit.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdint.h>
-
-#include <arch/board/board.h>
-
-#include "mizar32a.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: board_app_initialize
- *
- * Description:
- *   Perform application specific initialization.  This function is never
- *   called directly from application code, but only indirectly via the
- *   (non-standard) boardctl() interface using the command BOARDIOC_INIT.
- *
- * Input Parameters:
- *   arg - The boardctl() argument is passed to the board_app_initialize()
- *         implementation without modification.  The argument has no
- *         meaning to NuttX; the meaning of the argument is a contract
- *         between the board-specific initialization logic and the
- *         matching application logic.  The value could be such things as a
- *         mode enumeration value, a set of DIP switch switch settings, a
- *         pointer to configuration data read from a file or serial FLASH,
- *         or whatever you would like to do with it.  Every implementation
- *         should accept zero/NULL as a default configuration.
- *
- * Returned Value:
- *   Zero (OK) is returned on success; a negated errno value is returned on
- *   any failure to indicate the nature of the failure.
- *
- ****************************************************************************/
-
-int board_app_initialize(uintptr_t arg)
-{
-#ifndef CONFIG_BOARD_LATE_INITIALIZE
-  /* Perform board initialization */
-
-  return avr32_bringup();
-#else
-  return OK;
-#endif /* CONFIG_BOARD_LATE_INITIALIZE */
-}
diff --git a/boards/avr/at32uc3/mizar32a/src/avr32_boot.c 
b/boards/avr/at32uc3/mizar32a/src/avr32_boot.c
index a745997cc56..d4be3e96976 100644
--- a/boards/avr/at32uc3/mizar32a/src/avr32_boot.c
+++ b/boards/avr/at32uc3/mizar32a/src/avr32_boot.c
@@ -68,3 +68,23 @@ void at32uc3_boardinitialize(void)
   board_autoled_initializeialize();
 #endif
 }
+
+/****************************************************************************
+ * Name: board_late_initialize
+ *
+ * Description:
+ *   If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
+ *   initialization call will be performed in the boot-up sequence to a
+ *   function called board_late_initialize(). board_late_initialize() will be
+ *   called immediately after up_initialize() is called and just before the
+ *   initial application is started.  This additional initialization phase
+ *   may be used, for example, to initialize board-specific device drivers.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+void board_late_initialize(void)
+{
+  avr32_bringup();
+}
+#endif
diff --git a/boards/avr/at90usb/micropendous3/src/at90usb_boot.c 
b/boards/avr/at90usb/micropendous3/src/at90usb_boot.c
index d06888129bf..b09d700f570 100644
--- a/boards/avr/at90usb/micropendous3/src/at90usb_boot.c
+++ b/boards/avr/at90usb/micropendous3/src/at90usb_boot.c
@@ -77,3 +77,22 @@ void at90usb_boardinitialize(void)
   at90usb_led_initialize();
 #endif
 }
+
+/****************************************************************************
+ * Name: board_late_initialize
+ *
+ * Description:
+ *   If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
+ *   initialization call will be performed in the boot-up sequence to a
+ *   function called board_late_initialize(). board_late_initialize() will be
+ *   called immediately after up_initialize() is called and just before the
+ *   initial application is started.  This additional initialization phase
+ *   may be used, for example, to initialize board-specific device drivers.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+void board_late_initialize(void)
+{
+}
+#endif /* CONFIG_BOARD_LATE_INITIALIZE */
diff --git a/boards/avr/at90usb/teensy-2.0/src/Makefile 
b/boards/avr/at90usb/teensy-2.0/src/Makefile
index 4955e097ac3..3d0fce3153f 100644
--- a/boards/avr/at90usb/teensy-2.0/src/Makefile
+++ b/boards/avr/at90usb/teensy-2.0/src/Makefile
@@ -28,10 +28,6 @@ ifeq ($(CONFIG_ARCH_LEDS),y)
 CSRCS += at90usb_leds.c
 endif
 
-ifeq ($(CONFIG_BOARDCTL),y)
-CSRCS += at90usb_appinit.c
-endif
-
 ifeq ($(CONFIG_USBMSC),y)
 CSRCS += at90usb_usbmsc.c
 endif
diff --git a/boards/avr/at90usb/teensy-2.0/src/at90usb_appinit.c 
b/boards/avr/at90usb/teensy-2.0/src/at90usb_appinit.c
deleted file mode 100644
index 5f9705159cd..00000000000
--- a/boards/avr/at90usb/teensy-2.0/src/at90usb_appinit.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
- * boards/avr/at90usb/teensy-2.0/src/at90usb_appinit.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <sys/types.h>
-#include <nuttx/board.h>
-
-#ifdef CONFIG_BOARDCTL
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: board_app_initialize
- *
- * Description:
- *   Perform application specific initialization.  This function is never
- *   called directly from application code, but only indirectly via the
- *   (non-standard) boardctl() interface using the command BOARDIOC_INIT.
- *
- * Input Parameters:
- *   arg - The boardctl() argument is passed to the board_app_initialize()
- *         implementation without modification.  The argument has no
- *         meaning to NuttX; the meaning of the argument is a contract
- *         between the board-specific initialization logic and the
- *         matching application logic.  The value could be such things as a
- *         mode enumeration value, a set of DIP switch switch settings, a
- *         pointer to configuration data read from a file or serial FLASH,
- *         or whatever you would like to do with it.  Every implementation
- *         should accept zero/NULL as a default configuration.
- *
- * Returned Value:
- *   Zero (OK) is returned on success; a negated errno value is returned on
- *   any failure to indicate the nature of the failure.
- *
- ****************************************************************************/
-
-int board_app_initialize(uintptr_t arg)
-{
-  return OK;
-}
-
-#endif /* CONFIG_BOARDCTL */
diff --git a/boards/avr/at90usb/teensy-2.0/src/at90usb_boot.c 
b/boards/avr/at90usb/teensy-2.0/src/at90usb_boot.c
index 4e74f9f99e5..810424c81ce 100644
--- a/boards/avr/at90usb/teensy-2.0/src/at90usb_boot.c
+++ b/boards/avr/at90usb/teensy-2.0/src/at90usb_boot.c
@@ -69,3 +69,22 @@ void at90usb_boardinitialize(void)
   at90usb_led_initialize();
 #endif
 }
+
+/****************************************************************************
+ * Name: board_late_initialize
+ *
+ * Description:
+ *   If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
+ *   initialization call will be performed in the boot-up sequence to a
+ *   function called board_late_initialize(). board_late_initialize() will be
+ *   called immediately after up_initialize() is called and just before the
+ *   initial application is started.  This additional initialization phase
+ *   may be used, for example, to initialize board-specific device drivers.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+void board_late_initialize(void)
+{
+}
+#endif /* CONFIG_BOARD_LATE_INITIALIZE */
diff --git a/boards/avr/atmega/amber/src/atmega_boot.c 
b/boards/avr/atmega/amber/src/atmega_boot.c
index 7ade76f741c..3dc0455b128 100644
--- a/boards/avr/atmega/amber/src/atmega_boot.c
+++ b/boards/avr/atmega/amber/src/atmega_boot.c
@@ -77,3 +77,22 @@ void atmega_boardinitialize(void)
   atmega_led_initialize();
 #endif
 }
+
+/****************************************************************************
+ * Name: board_late_initialize
+ *
+ * Description:
+ *   If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
+ *   initialization call will be performed in the boot-up sequence to a
+ *   function called board_late_initialize(). board_late_initialize() will be
+ *   called immediately after up_initialize() is called and just before the
+ *   initial application is started.  This additional initialization phase
+ *   may be used, for example, to initialize board-specific device drivers.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+void board_late_initialize(void)
+{
+}
+#endif /* CONFIG_BOARD_LATE_INITIALIZE */
diff --git a/boards/avr/atmega/arduino-mega2560/src/avr_boot.c 
b/boards/avr/atmega/arduino-mega2560/src/avr_boot.c
index 77563d96eda..537aff676d4 100644
--- a/boards/avr/atmega/arduino-mega2560/src/avr_boot.c
+++ b/boards/avr/atmega/arduino-mega2560/src/avr_boot.c
@@ -65,3 +65,22 @@ void atmega_boardinitialize(void)
   atmega_led_initialize();
 #endif
 }
+
+/****************************************************************************
+ * Name: board_late_initialize
+ *
+ * Description:
+ *   If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
+ *   initialization call will be performed in the boot-up sequence to a
+ *   function called board_late_initialize(). board_late_initialize() will be
+ *   called immediately after up_initialize() is called and just before the
+ *   initial application is started.  This additional initialization phase
+ *   may be used, for example, to initialize board-specific device drivers.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+void board_late_initialize(void)
+{
+}
+#endif /* CONFIG_BOARD_LATE_INITIALIZE */
diff --git a/boards/avr/atmega/elegoo-mega2560r3/src/avr_boot.c 
b/boards/avr/atmega/elegoo-mega2560r3/src/avr_boot.c
index bc4aaf7fd7f..da65e66436c 100644
--- a/boards/avr/atmega/elegoo-mega2560r3/src/avr_boot.c
+++ b/boards/avr/atmega/elegoo-mega2560r3/src/avr_boot.c
@@ -66,3 +66,22 @@ void atmega_boardinitialize(void)
   board_autoled_initialize();
 #endif
 }
+
+/****************************************************************************
+ * Name: board_late_initialize
+ *
+ * Description:
+ *   If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
+ *   initialization call will be performed in the boot-up sequence to a
+ *   function called board_late_initialize(). board_late_initialize() will be
+ *   called immediately after up_initialize() is called and just before the
+ *   initial application is started.  This additional initialization phase
+ *   may be used, for example, to initialize board-specific device drivers.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+void board_late_initialize(void)
+{
+}
+#endif /* CONFIG_BOARD_LATE_INITIALIZE */
diff --git a/boards/avr/atmega/mega1284p-xplained/src/avr_boot.c 
b/boards/avr/atmega/mega1284p-xplained/src/avr_boot.c
index 1736e2d1eb0..6ed87f8f7ef 100644
--- a/boards/avr/atmega/mega1284p-xplained/src/avr_boot.c
+++ b/boards/avr/atmega/mega1284p-xplained/src/avr_boot.c
@@ -77,3 +77,22 @@ void atmega_boardinitialize(void)
   atmega_led_initialize();
 #endif
 }
+
+/****************************************************************************
+ * Name: board_late_initialize
+ *
+ * Description:
+ *   If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
+ *   initialization call will be performed in the boot-up sequence to a
+ *   function called board_late_initialize(). board_late_initialize() will be
+ *   called immediately after up_initialize() is called and just before the
+ *   initial application is started.  This additional initialization phase
+ *   may be used, for example, to initialize board-specific device drivers.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+void board_late_initialize(void)
+{
+}
+#endif
diff --git a/boards/avr/atmega/moteino-mega/src/avr_boot.c 
b/boards/avr/atmega/moteino-mega/src/avr_boot.c
index 094085dffe6..ded95a3e956 100644
--- a/boards/avr/atmega/moteino-mega/src/avr_boot.c
+++ b/boards/avr/atmega/moteino-mega/src/avr_boot.c
@@ -77,3 +77,22 @@ void atmega_boardinitialize(void)
   atmega_led_initialize();
 #endif
 }
+
+/****************************************************************************
+ * Name: board_late_initialize
+ *
+ * Description:
+ *   If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
+ *   initialization call will be performed in the boot-up sequence to a
+ *   function called board_late_initialize(). board_late_initialize() will be
+ *   called immediately after up_initialize() is called and just before the
+ *   initial application is started.  This additional initialization phase
+ *   may be used, for example, to initialize board-specific device drivers.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+void board_late_initialize(void)
+{
+}
+#endif /* CONFIG_BOARD_LATE_INITIALIZE */

Reply via email to