diff --git a/boards/arm/a1x/pcduino-a10/src/CMakeLists.txt b/boards/arm/a1x/pcduino-a10/src/CMakeLists.txt index cc31b938751..c65ee126397 100644 --- a/boards/arm/a1x/pcduino-a10/src/CMakeLists.txt +++ b/boards/arm/a1x/pcduino-a10/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS a1x_boot.c a1x_bringup.c a1x_leds.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS a1x_appinit.c) -endif() - if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS a1x_buttons.c) endif() diff --git a/boards/arm/a1x/pcduino-a10/src/Makefile b/boards/arm/a1x/pcduino-a10/src/Makefile index bcaa1debec9..cecb3d5cf0c 100644 --- a/boards/arm/a1x/pcduino-a10/src/Makefile +++ b/boards/arm/a1x/pcduino-a10/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = a1x_boot.c a1x_bringup.c a1x_leds.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += a1x_appinit.c -endif - ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += a1x_buttons.c endif diff --git a/boards/arm/a1x/pcduino-a10/src/a1x_appinit.c b/boards/arm/a1x/pcduino-a10/src/a1x_appinit.c deleted file mode 100644 index 3471ef774ea..00000000000 --- a/boards/arm/a1x/pcduino-a10/src/a1x_appinit.c +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** - * boards/arm/a1x/pcduino-a10/src/a1x_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 - -#include -#include - -#include - -#include "pcduino_a10.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return a1x_bringup(); -#endif -} diff --git a/boards/arm/am335x/beaglebone-black/src/CMakeLists.txt b/boards/arm/am335x/beaglebone-black/src/CMakeLists.txt index 90057ac2ca6..f0acea7cbc7 100644 --- a/boards/arm/am335x/beaglebone-black/src/CMakeLists.txt +++ b/boards/arm/am335x/beaglebone-black/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS am335x_boot.c am335x_bringup.c am335x_leds.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS am335x_appinit.c) -endif() - if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS am335x_buttons.c) endif() diff --git a/boards/arm/am335x/beaglebone-black/src/Makefile b/boards/arm/am335x/beaglebone-black/src/Makefile index 4ee7508a804..5002d5d8ca5 100644 --- a/boards/arm/am335x/beaglebone-black/src/Makefile +++ b/boards/arm/am335x/beaglebone-black/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = am335x_boot.c am335x_bringup.c am335x_leds.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += am335x_appinit.c -endif - ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += am335x_buttons.c endif diff --git a/boards/arm/am335x/beaglebone-black/src/am335x_appinit.c b/boards/arm/am335x/beaglebone-black/src/am335x_appinit.c deleted file mode 100644 index 821436013fa..00000000000 --- a/boards/arm/am335x/beaglebone-black/src/am335x_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/am335x/beaglebone-black/src/am335x_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 - -#include -#include - -#include "beaglebone-black.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return am335x_bringup(); -#endif -} diff --git a/boards/arm/at32/at32f437-mini/src/Makefile b/boards/arm/at32/at32f437-mini/src/Makefile index fe4346a648a..291e0427054 100644 --- a/boards/arm/at32/at32f437-mini/src/Makefile +++ b/boards/arm/at32/at32f437-mini/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = at32_boot.c at32_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) - CSRCS += at32_appinit.c -endif - ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += at32_gpio.c endif diff --git a/boards/arm/at32/at32f437-mini/src/at32_appinit.c b/boards/arm/at32/at32f437-mini/src/at32_appinit.c deleted file mode 100644 index 777531517b6..00000000000 --- a/boards/arm/at32/at32f437-mini/src/at32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/at32/at32f437-mini/src/at32_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 - -#include -#include - -#include "at32f437-mini.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return at32_bringup(); -#endif -} diff --git a/boards/arm/c5471/c5471evm/src/c5471_leds.c b/boards/arm/c5471/c5471evm/src/c5471_leds.c index c90c4e18d60..a9483aa8e55 100644 --- a/boards/arm/c5471/c5471evm/src/c5471_leds.c +++ b/boards/arm/c5471/c5471evm/src/c5471_leds.c @@ -96,3 +96,22 @@ void board_autoled_off(int led) } #endif /* CONFIG_ARCH_LEDS */ + +/**************************************************************************** + * 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/arm/csk6/csk6011a-nano/src/CMakeLists.txt b/boards/arm/csk6/csk6011a-nano/src/CMakeLists.txt index f8c5639559f..4941a4d551f 100644 --- a/boards/arm/csk6/csk6011a-nano/src/CMakeLists.txt +++ b/boards/arm/csk6/csk6011a-nano/src/CMakeLists.txt @@ -20,7 +20,7 @@ # # ############################################################################## -set(SRCS csk6011a_nano_appinit.c) +set(SRCS csk6011a_nano_boardinit.c) target_sources(board PRIVATE ${SRCS}) diff --git a/boards/arm/csk6/csk6011a-nano/src/Makefile b/boards/arm/csk6/csk6011a-nano/src/Makefile index ccece7f7ad2..31b18025fa9 100644 --- a/boards/arm/csk6/csk6011a-nano/src/Makefile +++ b/boards/arm/csk6/csk6011a-nano/src/Makefile @@ -22,6 +22,6 @@ include $(TOPDIR)/Make.defs -CSRCS = csk6011a_nano_appinit.c +CSRCS = csk6011a_nano_boardinit.c include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/csk6/csk6011a-nano/src/csk6011a_nano_appinit.c b/boards/arm/csk6/csk6011a-nano/src/csk6011a_nano_boardinit.c similarity index 67% rename from boards/arm/csk6/csk6011a-nano/src/csk6011a_nano_appinit.c rename to boards/arm/csk6/csk6011a-nano/src/csk6011a_nano_boardinit.c index 482c6991344..9809a14bc78 100644 --- a/boards/arm/csk6/csk6011a-nano/src/csk6011a_nano_appinit.c +++ b/boards/arm/csk6/csk6011a-nano/src/csk6011a_nano_boardinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/csk6/csk6011a-nano/src/csk6011a_nano_appinit.c + * boards/arm/csk6/csk6011a-nano/src/csk6011a_nano_boardinit.c * * SPDX-License-Identifier: Apache-2.0 * @@ -26,7 +26,12 @@ #include +#include + +#include +#include #include + #include /**************************************************************************** @@ -60,46 +65,23 @@ static const char verification_table[] VERIFICATION_TABLE_ATTR = ****************************************************************************/ /**************************************************************************** - * Name: board_app_initialize + * Name: board_late_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. + * 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_intitialize() 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. * ****************************************************************************/ -int board_app_initialize(uintptr_t arg) -{ - /* Perform board-specific initialization */ - - /* TODO */ - - return OK; -} - #ifdef CONFIG_BOARD_LATE_INITIALIZE - void board_late_initialize(void) { /* Perform board-specific initialization */ /* TODO */ } - #endif diff --git a/boards/arm/cxd56xx/common/src/cxd56_usbmsc.c b/boards/arm/cxd56xx/common/src/cxd56_usbmsc.c index 0f6b95b92fb..b84b4373cf1 100644 --- a/boards/arm/cxd56xx/common/src/cxd56_usbmsc.c +++ b/boards/arm/cxd56xx/common/src/cxd56_usbmsc.c @@ -54,8 +54,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/cxd56xx/spresense/src/CMakeLists.txt b/boards/arm/cxd56xx/spresense/src/CMakeLists.txt index 25f089b3f0d..ea80531c4cf 100644 --- a/boards/arm/cxd56xx/spresense/src/CMakeLists.txt +++ b/boards/arm/cxd56xx/spresense/src/CMakeLists.txt @@ -22,12 +22,8 @@ set(SRCS) -set(SRCS cxd56_main.c cxd56_clock.c cxd56_bringup.c) - -if(CONFIG_BOARDCTL) - list(APPEND SRCS cxd56_appinit.c) - list(APPEND SRCS cxd56_power.c) -endif() +set(SRCS cxd56_main.c cxd56_clock.c cxd56_bringup.c cxd56_boardinit.c + cxd56_power.c) if(CONFIG_BOARDCTL_IOCTL) list(APPEND SRCS cxd56_ioctl.c) diff --git a/boards/arm/cxd56xx/spresense/src/Make.defs b/boards/arm/cxd56xx/spresense/src/Make.defs index 06e14e890d8..3fc13a2db2a 100644 --- a/boards/arm/cxd56xx/spresense/src/Make.defs +++ b/boards/arm/cxd56xx/spresense/src/Make.defs @@ -23,11 +23,8 @@ CSRCS += cxd56_main.c CSRCS += cxd56_clock.c CSRCS += cxd56_bringup.c - -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += cxd56_appinit.c +CSRCS += cxd56_boardinit.c CSRCS += cxd56_power.c -endif ifeq ($(CONFIG_BOARDCTL_IOCTL),y) CSRCS += cxd56_ioctl.c diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_appinit.c b/boards/arm/cxd56xx/spresense/src/cxd56_appinit.c deleted file mode 100644 index e1d29d36c47..00000000000 --- a/boards/arm/cxd56xx/spresense/src/cxd56_appinit.c +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** - * boards/arm/cxd56xx/spresense/src/cxd56_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 -#include - -#include -#include - -#include "spresense.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return cxd56_bringup(); -#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 weak_function board_late_initialize(void) -{ - /* Perform board bring-up here instead of from the - * board_app_initialize(). - */ - - cxd56_bringup(); -} -#endif diff --git a/boards/arm/tiva/ekk-lm3s9b96/src/lm_appinit.c b/boards/arm/cxd56xx/spresense/src/cxd56_boardinit.c similarity index 63% rename from boards/arm/tiva/ekk-lm3s9b96/src/lm_appinit.c rename to boards/arm/cxd56xx/spresense/src/cxd56_boardinit.c index cc2f132157e..c3c7544581d 100644 --- a/boards/arm/tiva/ekk-lm3s9b96/src/lm_appinit.c +++ b/boards/arm/cxd56xx/spresense/src/cxd56_boardinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/tiva/ekk-lm3s9b96/src/lm_appinit.c + * boards/arm/cxd56xx/spresense/src/cxd56_boardinit.c * * SPDX-License-Identifier: Apache-2.0 * @@ -25,13 +25,18 @@ ****************************************************************************/ #include +#include + +#include #include -#include #include +#include #include +#include "spresense.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -41,29 +46,22 @@ ****************************************************************************/ /**************************************************************************** - * Name: board_app_initialize + * Name: board_late_initialize * * Description: - * Perform architecture specific initialization - * - * 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. + * 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. * ****************************************************************************/ -int board_app_initialize(uintptr_t arg) +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void weak_function board_late_initialize(void) { - return OK; + cxd56_bringup(); } +#endif diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_ioctl.c b/boards/arm/cxd56xx/spresense/src/cxd56_ioctl.c index b70fc672fac..83b992d3f64 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_ioctl.c +++ b/boards/arm/cxd56xx/spresense/src/cxd56_ioctl.c @@ -85,7 +85,6 @@ int board_ioctl(unsigned int cmd, uintptr_t arg) * and supply current value. * ARG: None * CONFIGURATION: CONFIG_BOARDCTL - * DEPENDENCIES: Board logic must provide board_app_initialization */ case BOARDIOC_USBDEV_SETNOTIFYSIG: diff --git a/boards/arm/dm320/ntosd-dm320/src/Makefile b/boards/arm/dm320/ntosd-dm320/src/Makefile index c84cc1751df..2dc99532d6c 100644 --- a/boards/arm/dm320/ntosd-dm320/src/Makefile +++ b/boards/arm/dm320/ntosd-dm320/src/Makefile @@ -28,8 +28,4 @@ ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) CSRCS += dm320_boardinit.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += dm320_appinit.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/dm320/ntosd-dm320/src/dm320_appinit.c b/boards/arm/dm320/ntosd-dm320/src/dm320_appinit.c deleted file mode 100644 index 7f35a0afaf2..00000000000 --- a/boards/arm/dm320/ntosd-dm320/src/dm320_appinit.c +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** - * boards/arm/dm320/ntosd-dm320/src/dm320_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 - -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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; -} diff --git a/boards/arm/eoss3/quickfeather/src/CMakeLists.txt b/boards/arm/eoss3/quickfeather/src/CMakeLists.txt index 0b6d3334fba..4fdae9c25f6 100644 --- a/boards/arm/eoss3/quickfeather/src/CMakeLists.txt +++ b/boards/arm/eoss3/quickfeather/src/CMakeLists.txt @@ -20,7 +20,7 @@ # # ############################################################################## -set(SRCS eoss3_boot.c eoss3_bringup.c eoss3_appinit.c) +set(SRCS eoss3_boot.c eoss3_bringup.c) if(CONFIG_ARCH_LEDS) list(APPEND SRCS eoss3_autoleds.c) diff --git a/boards/arm/eoss3/quickfeather/src/Makefile b/boards/arm/eoss3/quickfeather/src/Makefile index eaa7341472a..cdd0ae9c124 100644 --- a/boards/arm/eoss3/quickfeather/src/Makefile +++ b/boards/arm/eoss3/quickfeather/src/Makefile @@ -22,7 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = eoss3_boot.c eoss3_bringup.c eoss3_appinit.c +CSRCS = eoss3_boot.c eoss3_bringup.c ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += eoss3_autoleds.c @@ -30,4 +30,4 @@ else CSRCS += eoss3_userleds.c endif -include $(TOPDIR)/boards/Board.mk \ No newline at end of file +include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/eoss3/quickfeather/src/eoss3_appinit.c b/boards/arm/eoss3/quickfeather/src/eoss3_appinit.c deleted file mode 100644 index f5562cca630..00000000000 --- a/boards/arm/eoss3/quickfeather/src/eoss3_appinit.c +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** - * boards/arm/eoss3/quickfeather/src/eoss3_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 - -#include - -#include - -#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/arm/fvp-v8r-aarch32/fvp-armv8r-aarch32/src/CMakeLists.txt b/boards/arm/fvp-v8r-aarch32/fvp-armv8r-aarch32/src/CMakeLists.txt index b9932aa82a1..cc71d166c5c 100644 --- a/boards/arm/fvp-v8r-aarch32/fvp-armv8r-aarch32/src/CMakeLists.txt +++ b/boards/arm/fvp-v8r-aarch32/fvp-armv8r-aarch32/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS fvp_boardinit.c fvp_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS fvp_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/dramboot.ld") diff --git a/boards/arm/fvp-v8r-aarch32/fvp-armv8r-aarch32/src/Makefile b/boards/arm/fvp-v8r-aarch32/fvp-armv8r-aarch32/src/Makefile index 945a32b2d8e..404dd54a381 100644 --- a/boards/arm/fvp-v8r-aarch32/fvp-armv8r-aarch32/src/Makefile +++ b/boards/arm/fvp-v8r-aarch32/fvp-armv8r-aarch32/src/Makefile @@ -24,8 +24,4 @@ include $(TOPDIR)/Make.defs CSRCS = fvp_boardinit.c fvp_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += fvp_appinit.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/fvp-v8r-aarch32/fvp-armv8r-aarch32/src/fvp_appinit.c b/boards/arm/fvp-v8r-aarch32/fvp-armv8r-aarch32/src/fvp_appinit.c deleted file mode 100644 index f653f198ac5..00000000000 --- a/boards/arm/fvp-v8r-aarch32/fvp-armv8r-aarch32/src/fvp_appinit.c +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** - * boards/arm/fvp-v8r-aarch32/fvp-armv8r-aarch32/src/fvp_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 -#include -#include -#include "fvp-armv8r.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) -{ - UNUSED(arg); -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return fvp_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/gd32f4/gd32f450zk-aiotbox/src/CMakeLists.txt b/boards/arm/gd32f4/gd32f450zk-aiotbox/src/CMakeLists.txt index 7ae638988e7..a3eceac076d 100644 --- a/boards/arm/gd32f4/gd32f450zk-aiotbox/src/CMakeLists.txt +++ b/boards/arm/gd32f4/gd32f450zk-aiotbox/src/CMakeLists.txt @@ -22,9 +22,7 @@ set(SRCS gd32f4xx_boot.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS gd32f4xx_appinit.c gd32f4xx_bringup.c) -elseif(CONFIG_BOARD_LATE_INITIALIZE) +if(CONFIG_BOARD_LATE_INITIALIZE) list(APPEND SRCS gd32f4xx_bringup.c) endif() diff --git a/boards/arm/gd32f4/gd32f450zk-aiotbox/src/Makefile b/boards/arm/gd32f4/gd32f450zk-aiotbox/src/Makefile index 39c9efbaed9..f1e4b19e3fb 100644 --- a/boards/arm/gd32f4/gd32f450zk-aiotbox/src/Makefile +++ b/boards/arm/gd32f4/gd32f450zk-aiotbox/src/Makefile @@ -22,17 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = gd32f4xx_boot.c - -# ifeq ($(CONFIG_BOARDCTL),y) -# CSRCS += gd32f4xx_appinit.c -# endif - -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += gd32f4xx_appinit.c gd32f4xx_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += gd32f4xx_bringup.c -endif +CSRCS = gd32f4xx_boot.c gd32f4xx_bringup.c ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += gd32f4xx_autoleds.c diff --git a/boards/arm/gd32f4/gd32f450zk-aiotbox/src/gd32f450z_aiotbox.h b/boards/arm/gd32f4/gd32f450zk-aiotbox/src/gd32f450z_aiotbox.h index 4fa311a5112..149a4560006 100644 --- a/boards/arm/gd32f4/gd32f450zk-aiotbox/src/gd32f450z_aiotbox.h +++ b/boards/arm/gd32f4/gd32f450zk-aiotbox/src/gd32f450z_aiotbox.h @@ -136,16 +136,9 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINIT=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * - * Otherwise, bad news: Never called - * ****************************************************************************/ int gd32_bringup(void); @@ -348,16 +341,9 @@ void gd32_i2c_initialize(void); * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINIT=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * - * Otherwise, bad news: Never called - * ****************************************************************************/ int gd32_bringup(void); @@ -422,4 +408,4 @@ int gd32_sdio_initialize(void); #ifdef CONFIG_I2C void gd32_i2c_initialize(void); -#endif \ No newline at end of file +#endif diff --git a/boards/arm/gd32f4/gd32f450zk-aiotbox/src/gd32f4xx_appinit.c b/boards/arm/gd32f4/gd32f450zk-aiotbox/src/gd32f4xx_appinit.c deleted file mode 100644 index 2f7d3b307f2..00000000000 --- a/boards/arm/gd32f4/gd32f450zk-aiotbox/src/gd32f4xx_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/gd32f4/gd32f450zk-aiotbox/src/gd32f4xx_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 - -#include -#include -#include -#include - -#include - -#include "gd32f4xx.h" -#include "gd32f450z_aiotbox.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) -{ - /* Perform board initialization here */ - - return gd32_bringup(); -} diff --git a/boards/arm/gd32f4/gd32f450zk-eval/src/CMakeLists.txt b/boards/arm/gd32f4/gd32f450zk-eval/src/CMakeLists.txt index 7036cfa561b..aab550e4633 100644 --- a/boards/arm/gd32f4/gd32f450zk-eval/src/CMakeLists.txt +++ b/boards/arm/gd32f4/gd32f450zk-eval/src/CMakeLists.txt @@ -22,9 +22,7 @@ set(SRCS gd32f4xx_boot.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS gd32f4xx_appinit.c gd32f4xx_bringup.c) -elseif(CONFIG_BOARD_LATE_INITIALIZE) +if(CONFIG_BOARD_LATE_INITIALIZE) list(APPEND SRCS gd32f4xx_bringup.c) endif() diff --git a/boards/arm/gd32f4/gd32f450zk-eval/src/Makefile b/boards/arm/gd32f4/gd32f450zk-eval/src/Makefile index 8f87b677fb3..e9a79e6727a 100644 --- a/boards/arm/gd32f4/gd32f450zk-eval/src/Makefile +++ b/boards/arm/gd32f4/gd32f450zk-eval/src/Makefile @@ -22,17 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = gd32f4xx_boot.c - -# ifeq ($(CONFIG_BOARDCTL),y) -# CSRCS += gd32f4xx_appinit.c -# endif - -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += gd32f4xx_appinit.c gd32f4xx_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += gd32f4xx_bringup.c -endif +CSRCS = gd32f4xx_boot.c gd32f4xx_bringup.c ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += gd32f4xx_autoleds.c diff --git a/boards/arm/gd32f4/gd32f450zk-eval/src/gd32f450z_eval.h b/boards/arm/gd32f4/gd32f450zk-eval/src/gd32f450z_eval.h index b1caed736aa..2022049d294 100644 --- a/boards/arm/gd32f4/gd32f450zk-eval/src/gd32f450z_eval.h +++ b/boards/arm/gd32f4/gd32f450zk-eval/src/gd32f450z_eval.h @@ -188,16 +188,9 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINIT=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * - * Otherwise, bad news: Never called - * ****************************************************************************/ int gd32_bringup(void); diff --git a/boards/arm/gd32f4/gd32f450zk-eval/src/gd32f4xx_appinit.c b/boards/arm/gd32f4/gd32f450zk-eval/src/gd32f4xx_appinit.c deleted file mode 100644 index 23df26fd7de..00000000000 --- a/boards/arm/gd32f4/gd32f450zk-eval/src/gd32f4xx_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/gd32f4/gd32f450zk-eval/src/gd32f4xx_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 - -#include -#include -#include -#include - -#include - -#include "gd32f4xx.h" -#include "gd32f450z_eval.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) -{ - /* Perform board initialization here */ - - return gd32_bringup(); -} diff --git a/boards/arm/gd32f4/gd32f470ik-eval/src/CMakeLists.txt b/boards/arm/gd32f4/gd32f470ik-eval/src/CMakeLists.txt index b6af78fd172..2ff2544822e 100644 --- a/boards/arm/gd32f4/gd32f470ik-eval/src/CMakeLists.txt +++ b/boards/arm/gd32f4/gd32f470ik-eval/src/CMakeLists.txt @@ -22,9 +22,7 @@ set(SRCS gd32f4xx_boot.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS gd32f4xx_appinit.c gd32f4xx_bringup.c) -elseif(CONFIG_BOARD_LATE_INITIALIZE) +if(CONFIG_BOARD_LATE_INITIALIZE) list(APPEND SRCS gd32f4xx_bringup.c) endif() diff --git a/boards/arm/gd32f4/gd32f470ik-eval/src/Makefile b/boards/arm/gd32f4/gd32f470ik-eval/src/Makefile index ad497847e28..9b10a9d5e30 100644 --- a/boards/arm/gd32f4/gd32f470ik-eval/src/Makefile +++ b/boards/arm/gd32f4/gd32f470ik-eval/src/Makefile @@ -22,17 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = gd32f4xx_boot.c - -# ifeq ($(CONFIG_BOARDCTL),y) -# CSRCS += gd32f4xx_appinit.c -# endif - -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += gd32f4xx_appinit.c gd32f4xx_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += gd32f4xx_bringup.c -endif +CSRCS = gd32f4xx_boot.c gd32f4xx_bringup.c ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += gd32f4xx_autoleds.c diff --git a/boards/arm/gd32f4/gd32f470ik-eval/src/gd32f470i_eval.h b/boards/arm/gd32f4/gd32f470ik-eval/src/gd32f470i_eval.h index 1077a7ea1a9..3af1c63bcf3 100644 --- a/boards/arm/gd32f4/gd32f470ik-eval/src/gd32f470i_eval.h +++ b/boards/arm/gd32f4/gd32f470ik-eval/src/gd32f470i_eval.h @@ -188,16 +188,9 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * - * Otherwise, bad news: Never called - * ****************************************************************************/ int gd32_bringup(void); diff --git a/boards/arm/gd32f4/gd32f470ik-eval/src/gd32f4xx_appinit.c b/boards/arm/gd32f4/gd32f470ik-eval/src/gd32f4xx_appinit.c deleted file mode 100644 index fb7e387b822..00000000000 --- a/boards/arm/gd32f4/gd32f470ik-eval/src/gd32f4xx_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/gd32f4/gd32f470ik-eval/src/gd32f4xx_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 - -#include -#include -#include -#include - -#include - -#include "gd32f4xx.h" -#include "gd32f470i_eval.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) -{ - /* Perform board initialization here */ - - return gd32_bringup(); -} diff --git a/boards/arm/gd32f4/gd32f470zk-aiotbox/src/Makefile b/boards/arm/gd32f4/gd32f470zk-aiotbox/src/Makefile index 70295bf60b2..b429046bd67 100644 --- a/boards/arm/gd32f4/gd32f470zk-aiotbox/src/Makefile +++ b/boards/arm/gd32f4/gd32f470zk-aiotbox/src/Makefile @@ -22,17 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = gd32f4xx_boot.c - -# ifeq ($(CONFIG_BOARDCTL),y) -# CSRCS += gd32f4xx_appinit.c -# endif - -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += gd32f4xx_appinit.c gd32f4xx_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += gd32f4xx_bringup.c -endif +CSRCS = gd32f4xx_boot.c gd32f4xx_bringup.c ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += gd32f4xx_autoleds.c diff --git a/boards/arm/gd32f4/gd32f470zk-aiotbox/src/gd32f470z_aiotbox.h b/boards/arm/gd32f4/gd32f470zk-aiotbox/src/gd32f470z_aiotbox.h index 55aaae51656..17eda55614b 100644 --- a/boards/arm/gd32f4/gd32f470zk-aiotbox/src/gd32f470z_aiotbox.h +++ b/boards/arm/gd32f4/gd32f470zk-aiotbox/src/gd32f470z_aiotbox.h @@ -188,16 +188,9 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * - * Otherwise, bad news: Never called - * ****************************************************************************/ int gd32_bringup(void); diff --git a/boards/arm/gd32f4/gd32f470zk-aiotbox/src/gd32f4xx_appinit.c b/boards/arm/gd32f4/gd32f470zk-aiotbox/src/gd32f4xx_appinit.c deleted file mode 100644 index fb5720f9414..00000000000 --- a/boards/arm/gd32f4/gd32f470zk-aiotbox/src/gd32f4xx_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/gd32f4/gd32f470zk-aiotbox/src/gd32f4xx_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 - -#include -#include -#include -#include - -#include - -#include "gd32f4xx.h" -#include "gd32f470z_aiotbox.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) -{ - /* Perform board initialization here */ - - return gd32_bringup(); -} diff --git a/boards/arm/gd32f4/gd32f470zk-eval/src/Makefile b/boards/arm/gd32f4/gd32f470zk-eval/src/Makefile index 0ac508bc75e..853d8448313 100644 --- a/boards/arm/gd32f4/gd32f470zk-eval/src/Makefile +++ b/boards/arm/gd32f4/gd32f470zk-eval/src/Makefile @@ -22,17 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = gd32f4xx_boot.c - -# ifeq ($(CONFIG_BOARDCTL),y) -# CSRCS += gd32f4xx_appinit.c -# endif - -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += gd32f4xx_appinit.c gd32f4xx_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += gd32f4xx_bringup.c -endif +CSRCS = gd32f4xx_boot.c gd32f4xx_bringup.c ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += gd32f4xx_autoleds.c diff --git a/boards/arm/gd32f4/gd32f470zk-eval/src/gd32f470z_eval.h b/boards/arm/gd32f4/gd32f470zk-eval/src/gd32f470z_eval.h index bb01ac00580..e00df0aa7cd 100644 --- a/boards/arm/gd32f4/gd32f470zk-eval/src/gd32f470z_eval.h +++ b/boards/arm/gd32f4/gd32f470zk-eval/src/gd32f470z_eval.h @@ -188,16 +188,9 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * - * Otherwise, bad news: Never called - * ****************************************************************************/ int gd32_bringup(void); diff --git a/boards/arm/gd32f4/gd32f470zk-eval/src/gd32f4xx_appinit.c b/boards/arm/gd32f4/gd32f470zk-eval/src/gd32f4xx_appinit.c deleted file mode 100644 index 523a6339e54..00000000000 --- a/boards/arm/gd32f4/gd32f470zk-eval/src/gd32f4xx_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/gd32f4/gd32f470zk-eval/src/gd32f4xx_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 - -#include -#include -#include -#include - -#include - -#include "gd32f4xx.h" -#include "gd32f470z_eval.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) -{ - /* Perform board initialization here */ - - return gd32_bringup(); -} diff --git a/boards/arm/ht32f491x3/esk32/include/board.h b/boards/arm/ht32f491x3/esk32/include/board.h index 1a5e99c7650..9fff7de0157 100644 --- a/boards/arm/ht32f491x3/esk32/include/board.h +++ b/boards/arm/ht32f491x3/esk32/include/board.h @@ -118,8 +118,6 @@ void ht32f491x3_clockconfig(void); void ht32f491x3_boardinitialize(void); -int board_app_initialize(uintptr_t arg); - #ifdef CONFIG_PWM int ht32_pwm_setup(void); #endif diff --git a/boards/arm/ht32f491x3/esk32/src/CMakeLists.txt b/boards/arm/ht32f491x3/esk32/src/CMakeLists.txt index a76fb93ce64..6d4a8b63c4e 100644 --- a/boards/arm/ht32f491x3/esk32/src/CMakeLists.txt +++ b/boards/arm/ht32f491x3/esk32/src/CMakeLists.txt @@ -22,8 +22,8 @@ set(SRCS ht32_boot.c) -if(CONFIG_BOARDCTL OR CONFIG_BOARD_LATE_INITIALIZE) - list(APPEND SRCS ht32_appinit.c) +if(CONFIG_BOARD_LATE_INITIALIZE) + list(APPEND SRCS ht32_bringup.c) endif() if(CONFIG_USERLED) diff --git a/boards/arm/ht32f491x3/esk32/src/Makefile b/boards/arm/ht32f491x3/esk32/src/Makefile index 2ff294bed3b..f0f4a7fd236 100644 --- a/boards/arm/ht32f491x3/esk32/src/Makefile +++ b/boards/arm/ht32f491x3/esk32/src/Makefile @@ -24,10 +24,8 @@ include $(TOPDIR)/Make.defs CSRCS += ht32_boot.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += ht32_appinit.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += ht32_appinit.c +ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) +CSRCS += ht32_bringup.c endif ifeq ($(CONFIG_USERLED),y) diff --git a/boards/arm/ht32f491x3/esk32/src/ht32_appinit.c b/boards/arm/ht32f491x3/esk32/src/ht32_bringup.c similarity index 93% rename from boards/arm/ht32f491x3/esk32/src/ht32_appinit.c rename to boards/arm/ht32f491x3/esk32/src/ht32_bringup.c index 3c1d276f0f7..f715b657181 100644 --- a/boards/arm/ht32f491x3/esk32/src/ht32_appinit.c +++ b/boards/arm/ht32f491x3/esk32/src/ht32_bringup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/ht32f491x3/esk32/src/ht32_appinit.c + * boards/arm/ht32f491x3/esk32/src/ht32_bringup.c * * SPDX-License-Identifier: Apache-2.0 * @@ -91,17 +91,6 @@ static int ht32_bringup(void) * Public Functions ****************************************************************************/ -int board_app_initialize(uintptr_t arg) -{ - (void)arg; - -#ifdef CONFIG_BOARD_LATE_INITIALIZE - return OK; -#else - return ht32_bringup(); -#endif -} - #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { diff --git a/boards/arm/imx6/sabre-6quad/src/CMakeLists.txt b/boards/arm/imx6/sabre-6quad/src/CMakeLists.txt index f4d998bbaf0..d8ba2b7f9fe 100644 --- a/boards/arm/imx6/sabre-6quad/src/CMakeLists.txt +++ b/boards/arm/imx6/sabre-6quad/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS imx_boardinit.c imx_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS imx_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS imx_autoleds.c) else() diff --git a/boards/arm/imx6/sabre-6quad/src/Makefile b/boards/arm/imx6/sabre-6quad/src/Makefile index d80f1c02a0a..95ae85ce8f8 100644 --- a/boards/arm/imx6/sabre-6quad/src/Makefile +++ b/boards/arm/imx6/sabre-6quad/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = imx_boardinit.c imx_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += imx_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += imx_autoleds.c else diff --git a/boards/arm/imx6/sabre-6quad/src/imx_appinit.c b/boards/arm/imx6/sabre-6quad/src/imx_appinit.c deleted file mode 100644 index 93f2f8c9435..00000000000 --- a/boards/arm/imx6/sabre-6quad/src/imx_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/imx6/sabre-6quad/src/imx_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 - -#include - -#include - -#include "sabre-6quad.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return imx_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/imx9/imx93-qsb/src/CMakeLists.txt b/boards/arm/imx9/imx93-qsb/src/CMakeLists.txt index 1e9702770a8..bac76e40de6 100644 --- a/boards/arm/imx9/imx93-qsb/src/CMakeLists.txt +++ b/boards/arm/imx9/imx93-qsb/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS imx93_boardinit.c imx93_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS imx93_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_IMX93_RUN_FROM_ITCM) diff --git a/boards/arm/imx9/imx93-qsb/src/Makefile b/boards/arm/imx9/imx93-qsb/src/Makefile index 953a4c7109b..b1f3fecc154 100644 --- a/boards/arm/imx9/imx93-qsb/src/Makefile +++ b/boards/arm/imx9/imx93-qsb/src/Makefile @@ -25,8 +25,4 @@ include $(TOPDIR)/Make.defs CSRCS = imx93_boardinit.c imx93_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += imx93_appinit.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/imx9/imx93-qsb/src/imx93_appinit.c b/boards/arm/imx9/imx93-qsb/src/imx93_appinit.c deleted file mode 100644 index e7836900add..00000000000 --- a/boards/arm/imx9/imx93-qsb/src/imx93_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/imx9/imx93-qsb/src/imx93_appinit.c - * - * SPDX-License-Identifier: Apache-2.0 - * SPDX-FileCopyrightText: 2024 NXP - * - * 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 -#include -#include -#include "imx93-qsb.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) -{ - UNUSED(arg); -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return imx93_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/imx9/imx95-evk/src/CMakeLists.txt b/boards/arm/imx9/imx95-evk/src/CMakeLists.txt index 470144134ce..b867984a064 100644 --- a/boards/arm/imx9/imx95-evk/src/CMakeLists.txt +++ b/boards/arm/imx9/imx95-evk/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS imx95_boardinit.c imx95_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS imx95_appinit.c) -endif() - if(CONFIG_PWM) list(APPEND SRCS imx95_pwm.c) endif() diff --git a/boards/arm/imx9/imx95-evk/src/Makefile b/boards/arm/imx9/imx95-evk/src/Makefile index ad36c4085c2..38e0db974f0 100644 --- a/boards/arm/imx9/imx95-evk/src/Makefile +++ b/boards/arm/imx9/imx95-evk/src/Makefile @@ -25,10 +25,6 @@ include $(TOPDIR)/Make.defs CSRCS = imx95_boardinit.c imx95_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += imx95_appinit.c -endif - ifeq ($(CONFIG_PWM),y) CSRCS += imx95_pwm.c endif diff --git a/boards/arm/imx9/imx95-evk/src/imx95_appinit.c b/boards/arm/imx9/imx95-evk/src/imx95_appinit.c deleted file mode 100644 index 207befa8147..00000000000 --- a/boards/arm/imx9/imx95-evk/src/imx95_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/imx9/imx95-evk/src/imx95_appinit.c - * - * SPDX-License-Identifier: Apache-2.0 - * SPDX-FileCopyrightText: 2024 NXP - * - * 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 -#include -#include -#include "imx95-evk.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) -{ - UNUSED(arg); -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return imx95_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/imx9/mr-navq95b/src/CMakeLists.txt b/boards/arm/imx9/mr-navq95b/src/CMakeLists.txt index 2a30bf6bce7..affbdf1de0d 100644 --- a/boards/arm/imx9/mr-navq95b/src/CMakeLists.txt +++ b/boards/arm/imx9/mr-navq95b/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS imx95_boardinit.c imx95_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS imx95_appinit.c) -endif() - if(CONFIG_PWM) list(APPEND SRCS imx95_pwm.c) endif() diff --git a/boards/arm/imx9/mr-navq95b/src/Makefile b/boards/arm/imx9/mr-navq95b/src/Makefile index 5f75df705b0..9ece31344a2 100644 --- a/boards/arm/imx9/mr-navq95b/src/Makefile +++ b/boards/arm/imx9/mr-navq95b/src/Makefile @@ -25,10 +25,6 @@ include $(TOPDIR)/Make.defs CSRCS = imx95_boardinit.c imx95_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += imx95_appinit.c -endif - ifeq ($(CONFIG_PWM),y) CSRCS += imx95_pwm.c endif diff --git a/boards/arm/imx9/mr-navq95b/src/imx95_appinit.c b/boards/arm/imx9/mr-navq95b/src/imx95_appinit.c deleted file mode 100644 index 6a3d2d40e3f..00000000000 --- a/boards/arm/imx9/mr-navq95b/src/imx95_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/imx9/mr-navq95b/src/imx95_appinit.c - * - * SPDX-License-Identifier: Apache-2.0 - * SPDX-FileCopyrightText: 2026 NXP - * - * 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 -#include -#include -#include "mr-navq95b.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) -{ - UNUSED(arg); -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return imx95_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/imxrt/arcx-socket-grid/src/CMakeLists.txt b/boards/arm/imxrt/arcx-socket-grid/src/CMakeLists.txt index 393a38a41bc..bb59f42c1f7 100644 --- a/boards/arm/imxrt/arcx-socket-grid/src/CMakeLists.txt +++ b/boards/arm/imxrt/arcx-socket-grid/src/CMakeLists.txt @@ -20,18 +20,13 @@ # # ############################################################################## -set(SRCS imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c) +set(SRCS imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c + imxrt_bringup.c) if(CONFIG_IMXRT_SDRAMC) list(APPEND SRCS imxrt_sdram.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS imxrt_appinit.c imxrt_bringup.c) -elseif(CONFIG_BOARD_LATE_INITIALIZE) - list(APPEND SRCS imxrt_bringup.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS imxrt_autoleds.c) else() diff --git a/boards/arm/imxrt/arcx-socket-grid/src/Makefile b/boards/arm/imxrt/arcx-socket-grid/src/Makefile index c4b41eb81df..06417d05b1a 100644 --- a/boards/arm/imxrt/arcx-socket-grid/src/Makefile +++ b/boards/arm/imxrt/arcx-socket-grid/src/Makefile @@ -23,17 +23,12 @@ include $(TOPDIR)/Make.defs CSRCS = imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c +CSRCS += imxrt_bringup.c ifeq ($(CONFIG_IMXRT_SDRAMC),y) CSRCS += imxrt_sdram.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += imxrt_appinit.c imxrt_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += imxrt_bringup.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += imxrt_autoleds.c else diff --git a/boards/arm/imxrt/arcx-socket-grid/src/arcx-socket-grid.h b/boards/arm/imxrt/arcx-socket-grid/src/arcx-socket-grid.h index c211cbeb055..6272bec74c8 100644 --- a/boards/arm/imxrt/arcx-socket-grid/src/arcx-socket-grid.h +++ b/boards/arm/imxrt/arcx-socket-grid/src/arcx-socket-grid.h @@ -138,9 +138,7 @@ * ****************************************************************************/ -#if defined(CONFIG_BOARDCTL) || defined(CONFIG_BOARD_LATE_INITIALIZE) int imxrt_bringup(void); -#endif /**************************************************************************** * Name: imxrt_spidev_initialize diff --git a/boards/arm/imxrt/arcx-socket-grid/src/imxrt_appinit.c b/boards/arm/imxrt/arcx-socket-grid/src/imxrt_appinit.c deleted file mode 100644 index dd599b1a5e2..00000000000 --- a/boards/arm/imxrt/arcx-socket-grid/src/imxrt_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/imxrt/arcx-socket-grid/src/imxrt_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 - -#include - -#include - -#include "arcx-socket-grid.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return imxrt_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/imxrt/imxrt1020-evk/src/CMakeLists.txt b/boards/arm/imxrt/imxrt1020-evk/src/CMakeLists.txt index 78b11bbd725..b7bc46c6803 100644 --- a/boards/arm/imxrt/imxrt1020-evk/src/CMakeLists.txt +++ b/boards/arm/imxrt/imxrt1020-evk/src/CMakeLists.txt @@ -20,18 +20,13 @@ # # ############################################################################## -set(SRCS imxrt_flexspi_nor_flash.c imxrt_boot.c imxrt_flexspi_nor_boot.c) +set(SRCS imxrt_flexspi_nor_flash.c imxrt_boot.c imxrt_flexspi_nor_boot.c + imxrt_bringup.c) if(CONFIG_IMXRT_SDRAMC) list(APPEND SRCS imxrt_sdram.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS imxrt_appinit.c imxrt_bringup.c) -elseif(CONFIG_BOARD_LATE_INITIALIZE) - list(APPEND SRCS imxrt_bringup.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS imxrt_autoleds.c) else() diff --git a/boards/arm/imxrt/imxrt1020-evk/src/Makefile b/boards/arm/imxrt/imxrt1020-evk/src/Makefile index 271a9274b8d..d2404930d37 100644 --- a/boards/arm/imxrt/imxrt1020-evk/src/Makefile +++ b/boards/arm/imxrt/imxrt1020-evk/src/Makefile @@ -23,16 +23,12 @@ include $(TOPDIR)/Make.defs CSRCS = imxrt_flexspi_nor_flash.c imxrt_boot.c imxrt_flexspi_nor_boot.c +CSRCS += imxrt_bringup.c + ifeq ($(CONFIG_IMXRT_SDRAMC),y) CSRCS += imxrt_sdram.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += imxrt_appinit.c imxrt_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += imxrt_bringup.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += imxrt_autoleds.c else diff --git a/boards/arm/imxrt/imxrt1020-evk/src/imxrt_appinit.c b/boards/arm/imxrt/imxrt1020-evk/src/imxrt_appinit.c deleted file mode 100644 index eaba3ad8258..00000000000 --- a/boards/arm/imxrt/imxrt1020-evk/src/imxrt_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/imxrt/imxrt1020-evk/src/imxrt_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 - -#include - -#include - -#include "imxrt1020-evk.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return imxrt_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/imxrt/imxrt1050-evk/src/CMakeLists.txt b/boards/arm/imxrt/imxrt1050-evk/src/CMakeLists.txt index 0810cb71c88..972d105f16f 100644 --- a/boards/arm/imxrt/imxrt1050-evk/src/CMakeLists.txt +++ b/boards/arm/imxrt/imxrt1050-evk/src/CMakeLists.txt @@ -20,18 +20,13 @@ # # ############################################################################## -set(SRCS imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c) +set(SRCS imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c + imxrt_bringup.c) if(CONFIG_IMXRT_SDRAMC) list(APPEND SRCS imxrt_sdram.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS imxrt_appinit.c imxrt_bringup.c) -elseif(CONFIG_BOARD_LATE_INITIALIZE) - list(APPEND SRCS imxrt_bringup.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS imxrt_autoleds.c) else() diff --git a/boards/arm/imxrt/imxrt1050-evk/src/Makefile b/boards/arm/imxrt/imxrt1050-evk/src/Makefile index a088fb4ec62..ee67fd28bb2 100644 --- a/boards/arm/imxrt/imxrt1050-evk/src/Makefile +++ b/boards/arm/imxrt/imxrt1050-evk/src/Makefile @@ -23,17 +23,12 @@ include $(TOPDIR)/Make.defs CSRCS = imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c +CSRCS += imxrt_bringup.c ifeq ($(CONFIG_IMXRT_SDRAMC),y) CSRCS += imxrt_sdram.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += imxrt_appinit.c imxrt_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += imxrt_bringup.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += imxrt_autoleds.c else diff --git a/boards/arm/imxrt/imxrt1050-evk/src/imxrt_appinit.c b/boards/arm/imxrt/imxrt1050-evk/src/imxrt_appinit.c deleted file mode 100644 index 9857be556f0..00000000000 --- a/boards/arm/imxrt/imxrt1050-evk/src/imxrt_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/imxrt/imxrt1050-evk/src/imxrt_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 - -#include - -#include - -#include "imxrt1050-evk.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return imxrt_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/imxrt/imxrt1060-evk/src/CMakeLists.txt b/boards/arm/imxrt/imxrt1060-evk/src/CMakeLists.txt index 3493fd541e0..02c6fb86936 100644 --- a/boards/arm/imxrt/imxrt1060-evk/src/CMakeLists.txt +++ b/boards/arm/imxrt/imxrt1060-evk/src/CMakeLists.txt @@ -20,18 +20,13 @@ # # ############################################################################## -set(SRCS imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c) +set(SRCS imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c + imxrt_bringup.c) if(CONFIG_IMXRT_SDRAMC) list(APPEND SRCS imxrt_sdram.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS imxrt_appinit.c imxrt_bringup.c) -elseif(CONFIG_BOARD_LATE_INITIALIZE) - list(APPEND SRCS imxrt_bringup.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS imxrt_autoleds.c) else() diff --git a/boards/arm/imxrt/imxrt1060-evk/src/Makefile b/boards/arm/imxrt/imxrt1060-evk/src/Makefile index 7c0d5099ce2..5248d181414 100644 --- a/boards/arm/imxrt/imxrt1060-evk/src/Makefile +++ b/boards/arm/imxrt/imxrt1060-evk/src/Makefile @@ -23,17 +23,12 @@ include $(TOPDIR)/Make.defs CSRCS = imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c +CSRCS += imxrt_bringup.c ifeq ($(CONFIG_IMXRT_SDRAMC),y) CSRCS += imxrt_sdram.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += imxrt_appinit.c imxrt_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += imxrt_bringup.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += imxrt_autoleds.c else diff --git a/boards/arm/imxrt/imxrt1060-evk/src/imxrt_appinit.c b/boards/arm/imxrt/imxrt1060-evk/src/imxrt_appinit.c deleted file mode 100644 index b5efb37b5c7..00000000000 --- a/boards/arm/imxrt/imxrt1060-evk/src/imxrt_appinit.c +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** - * boards/arm/imxrt/imxrt1060-evk/src/imxrt_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 -#include -#include - -#include -#include - -#include "imxrt1060-evk.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) -{ -#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) - /* Register the LED driver */ - - int ret; - ret = userled_lower_initialize(LED_DRIVER_PATH); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); - return ret; - } -#endif - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return imxrt_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/imxrt/imxrt1060-evk/src/imxrt_boot.c b/boards/arm/imxrt/imxrt1060-evk/src/imxrt_boot.c index d6237861a04..15fd608aeee 100644 --- a/boards/arm/imxrt/imxrt1060-evk/src/imxrt_boot.c +++ b/boards/arm/imxrt/imxrt1060-evk/src/imxrt_boot.c @@ -26,8 +26,12 @@ #include +#include +#include + #include #include +#include #include "imxrt_start.h" #include "imxrt1060-evk.h" @@ -112,6 +116,17 @@ void imxrt_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { +#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) + /* Register the LED driver */ + + int ret; + ret = userled_lower_initialize(LED_DRIVER_PATH); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); + } +#endif + /* Perform board initialization */ imxrt_bringup(); diff --git a/boards/arm/imxrt/imxrt1064-evk/src/CMakeLists.txt b/boards/arm/imxrt/imxrt1064-evk/src/CMakeLists.txt index 5b36e3338c7..0711958020d 100644 --- a/boards/arm/imxrt/imxrt1064-evk/src/CMakeLists.txt +++ b/boards/arm/imxrt/imxrt1064-evk/src/CMakeLists.txt @@ -20,18 +20,13 @@ # # ############################################################################## -set(SRCS imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c) +set(SRCS imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c + imxrt_bringup.c) if(CONFIG_IMXRT_SDRAMC) list(APPEND SRCS imxrt_sdram.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS imxrt_appinit.c imxrt_bringup.c) -elseif(CONFIG_BOARD_LATE_INITIALIZE) - list(APPEND SRCS imxrt_bringup.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS imxrt_autoleds.c) else() diff --git a/boards/arm/imxrt/imxrt1064-evk/src/Makefile b/boards/arm/imxrt/imxrt1064-evk/src/Makefile index 86e1bb5f965..73df28beab7 100644 --- a/boards/arm/imxrt/imxrt1064-evk/src/Makefile +++ b/boards/arm/imxrt/imxrt1064-evk/src/Makefile @@ -23,17 +23,12 @@ include $(TOPDIR)/Make.defs CSRCS = imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c +CSRCS += imxrt_bringup.c ifeq ($(CONFIG_IMXRT_SDRAMC),y) CSRCS += imxrt_sdram.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += imxrt_appinit.c imxrt_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += imxrt_bringup.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += imxrt_autoleds.c else diff --git a/boards/arm/imxrt/imxrt1064-evk/src/imxrt_appinit.c b/boards/arm/imxrt/imxrt1064-evk/src/imxrt_appinit.c deleted file mode 100644 index 63dad92bf56..00000000000 --- a/boards/arm/imxrt/imxrt1064-evk/src/imxrt_appinit.c +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** - * boards/arm/imxrt/imxrt1064-evk/src/imxrt_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 -#include -#include - -#include -#include - -#include "imxrt1064-evk.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) -{ -#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) - /* Register the LED driver */ - - int ret; - ret = userled_lower_initialize(LED_DRIVER_PATH); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); - return ret; - } -#endif - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return imxrt_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/imxrt/imxrt1064-evk/src/imxrt_boot.c b/boards/arm/imxrt/imxrt1064-evk/src/imxrt_boot.c index 8ff31cf02a4..afcc69ad53a 100644 --- a/boards/arm/imxrt/imxrt1064-evk/src/imxrt_boot.c +++ b/boards/arm/imxrt/imxrt1064-evk/src/imxrt_boot.c @@ -26,8 +26,12 @@ #include +#include +#include + #include #include +#include #include "imxrt_start.h" #include "imxrt1064-evk.h" @@ -112,6 +116,17 @@ void imxrt_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { +#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) + /* Register the LED driver */ + + int ret; + ret = userled_lower_initialize(LED_DRIVER_PATH); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); + } +#endif + /* Perform board initialization */ imxrt_bringup(); diff --git a/boards/arm/imxrt/imxrt1170-evk/src/CMakeLists.txt b/boards/arm/imxrt/imxrt1170-evk/src/CMakeLists.txt index a152cf3f22f..99e1741b417 100644 --- a/boards/arm/imxrt/imxrt1170-evk/src/CMakeLists.txt +++ b/boards/arm/imxrt/imxrt1170-evk/src/CMakeLists.txt @@ -21,18 +21,12 @@ # ############################################################################## set(SRCS imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c - imxrt_clockconfig.c) + imxrt_clockconfig.c imxrt_bringup.c) if(CONFIG_IMXRT_SDRAMC) list(APPEND SRCS imxrt_sdram.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS imxrt_appinit.c imxrt_bringup.c) -elseif(CONFIG_BOARD_LATE_INITIALIZE) - list(APPEND SRCS imxrt_bringup.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS imxrt_autoleds.c) else() diff --git a/boards/arm/imxrt/imxrt1170-evk/src/Makefile b/boards/arm/imxrt/imxrt1170-evk/src/Makefile index 33b33360ed7..87f0a675393 100644 --- a/boards/arm/imxrt/imxrt1170-evk/src/Makefile +++ b/boards/arm/imxrt/imxrt1170-evk/src/Makefile @@ -23,18 +23,12 @@ include $(TOPDIR)/Make.defs CSRCS = imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c -CSRCS += imxrt_clockconfig.c +CSRCS += imxrt_clockconfig.c imxrt_bringup.c ifeq ($(CONFIG_IMXRT_SDRAMC),y) CSRCS += imxrt_sdram.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += imxrt_appinit.c imxrt_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += imxrt_bringup.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += imxrt_autoleds.c else diff --git a/boards/arm/imxrt/imxrt1170-evk/src/imxrt_appinit.c b/boards/arm/imxrt/imxrt1170-evk/src/imxrt_appinit.c deleted file mode 100644 index b4e7fc7dcb4..00000000000 --- a/boards/arm/imxrt/imxrt1170-evk/src/imxrt_appinit.c +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** - * boards/arm/imxrt/imxrt1170-evk/src/imxrt_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 -#include -#include - -#include -#include - -#include "imxrt1170-evk.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) -{ -#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) - /* Register the LED driver */ - - int ret; - ret = userled_lower_initialize(LED_DRIVER_PATH); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); - return ret; - } -#endif - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return imxrt_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/imxrt/imxrt1170-evk/src/imxrt_boot.c b/boards/arm/imxrt/imxrt1170-evk/src/imxrt_boot.c index c2b0a31c739..00ae6df22ea 100644 --- a/boards/arm/imxrt/imxrt1170-evk/src/imxrt_boot.c +++ b/boards/arm/imxrt/imxrt1170-evk/src/imxrt_boot.c @@ -26,8 +26,12 @@ #include +#include +#include + #include #include +#include #include "imxrt_start.h" #include "imxrt1170-evk.h" @@ -124,6 +128,17 @@ void imxrt_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { +#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) + /* Register the LED driver */ + + int ret; + ret = userled_lower_initialize(LED_DRIVER_PATH); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); + } +#endif + /* Perform board initialization */ imxrt_bringup(); diff --git a/boards/arm/imxrt/teensy-4.x/src/CMakeLists.txt b/boards/arm/imxrt/teensy-4.x/src/CMakeLists.txt index 8e6ab53f784..a96e99581ec 100644 --- a/boards/arm/imxrt/teensy-4.x/src/CMakeLists.txt +++ b/boards/arm/imxrt/teensy-4.x/src/CMakeLists.txt @@ -20,13 +20,8 @@ # # ############################################################################## -set(SRCS imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c) - -if(CONFIG_BOARDCTL) - list(APPEND SRCS imxrt_appinit.c imxrt_bringup.c) -elseif(CONFIG_BOARD_LATE_INITIALIZE) - list(APPEND SRCS imxrt_bringup.c) -endif() +set(SRCS imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c + imxrt_bringup.c) if(CONFIG_BOARDCTL_RESET) list(APPEND SRCS imxrt_reset.c) diff --git a/boards/arm/imxrt/teensy-4.x/src/Makefile b/boards/arm/imxrt/teensy-4.x/src/Makefile index 5bb3b17c59f..fbb43ad76e5 100644 --- a/boards/arm/imxrt/teensy-4.x/src/Makefile +++ b/boards/arm/imxrt/teensy-4.x/src/Makefile @@ -23,12 +23,7 @@ include $(TOPDIR)/Make.defs CSRCS = imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c - -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += imxrt_appinit.c imxrt_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) CSRCS += imxrt_bringup.c -endif ifeq ($(CONFIG_BOARDCTL_RESET),y) CSRCS += imxrt_reset.c diff --git a/boards/arm/imxrt/teensy-4.x/src/imxrt_appinit.c b/boards/arm/imxrt/teensy-4.x/src/imxrt_appinit.c deleted file mode 100644 index cefaabe207b..00000000000 --- a/boards/arm/imxrt/teensy-4.x/src/imxrt_appinit.c +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** - * boards/arm/imxrt/teensy-4.x/src/imxrt_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 - -#include -#include - -#include -#include - -#include "teensy-4.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) -{ - int ret; -#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) - /* Register the LED driver */ - - ret = userled_lower_initialize(LED_DRIVER_PATH); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); - return ret; - } -#endif - -#if defined(CONFIG_IMXRT_LPSPI1) || defined(CONFIG_IMXRT_LPSPI2) || \ - defined(CONFIG_IMXRT_LPSPI3) || defined(CONFIG_IMXRT_LPSPI4) - imxrt_spidev_initialize(); -#endif - -# ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return imxrt_bringup(); -# else - return OK; -# endif - - UNUSED(ret); -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/imxrt/teensy-4.x/src/imxrt_boot.c b/boards/arm/imxrt/teensy-4.x/src/imxrt_boot.c index 2c0194c433c..80939907e8a 100644 --- a/boards/arm/imxrt/teensy-4.x/src/imxrt_boot.c +++ b/boards/arm/imxrt/teensy-4.x/src/imxrt_boot.c @@ -26,8 +26,12 @@ #include +#include +#include + #include #include +#include #include "imxrt_start.h" #include "teensy-4.h" @@ -113,8 +117,24 @@ void imxrt_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform board initialization */ + int ret; +#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) + /* Register the LED driver */ + + ret = userled_lower_initialize(LED_DRIVER_PATH); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); + } +#endif + +#if defined(CONFIG_IMXRT_LPSPI1) || defined(CONFIG_IMXRT_LPSPI2) || \ + defined(CONFIG_IMXRT_LPSPI3) || defined(CONFIG_IMXRT_LPSPI4) + imxrt_spidev_initialize(); +#endif imxrt_bringup(); + + UNUSED(ret); } #endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/kinetis/freedom-k28f/src/CMakeLists.txt b/boards/arm/kinetis/freedom-k28f/src/CMakeLists.txt index 3041d649abf..de911f5d882 100644 --- a/boards/arm/kinetis/freedom-k28f/src/CMakeLists.txt +++ b/boards/arm/kinetis/freedom-k28f/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS k28_boot.c k28_bringup.c k28_spi.c k28_i2c.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS k28_appinit.c) -endif() - # If the RGB driver is not enabled, then treat the RGB as 3 LEDs if(NOT CONFIG_RGBLED) diff --git a/boards/arm/kinetis/freedom-k28f/src/Makefile b/boards/arm/kinetis/freedom-k28f/src/Makefile index 8ba545e0828..0f3e1c14a45 100644 --- a/boards/arm/kinetis/freedom-k28f/src/Makefile +++ b/boards/arm/kinetis/freedom-k28f/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = k28_boot.c k28_bringup.c k28_spi.c k28_i2c.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += k28_appinit.c -endif - # If the RGB driver is not enabled, then treat the RGB as 3 LEDs ifneq ($(CONFIG_RGBLED),y) diff --git a/boards/arm/kinetis/freedom-k28f/src/k28_appinit.c b/boards/arm/kinetis/freedom-k28f/src/k28_appinit.c deleted file mode 100644 index 277c395ac26..00000000000 --- a/boards/arm/kinetis/freedom-k28f/src/k28_appinit.c +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** - * boards/arm/kinetis/freedom-k28f/src/k28_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 - -#include -#include - -#include - -#include "kinetis_usbotg.h" -#include "freedom-k28f.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return k28_bringup(); -#endif -} diff --git a/boards/arm/kinetis/freedom-k64f/src/CMakeLists.txt b/boards/arm/kinetis/freedom-k64f/src/CMakeLists.txt index 8987c8811bb..8a8a896b770 100644 --- a/boards/arm/kinetis/freedom-k64f/src/CMakeLists.txt +++ b/boards/arm/kinetis/freedom-k64f/src/CMakeLists.txt @@ -20,7 +20,7 @@ # # ############################################################################## -set(SRCS k64_boot.c k64_spi.c) +set(SRCS k64_boot.c k64_spi.c k64_bringup.c) if(CONFIG_ARCH_LEDS) list(APPEND SRCS k64_autoleds.c) @@ -32,12 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS k64_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS k64_appinit.c k64_bringup.c) -elseif(CONFIG_BOARD_LATE_INITIALIZE) - list(APPEND SRCS k64_bringup.c) -endif() - if(CONFIG_I2C) list(APPEND SRCS k64_i2c.c) endif() diff --git a/boards/arm/kinetis/freedom-k64f/src/Makefile b/boards/arm/kinetis/freedom-k64f/src/Makefile index 1bd41fda42b..b3ef284e740 100644 --- a/boards/arm/kinetis/freedom-k64f/src/Makefile +++ b/boards/arm/kinetis/freedom-k64f/src/Makefile @@ -22,7 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = k64_boot.c k64_spi.c +CSRCS = k64_bringup.c k64_boot.c k64_spi.c ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += k64_autoleds.c @@ -34,12 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += k64_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += k64_appinit.c k64_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += k64_bringup.c -endif - ifeq ($(CONFIG_I2C),y) CSRCS += k64_i2c.c endif diff --git a/boards/arm/kinetis/freedom-k64f/src/freedom-k64f.h b/boards/arm/kinetis/freedom-k64f/src/freedom-k64f.h index d6c57b9a3ed..4f401446f9f 100644 --- a/boards/arm/kinetis/freedom-k64f/src/freedom-k64f.h +++ b/boards/arm/kinetis/freedom-k64f/src/freedom-k64f.h @@ -260,9 +260,7 @@ void weak_function k64_usbinitialize(void); * ****************************************************************************/ -#if defined(CONFIG_BOARDCTL) || defined(CONFIG_BOARD_LATE_INITIALIZE) int k64_bringup(void); -#endif /**************************************************************************** * Name: k64_sdhc_initialize diff --git a/boards/arm/kinetis/freedom-k64f/src/k64_appinit.c b/boards/arm/kinetis/freedom-k64f/src/k64_appinit.c deleted file mode 100644 index 664f27f1ebd..00000000000 --- a/boards/arm/kinetis/freedom-k64f/src/k64_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/kinetis/freedom-k64f/src/k64_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 - -#include - -#include - -#include "freedom-k64f.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return k64_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/kinetis/freedom-k64f/src/k64_usbmsc.c b/boards/arm/kinetis/freedom-k64f/src/k64_usbmsc.c index 7c399532fc0..9f660f328d8 100644 --- a/boards/arm/kinetis/freedom-k64f/src/k64_usbmsc.c +++ b/boards/arm/kinetis/freedom-k64f/src/k64_usbmsc.c @@ -73,8 +73,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see k64_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/kinetis/freedom-k66f/src/CMakeLists.txt b/boards/arm/kinetis/freedom-k66f/src/CMakeLists.txt index 325329f673d..2e4f0f7c03a 100644 --- a/boards/arm/kinetis/freedom-k66f/src/CMakeLists.txt +++ b/boards/arm/kinetis/freedom-k66f/src/CMakeLists.txt @@ -20,7 +20,7 @@ # # ############################################################################## -set(SRCS k66_boot.c k66_spi.c) +set(SRCS k66_boot.c k66_spi.c k66_bringup.c) if(CONFIG_ARCH_LEDS) list(APPEND SRCS k66_autoleds.c) @@ -32,13 +32,8 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS k66_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS k66_appinit.c k66_bringup.c) - if(CONFIG_BOARDCTL_RESET) - list(APPEND SRCS k66_reset.c) - endif() -elseif(CONFIG_BOARD_LATE_INITIALIZE) - list(APPEND SRCS k66_bringup.c) +if(CONFIG_BOARDCTL_RESET) + list(APPEND SRCS k66_reset.c) endif() if(CONFIG_KINETIS_SDHC) diff --git a/boards/arm/kinetis/freedom-k66f/src/Makefile b/boards/arm/kinetis/freedom-k66f/src/Makefile index 12ec96c1b25..192ff41df28 100644 --- a/boards/arm/kinetis/freedom-k66f/src/Makefile +++ b/boards/arm/kinetis/freedom-k66f/src/Makefile @@ -22,7 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = k66_boot.c k66_spi.c +CSRCS = k66_boot.c k66_spi.c k66_bringup.c ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += k66_autoleds.c @@ -34,14 +34,9 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += k66_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += k66_appinit.c k66_bringup.c ifeq ($(CONFIG_BOARDCTL_RESET),y) CSRCS += k66_reset.c endif -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += k66_bringup.c -endif ifeq ($(CONFIG_KINETIS_SDHC),y) CSRCS += k66_sdhc.c diff --git a/boards/arm/kinetis/freedom-k66f/src/k66_appinit.c b/boards/arm/kinetis/freedom-k66f/src/k66_appinit.c deleted file mode 100644 index 1d69ed84072..00000000000 --- a/boards/arm/kinetis/freedom-k66f/src/k66_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/kinetis/freedom-k66f/src/k66_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 - -#include - -#include - -#include "freedom-k66f.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return k66_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/kinetis/freedom-k66f/src/k66_usbmsc.c b/boards/arm/kinetis/freedom-k66f/src/k66_usbmsc.c index a21f1dce616..022cd6f2450 100644 --- a/boards/arm/kinetis/freedom-k66f/src/k66_usbmsc.c +++ b/boards/arm/kinetis/freedom-k66f/src/k66_usbmsc.c @@ -73,8 +73,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see k66_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/kinetis/kwikstik-k40/src/CMakeLists.txt b/boards/arm/kinetis/kwikstik-k40/src/CMakeLists.txt index f970c3160d9..bf80c4b0acc 100644 --- a/boards/arm/kinetis/kwikstik-k40/src/CMakeLists.txt +++ b/boards/arm/kinetis/kwikstik-k40/src/CMakeLists.txt @@ -30,10 +30,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS k40_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS k40_appinit.c) -endif() - if(CONFIG_USBDEV) list(APPEND SRCS k40_usbdev.c) endif() diff --git a/boards/arm/kinetis/kwikstik-k40/src/Makefile b/boards/arm/kinetis/kwikstik-k40/src/Makefile index 6111cebad24..19270ed97aa 100644 --- a/boards/arm/kinetis/kwikstik-k40/src/Makefile +++ b/boards/arm/kinetis/kwikstik-k40/src/Makefile @@ -32,10 +32,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += k40_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += k40_appinit.c -endif - ifeq ($(CONFIG_USBDEV),y) CSRCS += k40_usbdev.c endif diff --git a/boards/arm/kinetis/kwikstik-k40/src/k40_appinit.c b/boards/arm/kinetis/kwikstik-k40/src/k40_appinit.c deleted file mode 100644 index fde1e6c9b00..00000000000 --- a/boards/arm/kinetis/kwikstik-k40/src/k40_appinit.c +++ /dev/null @@ -1,253 +0,0 @@ -/**************************************************************************** - * boards/arm/kinetis/kwikstik-k40/src/k40_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 - -#include -#include -#include -#include - -#include - -#ifdef CONFIG_KINETIS_SDHC -# include -# include -#endif - -#include "kinetis.h" -#include "kwikstik-k40.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -/* PORT and SLOT number probably depend on the board configuration */ - -#ifdef CONFIG_ARCH_BOARD_KWIKSTIK_K40 -# define NSH_HAVEUSBDEV 1 -# define NSH_HAVEMMCSD 1 -# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 -# error "Only one MMC/SD slot, slot 0" -# undef CONFIG_NSH_MMCSDSLOTNO -# endif -# ifndef CONFIG_NSH_MMCSDSLOTNO -# define CONFIG_NSH_MMCSDSLOTNO 0 -# endif -#else - /* Add configuration for new Kinetis boards here */ - -# error "Unrecognized Kinetis board" -# undef NSH_HAVEUSBDEV -# undef NSH_HAVEMMCSD -#endif - -/* Can't support USB features if USB is not enabled */ - -#ifndef CONFIG_USBDEV -# undef NSH_HAVEUSBDEV -#endif - -/* Can't support MMC/SD features if mountpoints are disabled or if SDHC - * support is not enabled. - */ - -#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_KINETIS_SDHC) -# undef NSH_HAVEMMCSD -#endif - -#ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -#endif - -/* We expect to receive GPIO interrupts for card insertion events */ - -#ifndef CONFIG_KINETIS_GPIOIRQ -# error "CONFIG_KINETIS_GPIOIRQ required for card detect interrupt" -#endif - -#ifndef CONFIG_KINETIS_PORTEINTS -# error "CONFIG_KINETIS_PORTEINTS required for card detect interrupt" -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/* This structure encapsulates the global variable used in this file and - * reduces the probability of name collisions. - */ - -#ifdef NSH_HAVEMMCSD -struct kinetis_nsh_s -{ - struct sdio_dev_s *sdhc; /* SDIO driver handle */ - bool inserted; /* True: card is inserted */ -}; -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -#ifdef NSH_HAVEMMCSD -static struct kinetis_nsh_s g_nsh; -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: kinetis_mediachange - ****************************************************************************/ - -#ifdef NSH_HAVEMMCSD -static void kinetis_mediachange(void) -{ - bool inserted; - - /* Get the current value of the card detect pin. This pin is pulled up on - * board. So low means that a card is present. - */ - - inserted = !kinetis_gpioread(GPIO_SD_CARDDETECT); - - /* Has the pin changed state? */ - - if (inserted != g_nsh.inserted) - { - /* Yes.. - * perform the appropriate action (this might need some debounce). - */ - - g_nsh.inserted = inserted; - sdhc_mediachange(g_nsh.sdhc, inserted); - } -} -#endif - -/**************************************************************************** - * Name: kinetis_cdinterrupt - ****************************************************************************/ - -#ifdef NSH_HAVEMMCSD -static int kinetis_cdinterrupt(int irq, void *context) -{ - /* All of the work is done by kinetis_mediachange() */ - - kinetis_mediachange(); - return OK; -} -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef NSH_HAVEMMCSD - int ret; - - /* Configure GPIO pins. - * - * First CD power. The initial state will provide SD power. - */ - - kinetis_pinconfig(GPIO_SD_CARDON); /* Applies power to the card */ - - /* Attached the card detect interrupt (but don't enable it yet) */ - - kinetis_pinconfig(GPIO_SD_CARDDETECT); - kinetis_pinirqattach(GPIO_SD_CARDDETECT, kinetis_cdinterrupt, NULL); - - /* Mount the SDHC-based MMC/SD block driver */ - - /* First, get an instance of the SDHC interface */ - - syslog(LOG_INFO, "Initializing SDHC slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); - - g_nsh.sdhc = sdhc_initialize(CONFIG_NSH_MMCSDSLOTNO); - if (!g_nsh.sdhc) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SDHC slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); - return -ENODEV; - } - - /* Now bind the SDHC interface to the MMC/SD driver */ - - syslog(LOG_INFO, "Bind SDHC to the MMC/SD driver, minor=%d\n", - CONFIG_NSH_MMCSDMINOR); - - ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_nsh.sdhc); - if (ret != OK) - { - syslog(LOG_ERR, - "ERROR: Failed to bind SDHC to the MMC/SD driver: %d\n", - ret); - return ret; - } - - syslog(LOG_INFO, "Successfully bound SDHC to the MMC/SD driver\n"); - - /* Handle the initial card state */ - - kinetis_mediachange(); - - /* Enable CD interrupts to handle subsequent media changes */ - - kinetis_pinirqenable(GPIO_SD_CARDDETECT); -#endif - return OK; -} diff --git a/boards/arm/kinetis/kwikstik-k40/src/k40_boot.c b/boards/arm/kinetis/kwikstik-k40/src/k40_boot.c index d305aa05149..41de1245d5c 100644 --- a/boards/arm/kinetis/kwikstik-k40/src/k40_boot.c +++ b/boards/arm/kinetis/kwikstik-k40/src/k40_boot.c @@ -28,20 +28,149 @@ #include +#include +#include +#include +#include + #include #include +#ifdef CONFIG_KINETIS_SDHC +# include +# include +#endif + #include "arm_internal.h" +#include "kinetis.h" #include "kwikstik-k40.h" /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +/* PORT and SLOT number probably depend on the board configuration */ + +#ifdef CONFIG_ARCH_BOARD_KWIKSTIK_K40 +# define NSH_HAVEUSBDEV 1 +# define NSH_HAVEMMCSD 1 +# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 +# error "Only one MMC/SD slot, slot 0" +# undef CONFIG_NSH_MMCSDSLOTNO +# endif +# ifndef CONFIG_NSH_MMCSDSLOTNO +# define CONFIG_NSH_MMCSDSLOTNO 0 +# endif +#else + /* Add configuration for new Kinetis boards here */ + +# error "Unrecognized Kinetis board" +# undef NSH_HAVEUSBDEV +# undef NSH_HAVEMMCSD +#endif + +/* Can't support USB features if USB is not enabled */ + +#ifndef CONFIG_USBDEV +# undef NSH_HAVEUSBDEV +#endif + +/* Can't support MMC/SD features if mountpoints are disabled or if SDHC + * support is not enabled. + */ + +#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_KINETIS_SDHC) +# undef NSH_HAVEMMCSD +#endif + +#ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +#endif + +/* We expect to receive GPIO interrupts for card insertion events */ + +#ifndef CONFIG_KINETIS_GPIOIRQ +# error "CONFIG_KINETIS_GPIOIRQ required for card detect interrupt" +#endif + +#ifndef CONFIG_KINETIS_PORTEINTS +# error "CONFIG_KINETIS_PORTEINTS required for card detect interrupt" +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/* This structure encapsulates the global variable used in this file and + * reduces the probability of name collisions. + */ + +#ifdef NSH_HAVEMMCSD +struct kinetis_nsh_s +{ + struct sdio_dev_s *sdhc; /* SDIO driver handle */ + bool inserted; /* True: card is inserted */ +}; +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +#ifdef NSH_HAVEMMCSD +static struct kinetis_nsh_s g_nsh; +#endif + + /**************************************************************************** * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: kinetis_mediachange + ****************************************************************************/ + +#ifdef NSH_HAVEMMCSD +static void kinetis_mediachange(void) +{ + bool inserted; + + /* Get the current value of the card detect pin. This pin is pulled up on + * board. So low means that a card is present. + */ + + inserted = !kinetis_gpioread(GPIO_SD_CARDDETECT); + + /* Has the pin changed state? */ + + if (inserted != g_nsh.inserted) + { + /* Yes.. + * perform the appropriate action (this might need some debounce). + */ + + g_nsh.inserted = inserted; + sdhc_mediachange(g_nsh.sdhc, inserted); + } +} +#endif + +/**************************************************************************** + * Name: kinetis_cdinterrupt + ****************************************************************************/ + +#ifdef NSH_HAVEMMCSD +static int kinetis_cdinterrupt(int irq, void *context) +{ + /* All of the work is done by kinetis_mediachange() */ + + kinetis_mediachange(); + return OK; +} +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -88,3 +217,76 @@ void kinetis_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) +{ +#ifdef NSH_HAVEMMCSD + int ret; + + /* Configure GPIO pins. + * + * First CD power. The initial state will provide SD power. + */ + + kinetis_pinconfig(GPIO_SD_CARDON); /* Applies power to the card */ + + /* Attached the card detect interrupt (but don't enable it yet) */ + + kinetis_pinconfig(GPIO_SD_CARDDETECT); + kinetis_pinirqattach(GPIO_SD_CARDDETECT, kinetis_cdinterrupt, NULL); + + /* Mount the SDHC-based MMC/SD block driver */ + + /* First, get an instance of the SDHC interface */ + + syslog(LOG_INFO, "Initializing SDHC slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + + g_nsh.sdhc = sdhc_initialize(CONFIG_NSH_MMCSDSLOTNO); + if (!g_nsh.sdhc) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SDHC slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + return; + } + + /* Now bind the SDHC interface to the MMC/SD driver */ + + syslog(LOG_INFO, "Bind SDHC to the MMC/SD driver, minor=%d\n", + CONFIG_NSH_MMCSDMINOR); + + ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_nsh.sdhc); + if (ret != OK) + { + syslog(LOG_ERR, + "ERROR: Failed to bind SDHC to the MMC/SD driver: %d\n", + ret); + return; + } + + syslog(LOG_INFO, "Successfully bound SDHC to the MMC/SD driver\n"); + + /* Handle the initial card state */ + + kinetis_mediachange(); + + /* Enable CD interrupts to handle subsequent media changes */ + + kinetis_pinirqenable(GPIO_SD_CARDDETECT); +#endif +} +#endif diff --git a/boards/arm/kinetis/kwikstik-k40/src/k40_usbmsc.c b/boards/arm/kinetis/kwikstik-k40/src/k40_usbmsc.c index 4be33dc3b1d..783b1bbda3d 100644 --- a/boards/arm/kinetis/kwikstik-k40/src/k40_usbmsc.c +++ b/boards/arm/kinetis/kwikstik-k40/src/k40_usbmsc.c @@ -72,8 +72,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see k40_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/kinetis/teensy-3.x/src/CMakeLists.txt b/boards/arm/kinetis/teensy-3.x/src/CMakeLists.txt index d362c5d7091..125acc1514f 100644 --- a/boards/arm/kinetis/teensy-3.x/src/CMakeLists.txt +++ b/boards/arm/kinetis/teensy-3.x/src/CMakeLists.txt @@ -31,10 +31,6 @@ if(CONFIG_KINETIS_USBOTG) list(APPEND SRCS k20_usbdev.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS k20_appinit.c) -endif() - if(CONFIG_PWM) list(APPEND SRCS k20_pwm.c) endif() diff --git a/boards/arm/kinetis/teensy-3.x/src/Makefile b/boards/arm/kinetis/teensy-3.x/src/Makefile index e255c86ca0a..8d2e24fb1dc 100644 --- a/boards/arm/kinetis/teensy-3.x/src/Makefile +++ b/boards/arm/kinetis/teensy-3.x/src/Makefile @@ -33,10 +33,6 @@ ifeq ($(CONFIG_KINETIS_USBOTG),y) CSRCS += k20_usbdev.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += k20_appinit.c -endif - ifeq ($(CONFIG_PWM),y) CSRCS += k20_pwm.c endif diff --git a/boards/arm/kinetis/teensy-3.x/src/k20_appinit.c b/boards/arm/kinetis/teensy-3.x/src/k20_appinit.c deleted file mode 100644 index 03a15c79e63..00000000000 --- a/boards/arm/kinetis/teensy-3.x/src/k20_appinit.c +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** - * boards/arm/kinetis/teensy-3.x/src/k20_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 - -#include -#include - -#include - -#include "kinetis_usbotg.h" -#include "teensy-3x.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) -{ - int ret; - -#ifdef CONFIG_PWM - /* Initialize PWM and register the PWM device. */ - - ret = kinetis_pwm_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: kinetis_pwm_setup() failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/kinetis/teensy-3.x/src/k20_boot.c b/boards/arm/kinetis/teensy-3.x/src/k20_boot.c index aeb0592f1f5..e29df37400b 100644 --- a/boards/arm/kinetis/teensy-3.x/src/k20_boot.c +++ b/boards/arm/kinetis/teensy-3.x/src/k20_boot.c @@ -28,9 +28,14 @@ #include +#include +#include +#include + #include #include +#include "kinetis_usbotg.h" #include "arm_internal.h" #include "teensy-3x.h" @@ -69,11 +74,39 @@ void kinetis_boardinitialize(void) #endif } -#if defined(CONFIG_BOARD_LATE_INITIALIZE) +/**************************************************************************** + * 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_intitialize() 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) { + int ret; + #if defined(CONFIG_KINETIS_I2C0) || defined(CONFIG_KINETIS_I2C1) kinetis_i2cdev_initialize(); #endif -} + +#ifdef CONFIG_PWM + /* Initialize PWM and register the PWM device. */ + + ret = kinetis_pwm_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: kinetis_pwm_setup() failed: %d\n", ret); + } #endif + + UNUSED(ret); +} +#endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/kinetis/twr-k60n512/src/CMakeLists.txt b/boards/arm/kinetis/twr-k60n512/src/CMakeLists.txt index 262855afc8a..5d608a1c3bc 100644 --- a/boards/arm/kinetis/twr-k60n512/src/CMakeLists.txt +++ b/boards/arm/kinetis/twr-k60n512/src/CMakeLists.txt @@ -30,10 +30,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS k60_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS k60_appinit.c) -endif() - if(CONFIG_USBDEV) list(APPEND SRCS k60_usbdev.c) endif() diff --git a/boards/arm/kinetis/twr-k60n512/src/Makefile b/boards/arm/kinetis/twr-k60n512/src/Makefile index f41ef1a939f..4e0b7170ee5 100644 --- a/boards/arm/kinetis/twr-k60n512/src/Makefile +++ b/boards/arm/kinetis/twr-k60n512/src/Makefile @@ -32,10 +32,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += k60_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += k60_appinit.c -endif - ifeq ($(CONFIG_USBDEV),y) CSRCS += k60_usbdev.c endif diff --git a/boards/arm/kinetis/twr-k60n512/src/k60_appinit.c b/boards/arm/kinetis/twr-k60n512/src/k60_appinit.c deleted file mode 100644 index eaab1f213dc..00000000000 --- a/boards/arm/kinetis/twr-k60n512/src/k60_appinit.c +++ /dev/null @@ -1,266 +0,0 @@ -/**************************************************************************** - * boards/arm/kinetis/twr-k60n512/src/k60_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 - -#include -#include -#include -#include - -#include - -#ifdef CONFIG_KINETIS_SDHC -# include -# include -#endif - -#include "kinetis.h" -#include "twr-k60n512.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -/* PORT and SLOT number probably depend on the board configuration */ - -#ifdef CONFIG_ARCH_BOARD_TWR_K60N512 -# define NSH_HAVEUSBDEV 1 -# define NSH_HAVEMMCSD 1 -# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 -# error "Only one MMC/SD slot, slot 0" -# undef CONFIG_NSH_MMCSDSLOTNO -# endif -# ifndef CONFIG_NSH_MMCSDSLOTNO -# define CONFIG_NSH_MMCSDSLOTNO 0 -# endif -#else - /* Add configuration for new Kinetis boards here */ - -# error "Unrecognized Kinetis board" -# undef NSH_HAVEUSBDEV -# undef NSH_HAVEMMCSD -#endif - -/* Can't support USB features if USB is not enabled */ - -#ifndef CONFIG_USBDEV -# undef NSH_HAVEUSBDEV -#endif - -/* Can't support MMC/SD features if mountpoints are disabled or if SDHC - * support is not enabled. - */ - -#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_KINETIS_SDHC) -# undef NSH_HAVEMMCSD -#endif - -#ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -#endif - -/* We expect to receive GPIO interrupts for card insertion events */ - -#ifdef NSH_HAVEMMCSD -# ifndef CONFIG_KINETIS_GPIOIRQ -# error "CONFIG_KINETIS_GPIOIRQ required for card detect interrupt" -# endif - -# ifndef CONFIG_KINETIS_PORTEINTS -# error "CONFIG_KINETIS_PORTEINTS required for card detect interrupt" -# endif -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/* This structure encapsulates the global variable used in this file and - * reduces the probability of name collisions. - */ - -#ifdef NSH_HAVEMMCSD -struct kinetis_nsh_s -{ - struct sdio_dev_s *sdhc; /* SDIO driver handle */ - bool inserted; /* True: card is inserted */ -}; -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -#ifdef NSH_HAVEMMCSD -static struct kinetis_nsh_s g_nsh; -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: kinetis_mediachange - ****************************************************************************/ - -#ifdef NSH_HAVEMMCSD -static void kinetis_mediachange(void) -{ - bool inserted; - - /* Get the current value of the card detect pin. This pin is pulled up on - * board. So low means that a card is present. - */ - - inserted = !kinetis_gpioread(GPIO_SD_CARDDETECT); - - /* Has the pin changed state? */ - - if (inserted != g_nsh.inserted) - { - /* Yes.. - * perform the appropriate action (this might need some debounce). - */ - - g_nsh.inserted = inserted; - sdhc_mediachange(g_nsh.sdhc, inserted); - - /* If the card has been inserted, then check if it is write protected - * as well. The pin is pulled up, but apparently logic high means - * write protected. - */ - - if (inserted) - { - sdhc_wrprotect(g_nsh.sdhc, kinetis_gpioread(GPIO_SD_WRPROTECT)); - } - } -} -#endif - -/**************************************************************************** - * Name: kinetis_cdinterrupt - ****************************************************************************/ - -#ifdef NSH_HAVEMMCSD -static int kinetis_cdinterrupt(int irq, void *context) -{ - /* All of the work is done by kinetis_mediachange() */ - - kinetis_mediachange(); - return OK; -} -#endif - -/**************************************************************************** - * 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) -{ -#ifdef NSH_HAVEMMCSD - int ret; - - /* Configure GPIO pins */ - - /* Attached the card detect interrupt (but don't enable it yet) */ - - kinetis_pinconfig(GPIO_SD_CARDDETECT); - kinetis_pinirqattach(GPIO_SD_CARDDETECT, kinetis_cdinterrupt, NULL); - - /* Configure the write protect GPIO */ - - kinetis_pinconfig(GPIO_SD_WRPROTECT); - - /* Mount the SDHC-based MMC/SD block driver */ - - /* First, get an instance of the SDHC interface */ - - syslog(LOG_INFO, "Initializing SDHC slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); - - g_nsh.sdhc = sdhc_initialize(CONFIG_NSH_MMCSDSLOTNO); - if (!g_nsh.sdhc) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SDHC slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); - return -ENODEV; - } - - /* Now bind the SDHC interface to the MMC/SD driver */ - - syslog(LOG_INFO, "Bind SDHC to the MMC/SD driver, minor=%d\n", - CONFIG_NSH_MMCSDMINOR); - - ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_nsh.sdhc); - if (ret != OK) - { - syslog(LOG_ERR, - "ERROR: Failed to bind SDHC to the MMC/SD driver: %d\n", - ret); - return ret; - } - - syslog(LOG_INFO, "Successfully bound SDHC to the MMC/SD driver\n"); - - /* Handle the initial card state */ - - kinetis_mediachange(); - - /* Enable CD interrupts to handle subsequent media changes */ - - kinetis_pinirqenable(GPIO_SD_CARDDETECT); -#endif - return OK; -} diff --git a/boards/arm/kinetis/twr-k60n512/src/k60_boot.c b/boards/arm/kinetis/twr-k60n512/src/k60_boot.c index af711cb7568..b9195d42cb3 100644 --- a/boards/arm/kinetis/twr-k60n512/src/k60_boot.c +++ b/boards/arm/kinetis/twr-k60n512/src/k60_boot.c @@ -28,20 +28,160 @@ #include +#include +#include +#include +#include + #include #include +#ifdef CONFIG_KINETIS_SDHC +# include +# include +#endif + #include "arm_internal.h" +#include "kinetis.h" #include "twr-k60n512.h" /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +/* PORT and SLOT number probably depend on the board configuration */ + +#ifdef CONFIG_ARCH_BOARD_TWR_K60N512 +# define NSH_HAVEUSBDEV 1 +# define NSH_HAVEMMCSD 1 +# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 +# error "Only one MMC/SD slot, slot 0" +# undef CONFIG_NSH_MMCSDSLOTNO +# endif +# ifndef CONFIG_NSH_MMCSDSLOTNO +# define CONFIG_NSH_MMCSDSLOTNO 0 +# endif +#else + /* Add configuration for new Kinetis boards here */ + +# error "Unrecognized Kinetis board" +# undef NSH_HAVEUSBDEV +# undef NSH_HAVEMMCSD +#endif + +/* Can't support USB features if USB is not enabled */ + +#ifndef CONFIG_USBDEV +# undef NSH_HAVEUSBDEV +#endif + +/* Can't support MMC/SD features if mountpoints are disabled or if SDHC + * support is not enabled. + */ + +#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_KINETIS_SDHC) +# undef NSH_HAVEMMCSD +#endif + +#ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +#endif + +/* We expect to receive GPIO interrupts for card insertion events */ + +#ifdef NSH_HAVEMMCSD +# ifndef CONFIG_KINETIS_GPIOIRQ +# error "CONFIG_KINETIS_GPIOIRQ required for card detect interrupt" +# endif + +# ifndef CONFIG_KINETIS_PORTEINTS +# error "CONFIG_KINETIS_PORTEINTS required for card detect interrupt" +# endif +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/* This structure encapsulates the global variable used in this file and + * reduces the probability of name collisions. + */ + +#ifdef NSH_HAVEMMCSD +struct kinetis_nsh_s +{ + struct sdio_dev_s *sdhc; /* SDIO driver handle */ + bool inserted; /* True: card is inserted */ +}; +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +#ifdef NSH_HAVEMMCSD +static struct kinetis_nsh_s g_nsh; +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: kinetis_mediachange + ****************************************************************************/ + +#ifdef NSH_HAVEMMCSD +static void kinetis_mediachange(void) +{ + bool inserted; + + /* Get the current value of the card detect pin. This pin is pulled up on + * board. So low means that a card is present. + */ + + inserted = !kinetis_gpioread(GPIO_SD_CARDDETECT); + + /* Has the pin changed state? */ + + if (inserted != g_nsh.inserted) + { + /* Yes.. + * perform the appropriate action (this might need some debounce). + */ + + g_nsh.inserted = inserted; + sdhc_mediachange(g_nsh.sdhc, inserted); + + /* If the card has been inserted, then check if it is write protected + * as well. The pin is pulled up, but apparently logic high means + * write protected. + */ + + if (inserted) + { + sdhc_wrprotect(g_nsh.sdhc, kinetis_gpioread(GPIO_SD_WRPROTECT)); + } + } +} +#endif + +/**************************************************************************** + * Name: kinetis_cdinterrupt + ****************************************************************************/ + +#ifdef NSH_HAVEMMCSD +static int kinetis_cdinterrupt(int irq, void *context) +{ + /* All of the work is done by kinetis_mediachange() */ + + kinetis_mediachange(); + return OK; +} +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -88,3 +228,76 @@ void kinetis_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_intitialize() 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) +{ +#ifdef NSH_HAVEMMCSD + int ret; + + /* Configure GPIO pins */ + + /* Attached the card detect interrupt (but don't enable it yet) */ + + kinetis_pinconfig(GPIO_SD_CARDDETECT); + kinetis_pinirqattach(GPIO_SD_CARDDETECT, kinetis_cdinterrupt, NULL); + + /* Configure the write protect GPIO */ + + kinetis_pinconfig(GPIO_SD_WRPROTECT); + + /* Mount the SDHC-based MMC/SD block driver */ + + /* First, get an instance of the SDHC interface */ + + syslog(LOG_INFO, "Initializing SDHC slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + + g_nsh.sdhc = sdhc_initialize(CONFIG_NSH_MMCSDSLOTNO); + if (!g_nsh.sdhc) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SDHC slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + return; + } + + /* Now bind the SDHC interface to the MMC/SD driver */ + + syslog(LOG_INFO, "Bind SDHC to the MMC/SD driver, minor=%d\n", + CONFIG_NSH_MMCSDMINOR); + + ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_nsh.sdhc); + if (ret != OK) + { + syslog(LOG_ERR, + "ERROR: Failed to bind SDHC to the MMC/SD driver: %d\n", + ret); + return; + } + + syslog(LOG_INFO, "Successfully bound SDHC to the MMC/SD driver\n"); + + /* Handle the initial card state */ + + kinetis_mediachange(); + + /* Enable CD interrupts to handle subsequent media changes */ + + kinetis_pinirqenable(GPIO_SD_CARDDETECT); +#endif +} +#endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/kinetis/twr-k60n512/src/k60_usbmsc.c b/boards/arm/kinetis/twr-k60n512/src/k60_usbmsc.c index dc1fa7e7d8f..709ea9f1245 100644 --- a/boards/arm/kinetis/twr-k60n512/src/k60_usbmsc.c +++ b/boards/arm/kinetis/twr-k60n512/src/k60_usbmsc.c @@ -73,8 +73,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see k60_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/kinetis/twr-k64f120m/src/CMakeLists.txt b/boards/arm/kinetis/twr-k64f120m/src/CMakeLists.txt index 06cdd7759f1..dfcf968053c 100644 --- a/boards/arm/kinetis/twr-k64f120m/src/CMakeLists.txt +++ b/boards/arm/kinetis/twr-k64f120m/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_ARCH_LEDS) list(APPEND SRCS k64_leds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS k64_appinit.c) -endif() - if(CONFIG_KINETIS_SDHC) list(APPEND SRCS k64_sdhc.c) if(CONFIG_FS_AUTOMOUNTER) diff --git a/boards/arm/kinetis/twr-k64f120m/src/Makefile b/boards/arm/kinetis/twr-k64f120m/src/Makefile index 3c721ecc1d3..f241be632ba 100644 --- a/boards/arm/kinetis/twr-k64f120m/src/Makefile +++ b/boards/arm/kinetis/twr-k64f120m/src/Makefile @@ -33,10 +33,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) #CSRCS += k64_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += k64_appinit.c -endif - ifeq ($(CONFIG_KINETIS_SDHC),y) CSRCS += k64_sdhc.c ifeq ($(CONFIG_FS_AUTOMOUNTER),y) diff --git a/boards/arm/kinetis/twr-k64f120m/src/k64_appinit.c b/boards/arm/kinetis/twr-k64f120m/src/k64_appinit.c deleted file mode 100644 index 3077c904d10..00000000000 --- a/boards/arm/kinetis/twr-k64f120m/src/k64_appinit.c +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** - * boards/arm/kinetis/twr-k64f120m/src/k64_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 - -#include -#include -#include -#include - -#include -#include - -#ifdef CONFIG_KINETIS_SDHC -# include -# include -#endif - -#include "kinetis.h" -#include "twrk64.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) -{ - int ret; - -#ifdef HAVE_PROC - /* Mount the proc filesystem */ - - syslog(LOG_INFO, "Mounting procfs to /proc\n"); - - ret = nx_mount(NULL, PROCFS_MOUNTPOUNT, "procfs", 0, NULL); - if (ret < 0) - { - syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d\n", ret); - return ret; - } -#endif - -#ifdef HAVE_MMCSD - /* Initialize the MMC/SD driver and possible automount */ - - return k64_sdhc_initialize(); -#endif - return OK; -} diff --git a/boards/arm/kinetis/twr-k64f120m/src/k64_boot.c b/boards/arm/kinetis/twr-k64f120m/src/k64_boot.c index 76b2112ec8e..366dff5ef6e 100644 --- a/boards/arm/kinetis/twr-k64f120m/src/k64_boot.c +++ b/boards/arm/kinetis/twr-k64f120m/src/k64_boot.c @@ -28,9 +28,20 @@ #include +#include +#include +#include +#include + #include #include +#ifdef CONFIG_KINETIS_SDHC +# include +# include +#endif + +#include "kinetis.h" #include "arm_internal.h" #include "twrk64.h" @@ -88,3 +99,44 @@ void kinetis_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_intitialize() 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) +{ + int ret; + +#ifdef HAVE_PROC + /* Mount the proc filesystem */ + + syslog(LOG_INFO, "Mounting procfs to /proc\n"); + + ret = nx_mount(NULL, PROCFS_MOUNTPOUNT, "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); + return; + } +#endif + +#ifdef HAVE_MMCSD + /* Initialize the MMC/SD driver and possible automount */ + + k64_sdhc_initialize(); +#endif +} +#endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/kl/freedom-kl25z/src/CMakeLists.txt b/boards/arm/kl/freedom-kl25z/src/CMakeLists.txt index 19e6395ae98..ae654689399 100644 --- a/boards/arm/kl/freedom-kl25z/src/CMakeLists.txt +++ b/boards/arm/kl/freedom-kl25z/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS kl_boardinitialize.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS kl_appinit.c) -endif() - if(CONFIG_KL_TSI) list(APPEND SRCS kl_tsi.c) endif() diff --git a/boards/arm/kl/freedom-kl25z/src/Makefile b/boards/arm/kl/freedom-kl25z/src/Makefile index b09f8213fe2..8a0e18b9d5d 100644 --- a/boards/arm/kl/freedom-kl25z/src/Makefile +++ b/boards/arm/kl/freedom-kl25z/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = kl_boardinitialize.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += kl_appinit.c -endif - ifeq ($(CONFIG_KL_TSI),y) CSRCS += kl_tsi.c endif diff --git a/boards/arm/kl/freedom-kl25z/src/kl_appinit.c b/boards/arm/kl/freedom-kl25z/src/kl_appinit.c deleted file mode 100644 index f4ff6b17865..00000000000 --- a/boards/arm/kl/freedom-kl25z/src/kl_appinit.c +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** - * boards/arm/kl/freedom-kl25z/src/kl_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 - -#include -#include -#include - -#include - -#include "freedom-kl25z.h" - -#ifdef CONFIG_BOARDCTL - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ - int ret; - - #if defined(CONFIG_SENSORS_ADXL345) - ret = adxl345_archinitialize(0); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: adxl345_archinitialize failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_PWM - /* Initialize PWM and register the PWM device. */ - - ret = kl_pwm_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: k64_pwm_setup() failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/kl/freedom-kl25z/src/kl_boardinitialize.c b/boards/arm/kl/freedom-kl25z/src/kl_boardinitialize.c index 089b199779f..e14bfeb4ef8 100644 --- a/boards/arm/kl/freedom-kl25z/src/kl_boardinitialize.c +++ b/boards/arm/kl/freedom-kl25z/src/kl_boardinitialize.c @@ -28,6 +28,10 @@ #include +#include +#include +#include + #include #include @@ -106,13 +110,26 @@ void kl_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform NSH initialization here instead of from the NSH. This - * alternative NSH initialization is necessary when NSH is ran in - * user-space but the initialization function must run in kernel space. - */ + int ret; -#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) - board_app_initialize(0); + #if defined(CONFIG_SENSORS_ADXL345) + ret = adxl345_archinitialize(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: adxl345_archinitialize failed: %d\n", ret); + } #endif + +#ifdef CONFIG_PWM + /* Initialize PWM and register the PWM device. */ + + ret = kl_pwm_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: k64_pwm_setup() failed: %d\n", ret); + } +#endif + + UNUSED(ret); } #endif diff --git a/boards/arm/kl/freedom-kl26z/src/CMakeLists.txt b/boards/arm/kl/freedom-kl26z/src/CMakeLists.txt index 86ab715d90c..d9e556a7637 100644 --- a/boards/arm/kl/freedom-kl26z/src/CMakeLists.txt +++ b/boards/arm/kl/freedom-kl26z/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS kl_boardinitialize.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS kl_appinit.c) -endif() - if(CONFIG_KL_TSI) list(APPEND SRCS kl_tsi.c) endif() diff --git a/boards/arm/kl/freedom-kl26z/src/Makefile b/boards/arm/kl/freedom-kl26z/src/Makefile index c09674f3153..d5e68e860c9 100644 --- a/boards/arm/kl/freedom-kl26z/src/Makefile +++ b/boards/arm/kl/freedom-kl26z/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = kl_boardinitialize.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += kl_appinit.c -endif - ifeq ($(CONFIG_KL_TSI),y) CSRCS += kl_tsi.c endif diff --git a/boards/arm/kl/freedom-kl26z/src/kl_appinit.c b/boards/arm/kl/freedom-kl26z/src/kl_appinit.c deleted file mode 100644 index d4bf50931e6..00000000000 --- a/boards/arm/kl/freedom-kl26z/src/kl_appinit.c +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** - * boards/arm/kl/freedom-kl26z/src/kl_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 - -#include -#include - -#include - -#include "freedom-kl26z.h" - -#ifdef CONFIG_BOARDCTL - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ - int ret; - -#ifdef CONFIG_PWM - /* Initialize PWM and register the PWM device. */ - - ret = kl_pwm_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: kl_pwm_setup() failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/kl/freedom-kl26z/src/kl_boardinitialize.c b/boards/arm/kl/freedom-kl26z/src/kl_boardinitialize.c index 8656ec5f2a8..0e8272de479 100644 --- a/boards/arm/kl/freedom-kl26z/src/kl_boardinitialize.c +++ b/boards/arm/kl/freedom-kl26z/src/kl_boardinitialize.c @@ -99,13 +99,18 @@ void kl_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform NSH initialization here instead of from the NSH. This - * alternative NSH initialization is necessary when NSH is ran in - * user-space but the initialization function must run in kernel space. - */ + int ret; -#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) - board_app_initialize(0); +#ifdef CONFIG_PWM + /* Initialize PWM and register the PWM device. */ + + ret = kl_pwm_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: kl_pwm_setup() failed: %d\n", ret); + } #endif + + UNUSED(ret); } #endif diff --git a/boards/arm/kl/teensy-lc/src/CMakeLists.txt b/boards/arm/kl/teensy-lc/src/CMakeLists.txt index bb8e9f955f6..420d4977d23 100644 --- a/boards/arm/kl/teensy-lc/src/CMakeLists.txt +++ b/boards/arm/kl/teensy-lc/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS kl_boardinitialize.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS kl_appinit.c) -endif() - if(CONFIG_KL_SPI0) list(APPEND SRCS kl_spi.c) else() diff --git a/boards/arm/kl/teensy-lc/src/Makefile b/boards/arm/kl/teensy-lc/src/Makefile index 3bb7a3cf82f..7d6db5066a8 100644 --- a/boards/arm/kl/teensy-lc/src/Makefile +++ b/boards/arm/kl/teensy-lc/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = kl_boardinitialize.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += kl_appinit.c -endif - ifeq ($(CONFIG_KL_SPI0),y) CSRCS += kl_spi.c else diff --git a/boards/arm/kl/teensy-lc/src/kl_appinit.c b/boards/arm/kl/teensy-lc/src/kl_appinit.c deleted file mode 100644 index 479e5229577..00000000000 --- a/boards/arm/kl/teensy-lc/src/kl_appinit.c +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** - * boards/arm/kl/teensy-lc/src/kl_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 - -#include -#include -#include - -#include - -#include "teensy-lc.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) -{ - int ret; - -#ifdef CONFIG_PWM - /* Initialize PWM and register the PWM device. */ - - ret = kl_pwm_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: kl_pwm_setup() failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/kl/teensy-lc/src/kl_boardinitialize.c b/boards/arm/kl/teensy-lc/src/kl_boardinitialize.c index 4f8b9810358..172a1dc9fbb 100644 --- a/boards/arm/kl/teensy-lc/src/kl_boardinitialize.c +++ b/boards/arm/kl/teensy-lc/src/kl_boardinitialize.c @@ -118,13 +118,18 @@ void kl_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform NSH initialization here instead of from the NSH. - * This alternative NSH initialization is necessary when NSH is ran in - * user-space but the initialization function must run in kernel space. - */ + int ret; -#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) - board_app_initialize(0); +#ifdef CONFIG_PWM + /* Initialize PWM and register the PWM device. */ + + ret = kl_pwm_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: kl_pwm_setup() failed: %d\n", ret); + } #endif + + UNUSED(ret); } #endif diff --git a/boards/arm/lc823450/lc823450-xgevk/src/Makefile b/boards/arm/lc823450/lc823450-xgevk/src/Makefile index 869a73813e9..d128bf06a5e 100644 --- a/boards/arm/lc823450/lc823450-xgevk/src/Makefile +++ b/boards/arm/lc823450/lc823450-xgevk/src/Makefile @@ -22,16 +22,11 @@ include $(TOPDIR)/Make.defs -CSRCS = lc823450_boot.c lc823450_mux.c +CSRCS = lc823450_boot.c lc823450_mux.c lc823450_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lc823450_appinit.c lc823450_bringup.c ifeq ($(CONFIG_BOARDCTL_RESET),y) CSRCS += lc823450_reset.c endif -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += lc823450_bringup.c -endif ifeq ($(CONFIG_LC823450_SDIF),y) CSRCS += lc823450_sdif.c diff --git a/boards/arm/lc823450/lc823450-xgevk/src/lc823450_appinit.c b/boards/arm/lc823450/lc823450-xgevk/src/lc823450_appinit.c deleted file mode 100644 index 90836f69010..00000000000 --- a/boards/arm/lc823450/lc823450-xgevk/src/lc823450_appinit.c +++ /dev/null @@ -1,179 +0,0 @@ -/**************************************************************************** - * boards/arm/lc823450/lc823450-xgevk/src/lc823450_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 - -#include -#include - -#include -#include - -#ifdef CONFIG_MTD -# include "lc823450_mtd.h" -#endif - -#include "lc823450_i2c.h" -#include "lc823450-xgevk.h" - -#ifdef CONFIG_BOARDCTL - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: lc823450_i2c_register - * - * Description: - * Register one I2C drivers for the I2C tool. - * - ****************************************************************************/ - -#ifdef HAVE_I2CTOOL -static void lc823450_i2c_register(int bus) -{ - struct i2c_master_s *i2c; - int ret; - - i2c = lc823450_i2cbus_initialize(bus); - if (i2c == NULL) - { - syslog(LOG_ERR, "ERROR: Failed to get I2C%d interface\n", bus); - } - else - { - ret = i2c_register(i2c, bus); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to register I2C%d driver: %d\n", - bus, ret); - lc823450_i2cbus_uninitialize(i2c); - } - } -} -#endif - -/**************************************************************************** - * Name: lc823450_i2ctool - * - * Description: - * Register I2C drivers for the I2C tool. - * - ****************************************************************************/ - -#ifdef HAVE_I2CTOOL -static void lc823450_i2ctool(void) -{ -#ifdef CONFIG_LC823450_I2C0 - lc823450_i2c_register(0); -#endif -#ifdef CONFIG_LC823450_I2C1 - lc823450_i2c_register(1); -#endif -} -#else -# define lc823450_i2ctool() -#endif - -/**************************************************************************** - * 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) -{ - int ret; - -#ifdef CONFIG_ADC - ret = lc823450_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: lc82450_adc_setup failed: %d\n", ret); - } -#endif - - /* Register I2C drivers on behalf of the I2C tool */ - - lc823450_i2ctool(); - -#ifdef CONFIG_LC823450_MTD - /* Initialize eMMC */ - - ret = lc823450_mtd_initialize(CONFIG_MTD_DEVNO_EMMC); - if (ret != OK) - { - syslog(LOG_ERR, "Failed to initialize eMMC: ret=%d\n", ret); - } - -#ifdef CONFIG_LC823450_SDIF_SDC - /* Initialize uSD */ - - ret = lc823450_mtd_initialize(CONFIG_MTD_DEVNO_SDC); - if (ret != OK) - { - syslog(LOG_ERR, "Failed to initialize uSD: ret=%d\n", ret); - } -#endif /* CONFIG_LC823450_SDIF_SDC */ - -#endif /* CONFIG_LC823450_MTD */ - - UNUSED(ret); /* May not be used */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return lc823450_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/lc823450/lc823450-xgevk/src/lc823450_boot.c b/boards/arm/lc823450/lc823450-xgevk/src/lc823450_boot.c index 01f39a0773b..b4e06b89e9b 100644 --- a/boards/arm/lc823450/lc823450-xgevk/src/lc823450_boot.c +++ b/boards/arm/lc823450/lc823450-xgevk/src/lc823450_boot.c @@ -28,10 +28,77 @@ #include -#include +#include +#include +#include +#include + +#ifdef CONFIG_MTD +# include "lc823450_mtd.h" +#endif + +#include "lc823450_i2c.h" #include "lc823450-xgevk.h" +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lc823450_i2c_register + * + * Description: + * Register one I2C drivers for the I2C tool. + * + ****************************************************************************/ + +#ifdef HAVE_I2CTOOL +static void lc823450_i2c_register(int bus) +{ + struct i2c_master_s *i2c; + int ret; + + i2c = lc823450_i2cbus_initialize(bus); + if (i2c == NULL) + { + syslog(LOG_ERR, "ERROR: Failed to get I2C%d interface\n", bus); + } + else + { + ret = i2c_register(i2c, bus); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to register I2C%d driver: %d\n", + bus, ret); + lc823450_i2cbus_uninitialize(i2c); + } + } +} +#endif + +/**************************************************************************** + * Name: lc823450_i2ctool + * + * Description: + * Register I2C drivers for the I2C tool. + * + ****************************************************************************/ + +#ifdef HAVE_I2CTOOL +static void lc823450_i2ctool(void) +{ +#ifdef CONFIG_LC823450_I2C0 + lc823450_i2c_register(0); +#endif +#ifdef CONFIG_LC823450_I2C1 + lc823450_i2c_register(1); +#endif +} +#else +# define lc823450_i2ctool() +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -52,7 +119,42 @@ #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform board initialization */ + int ret; + +#ifdef CONFIG_ADC + ret = lc823450_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: lc82450_adc_setup failed: %d\n", ret); + } +#endif + + /* Register I2C drivers on behalf of the I2C tool */ + + lc823450_i2ctool(); + +#ifdef CONFIG_LC823450_MTD + /* Initialize eMMC */ + + ret = lc823450_mtd_initialize(CONFIG_MTD_DEVNO_EMMC); + if (ret != OK) + { + syslog(LOG_ERR, "Failed to initialize eMMC: ret=%d\n", ret); + } + +#ifdef CONFIG_LC823450_SDIF_SDC + /* Initialize uSD */ + + ret = lc823450_mtd_initialize(CONFIG_MTD_DEVNO_SDC); + if (ret != OK) + { + syslog(LOG_ERR, "Failed to initialize uSD: ret=%d\n", ret); + } +#endif /* CONFIG_LC823450_SDIF_SDC */ + +#endif /* CONFIG_LC823450_MTD */ + + UNUSED(ret); /* May not be used */ lc823450_bringup(); } diff --git a/boards/arm/lpc17xx_40xx/lincoln60/src/CMakeLists.txt b/boards/arm/lpc17xx_40xx/lincoln60/src/CMakeLists.txt index 1e45c095294..881c35c017a 100644 --- a/boards/arm/lpc17xx_40xx/lincoln60/src/CMakeLists.txt +++ b/boards/arm/lpc17xx_40xx/lincoln60/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS lpc17_40_boot.c lpc17_40_leds.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS lpc17_40_appinit.c) -endif() - if(CONFIG_USBMSC) list(APPEND SRCS lpc17_40_usbmsc.c) endif() diff --git a/boards/arm/lpc17xx_40xx/lincoln60/src/Makefile b/boards/arm/lpc17xx_40xx/lincoln60/src/Makefile index d507f2d11c0..78cfc32a8bd 100644 --- a/boards/arm/lpc17xx_40xx/lincoln60/src/Makefile +++ b/boards/arm/lpc17xx_40xx/lincoln60/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = lpc17_40_boot.c lpc17_40_leds.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc17_40_appinit.c -endif - ifeq ($(CONFIG_USBMSC),y) CSRCS += lpc17_40_usbmsc.c endif diff --git a/boards/arm/lpc17xx_40xx/lincoln60/src/lpc17_40_appinit.c b/boards/arm/lpc17xx_40xx/lincoln60/src/lpc17_40_appinit.c deleted file mode 100644 index bffc5f9bdc8..00000000000 --- a/boards/arm/lpc17xx_40xx/lincoln60/src/lpc17_40_appinit.c +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc17xx_40xx/lincoln60/src/lpc17_40_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 - -#include -#include -#include - -#include -#include -#include - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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; -} diff --git a/boards/arm/lpc17xx_40xx/lincoln60/src/lpc17_40_boot.c b/boards/arm/lpc17xx_40xx/lincoln60/src/lpc17_40_boot.c index 215dd7a10db..56ac60a0c4f 100644 --- a/boards/arm/lpc17xx_40xx/lincoln60/src/lpc17_40_boot.c +++ b/boards/arm/lpc17xx_40xx/lincoln60/src/lpc17_40_boot.c @@ -66,3 +66,22 @@ void lpc17_40_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 diff --git a/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/CMakeLists.txt b/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/CMakeLists.txt index 3c6f6ef316e..4ae491bf09d 100644 --- a/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/CMakeLists.txt +++ b/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/CMakeLists.txt @@ -40,10 +40,6 @@ if(CONFIG_LPC17_40_LCD) list(APPEND SRCS lpc17_40_lcd.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS lpc17_40_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS lpc17_40_autoleds.c) else() diff --git a/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/Makefile b/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/Makefile index 015cea6a2f4..ff9b430d8c0 100644 --- a/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/Makefile +++ b/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/Makefile @@ -42,10 +42,6 @@ ifeq ($(CONFIG_LPC17_40_LCD),y) CSRCS += lpc17_40_lcd.c endif -ifeq ($(CONFIG_BOARDCTL),y) - CSRCS += lpc17_40_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += lpc17_40_autoleds.c else diff --git a/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/lpc17_40_appinit.c b/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/lpc17_40_appinit.c deleted file mode 100644 index 2827df7b5b8..00000000000 --- a/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/lpc17_40_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc17xx_40xx/lpc4088-devkit/src/lpc17_40_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 - -#include -#include - -#include "lpc4088-devkit.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return lpc4088_devkit_bringup(); -#endif -} diff --git a/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/CMakeLists.txt b/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/CMakeLists.txt index 36c31734aec..f6c6a3cceb7 100644 --- a/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/CMakeLists.txt +++ b/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/CMakeLists.txt @@ -37,10 +37,6 @@ if(CONFIG_LPC17_40_EXTNAND) list(APPEND SRCS lpc17_40_nandinitialize.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS lpc17_40_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS lpc17_40_autoleds.c) else() diff --git a/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/Makefile b/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/Makefile index 1b04a39fc13..fefc409e4c5 100644 --- a/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/Makefile +++ b/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/Makefile @@ -39,10 +39,6 @@ ifeq ($(CONFIG_LPC17_40_EXTNAND),y) CSRCS += lpc17_40_nandinitialize.c endif -ifeq ($(CONFIG_BOARDCTL),y) - CSRCS += lpc17_40_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += lpc17_40_autoleds.c else diff --git a/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/lpc17_40_appinit.c b/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/lpc17_40_appinit.c deleted file mode 100644 index 44dfdd99b8a..00000000000 --- a/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/lpc17_40_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/lpc17_40_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 - -#include -#include - -#include "lpc4088-quickstart.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return lpc4088_quickstart_bringup(); -#endif -} diff --git a/boards/arm/lpc17xx_40xx/lpcxpresso-lpc1768/src/CMakeLists.txt b/boards/arm/lpc17xx_40xx/lpcxpresso-lpc1768/src/CMakeLists.txt index dcfd52a73b3..710e053aba4 100644 --- a/boards/arm/lpc17xx_40xx/lpcxpresso-lpc1768/src/CMakeLists.txt +++ b/boards/arm/lpc17xx_40xx/lpcxpresso-lpc1768/src/CMakeLists.txt @@ -30,10 +30,6 @@ if(CONFIG_ADC) list(APPEND SRCS lpc17_40_adc.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS lpc17_40_appinit.c) -endif() - if(CONFIG_NX_LCDDRIVER) list(APPEND SRCS lpc17_40_oled.c) endif() diff --git a/boards/arm/lpc17xx_40xx/lpcxpresso-lpc1768/src/Makefile b/boards/arm/lpc17xx_40xx/lpcxpresso-lpc1768/src/Makefile index b0f6346c6ff..8638b93c04c 100644 --- a/boards/arm/lpc17xx_40xx/lpcxpresso-lpc1768/src/Makefile +++ b/boards/arm/lpc17xx_40xx/lpcxpresso-lpc1768/src/Makefile @@ -32,10 +32,6 @@ ifeq ($(CONFIG_ADC),y) CSRCS += lpc17_40_adc.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc17_40_appinit.c -endif - ifeq ($(CONFIG_NX_LCDDRIVER),y) CSRCS += lpc17_40_oled.c endif diff --git a/boards/arm/lpc17xx_40xx/lpcxpresso-lpc1768/src/lpc17_40_appinit.c b/boards/arm/lpc17xx_40xx/lpcxpresso-lpc1768/src/lpc17_40_appinit.c deleted file mode 100644 index d8b5f98836a..00000000000 --- a/boards/arm/lpc17xx_40xx/lpcxpresso-lpc1768/src/lpc17_40_appinit.c +++ /dev/null @@ -1,174 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc17xx_40xx/lpcxpresso-lpc1768/src/lpc17_40_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 - -#include -#include -#include - -#include -#include -#include - -#include "lpc17_40_ssp.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#ifdef CONFIG_BOARDCTL - -/* PORT and SLOT number probably depend on the board configuration */ - -#define NSH_HAVEUSBDEV 1 -#ifdef CONFIG_LPC17_40_SSP1 -# define NSH_HAVEMMCSD 1 -#else -# undef NSH_HAVEMMCSD -#endif - -/* Do we have SPI support for MMC/SD? */ - -#ifdef NSH_HAVEMMCSD -# undef CONFIG_NSH_MMCSDSPIPORTNO -# define CONFIG_NSH_MMCSDSPIPORTNO 1 -# undef CONFIG_NSH_MMCSDSLOTNO -# define CONFIG_NSH_MMCSDSLOTNO 0 -#endif - -/* Can't support USB device features if USB device is not enabled */ - -#ifndef CONFIG_USBDEV -# undef NSH_HAVEUSBDEV -#endif - -/* Can't support MMC/SD features if mountpoints are disabled */ - -#if defined(CONFIG_DISABLE_MOUNTPOINT) -# undef NSH_HAVEMMCSD -#endif - -#ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -#endif - -/* Currnently MMC/SD support is available only for NSH configurations */ - -#else -# undef NSH_HAVEMMCSD -#endif /* CONFIG_BOARDCTL */ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef NSH_HAVEMMCSD - struct spi_dev_s *ssp; -#endif - int ret; - -#ifdef NSH_HAVEMMCSD - /* Get the SSP port */ - - ssp = lpc17_40_sspbus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); - if (!ssp) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SSP port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); - return -ENODEV; - } - - syslog(LOG_INFO, "Successfully initialized SSP port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); - - /* Bind the SSP port to the slot */ - - ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, - CONFIG_NSH_MMCSDSLOTNO, ssp); - if (ret < 0) - { - syslog(LOG_ERR, - "ERROR: Failed to bind SSP port %d to MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); - return ret; - } - - syslog(LOG_INFO, - "Successfully bound SSP port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); -#endif - -#ifdef CONFIG_PWM - /* Initialize PWM and register the PWM device. */ - - ret = lpcexpresso_pwm_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: lpcexpresso_pwm_setup() failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_ADC - /* Initialize ADC and register the ADC driver. */ - - ret = lpcxpresso_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: lpcxpresso_adc_setup failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/lpc17xx_40xx/lpcxpresso-lpc1768/src/lpc17_40_boot.c b/boards/arm/lpc17xx_40xx/lpcxpresso-lpc1768/src/lpc17_40_boot.c index c775bd0ed21..1f5973eedd6 100644 --- a/boards/arm/lpc17xx_40xx/lpcxpresso-lpc1768/src/lpc17_40_boot.c +++ b/boards/arm/lpc17xx_40xx/lpcxpresso-lpc1768/src/lpc17_40_boot.c @@ -28,7 +28,13 @@ #include +#include +#include +#include + #include +#include +#include #include #include "arm_internal.h" @@ -39,6 +45,50 @@ * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +#ifdef CONFIG_BOARDCTL + +/* PORT and SLOT number probably depend on the board configuration */ + +#define NSH_HAVEUSBDEV 1 +#ifdef CONFIG_LPC17_40_SSP1 +# define NSH_HAVEMMCSD 1 +#else +# undef NSH_HAVEMMCSD +#endif + +/* Do we have SPI support for MMC/SD? */ + +#ifdef NSH_HAVEMMCSD +# undef CONFIG_NSH_MMCSDSPIPORTNO +# define CONFIG_NSH_MMCSDSPIPORTNO 1 +# undef CONFIG_NSH_MMCSDSLOTNO +# define CONFIG_NSH_MMCSDSLOTNO 0 +#endif + +/* Can't support USB device features if USB device is not enabled */ + +#ifndef CONFIG_USBDEV +# undef NSH_HAVEUSBDEV +#endif + +/* Can't support MMC/SD features if mountpoints are disabled */ + +#if defined(CONFIG_DISABLE_MOUNTPOINT) +# undef NSH_HAVEMMCSD +#endif + +#ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +#endif + +/* Currently MMC/SD support is available only for NSH configurations */ + +#else +# undef NSH_HAVEMMCSD +#endif /* CONFIG_BOARDCTL */ + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -79,3 +129,79 @@ void lpc17_40_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) +{ +#ifdef NSH_HAVEMMCSD + struct spi_dev_s *ssp; +#endif + int ret; + +#ifdef NSH_HAVEMMCSD + /* Get the SSP port */ + + ssp = lpc17_40_sspbus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); + if (!ssp) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SSP port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); + return; + } + + syslog(LOG_INFO, "Successfully initialized SSP port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); + + /* Bind the SSP port to the slot */ + + ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, + CONFIG_NSH_MMCSDSLOTNO, ssp); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to bind SSP port %d to MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); + return; + } + + syslog(LOG_INFO, + "Successfully bound SSP port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); +#endif + +#ifdef CONFIG_PWM + /* Initialize PWM and register the PWM device. */ + + ret = lpcexpresso_pwm_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: lpcexpresso_pwm_setup() failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_ADC + /* Initialize ADC and register the ADC driver. */ + + ret = lpcxpresso_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: lpcxpresso_adc_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); +} +#endif diff --git a/boards/arm/lpc17xx_40xx/lx_cpu/src/Makefile b/boards/arm/lpc17xx_40xx/lx_cpu/src/Makefile index 6f6e2a5ffc0..54b4103dc78 100644 --- a/boards/arm/lpc17xx_40xx/lx_cpu/src/Makefile +++ b/boards/arm/lpc17xx_40xx/lx_cpu/src/Makefile @@ -32,10 +32,6 @@ endif CSRCS += lpc17_40_fpgainitialize.c endif -ifeq ($(CONFIG_BOARDCTL),y) - CSRCS += lpc17_40_appinit.c -endif - ifeq ($(CONFIG_USBDEV_COMPOSITE),y) CSRCS += lpc17_40_composite.c endif diff --git a/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_appinit.c b/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_appinit.c deleted file mode 100644 index c91a1a45e5a..00000000000 --- a/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_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 - -#include -#include - -#include "lx_cpu.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return lx_cpu_bringup(); -#endif -} diff --git a/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_boardinitialize.c b/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_boardinitialize.c index dd88f96e8d9..cdc88d845b9 100644 --- a/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_boardinitialize.c +++ b/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_boardinitialize.c @@ -115,3 +115,23 @@ void board_initialize(void) lx_cpu_bringup(); } #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) +{ + lx_cpu_bringup(); +} +#endif diff --git a/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_nsh.c b/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_nsh.c deleted file mode 100644 index f83e9c16c15..00000000000 --- a/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_nsh.c +++ /dev/null @@ -1,388 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_nsh.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 - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "lpc17_40_gpio.h" -#include "lpc17_40_sdcard.h" -#include "lpc17_40_usbhost.h" -#include "lx_cpu.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#define NSH_HAVE_MMCSD 1 -#define NSH_HAVE_USBHOST 1 -#define NSH_HAVE_USBHDEV 1 - -#undef NSH_HAVE_MMCSD_CD -#undef NSH_HAVE_MMCSD_CDINT - -/* MMC/SD support */ - -#if !defined(CONFIG_LPC17_40_SDCARD) || !defined(CONFIG_MMCSD) && \ - !defined(CONFIG_MMCD_SDIO) -# undef NSH_HAVE_MMCSD -#endif - -/* Can't support MMC/SD features if mountpoints are disabled */ - -#if defined(CONFIG_DISABLE_MOUNTPOINT) -# undef NSH_HAVE_MMCSD -#endif - -/* MMC/SD support requires that an SPI support is enabled and an SPI port is - * selected. - */ - -#ifdef NSH_HAVE_MMCSD -# if !defined(CONFIG_NSH_MMCSDSLOTNO) -# warning "Assuming slot MMC/SD slot 0" -# define CONFIG_NSH_MMCSDSLOTNO 0 -# endif -#endif - -#ifdef NSH_HAVE_MMCSD -# if !defined(CONFIG_NSH_MMCSDMINOR) -# warning "Assuming /dev/mmcsd0" -# define CONFIG_NSH_MMCSDMINOR 0 -# endif -#endif - -/* The SD card detect (CD) signal is on P0[13]. This signal is shared. It - * is also used for MOSI1 and USB_UP_LED. The CD pin may be disconnected. - * There is a jumper on board that enables the CD pin. - */ - -#ifdef NSH_HAVE_MMCSD -# ifdef CONFIG_MMCSD_HAVECARDDETECT -# define NSH_HAVE_MMCSD_CD 1 -# ifdef CONFIG_GPIO_IRQ -# define NSH_HAVE_MMCSD_CDINT 1 -# endif -# endif -#endif - -#if defined(NSH_HAVE_MMCSD_CD) && \ - (defined(CONFIG_LPC17_40_SSP1) || defined(CONFIG_LPC17_40_USBDEV)) -# warning "Use of SD Card Detect pin conflicts with SSP1 and/or USB device" -#endif - -/* USB Host */ - -#ifndef CONFIG_USBHOST -# undef NSH_HAVE_USBHOST -#endif - -#ifndef CONFIG_LPC17_40_USBHOST -# undef NSH_HAVE_USBHOST -#endif - -#ifdef NSH_HAVE_USBHOST -# ifndef CONFIG_USBHOST_DEFPRIO -# define CONFIG_USBHOST_DEFPRIO 50 -# endif -# ifndef CONFIG_USBHOST_STACKSIZE -# ifdef CONFIG_USBHOST_HUB -# define CONFIG_USBHOST_STACKSIZE 1536 -# else -# define CONFIG_USBHOST_STACKSIZE 1024 -# endif -# endif -#endif - -/* USB Device */ - -#ifndef CONFIG_USBDEV -# undef NSH_HAVE_USBDEV -#endif - -#ifndef CONFIG_LPC17_40_USBDEV -# undef NSH_HAVE_USBDEV -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -#ifdef NSH_HAVE_USBHOST -static struct usbhost_connection_s *g_usbconn; -#endif -#ifdef NSH_HAVE_MMCSD -static struct sdio_dev_s *g_sdiodev; -#endif -#ifdef NSH_HAVE_MMCSD_CD -static bool g_sd_inserted; -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nsh_waiter - * - * Description: - * Wait for USB devices to be connected. - * - ****************************************************************************/ - -#ifdef NSH_HAVE_USBHOST -static int nsh_waiter(int argc, char *argv[]) -{ - struct usbhost_hubport_s *hport; - - syslog(LOG_INFO, "nsh_waiter: Running\n"); - for (; ; ) - { - /* Wait for the device to change state */ - - DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport)); - syslog(LOG_INFO, "nsh_waiter: %s\n", - hport->connected ? "connected" : "disconnected"); - - /* Did we just become connected? */ - - if (hport->connected) - { - /* Yes.. enumerate the newly connected device */ - - CONN_ENUMERATE(g_usbconn, hport); - } - } - - /* Keep the compiler from complaining */ - - return 0; -} -#endif - -/**************************************************************************** - * Name: nsh_cdinterrupt - * - * Description: - * Card detect interrupt handler. - * - ****************************************************************************/ - -#ifdef NSH_HAVE_MMCSD_CDINT -static int nsh_cdinterrupt(int irq, void *context) -{ - bool present; - - present = !lpc17_40_gpioread(GPIO_SD_CD); - if (present != g_sd_inserted) - { - sdio_mediachange(g_sdiodev, present); - g_sd_inserted = present; - } - - return OK; -} -#endif - -/**************************************************************************** - * Name: nsh_sdinitialize - * - * Description: - * Initialize SPI-based microSD. - * - ****************************************************************************/ - -#ifdef NSH_HAVE_MMCSD -static int nsh_sdinitialize(void) -{ - int ret; - -#ifdef NSH_HAVE_MMCSD_CD - /* Configure the SD card detect GPIO */ - - lpc17_40_configgpio(GPIO_SD_CD); - -#if NSH_HAVE_MMCSD_CDINT - /* Attach an interrupt handler to get notifications when a card is - * inserted or deleted. - */ - - irq_attach(LPC17_40_IRQ_P0p13, nsh_cdinterrupt); - up_enable_irq(LPC17_40_IRQ_P0p13); -#endif -#endif - - /* First, get an instance of the SDIO interface */ - - g_sdiodev = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); - if (!g_sdiodev) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); - return -ENODEV; - } - - /* Now bind the SDIO interface to the MMC/SD driver */ - - ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_sdiodev); - if (ret != OK) - { - syslog(LOG_ERR, - "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", - ret); - return ret; - } - - /* Check if there is a card in the slot and inform the SDCARD driver. If - * we do not support the card detect, then let's assume that there is - * one. - */ - -#ifdef NSH_HAVE_MMCSD_CD - g_sd_inserted = !lpc17_40_gpioread(GPIO_SD_CD); - sdio_mediachange(g_sdiodev, g_sd_inserted); -#else - sdio_mediachange(g_sdiodev, true); -#endif - return OK; -} -#else -# define nsh_sdinitialize() (OK) -#endif - -/**************************************************************************** - * Name: nsh_usbhostinitialize - * - * Description: - * Initialize SPI-based microSD. - * - ****************************************************************************/ - -#ifdef NSH_HAVE_USBHOST -static int nsh_usbhostinitialize(void) -{ - int pid; - int ret; - - /* First, register all of the class drivers needed to support the drivers - * that we care about: - */ - - syslog(LOG_INFO, "Register class drivers\n"); - -#ifdef CONFIG_USBHOST_MSC - /* Register the USB host Mass Storage Class */ - - ret = usbhost_msc_initialize(); - if (ret != OK) - { - syslog(LOG_ERR, - "ERROR: Failed to register the mass storage class: %d\n", - ret); - } -#endif - -#ifdef CONFIG_USBHOST_CDCACM - /* Register the CDC/ACM serial class */ - - ret = usbhost_cdcacm_initialize(); - if (ret != OK) - { - syslog(LOG_ERR, - "ERROR: Failed to register the CDC/ACM serial class: %d\n", - ret); - } -#endif - - /* Then get an instance of the USB host interface */ - - syslog(LOG_INFO, "Initialize USB host\n"); - g_usbconn = lpc17_40_usbhost_initialize(0); - if (g_usbconn) - { - /* Start a thread to handle device connection. */ - - syslog(LOG_INFO, "Start nsh_waiter\n"); - - pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, - CONFIG_USBHOST_STACKSIZE, - nsh_waiter, NULL); - return pid < 0 ? -ENOEXEC : OK; - } - - return -ENODEV; -} -#else -# define nsh_usbhostinitialize() (OK) -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization for NSH. - * - * CONFIG_NSH_ARCHINIT=y : - * Called from the NSH library - * - * CONFIG_BOARD_INITIALIZE=y, CONFIG_NSH_LIBRARY=y, && - * CONFIG_NSH_ARCHINIT=n: - * Called from board_initialize(). - * - ****************************************************************************/ - -int board_app_initialize(void) -{ - int ret; - - /* Initialize SPI-based microSD */ - - ret = nsh_sdinitialize(); - if (ret == OK) - { - /* Initialize USB host */ - - ret = nsh_usbhostinitialize(); - } - - return ret; -} diff --git a/boards/arm/lpc17xx_40xx/mbed/src/CMakeLists.txt b/boards/arm/lpc17xx_40xx/mbed/src/CMakeLists.txt index d32be9271e3..89574233433 100644 --- a/boards/arm/lpc17xx_40xx/mbed/src/CMakeLists.txt +++ b/boards/arm/lpc17xx_40xx/mbed/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_ARCH_LEDS) list(APPEND SRCS lpc17_40_leds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS lpc17_40_appinit.c) -endif() - if(CONFIG_USBMSC) list(APPEND SRCS lpc17_40_usbmsc.c) endif() diff --git a/boards/arm/lpc17xx_40xx/mbed/src/Makefile b/boards/arm/lpc17xx_40xx/mbed/src/Makefile index 22cb375f766..0e7ec37a34f 100644 --- a/boards/arm/lpc17xx_40xx/mbed/src/Makefile +++ b/boards/arm/lpc17xx_40xx/mbed/src/Makefile @@ -28,10 +28,6 @@ ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += lpc17_40_leds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc17_40_appinit.c -endif - ifeq ($(CONFIG_USBMSC),y) CSRCS += lpc17_40_usbmsc.c endif diff --git a/boards/arm/lpc17xx_40xx/mbed/src/lpc17_40_appinit.c b/boards/arm/lpc17xx_40xx/mbed/src/lpc17_40_appinit.c deleted file mode 100644 index 06eecc94e8c..00000000000 --- a/boards/arm/lpc17xx_40xx/mbed/src/lpc17_40_appinit.c +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc17xx_40xx/mbed/src/lpc17_40_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 - -#include -#include -#include - -#include -#include -#include - -#include "mbed.h" - -#ifdef CONFIG_USERLED -#include -#endif - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -/* PORT and SLOT number probably depend on the board configuration */ - -#ifdef CONFIG_ARCH_BOARD_MBED -# define NSH_HAVEUSBDEV 1 -#else -# error "Unrecognized board" -# undef NSH_HAVEUSBDEV -#endif - -/* Can't support USB features if USB is not enabled */ - -#ifndef CONFIG_USBDEV -# undef NSH_HAVEUSBDEV -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ - int ret; - -#ifdef CONFIG_PWM - /* Initialize PWM and register the PWM device. */ - - ret = mbed_pwm_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: mbed_pwm_setup() failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_ADC - /* Initialize ADC and register the ADC driver. */ - - ret = mbed_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: mbed_adc_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_USERLED - /* Register the LED driver */ - - ret = userled_lower_initialize("/dev/userleds"); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/lpc17xx_40xx/mbed/src/lpc17_40_boot.c b/boards/arm/lpc17xx_40xx/mbed/src/lpc17_40_boot.c index 98aa74fd9a2..b7074ab0848 100644 --- a/boards/arm/lpc17xx_40xx/mbed/src/lpc17_40_boot.c +++ b/boards/arm/lpc17xx_40xx/mbed/src/lpc17_40_boot.c @@ -28,16 +28,44 @@ #include +#include +#include +#include + #include +#include +#include #include #include "arm_internal.h" #include "mbed.h" +#ifdef CONFIG_USERLED +#include +#endif + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +/* PORT and SLOT number probably depend on the board configuration */ + +#ifdef CONFIG_ARCH_BOARD_MBED +# define NSH_HAVEUSBDEV 1 +#else +# error "Unrecognized board" +# undef NSH_HAVEUSBDEV +#endif + +/* Can't support USB features if USB is not enabled */ + +#ifndef CONFIG_USBDEV +# undef NSH_HAVEUSBDEV +#endif + + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -66,3 +94,55 @@ void lpc17_40_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) +{ + int ret; + +#ifdef CONFIG_PWM + /* Initialize PWM and register the PWM device. */ + + ret = mbed_pwm_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: mbed_pwm_setup() failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_ADC + /* Initialize ADC and register the ADC driver. */ + + ret = mbed_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: mbed_adc_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_USERLED + /* Register the LED driver */ + + ret = userled_lower_initialize("/dev/userleds"); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); + } +#endif + + UNUSED(ret); +} +#endif diff --git a/boards/arm/lpc17xx_40xx/mcb1700/src/CMakeLists.txt b/boards/arm/lpc17xx_40xx/mcb1700/src/CMakeLists.txt index ccfa428c733..d4dd844c66c 100644 --- a/boards/arm/lpc17xx_40xx/mcb1700/src/CMakeLists.txt +++ b/boards/arm/lpc17xx_40xx/mcb1700/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS lpc17_40_boot.c lpc17_40_bringup.c lpc17_40_leds.c lpc17_40_dac.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS lpc17_40_appinit.c) -endif() - if(CONFIG_USBMSC) list(APPEND SRCS lpc17_40_usbmsc.c) endif() diff --git a/boards/arm/lpc17xx_40xx/mcb1700/src/Makefile b/boards/arm/lpc17xx_40xx/mcb1700/src/Makefile index 04312418a60..85583268c6a 100644 --- a/boards/arm/lpc17xx_40xx/mcb1700/src/Makefile +++ b/boards/arm/lpc17xx_40xx/mcb1700/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = lpc17_40_boot.c lpc17_40_bringup.c lpc17_40_leds.c lpc17_40_dac.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc17_40_appinit.c -endif - ifeq ($(CONFIG_USBMSC),y) CSRCS += lpc17_40_usbmsc.c endif diff --git a/boards/arm/lpc17xx_40xx/mcb1700/src/lpc17_40_appinit.c b/boards/arm/lpc17xx_40xx/mcb1700/src/lpc17_40_appinit.c deleted file mode 100644 index b8c19bcc50a..00000000000 --- a/boards/arm/lpc17xx_40xx/mcb1700/src/lpc17_40_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc17xx_40xx/mcb1700/src/lpc17_40_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 - -#include -#include - -#include "mcb1700.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return mcb1700_bringup(); -#endif -} diff --git a/boards/arm/lpc17xx_40xx/olimex-lpc1766stk/src/CMakeLists.txt b/boards/arm/lpc17xx_40xx/olimex-lpc1766stk/src/CMakeLists.txt index b77dca2ee41..2423e245549 100644 --- a/boards/arm/lpc17xx_40xx/olimex-lpc1766stk/src/CMakeLists.txt +++ b/boards/arm/lpc17xx_40xx/olimex-lpc1766stk/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS lpc17_40_boot.c lpc17_40_bringup.c lpc17_40_leds.c lpc17_40_ssp.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS lpc17_40_appinit.c) -endif() - if(CONFIG_USBMSC) list(APPEND SRCS lpc17_40_usbmsc.c) endif() diff --git a/boards/arm/lpc17xx_40xx/olimex-lpc1766stk/src/Makefile b/boards/arm/lpc17xx_40xx/olimex-lpc1766stk/src/Makefile index 14bf6c3d17d..ff0bc295509 100644 --- a/boards/arm/lpc17xx_40xx/olimex-lpc1766stk/src/Makefile +++ b/boards/arm/lpc17xx_40xx/olimex-lpc1766stk/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = lpc17_40_boot.c lpc17_40_bringup.c lpc17_40_leds.c lpc17_40_ssp.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc17_40_appinit.c -endif - ifeq ($(CONFIG_USBMSC),y) CSRCS += lpc17_40_usbmsc.c endif diff --git a/boards/arm/lpc17xx_40xx/olimex-lpc1766stk/src/lpc17_40_appinit.c b/boards/arm/lpc17xx_40xx/olimex-lpc1766stk/src/lpc17_40_appinit.c deleted file mode 100644 index b3b178c4ac5..00000000000 --- a/boards/arm/lpc17xx_40xx/olimex-lpc1766stk/src/lpc17_40_appinit.c +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc17xx_40xx/olimex-lpc1766stk/src/lpc17_40_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 - -#include -#include - -#include - -#include "lpc1766stk.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. - * - * CONFIG_BOARDCTL=y : - * Called from the NSH library - * - * CONFIG_BOARD_LATE_INITIALIZE=y, CONFIG_NSH_LIBRARY=y, && - * CONFIG_BOARDCTL=n : - * Called from board_late_initialize(). - * - * 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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return lpc17_40_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/lpc17xx_40xx/open1788/src/CMakeLists.txt b/boards/arm/lpc17xx_40xx/open1788/src/CMakeLists.txt index 609dfeb6cf6..ecd0d01e59c 100644 --- a/boards/arm/lpc17xx_40xx/open1788/src/CMakeLists.txt +++ b/boards/arm/lpc17xx_40xx/open1788/src/CMakeLists.txt @@ -40,10 +40,6 @@ if(CONFIG_LPC17_40_LCD) list(APPEND SRCS lpc17_40_lcd.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS lpc17_40_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS lpc17_40_autoleds.c) else() diff --git a/boards/arm/lpc17xx_40xx/open1788/src/Makefile b/boards/arm/lpc17xx_40xx/open1788/src/Makefile index 45daf9e4d92..4c42d5b6e44 100644 --- a/boards/arm/lpc17xx_40xx/open1788/src/Makefile +++ b/boards/arm/lpc17xx_40xx/open1788/src/Makefile @@ -42,10 +42,6 @@ ifeq ($(CONFIG_LPC17_40_LCD),y) CSRCS += lpc17_40_lcd.c endif -ifeq ($(CONFIG_BOARDCTL),y) - CSRCS += lpc17_40_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += lpc17_40_autoleds.c else diff --git a/boards/arm/lpc17xx_40xx/open1788/src/lpc17_40_appinit.c b/boards/arm/lpc17xx_40xx/open1788/src/lpc17_40_appinit.c deleted file mode 100644 index 50141c433a1..00000000000 --- a/boards/arm/lpc17xx_40xx/open1788/src/lpc17_40_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc17xx_40xx/open1788/src/lpc17_40_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 - -#include -#include - -#include "open1788.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return open1788_bringup(); -#endif -} diff --git a/boards/arm/lpc17xx_40xx/pnev5180b/src/CMakeLists.txt b/boards/arm/lpc17xx_40xx/pnev5180b/src/CMakeLists.txt index 70090743111..a0bd10d993b 100644 --- a/boards/arm/lpc17xx_40xx/pnev5180b/src/CMakeLists.txt +++ b/boards/arm/lpc17xx_40xx/pnev5180b/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_ARCH_LEDS) list(APPEND SRCS lpc17_40_leds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS lpc17_40_appinit.c) -endif() - if(CONFIG_USBDEV_COMPOSITE) list(APPEND SRCS lpc17_40_composite.c) endif() diff --git a/boards/arm/lpc17xx_40xx/pnev5180b/src/Makefile b/boards/arm/lpc17xx_40xx/pnev5180b/src/Makefile index 35d429e1ecc..5895ab82843 100644 --- a/boards/arm/lpc17xx_40xx/pnev5180b/src/Makefile +++ b/boards/arm/lpc17xx_40xx/pnev5180b/src/Makefile @@ -28,10 +28,6 @@ ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += lpc17_40_leds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc17_40_appinit.c -endif - ifeq ($(CONFIG_USBDEV_COMPOSITE),y) CSRCS += lpc17_40_composite.c endif diff --git a/boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_appinit.c b/boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_appinit.c deleted file mode 100644 index 474cd4fc628..00000000000 --- a/boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_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 - -#include -#include - -#include "pnev5180b.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return pnev5180b_bringup(); -#endif -} diff --git a/boards/arm/lpc17xx_40xx/u-blox-c027/src/CMakeLists.txt b/boards/arm/lpc17xx_40xx/u-blox-c027/src/CMakeLists.txt index f9c98b843e9..5aa5c7476d2 100644 --- a/boards/arm/lpc17xx_40xx/u-blox-c027/src/CMakeLists.txt +++ b/boards/arm/lpc17xx_40xx/u-blox-c027/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS lpc17_40_boot.c lpc17_40_leds.c lpc17_40_ssp.c lpc17_40_dac.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS lpc17_40_appinit.c) -endif() - if(CONFIG_PWM) list(APPEND SRCS lpc17_40_pwm.c) endif() diff --git a/boards/arm/lpc17xx_40xx/u-blox-c027/src/Makefile b/boards/arm/lpc17xx_40xx/u-blox-c027/src/Makefile index 7c5f80d84cf..09296c1af4e 100644 --- a/boards/arm/lpc17xx_40xx/u-blox-c027/src/Makefile +++ b/boards/arm/lpc17xx_40xx/u-blox-c027/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = lpc17_40_boot.c lpc17_40_leds.c lpc17_40_ssp.c lpc17_40_dac.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc17_40_appinit.c -endif - ifeq ($(CONFIG_PWM),y) CSRCS += lpc17_40_pwm.c endif diff --git a/boards/arm/lpc17xx_40xx/u-blox-c027/src/lpc17_40_appinit.c b/boards/arm/lpc17xx_40xx/u-blox-c027/src/lpc17_40_appinit.c deleted file mode 100644 index 473b44f5fd9..00000000000 --- a/boards/arm/lpc17xx_40xx/u-blox-c027/src/lpc17_40_appinit.c +++ /dev/null @@ -1,196 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc17xx_40xx/u-blox-c027/src/lpc17_40_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 - -#include -#include -#include - -#include -#include -#include -#include - -#include "lpc17_40_ssp.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#ifdef CONFIG_BOARDCTL - -/* PORT and SLOT number probably depend on the board configuration */ - -#ifdef CONFIG_ARCH_BOARD_U_BLOX_C027 -# define NSH_HAVEUSBDEV 1 -# ifdef CONFIG_LPC17_40_SSP0 -# define NSH_HAVEMMCSD 1 -# else -# undef NSH_HAVEMMCSD -# endif -#else -# error "Unrecognized board" -# undef NSH_HAVEUSBDEV -# undef NSH_HAVEMMCSD -#endif - -/* Do we have SPI support for MMC/SD? */ - -#ifdef NSH_HAVEMMCSD -# undef CONFIG_NSH_MMCSDSPIPORTNO -# define CONFIG_NSH_MMCSDSPIPORTNO 0 -# undef CONFIG_NSH_MMCSDSLOTNO -# define CONFIG_NSH_MMCSDSLOTNO 0 -#endif - -/* Can't support USB device features if USB device is not enabled */ - -#ifndef CONFIG_USBDEV -# undef NSH_HAVEUSBDEV -#endif - -/* Can't support MMC/SD features if mountpoints are disabled */ - -#if defined(CONFIG_DISABLE_MOUNTPOINT) -# undef NSH_HAVEMMCSD -#endif - -#ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -#endif - -/* Currnently MMC/SD support is available only for NSH configurations */ - -#else -# undef NSH_HAVEMMCSD -#endif /* 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) -{ - int ret; - -#ifdef CONFIG_FS_PROCFS - /* mount the proc filesystem */ - - syslog(LOG_INFO, "Mounting procfs to /proc\n"); - - ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); - if (ret < 0) - { - syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d\n", ret); - return ret; - } -#endif - -#ifdef NSH_HAVEMMCSD - struct spi_dev_s *ssp; - - /* Get the SSP port */ - - ssp = lpc17_40_sspbus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); - if (!ssp) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SSP port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); - return -ENODEV; - } - - syslog(LOG_INFO, "Successfully initialized SSP port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); - - /* Bind the SSP port to the slot */ - - ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, - CONFIG_NSH_MMCSDSLOTNO, ssp); - if (ret < 0) - { - syslog(LOG_ERR, - "ERROR: Failed to bind SSP port %d to MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); - return ret; - } - - syslog(LOG_INFO, "Successfully bound SSP port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); -#endif - -#ifdef CONFIG_PWM - /* Initialize PWM and register the PWM device. */ - - ret = lpc17_40_pwm_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: lpc17_40_pwm_setup() failed: %d\n", ret); - return ret; - } -#endif - -#ifdef CONFIG_ADC - /* Initialize ADC and register the ADC driver. */ - - ret = lpc17_40_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: lpc17_40_adc_setup failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/lpc17xx_40xx/u-blox-c027/src/lpc17_40_boot.c b/boards/arm/lpc17xx_40xx/u-blox-c027/src/lpc17_40_boot.c index e038c380bea..885aeb94c92 100644 --- a/boards/arm/lpc17xx_40xx/u-blox-c027/src/lpc17_40_boot.c +++ b/boards/arm/lpc17xx_40xx/u-blox-c027/src/lpc17_40_boot.c @@ -28,7 +28,14 @@ #include +#include +#include +#include + #include +#include +#include +#include #include #include "arm_internal.h" @@ -36,6 +43,60 @@ #include "lpc17_40_ssp.h" #include "u-blox-c027.h" +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +#ifdef CONFIG_BOARDCTL + +/* PORT and SLOT number probably depend on the board configuration */ + +#ifdef CONFIG_ARCH_BOARD_U_BLOX_C027 +# define NSH_HAVEUSBDEV 1 +# ifdef CONFIG_LPC17_40_SSP0 +# define NSH_HAVEMMCSD 1 +# else +# undef NSH_HAVEMMCSD +# endif +#else +# error "Unrecognized board" +# undef NSH_HAVEUSBDEV +# undef NSH_HAVEMMCSD +#endif + +/* Do we have SPI support for MMC/SD? */ + +#ifdef NSH_HAVEMMCSD +# undef CONFIG_NSH_MMCSDSPIPORTNO +# define CONFIG_NSH_MMCSDSPIPORTNO 0 +# undef CONFIG_NSH_MMCSDSLOTNO +# define CONFIG_NSH_MMCSDSLOTNO 0 +#endif + +/* Can't support USB device features if USB device is not enabled */ + +#ifndef CONFIG_USBDEV +# undef NSH_HAVEUSBDEV +#endif + +/* Can't support MMC/SD features if mountpoints are disabled */ + +#if defined(CONFIG_DISABLE_MOUNTPOINT) +# undef NSH_HAVEMMCSD +#endif + +#ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +#endif + +/* Currnently MMC/SD support is available only for NSH configurations */ + +#else +# undef NSH_HAVEMMCSD +#endif /* CONFIG_BOARDCTL */ + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -89,19 +150,79 @@ void lpc17_40_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { + int ret; + #ifdef CONFIG_MODEM_U_BLOX lpc17_40_ubxmdm_init(false); #endif -#if 0 - lpc17_40_configgpio(C027_MDMEN | GPIO_VALUE_ZERO); /* Modem disabled */ - lpc17_40_configgpio(C027_MDMRST | GPIO_VALUE_ONE); /* Modem reset on */ - lpc17_40_configgpio(C027_MDMPWR | GPIO_VALUE_ONE); /* Modem power off */ - lpc17_40_configgpio(C027_GPSEN | GPIO_VALUE_ZERO); /* GPS disabled */ - lpc17_40_configgpio(C027_GPSRST | GPIO_VALUE_ONE); /* GPS reset on */ - lpc17_40_configgpio(C027_MDMLVLOE | GPIO_VALUE_ONE); /* UART shifter disabled */ - lpc17_40_configgpio(C027_MDMILVLOE | GPIO_VALUE_ZERO); /* I2C shifter disabled */ - lpc17_40_configgpio(C027_MDMUSBDET | GPIO_VALUE_ZERO); /* USB sense off */ +#ifdef CONFIG_FS_PROCFS + /* mount the proc filesystem */ + + syslog(LOG_INFO, "Mounting procfs to /proc\n"); + + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); + return; + } #endif + +#ifdef NSH_HAVEMMCSD + struct spi_dev_s *ssp; + + /* Get the SSP port */ + + ssp = lpc17_40_sspbus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); + if (!ssp) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SSP port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); + return; + } + + syslog(LOG_INFO, "Successfully initialized SSP port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); + + /* Bind the SSP port to the slot */ + + ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, + CONFIG_NSH_MMCSDSLOTNO, ssp); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to bind SSP port %d to MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); + return; + } + + syslog(LOG_INFO, "Successfully bound SSP port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); +#endif + +#ifdef CONFIG_PWM + /* Initialize PWM and register the PWM device. */ + + ret = lpc17_40_pwm_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: lpc17_40_pwm_setup() failed: %d\n", ret); + return; + } +#endif + +#ifdef CONFIG_ADC + /* Initialize ADC and register the ADC driver. */ + + ret = lpc17_40_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: lpc17_40_adc_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); } #endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/lpc17xx_40xx/zkit-arm-1769/src/CMakeLists.txt b/boards/arm/lpc17xx_40xx/zkit-arm-1769/src/CMakeLists.txt index 1872d841cfa..61cf9aab35f 100644 --- a/boards/arm/lpc17xx_40xx/zkit-arm-1769/src/CMakeLists.txt +++ b/boards/arm/lpc17xx_40xx/zkit-arm-1769/src/CMakeLists.txt @@ -23,10 +23,6 @@ set(SRCS lpc17_40_boot.c lpc17_40_leds.c lpc17_40_ssp.c lpc17_40_buttons.c lpc17_40_lcd.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS lpc17_40_appinit.c) -endif() - if(CONFIG_USBMSC) list(APPEND SRCS lpc17_40_usbmsc.c) endif() diff --git a/boards/arm/lpc17xx_40xx/zkit-arm-1769/src/Makefile b/boards/arm/lpc17xx_40xx/zkit-arm-1769/src/Makefile index 005bf37eef8..aea6afcba12 100644 --- a/boards/arm/lpc17xx_40xx/zkit-arm-1769/src/Makefile +++ b/boards/arm/lpc17xx_40xx/zkit-arm-1769/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = lpc17_40_boot.c lpc17_40_leds.c lpc17_40_ssp.c lpc17_40_buttons.c lpc17_40_lcd.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc17_40_appinit.c -endif - ifeq ($(CONFIG_USBMSC),y) CSRCS += lpc17_40_usbmsc.c endif diff --git a/boards/arm/lpc17xx_40xx/zkit-arm-1769/src/lpc17_40_appinit.c b/boards/arm/lpc17xx_40xx/zkit-arm-1769/src/lpc17_40_appinit.c deleted file mode 100644 index d70a5e53184..00000000000 --- a/boards/arm/lpc17xx_40xx/zkit-arm-1769/src/lpc17_40_appinit.c +++ /dev/null @@ -1,181 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc17xx_40xx/zkit-arm-1769/src/lpc17_40_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 - -#include -#include -#include - -#include -#include -#include - -#include "lpc17_40_spi.h" -#include "zkit-arm-1769.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -/* PORT and SLOT number probably depend on the board configuration */ - -#ifdef CONFIG_ARCH_BOARD_ZKITARM -# define CONFIG_NSH_HAVEUSBDEV 1 -# ifdef CONFIG_LPC17_40_SPI -# define CONFIG_NSH_HAVEMMCSD 1 -# else -# undef CONFIG_NSH_HAVEMMCSD -# endif -#else -# error "Unrecognized board" -# undef CONFIG_NSH_HAVEUSBDEV -# undef CONFIG_NSH_HAVEMMCSD -#endif - -/* Do we have SPI support for MMC/SD? */ - -#ifdef CONFIG_NSH_HAVEMMCSD -# undef CONFIG_NSH_MMCSDSPIPORTNO -# define CONFIG_NSH_MMCSDSPIPORTNO 0 -# undef CONFIG_NSH_MMCSDSLOTNO -# define CONFIG_NSH_MMCSDSLOTNO 0 -#endif - -/* Can't support USB device features if USB device is not enabled */ - -#ifndef CONFIG_USBDEV -# undef CONFIG_NSH_HAVEUSBDEV -#endif - -/* Can't support MMC/SD features if mountpoints are disabled */ - -#if defined(CONFIG_DISABLE_MOUNTPOINT) -# undef CONFIG_NSH_HAVEMMCSD -#endif - -#ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -#endif - -/* Debug ********************************************************************/ - -#ifdef CONFIG_DEBUG_INFO -# define message _info -#else -# define message _err -#endif - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_NSH_HAVEMMCSD - struct spi_dev_s *spi; -#endif - int ret; - -#ifdef CONFIG_NSH_HAVEMMCSD - /* Get the SPI port */ - - spi = lpc17_40_spibus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); - if (!spi) - { - message("board_app_initialize: Failed to initialize SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); - return -ENODEV; - } - - message("Successfully initialized SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); - - /* Bind the SPI port to the slot */ - - ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, - CONFIG_NSH_MMCSDSLOTNO, spi); - if (ret < 0) - { - message("Failed to bind SPI port %d to MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); - return ret; - } - - message("Successfully bound SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); -#endif - -#ifdef CONFIG_ADC - /* Initialize ADC and register the ADC driver. */ - - ret = zkit_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: zkit_adc_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_CAN - /* Initialize CAN and register the CAN driver. */ - - ret = zkit_can_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: zkit_can_setup failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/lpc17xx_40xx/zkit-arm-1769/src/lpc17_40_boot.c b/boards/arm/lpc17xx_40xx/zkit-arm-1769/src/lpc17_40_boot.c index 2a2b444d801..65ed8535942 100644 --- a/boards/arm/lpc17xx_40xx/zkit-arm-1769/src/lpc17_40_boot.c +++ b/boards/arm/lpc17xx_40xx/zkit-arm-1769/src/lpc17_40_boot.c @@ -28,16 +28,72 @@ #include +#include +#include + #include +#include +#include #include #include "arm_internal.h" +#include "lpc17_40_spi.h" #include "zkit-arm-1769.h" /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +/* PORT and SLOT number probably depend on the board configuration */ + +#ifdef CONFIG_ARCH_BOARD_ZKITARM +# define CONFIG_NSH_HAVEUSBDEV 1 +# ifdef CONFIG_LPC17_40_SPI +# define CONFIG_NSH_HAVEMMCSD 1 +# else +# undef CONFIG_NSH_HAVEMMCSD +# endif +#else +# error "Unrecognized board" +# undef CONFIG_NSH_HAVEUSBDEV +# undef CONFIG_NSH_HAVEMMCSD +#endif + +/* Do we have SPI support for MMC/SD? */ + +#ifdef CONFIG_NSH_HAVEMMCSD +# undef CONFIG_NSH_MMCSDSPIPORTNO +# define CONFIG_NSH_MMCSDSPIPORTNO 0 +# undef CONFIG_NSH_MMCSDSLOTNO +# define CONFIG_NSH_MMCSDSLOTNO 0 +#endif + +/* Can't support USB device features if USB device is not enabled */ + +#ifndef CONFIG_USBDEV +# undef CONFIG_NSH_HAVEUSBDEV +#endif + +/* Can't support MMC/SD features if mountpoints are disabled */ + +#if defined(CONFIG_DISABLE_MOUNTPOINT) +# undef CONFIG_NSH_HAVEMMCSD +#endif + +#ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +#endif + +/* Debug ********************************************************************/ + +#ifdef CONFIG_DEBUG_INFO +# define message _info +#else +# define message _err +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -78,3 +134,77 @@ void lpc17_40_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) +{ +#ifdef CONFIG_NSH_HAVEMMCSD + struct spi_dev_s *spi; +#endif + int ret; + +#ifdef CONFIG_NSH_HAVEMMCSD + /* Get the SPI port */ + + spi = lpc17_40_spibus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); + if (!spi) + { + message("Failed to initialize SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); + return; + } + + message("Successfully initialized SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); + + /* Bind the SPI port to the slot */ + + ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, + CONFIG_NSH_MMCSDSLOTNO, spi); + if (ret < 0) + { + message("Failed to bind SPI port %d to MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); + return; + } + + message("Successfully bound SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); +#endif + +#ifdef CONFIG_ADC + /* Initialize ADC and register the ADC driver. */ + + ret = zkit_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: zkit_adc_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_CAN + /* Initialize CAN and register the CAN driver. */ + + ret = zkit_can_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: zkit_can_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); +} +#endif diff --git a/boards/arm/lpc214x/mcu123-lpc214x/src/Makefile b/boards/arm/lpc214x/mcu123-lpc214x/src/Makefile index 6ed825db26c..f6e9dc20d51 100644 --- a/boards/arm/lpc214x/mcu123-lpc214x/src/Makefile +++ b/boards/arm/lpc214x/mcu123-lpc214x/src/Makefile @@ -22,11 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = lpc2148_spi1.c lpc2148_leds.c - -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc2148_appinit.c -endif +CSRCS = lpc2148_spi1.c lpc2148_leds.c lpc2148_boardinit.c ifeq ($(CONFIG_USBMSC),y) CSRCS += lpc2148_usbmsc.c diff --git a/boards/arm/lpc214x/mcu123-lpc214x/src/lpc2148_appinit.c b/boards/arm/lpc214x/mcu123-lpc214x/src/lpc2148_boardinit.c similarity index 77% rename from boards/arm/lpc214x/mcu123-lpc214x/src/lpc2148_appinit.c rename to boards/arm/lpc214x/mcu123-lpc214x/src/lpc2148_boardinit.c index 4d326d69491..655f2ca2ef9 100644 --- a/boards/arm/lpc214x/mcu123-lpc214x/src/lpc2148_appinit.c +++ b/boards/arm/lpc214x/mcu123-lpc214x/src/lpc2148_boardinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/lpc214x/mcu123-lpc214x/src/lpc2148_appinit.c + * boards/arm/lpc214x/mcu123-lpc214x/src/lpc2148_boardinit.c * * SPDX-License-Identifier: Apache-2.0 * @@ -71,29 +71,20 @@ ****************************************************************************/ /**************************************************************************** - * Name: board_app_initialize + * Name: board_late_initialize * * Description: - * Perform architecture specific initialization - * - * 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. + * 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. * ****************************************************************************/ -int board_app_initialize(uintptr_t arg) +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) { #ifdef HAVE_MMCSD struct spi_dev_s *spi; @@ -109,7 +100,7 @@ int board_app_initialize(uintptr_t arg) { syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n", CONFIG_NSH_MMCSDSPIPORTNO); - return -ENODEV; + return; } syslog(LOG_INFO, "Successfully initialized SPI port %d\n", @@ -127,12 +118,11 @@ int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); - return ret; + return; } syslog(LOG_INFO, "Successfully bound SPI port %d to MMC/SD slot %d\n", CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); #endif - - return OK; } +#endif diff --git a/boards/arm/lpc214x/mcu123-lpc214x/src/lpc2148_composite.c b/boards/arm/lpc214x/mcu123-lpc214x/src/lpc2148_composite.c index b92ed6b3eba..953f17565d2 100644 --- a/boards/arm/lpc214x/mcu123-lpc214x/src/lpc2148_composite.c +++ b/boards/arm/lpc214x/mcu123-lpc214x/src/lpc2148_composite.c @@ -337,8 +337,7 @@ static void *board_composite1_connect(int port) int board_composite_initialize(int port) { /* If system/composite is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see lpc2148_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. * * NOTE: CONFIG_NSH_BUILTIN_APPS is not a fool-proof indication that NSH diff --git a/boards/arm/lpc214x/zp214xpa/src/Makefile b/boards/arm/lpc214x/zp214xpa/src/Makefile index 32ef274cbc8..ed9c1ce2d60 100644 --- a/boards/arm/lpc214x/zp214xpa/src/Makefile +++ b/boards/arm/lpc214x/zp214xpa/src/Makefile @@ -22,12 +22,10 @@ include $(TOPDIR)/Make.defs +CSRCS += lpc2148_boardinit.c + ifeq ($(CONFIG_LCD_UG2864AMBAG01),y) CSRCS += lpc2148_ug2864ambag01.c lpc2148_spi1.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc2148_appinit.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/lpc214x/zp214xpa/src/lpc2148_appinit.c b/boards/arm/lpc214x/zp214xpa/src/lpc2148_boardinit.c similarity index 63% rename from boards/arm/lpc214x/zp214xpa/src/lpc2148_appinit.c rename to boards/arm/lpc214x/zp214xpa/src/lpc2148_boardinit.c index 1411f4d83dc..06020ea8e74 100644 --- a/boards/arm/lpc214x/zp214xpa/src/lpc2148_appinit.c +++ b/boards/arm/lpc214x/zp214xpa/src/lpc2148_boardinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/lpc214x/zp214xpa/src/lpc2148_appinit.c + * boards/arm/lpc214x/zp214xpa/src/lpc2148_boardinit.c * * SPDX-License-Identifier: Apache-2.0 * @@ -26,6 +26,10 @@ #include +#include + +#include +#include #include #include @@ -33,38 +37,25 @@ # include #endif -#ifdef CONFIG_BOARDCTL - /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** - * Name: board_app_initialize + * Name: board_late_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. + * 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. * ****************************************************************************/ -int board_app_initialize(uintptr_t arg) +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) { int ret; @@ -89,7 +80,5 @@ int board_app_initialize(uintptr_t arg) #endif UNUSED(ret); - return OK; } - -#endif /* CONFIG_BOARDCTL */ +#endif diff --git a/boards/arm/lpc2378/olimex-lpc2378/src/Makefile b/boards/arm/lpc2378/olimex-lpc2378/src/Makefile index 30070b0d144..8cddb1ec4ea 100644 --- a/boards/arm/lpc2378/olimex-lpc2378/src/Makefile +++ b/boards/arm/lpc2378/olimex-lpc2378/src/Makefile @@ -24,8 +24,4 @@ include $(TOPDIR)/Make.defs CSRCS = lpc2378_leds.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc2378_appinit.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/lpc2378/olimex-lpc2378/src/lpc2378_appinit.c b/boards/arm/lpc2378/olimex-lpc2378/src/lpc2378_appinit.c deleted file mode 100644 index acc83eb2580..00000000000 --- a/boards/arm/lpc2378/olimex-lpc2378/src/lpc2378_appinit.c +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc2378/olimex-lpc2378/src/lpc2378_appinit.c - * - * SPDX-License-Identifier: BSD-3-Clause - * SPDX-FileCopyrightText: 2010 Rommel Marcelo. All rights reserved. - * SPDX-FileCopyrightText: 2010, 2014 Gregory Nutt. All rights reserved. - * SPDX-FileContributor: Gregory Nutt - * SPDX-FileContributor: Rommel Marcelo - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#include -#include -#include - -#include -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -/* PORT and SLOT number probably depend on the board configuration */ - -#undef NSH_HAVEUSBDEV -#undef NSH_HAVEMMCSD - -/* Can't support USB features if USB is not enabled */ - -#ifndef CONFIG_USBDEV -# undef NSH_HAVEUSBDEV -#endif - -/* Can't support MMC/SD features if mountpoints are disabled */ - -#if defined(CONFIG_DISABLE_MOUNTPOINT) -# undef NSH_HAVEMMCSD -#endif - -#ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -#endif - -/**************************************************************************** - * 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; -} diff --git a/boards/arm/lpc2378/olimex-lpc2378/src/lpc2378_leds.c b/boards/arm/lpc2378/olimex-lpc2378/src/lpc2378_leds.c index 7dc3d8d1936..41ae3763a8d 100644 --- a/boards/arm/lpc2378/olimex-lpc2378/src/lpc2378_leds.c +++ b/boards/arm/lpc2378/olimex-lpc2378/src/lpc2378_leds.c @@ -128,4 +128,23 @@ void lpc2378_statledon(void) putled8(STATLED, FIO1SET2_OFFSET); } +/**************************************************************************** + * 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 */ + #endif /* CONFIG_ARCH_LEDS */ diff --git a/boards/arm/lpc31xx/ea3131/src/Makefile b/boards/arm/lpc31xx/ea3131/src/Makefile index efe2c22936c..6e7e97b429d 100644 --- a/boards/arm/lpc31xx/ea3131/src/Makefile +++ b/boards/arm/lpc31xx/ea3131/src/Makefile @@ -40,10 +40,6 @@ ifeq ($(CONFIG_LPC31_SPI),y) CSRCS += lpc31_spi.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc31_appinit.c -endif - ifeq ($(CONFIG_LEGACY_PAGING),y) CSRCS += lpc31_fillpage.c endif diff --git a/boards/arm/lpc31xx/ea3131/src/lpc31_appinit.c b/boards/arm/lpc31xx/ea3131/src/lpc31_appinit.c deleted file mode 100644 index 1a43cded550..00000000000 --- a/boards/arm/lpc31xx/ea3131/src/lpc31_appinit.c +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc31xx/ea3131/src/lpc31_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 - -#include -#include -#include -#include - -#include - -#ifdef CONFIG_LPC31_MCI -# include -# include -#endif - -#include "lpc31.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -/* PORT and SLOT number probably depend on the board configuration */ - -#ifdef CONFIG_ARCH_BOARD_EA3131 -# define NSH_HAVEUSBDEV 1 -# define NSH_HAVEMMCSD 1 -# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 -# error "Only one MMC/SD slot" -# undef CONFIG_NSH_MMCSDSLOTNO -# endif -# ifndef CONFIG_NSH_MMCSDSLOTNO -# define CONFIG_NSH_MMCSDSLOTNO 0 -# endif -#else - /* Add configuration for new LPC31XX boards here */ - -# error "Unrecognized LPC31XX board" -# undef NSH_HAVEUSBDEV -# undef NSH_HAVEMMCSD -#endif - -/* Can't support USB features if USB is not enabled */ - -#ifndef CONFIG_USBDEV -# undef NSH_HAVEUSBDEV -#endif - -/* Can't support MMC/SD features if mountpoints are disabled or if SDIO - * support is not enabled. - */ - -#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_LPC31_MCI) -# undef NSH_HAVEMMCSD -#endif - -#ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef NSH_HAVEMMCSD - struct sdio_dev_s *sdio; - int ret; - - /* First, get an instance of the SDIO interface */ - - syslog(LOG_INFO, "Initializing SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); - - sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); - if (!sdio) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); - return -ENODEV; - } - - /* Now bind the SPI interface to the MMC/SD driver */ - - syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=%d\n", - CONFIG_NSH_MMCSDMINOR); - - ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio); - if (ret != OK) - { - syslog(LOG_ERR, - "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); - return ret; - } - - syslog(LOG_INFO, "Successfully bound SDIO to the MMC/SD driver\n"); - - /* Then let's guess and say that there is a card in the slot. - * I need to check to see if the LPC313X10E-EVAL board supports a GPIO to - * detect if there is a card in the slot. - */ - - sdio_mediachange(sdio, true); -#endif - return OK; -} diff --git a/boards/arm/lpc31xx/ea3131/src/lpc31_boot.c b/boards/arm/lpc31xx/ea3131/src/lpc31_boot.c index 349dfbc5ba5..147ce77d920 100644 --- a/boards/arm/lpc31xx/ea3131/src/lpc31_boot.c +++ b/boards/arm/lpc31xx/ea3131/src/lpc31_boot.c @@ -28,9 +28,19 @@ #include +#include +#include +#include +#include + #include #include +#ifdef CONFIG_LPC31_MCI +# include +# include +#endif + #include "arm_internal.h" #include "lpc31.h" #include "ea3131.h" @@ -39,6 +49,47 @@ * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +/* PORT and SLOT number probably depend on the board configuration */ + +#ifdef CONFIG_ARCH_BOARD_EA3131 +# define NSH_HAVEUSBDEV 1 +# define NSH_HAVEMMCSD 1 +# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 +# error "Only one MMC/SD slot" +# undef CONFIG_NSH_MMCSDSLOTNO +# endif +# ifndef CONFIG_NSH_MMCSDSLOTNO +# define CONFIG_NSH_MMCSDSLOTNO 0 +# endif +#else + /* Add configuration for new LPC31XX boards here */ + +# error "Unrecognized LPC31XX board" +# undef NSH_HAVEUSBDEV +# undef NSH_HAVEMMCSD +#endif + +/* Can't support USB features if USB is not enabled */ + +#ifndef CONFIG_USBDEV +# undef NSH_HAVEUSBDEV +#endif + +/* Can't support MMC/SD features if mountpoints are disabled or if SDIO + * support is not enabled. + */ + +#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_LPC31_MCI) +# undef NSH_HAVEMMCSD +#endif + +#ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +#endif + + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -117,3 +168,61 @@ void lpc31_boardinitialize(void) } #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) +{ +#ifdef NSH_HAVEMMCSD + struct sdio_dev_s *sdio; + int ret; + + /* First, get an instance of the SDIO interface */ + + syslog(LOG_INFO, "Initializing SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + + sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); + if (!sdio) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + return; + } + + /* Now bind the SPI interface to the MMC/SD driver */ + + syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=%d\n", + CONFIG_NSH_MMCSDMINOR); + + ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio); + if (ret != OK) + { + syslog(LOG_ERR, + "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); + return; + } + + syslog(LOG_INFO, "Successfully bound SDIO to the MMC/SD driver\n"); + + /* Then let's guess and say that there is a card in the slot. + * I need to check to see if the LPC313X10E-EVAL board supports a GPIO to + * detect if there is a card in the slot. + */ + + sdio_mediachange(sdio, true); +#endif +} +#endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/lpc31xx/ea3152/src/Makefile b/boards/arm/lpc31xx/ea3152/src/Makefile index b30ac1953b2..426d1031dea 100644 --- a/boards/arm/lpc31xx/ea3152/src/Makefile +++ b/boards/arm/lpc31xx/ea3152/src/Makefile @@ -35,9 +35,6 @@ endif ifeq ($(CONFIG_LPC31_SPI),y) CSRCS += lpc31_spi.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc31_appinit.c -endif ifeq ($(CONFIG_LEGACY_PAGING),y) CSRCS += lpc31_fillpage.c endif diff --git a/boards/arm/lpc31xx/ea3152/src/lpc31_appinit.c b/boards/arm/lpc31xx/ea3152/src/lpc31_appinit.c deleted file mode 100644 index fd6d4a27452..00000000000 --- a/boards/arm/lpc31xx/ea3152/src/lpc31_appinit.c +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc31xx/ea3152/src/lpc31_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 - -#include -#include -#include -#include - -#include - -#ifdef CONFIG_LPC31_MCI -# include -# include -#endif - -#include "lpc31.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -/* PORT and SLOT number probably depend on the board configuration */ - -#ifdef CONFIG_ARCH_BOARD_EA3152 -# define NSH_HAVEUSBDEV 1 -# define NSH_HAVEMMCSD 1 -# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 -# error "Only one MMC/SD slot" -# undef CONFIG_NSH_MMCSDSLOTNO -# endif -# ifndef CONFIG_NSH_MMCSDSLOTNO -# define CONFIG_NSH_MMCSDSLOTNO 0 -# endif -#else - /* Add configuration for new LPC31XX boards here */ - -# error "Unrecognized LPC31XX board" -# undef NSH_HAVEUSBDEV -# undef NSH_HAVEMMCSD -#endif - -/* Can't support USB features if USB is not enabled */ - -#ifndef CONFIG_USBDEV -# undef NSH_HAVEUSBDEV -#endif - -/* Can't support MMC/SD features if mountpoints are disabled or if SDIO - * support is not enabled. - */ - -#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_LPC31_MCI) -# undef NSH_HAVEMMCSD -#endif - -#ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef NSH_HAVEMMCSD - struct sdio_dev_s *sdio; - int ret; - - /* First, get an instance of the SDIO interface */ - - syslog(LOG_INFO, "Initializing SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); - - sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); - if (!sdio) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); - return -ENODEV; - } - - /* Now bind the SPI interface to the MMC/SD driver */ - - syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=%d\n", - CONFIG_NSH_MMCSDMINOR); - - ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio); - if (ret != OK) - { - syslog(LOG_ERR, - "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); - return ret; - } - - syslog(LOG_INFO, "Successfully bound SDIO to the MMC/SD driver\n"); - - /* Then let's guess and say that there is a card in the slot. - * I need to check to see if the LPC313X10E-EVAL board supports a GPIO to - * detect if there is a card in the slot. - */ - - sdio_mediachange(sdio, true); -#endif - return OK; -} diff --git a/boards/arm/lpc31xx/ea3152/src/lpc31_boot.c b/boards/arm/lpc31xx/ea3152/src/lpc31_boot.c index 36dca5b029d..a8f5a53efbc 100644 --- a/boards/arm/lpc31xx/ea3152/src/lpc31_boot.c +++ b/boards/arm/lpc31xx/ea3152/src/lpc31_boot.c @@ -28,9 +28,19 @@ #include +#include +#include +#include +#include + #include #include +#ifdef CONFIG_LPC31_MCI +# include +# include +#endif + #include "arm_internal.h" #include "lpc31.h" #include "ea3152.h" @@ -39,6 +49,46 @@ * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +/* PORT and SLOT number probably depend on the board configuration */ + +#ifdef CONFIG_ARCH_BOARD_EA3152 +# define NSH_HAVEUSBDEV 1 +# define NSH_HAVEMMCSD 1 +# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 +# error "Only one MMC/SD slot" +# undef CONFIG_NSH_MMCSDSLOTNO +# endif +# ifndef CONFIG_NSH_MMCSDSLOTNO +# define CONFIG_NSH_MMCSDSLOTNO 0 +# endif +#else + /* Add configuration for new LPC31XX boards here */ + +# error "Unrecognized LPC31XX board" +# undef NSH_HAVEUSBDEV +# undef NSH_HAVEMMCSD +#endif + +/* Can't support USB features if USB is not enabled */ + +#ifndef CONFIG_USBDEV +# undef NSH_HAVEUSBDEV +#endif + +/* Can't support MMC/SD features if mountpoints are disabled or if SDIO + * support is not enabled. + */ + +#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_LPC31_MCI) +# undef NSH_HAVEMMCSD +#endif + +#ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -104,3 +154,61 @@ void lpc31_boardinitialize(void) } #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) +{ +#ifdef NSH_HAVEMMCSD + struct sdio_dev_s *sdio; + int ret; + + /* First, get an instance of the SDIO interface */ + + syslog(LOG_INFO, "Initializing SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + + sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); + if (!sdio) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + return; + } + + /* Now bind the SPI interface to the MMC/SD driver */ + + syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=%d\n", + CONFIG_NSH_MMCSDMINOR); + + ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio); + if (ret != OK) + { + syslog(LOG_ERR, + "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); + return; + } + + syslog(LOG_INFO, "Successfully bound SDIO to the MMC/SD driver\n"); + + /* Then let's guess and say that there is a card in the slot. + * I need to check to see if the LPC313X10E-EVAL board supports a GPIO to + * detect if there is a card in the slot. + */ + + sdio_mediachange(sdio, true); +#endif +} +#endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/lpc31xx/olimex-lpc-h3131/src/Makefile b/boards/arm/lpc31xx/olimex-lpc-h3131/src/Makefile index 984ef980ea1..5d0a210b8c5 100644 --- a/boards/arm/lpc31xx/olimex-lpc-h3131/src/Makefile +++ b/boards/arm/lpc31xx/olimex-lpc-h3131/src/Makefile @@ -40,10 +40,6 @@ ifeq ($(CONFIG_LPC31_MCI),y) CSRCS += lpc31_mmcsd.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc31_appinit.c -endif - ifeq ($(CONFIG_LPC31_USBOTG),y) ifeq ($(CONFIG_USBHOST),y) CSRCS += lpc31_usbhost.c diff --git a/boards/arm/lpc31xx/olimex-lpc-h3131/src/lpc31_appinit.c b/boards/arm/lpc31xx/olimex-lpc-h3131/src/lpc31_appinit.c deleted file mode 100644 index 4011683149f..00000000000 --- a/boards/arm/lpc31xx/olimex-lpc-h3131/src/lpc31_appinit.c +++ /dev/null @@ -1,136 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc31xx/olimex-lpc-h3131/src/lpc31_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 - -#include -#include -#include -#include - -#include - -#ifdef CONFIG_USBMONITOR -# include -#endif - -#include "lpc31.h" - -#include "lpc_h3131.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -/* PORT and SLOT number probably depend on the board configuration */ - -#ifdef HAVE_MMCSD -# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 -# error "Only one MMC/SD slot" -# undef CONFIG_NSH_MMCSDSLOTNO -# endif -# ifndef CONFIG_NSH_MMCSDSLOTNO -# define CONFIG_NSH_MMCSDSLOTNO 0 -# endif -#endif - -/**************************************************************************** - * 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) -{ -#if defined(HAVE_MMCSD) || defined(HAVE_USBHOST) - int ret; -#endif - -#ifdef HAVE_MMCSD - /* Create the SDIO-based MMC/SD device */ - - syslog(LOG_INFO, "Create the MMC/SD device\n"); - ret = lpc31_mmcsd_initialize(CONFIG_NSH_MMCSDSLOTNO); - if (!sdio) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO, CONFIG_NSH_MMCSDMINOR); - return -ENODEV; - } -#endif - -#ifdef HAVE_USBHOST - /* Initialize USB host operation. lpc31_usbhost_initialize() starts a - * thread will monitor for USB connection and disconnection events. - */ - - syslog(LOG_INFO, "Start USB host services\n"); - ret = lpc31_usbhost_initialize(); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: Failed to start USB host services: %d\n", ret); - return ret; - } -#endif - -#ifdef HAVE_USBMONITOR - /* Start the USB Monitor */ - - syslog(LOG_ERR, "ERROR: Failed to start the USB monitor\n"); - ret = usbmonitor_start(); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); - } -#endif - - return OK; -} diff --git a/boards/arm/lpc31xx/olimex-lpc-h3131/src/lpc31_boot.c b/boards/arm/lpc31xx/olimex-lpc-h3131/src/lpc31_boot.c index b5b7139f1ab..844ef0c7194 100644 --- a/boards/arm/lpc31xx/olimex-lpc-h3131/src/lpc31_boot.c +++ b/boards/arm/lpc31xx/olimex-lpc-h3131/src/lpc31_boot.c @@ -28,9 +28,18 @@ #include +#include +#include +#include +#include + #include #include +#ifdef CONFIG_USBMONITOR +# include +#endif + #include "arm_internal.h" #include "lpc31.h" #include "lpc_h3131.h" @@ -39,6 +48,20 @@ * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +/* PORT and SLOT number probably depend on the board configuration */ + +#ifdef HAVE_MMCSD +# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 +# error "Only one MMC/SD slot" +# undef CONFIG_NSH_MMCSDSLOTNO +# endif +# ifndef CONFIG_NSH_MMCSDSLOTNO +# define CONFIG_NSH_MMCSDSLOTNO 0 +# endif +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -103,3 +126,63 @@ void lpc31_boardinitialize(void) board_autoled_initialize(); } + +/**************************************************************************** + * 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) +{ +#if defined(HAVE_MMCSD) || defined(HAVE_USBHOST) + int ret; +#endif + +#ifdef HAVE_MMCSD + /* Create the SDIO-based MMC/SD device */ + + syslog(LOG_INFO, "Create the MMC/SD device\n"); + ret = lpc31_mmcsd_initialize(CONFIG_NSH_MMCSDSLOTNO); + if (!sdio) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO, CONFIG_NSH_MMCSDMINOR); + return; + } +#endif + +#ifdef HAVE_USBHOST + /* Initialize USB host operation. lpc31_usbhost_initialize() starts a + * thread will monitor for USB connection and disconnection events. + */ + + syslog(LOG_INFO, "Start USB host services\n"); + ret = lpc31_usbhost_initialize(); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: Failed to start USB host services: %d\n", ret); + return; + } +#endif + +#ifdef HAVE_USBMONITOR + /* Start the USB Monitor */ + + syslog(LOG_ERR, "ERROR: Failed to start the USB monitor\n"); + ret = usbmonitor_start(); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); + } +#endif +} +#endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/lpc43xx/bambino-200e/src/CMakeLists.txt b/boards/arm/lpc43xx/bambino-200e/src/CMakeLists.txt index 99068b8c636..563589c289f 100644 --- a/boards/arm/lpc43xx/bambino-200e/src/CMakeLists.txt +++ b/boards/arm/lpc43xx/bambino-200e/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_SENSORS_MAX31855) list(APPEND SRCS lpc43_max31855.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS lpc43_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS lpc43_autoleds.c) else() diff --git a/boards/arm/lpc43xx/bambino-200e/src/Makefile b/boards/arm/lpc43xx/bambino-200e/src/Makefile index 23389df4411..f5ac7fd0644 100644 --- a/boards/arm/lpc43xx/bambino-200e/src/Makefile +++ b/boards/arm/lpc43xx/bambino-200e/src/Makefile @@ -28,10 +28,6 @@ ifeq ($(CONFIG_SENSORS_MAX31855),y) CSRCS += lpc43_max31855.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc43_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += lpc43_autoleds.c else diff --git a/boards/arm/lpc43xx/bambino-200e/src/lpc43_appinit.c b/boards/arm/lpc43xx/bambino-200e/src/lpc43_appinit.c deleted file mode 100644 index 3993589e609..00000000000 --- a/boards/arm/lpc43xx/bambino-200e/src/lpc43_appinit.c +++ /dev/null @@ -1,202 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc43xx/bambino-200e/src/lpc43_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 - -#include -#include -#include - -#include - -#include "chip.h" - -#ifdef CONFIG_LPC43_SPIFI -# include -# include "lpc43_spifi.h" - -# ifdef CONFIG_SPFI_NXFFS -# include -# include -# endif -#endif - -#ifdef CONFIG_LPC43_SDMMC -# include -# include -# include "lpc43_sdmmc.h" -#endif - -#include "bambino-200e.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#ifndef CONFIG_SPIFI_DEVNO -# define CONFIG_SPIFI_DEVNO 0 -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nsh_spifi_initialize - * - * Description: - * Make the SPIFI (or part of it) into a block driver that can hold a - * file system. - * - ****************************************************************************/ - -#ifdef CONFIG_LPC43_SPIFI -static int nsh_spifi_initialize(void) -{ - struct mtd_dev_s *mtd; - int ret; - - /* Initialize the SPIFI interface and create the MTD driver instance */ - - mtd = lpc43_spifi_initialize(); - if (!mtd) - { - ferr("ERROR: lpc43_spifi_initialize failed\n"); - return -ENODEV; - } - -#ifndef CONFIG_SPFI_NXFFS - /* Register the MTD driver */ - - char path[32]; - snprintf(path, sizeof(path), "/dev/mtdblock%d", CONFIG_SPIFI_DEVNO); - ret = register_mtddriver(path, mtd, 0755, NULL); - if (ret < 0) - { - ferr("ERROR: Failed to register the MTD driver %s, ret %d\n", - path, ret); - return ret; - } -#else - /* Initialize to provide NXFFS on the MTD interface */ - - ret = nxffs_initialize(mtd); - if (ret < 0) - { - ferr("ERROR: NXFFS initialization failed: %d\n", ret); - return ret; - } - - /* Mount the file system at /mnt/spifi */ - - ret = nx_mount(NULL, "/mnt/spifi", "nxffs", 0, NULL); - if (ret < 0) - { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); - return ret; - } -#endif - - return OK; -} -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef HAVE_MMCSD - struct sdio_dev_s *sdmmc; -#endif - int ret = 0; - -#ifdef CONFIG_LPC43_SPIFI - /* Initialize the SPIFI block device */ - - ret = nsh_spifi_initialize(); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: nsh_spifi_initialize() failed: %d\n", ret); - } -#endif - -#ifdef HAVE_MMCSD - /* Get an instance of the SDIO interface */ - - sdmmc = lpc43_sdmmc_initialize(0); - if (!sdmmc) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SD/MMC\n"); - } - else - { - /* Bind the SDIO interface to the MMC/SD driver */ - - ret = mmcsd_slotinitialize(MMCSD_MINOR, sdmmc); - if (ret != OK) - { - syslog(LOG_ERR, - "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", - ret); - } - } -#endif - -#ifdef CONFIG_TIMER - /* Registers the timers */ - - lpc43_timerinitialize(); -#endif - - return ret; -} diff --git a/boards/arm/lpc43xx/bambino-200e/src/lpc43_boot.c b/boards/arm/lpc43xx/bambino-200e/src/lpc43_boot.c index e49cd74ad64..70f95ee2cff 100644 --- a/boards/arm/lpc43xx/bambino-200e/src/lpc43_boot.c +++ b/boards/arm/lpc43xx/bambino-200e/src/lpc43_boot.c @@ -28,11 +28,42 @@ #include +#include +#include +#include + #include #include +#ifdef CONFIG_LPC43_SPIFI +# include +# include "lpc43_spifi.h" + +# ifdef CONFIG_SPFI_NXFFS +# include +# include +# endif +#endif + +#ifdef CONFIG_LPC43_SDMMC +# include +# include +# include "lpc43_sdmmc.h" +#endif + #include "arm_internal.h" #include "bambino-200e.h" +#include "chip.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +#ifndef CONFIG_SPIFI_DEVNO +# define CONFIG_SPIFI_DEVNO 0 +#endif /**************************************************************************** * Private Types @@ -50,6 +81,70 @@ enum ssp_channel_e SSP1 }; +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nsh_spifi_initialize + * + * Description: + * Make the SPIFI (or part of it) into a block driver that can hold a + * file system. + * + ****************************************************************************/ + +#ifdef CONFIG_LPC43_SPIFI +static int nsh_spifi_initialize(void) +{ + struct mtd_dev_s *mtd; + int ret; + + /* Initialize the SPIFI interface and create the MTD driver instance */ + + mtd = lpc43_spifi_initialize(); + if (!mtd) + { + ferr("ERROR: lpc43_spifi_initialize failed\n"); + return -ENODEV; + } + +#ifndef CONFIG_SPFI_NXFFS + /* Register the MTD driver */ + + char path[32]; + snprintf(path, sizeof(path), "/dev/mtdblock%d", CONFIG_SPIFI_DEVNO); + ret = register_mtddriver(path, mtd, 0755, NULL); + if (ret < 0) + { + ferr("ERROR: Failed to register the MTD driver %s, ret %d\n", + path, ret); + return ret; + } +#else + /* Initialize to provide NXFFS on the MTD interface */ + + ret = nxffs_initialize(mtd); + if (ret < 0) + { + ferr("ERROR: NXFFS initialization failed: %d\n", ret); + return ret; + } + + /* Mount the file system at /mnt/spifi */ + + ret = nx_mount(NULL, "/mnt/spifi", "nxffs", 0, NULL); + if (ret < 0) + { + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); + return ret; + } +#endif + + return OK; +} +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -103,10 +198,14 @@ void lpc43_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { + int ret = 0; +#ifdef HAVE_MMCSD + struct sdio_dev_s *sdmmc; +#endif + /* Configure max31855 driver for SSP0 or SSP1 */ #if defined(CONFIG_SENSORS_MAX31855) - int ret; #if defined(CONFIG_LPC43_SSP0) ret = lpc43_max31855initialize("/dev/temp0", SSP0, DEVID0); @@ -136,5 +235,45 @@ void board_late_initialize(void) } #endif #endif + +#ifdef CONFIG_LPC43_SPIFI + /* Initialize the SPIFI block device */ + + ret = nsh_spifi_initialize(); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: nsh_spifi_initialize() failed: %d\n", ret); + } +#endif + +#ifdef HAVE_MMCSD + /* Get an instance of the SDIO interface */ + + sdmmc = lpc43_sdmmc_initialize(0); + if (!sdmmc) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SD/MMC\n"); + } + else + { + /* Bind the SDIO interface to the MMC/SD driver */ + + ret = mmcsd_slotinitialize(MMCSD_MINOR, sdmmc); + if (ret != OK) + { + syslog(LOG_ERR, + "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", + ret); + } + } +#endif + +#ifdef CONFIG_TIMER + /* Registers the timers */ + + lpc43_timerinitialize(); +#endif + + UNUSED(ret); } #endif diff --git a/boards/arm/lpc43xx/lpc4330-xplorer/src/CMakeLists.txt b/boards/arm/lpc43xx/lpc4330-xplorer/src/CMakeLists.txt index 1d2f2561dbe..034d77773d3 100644 --- a/boards/arm/lpc43xx/lpc4330-xplorer/src/CMakeLists.txt +++ b/boards/arm/lpc43xx/lpc4330-xplorer/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS lpc43_boot.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS lpc43_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS lpc43_autoleds.c) else() diff --git a/boards/arm/lpc43xx/lpc4330-xplorer/src/Makefile b/boards/arm/lpc43xx/lpc4330-xplorer/src/Makefile index cbdc736ec36..5315fbb8d8c 100644 --- a/boards/arm/lpc43xx/lpc4330-xplorer/src/Makefile +++ b/boards/arm/lpc43xx/lpc4330-xplorer/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = lpc43_boot.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc43_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += lpc43_autoleds.c else diff --git a/boards/arm/lpc43xx/lpc4330-xplorer/src/lpc43_appinit.c b/boards/arm/lpc43xx/lpc4330-xplorer/src/lpc43_appinit.c deleted file mode 100644 index 834f9497fb6..00000000000 --- a/boards/arm/lpc43xx/lpc4330-xplorer/src/lpc43_appinit.c +++ /dev/null @@ -1,155 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc43xx/lpc4330-xplorer/src/lpc43_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 - -#include -#include -#include - -#include - -#include "chip.h" - -#ifdef CONFIG_LPC43_SPIFI -# include -# include "lpc43_spifi.h" - -# ifdef CONFIG_SPFI_NXFFS -# include -# include -# endif -#endif - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#ifndef CONFIG_SPIFI_DEVNO -# define CONFIG_SPIFI_DEVNO 0 -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nsh_spifi_initialize - * - * Description: - * Make the SPIFI (or part of it) into a block driver that can hold a - * file system. - * - ****************************************************************************/ - -#ifdef CONFIG_LPC43_SPIFI -static int nsh_spifi_initialize(void) -{ - struct mtd_dev_s *mtd; - int ret; - - /* Initialize the SPIFI interface and create the MTD driver instance */ - - mtd = lpc43_spifi_initialize(); - if (!mtd) - { - ferr("ERROR: lpc43_spifi_initialize failed\n"); - return -ENODEV; - } - -#ifndef CONFIG_SPFI_NXFFS - /* Register the MTD driver */ - - char path[32]; - snprintf(path, sizeof(path), "/dev/mtdblock%d", CONFIG_SPIFI_DEVNO); - ret = register_mtddriver(path, mtd, 0755, NULL); - if (ret < 0) - { - ferr("ERROR: Failed to register the MTD driver %s, ret %d\n", - path, ret); - return ret; - } -#else - /* Initialize to provide NXFFS on the MTD interface */ - - ret = nxffs_initialize(mtd); - if (ret < 0) - { - ferr("ERROR: NXFFS initialization failed: %d\n", ret); - return ret; - } - - /* Mount the file system at /mnt/spifi */ - - ret = nx_mount(NULL, "/mnt/spifi", "nxffs", 0, NULL); - if (ret < 0) - { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); - return ret; - } -#endif - - return OK; -} -#else -# define nsh_spifi_initialize() (OK) -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ - /* Initialize the SPIFI block device */ - - return nsh_spifi_initialize(); -} diff --git a/boards/arm/lpc43xx/lpc4330-xplorer/src/lpc43_boot.c b/boards/arm/lpc43xx/lpc4330-xplorer/src/lpc43_boot.c index 8087ca9c7fd..1e33e0c9559 100644 --- a/boards/arm/lpc43xx/lpc4330-xplorer/src/lpc43_boot.c +++ b/boards/arm/lpc43xx/lpc4330-xplorer/src/lpc43_boot.c @@ -28,20 +28,104 @@ #include +#include +#include +#include + #include #include #include "arm_internal.h" #include "lpc4330-xplorer.h" +#include "chip.h" + +#ifdef CONFIG_LPC43_SPIFI +# include +# include "lpc43_spifi.h" + +# ifdef CONFIG_SPFI_NXFFS +# include +# include +# endif +#endif + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +#ifndef CONFIG_SPIFI_DEVNO +# define CONFIG_SPIFI_DEVNO 0 +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: nsh_spifi_initialize + * + * Description: + * Make the SPIFI (or part of it) into a block driver that can hold a + * file system. + * + ****************************************************************************/ + +#ifdef CONFIG_LPC43_SPIFI +static int nsh_spifi_initialize(void) +{ + struct mtd_dev_s *mtd; + int ret; + + /* Initialize the SPIFI interface and create the MTD driver instance */ + + mtd = lpc43_spifi_initialize(); + if (!mtd) + { + ferr("ERROR: lpc43_spifi_initialize failed\n"); + return -ENODEV; + } + +#ifndef CONFIG_SPFI_NXFFS + /* Register the MTD driver */ + + char path[32]; + snprintf(path, sizeof(path), "/dev/mtdblock%d", CONFIG_SPIFI_DEVNO); + ret = register_mtddriver(path, mtd, 0755, NULL); + if (ret < 0) + { + ferr("ERROR: Failed to register the MTD driver %s, ret %d\n", + path, ret); + return ret; + } +#else + /* Initialize to provide NXFFS on the MTD interface */ + + ret = nxffs_initialize(mtd); + if (ret < 0) + { + ferr("ERROR: NXFFS initialization failed: %d\n", ret); + return ret; + } + + /* Mount the file system at /mnt/spifi */ + + ret = nx_mount(NULL, "/mnt/spifi", "nxffs", 0, NULL); + if (ret < 0) + { + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); + return ret; + } +#endif + + return OK; +} +#else +# define nsh_spifi_initialize() +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -65,3 +149,26 @@ void lpc43_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) +{ + /* Initialize the SPIFI block device */ + + nsh_spifi_initialize(); +} +#endif diff --git a/boards/arm/lpc43xx/lpc4337-ws/src/CMakeLists.txt b/boards/arm/lpc43xx/lpc4337-ws/src/CMakeLists.txt index 2ce331a9d83..168db0f9b55 100644 --- a/boards/arm/lpc43xx/lpc4337-ws/src/CMakeLists.txt +++ b/boards/arm/lpc43xx/lpc4337-ws/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS lpc43_boot.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS lpc43_appinit.c) -endif() - if(CONFIG_LPC43_ADC0) list(APPEND SRCS lpc43_adc.c) endif() diff --git a/boards/arm/lpc43xx/lpc4337-ws/src/Makefile b/boards/arm/lpc43xx/lpc4337-ws/src/Makefile index c1a804b79cd..038e5b07d76 100644 --- a/boards/arm/lpc43xx/lpc4337-ws/src/Makefile +++ b/boards/arm/lpc43xx/lpc4337-ws/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = lpc43_boot.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc43_appinit.c -endif - ifeq ($(CONFIG_LPC43_ADC0),y) CSRCS += lpc43_adc.c endif diff --git a/boards/arm/lpc43xx/lpc4337-ws/src/lpc43_appinit.c b/boards/arm/lpc43xx/lpc4337-ws/src/lpc43_appinit.c deleted file mode 100644 index 9c16715e50f..00000000000 --- a/boards/arm/lpc43xx/lpc4337-ws/src/lpc43_appinit.c +++ /dev/null @@ -1,144 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc43xx/lpc4337-ws/src/lpc43_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 - -#include -#include -#include - -#include -#include - -#include "chip.h" -#include "lpc43_i2c.h" -#include "lpc4337-ws.h" - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: lpc43_i2c_register - * - * Description: - * Register one I2C drivers for the I2C tool. - * - ****************************************************************************/ - -#ifdef HAVE_I2CTOOL -static void lpc43_i2c_register(int bus) -{ - struct i2c_master_s *i2c; - int ret; - - i2c = lpc43_i2cbus_initialize(bus); - if (i2c == NULL) - { - _err("ERROR: Failed to get I2C%d interface\n", bus); - } - else - { - ret = i2c_register(i2c, bus); - if (ret < 0) - { - _err("ERROR: Failed to register I2C%d driver: %d\n", bus, ret); - lpc43_i2cbus_uninitialize(i2c); - } - } -} -#endif - -/**************************************************************************** - * Name: lpc43_i2ctool - * - * Description: - * Register I2C drivers for the I2C tool. - * - ****************************************************************************/ - -#ifdef HAVE_I2CTOOL -static void lpc43_i2ctool(void) -{ -#ifdef CONFIG_LPC43_I2C0 - lpc43_i2c_register(0); -#endif -#ifdef CONFIG_STM32_I2C1 - lpc43_i2c_register(1); -#endif -} -#else -# define lpc43_i2ctool() -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ - int ret; - - /* Register I2C drivers on behalf of the I2C tool */ - - lpc43_i2ctool(); - -#ifdef CONFIG_LPC43_ADC0 - /* Initialize ADC and register the ADC driver. */ - - ret = lpc43_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: lpc43_adc_setup failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/lpc43xx/lpc4337-ws/src/lpc43_boot.c b/boards/arm/lpc43xx/lpc4337-ws/src/lpc43_boot.c index 992add3a91d..fbe13657ba5 100644 --- a/boards/arm/lpc43xx/lpc4337-ws/src/lpc43_boot.c +++ b/boards/arm/lpc43xx/lpc4337-ws/src/lpc43_boot.c @@ -28,11 +28,73 @@ #include +#include +#include + #include #include +#include #include "arm_internal.h" #include "lpc4337-ws.h" +#include "lpc43_i2c.h" + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lpc43_i2c_register + * + * Description: + * Register one I2C drivers for the I2C tool. + * + ****************************************************************************/ + +#ifdef HAVE_I2CTOOL +static void lpc43_i2c_register(int bus) +{ + struct i2c_master_s *i2c; + int ret; + + i2c = lpc43_i2cbus_initialize(bus); + if (i2c == NULL) + { + _err("ERROR: Failed to get I2C%d interface\n", bus); + } + else + { + ret = i2c_register(i2c, bus); + if (ret < 0) + { + _err("ERROR: Failed to register I2C%d driver: %d\n", bus, ret); + lpc43_i2cbus_uninitialize(i2c); + } + } +} +#endif + +/**************************************************************************** + * Name: lpc43_i2ctool + * + * Description: + * Register I2C drivers for the I2C tool. + * + ****************************************************************************/ + +#ifdef HAVE_I2CTOOL +static void lpc43_i2ctool(void) +{ +#ifdef CONFIG_LPC43_I2C0 + lpc43_i2c_register(0); +#endif +#ifdef CONFIG_STM32_I2C1 + lpc43_i2c_register(1); +#endif +} +#else +# define lpc43_i2ctool() +#endif /**************************************************************************** * Public Functions @@ -52,3 +114,40 @@ void lpc43_boardinitialize(void) { } + +/**************************************************************************** + * 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) +{ + int ret; + + /* Register I2C drivers on behalf of the I2C tool */ + + lpc43_i2ctool(); + +#ifdef CONFIG_LPC43_ADC0 + /* Initialize ADC and register the ADC driver. */ + + ret = lpc43_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: lpc43_adc_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); +} +#endif diff --git a/boards/arm/lpc43xx/lpc4357-evb/src/CMakeLists.txt b/boards/arm/lpc43xx/lpc4357-evb/src/CMakeLists.txt index 02b9c39a4a7..fafe257adbe 100644 --- a/boards/arm/lpc43xx/lpc4357-evb/src/CMakeLists.txt +++ b/boards/arm/lpc43xx/lpc4357-evb/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS lpc43_boot.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS lpc43_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS lpc43_autoleds.c) else() diff --git a/boards/arm/lpc43xx/lpc4357-evb/src/Makefile b/boards/arm/lpc43xx/lpc4357-evb/src/Makefile index 600ca5b5a7c..1a77032944d 100644 --- a/boards/arm/lpc43xx/lpc4357-evb/src/Makefile +++ b/boards/arm/lpc43xx/lpc4357-evb/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = lpc43_boot.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc43_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += lpc43_autoleds.c else diff --git a/boards/arm/lpc43xx/lpc4357-evb/src/lpc43_appinit.c b/boards/arm/lpc43xx/lpc4357-evb/src/lpc43_appinit.c deleted file mode 100644 index 7bf5fdb903d..00000000000 --- a/boards/arm/lpc43xx/lpc4357-evb/src/lpc43_appinit.c +++ /dev/null @@ -1,155 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc43xx/lpc4357-evb/src/lpc43_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 - -#include -#include -#include - -#include - -#include "chip.h" - -#ifdef CONFIG_LPC43_SPIFI -# include -# include "lpc43_spifi.h" - -# ifdef CONFIG_SPFI_NXFFS -# include -# include -# endif -#endif - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#ifndef CONFIG_SPIFI_DEVNO -# define CONFIG_SPIFI_DEVNO 0 -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nsh_spifi_initialize - * - * Description: - * Make the SPIFI (or part of it) into a block driver that can hold a - * file system. - * - ****************************************************************************/ - -#ifdef CONFIG_LPC43_SPIFI -static int nsh_spifi_initialize(void) -{ - struct mtd_dev_s *mtd; - int ret; - - /* Initialize the SPIFI interface and create the MTD driver instance */ - - mtd = lpc43_spifi_initialize(); - if (!mtd) - { - ferr("ERROR: lpc43_spifi_initialize failed\n"); - return -ENODEV; - } - -#ifndef CONFIG_SPFI_NXFFS - /* Register the MTD driver */ - - char path[32]; - snprintf(path, sizeof(path), "/dev/mtdblock%d", CONFIG_SPIFI_DEVNO); - ret = register_mtddriver(path, mtd, 0755, NULL); - if (ret < 0) - { - ferr("ERROR: Failed to register the MTD driver %s, ret %d\n", - path, ret); - return ret; - } -#else - /* Initialize to provide NXFFS on the MTD interface */ - - ret = nxffs_initialize(mtd); - if (ret < 0) - { - ferr("ERROR: NXFFS initialization failed: %d\n", ret); - return ret; - } - - /* Mount the file system at /mnt/spifi */ - - ret = nx_mount(NULL, "/mnt/spifi", "nxffs", 0, NULL); - if (ret < 0) - { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); - return ret; - } -#endif - - return OK; -} -#else -# define nsh_spifi_initialize() (OK) -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ - /* Initialize the SPIFI block device */ - - return nsh_spifi_initialize(); -} diff --git a/boards/arm/lpc43xx/lpc4357-evb/src/lpc43_boot.c b/boards/arm/lpc43xx/lpc4357-evb/src/lpc43_boot.c index cffb488910a..427468167d6 100644 --- a/boards/arm/lpc43xx/lpc4357-evb/src/lpc43_boot.c +++ b/boards/arm/lpc43xx/lpc4357-evb/src/lpc43_boot.c @@ -28,20 +28,102 @@ #include +#include +#include + #include #include #include "arm_internal.h" #include "lpc4357-evb.h" +#include "chip.h" + +#ifdef CONFIG_LPC43_SPIFI +# include +# include "lpc43_spifi.h" + +# ifdef CONFIG_SPFI_NXFFS +# include +# include +# endif +#endif /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +#ifndef CONFIG_SPIFI_DEVNO +# define CONFIG_SPIFI_DEVNO 0 +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: nsh_spifi_initialize + * + * Description: + * Make the SPIFI (or part of it) into a block driver that can hold a + * file system. + * + ****************************************************************************/ + +#ifdef CONFIG_LPC43_SPIFI +static int nsh_spifi_initialize(void) +{ + struct mtd_dev_s *mtd; + int ret; + + /* Initialize the SPIFI interface and create the MTD driver instance */ + + mtd = lpc43_spifi_initialize(); + if (!mtd) + { + ferr("ERROR: lpc43_spifi_initialize failed\n"); + return -ENODEV; + } + +#ifndef CONFIG_SPFI_NXFFS + /* Register the MTD driver */ + + char path[32]; + snprintf(path, sizeof(path), "/dev/mtdblock%d", CONFIG_SPIFI_DEVNO); + ret = register_mtddriver(path, mtd, 0755, NULL); + if (ret < 0) + { + ferr("ERROR: Failed to register the MTD driver %s, ret %d\n", + path, ret); + return ret; + } +#else + /* Initialize to provide NXFFS on the MTD interface */ + + ret = nxffs_initialize(mtd); + if (ret < 0) + { + ferr("ERROR: NXFFS initialization failed: %d\n", ret); + return ret; + } + + /* Mount the file system at /mnt/spifi */ + + ret = nx_mount(NULL, "/mnt/spifi", "nxffs", 0, NULL); + if (ret < 0) + { + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); + return ret; + } +#endif + + return OK; +} +#else +# define nsh_spifi_initialize() +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -65,3 +147,26 @@ void lpc43_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) +{ + /* Initialize the SPIFI block device */ + + nsh_spifi_initialize(); +} +#endif diff --git a/boards/arm/lpc43xx/lpc4370-link2/src/CMakeLists.txt b/boards/arm/lpc43xx/lpc4370-link2/src/CMakeLists.txt index fe6e5d60489..866a35f00b8 100644 --- a/boards/arm/lpc43xx/lpc4370-link2/src/CMakeLists.txt +++ b/boards/arm/lpc43xx/lpc4370-link2/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS lpc43_boot.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS lpc43_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS lpc43_autoleds.c) else() diff --git a/boards/arm/lpc43xx/lpc4370-link2/src/Makefile b/boards/arm/lpc43xx/lpc4370-link2/src/Makefile index d5c93b7aeea..2597a600ca1 100644 --- a/boards/arm/lpc43xx/lpc4370-link2/src/Makefile +++ b/boards/arm/lpc43xx/lpc4370-link2/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = lpc43_boot.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc43_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += lpc43_autoleds.c else diff --git a/boards/arm/lpc43xx/lpc4370-link2/src/lpc43_appinit.c b/boards/arm/lpc43xx/lpc4370-link2/src/lpc43_appinit.c deleted file mode 100644 index bc4ed6b486a..00000000000 --- a/boards/arm/lpc43xx/lpc4370-link2/src/lpc43_appinit.c +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc43xx/lpc4370-link2/src/lpc43_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 - -#include -#include -#include - -#include -#include - -#include "lpc43_i2c.h" -#include "chip.h" - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: lpc43_i2c_register - * - * Description: - * Register one I2C drivers for the I2C tool. - * - ****************************************************************************/ - -#ifdef HAVE_I2CTOOL -static void lpc43_i2c_register(int bus) -{ - struct i2c_master_s *i2c; - int ret; - - i2c = lpc43_i2cbus_initialize(bus); - if (i2c == NULL) - { - _err("ERROR: Failed to get I2C%d interface\n", bus); - } - else - { - ret = i2c_register(i2c, bus); - if (ret < 0) - { - _err("ERROR: Failed to register I2C%d driver: %d\n", bus, ret); - lpc43_i2cbus_uninitialize(i2c); - } - } -} -#endif - -/**************************************************************************** - * Name: lpc43_i2ctool - * - * Description: - * Register I2C drivers for the I2C tool. - * - ****************************************************************************/ - -#ifdef HAVE_I2CTOOL -static void lpc43_i2ctool(void) -{ -#ifdef CONFIG_LPC43_I2C0 - lpc43_i2c_register(0); -#endif -#ifdef CONFIG_STM32_I2C1 - lpc43_i2c_register(1); -#endif -} -#else -# define lpc43_i2ctool() -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ - int ret; - - /* Register I2C drivers on behalf of the I2C tool */ - - lpc43_i2ctool(); - -#ifdef CONFIG_ADC - /* Initialize ADC and register the ADC driver. */ - - ret = lpc43_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: lpc43_adc_setup failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/lpc43xx/lpc4370-link2/src/lpc43_boot.c b/boards/arm/lpc43xx/lpc4370-link2/src/lpc43_boot.c index 5996b567104..02d77d42f07 100644 --- a/boards/arm/lpc43xx/lpc4370-link2/src/lpc43_boot.c +++ b/boards/arm/lpc43xx/lpc4370-link2/src/lpc43_boot.c @@ -28,11 +28,17 @@ #include +#include +#include + #include +#include #include #include "arm_internal.h" #include "lpc4370-link2.h" +#include "lpc43_i2c.h" +#include "chip.h" /**************************************************************************** * Pre-processor Definitions @@ -42,6 +48,60 @@ * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: lpc43_i2c_register + * + * Description: + * Register one I2C drivers for the I2C tool. + * + ****************************************************************************/ + +#ifdef HAVE_I2CTOOL +static void lpc43_i2c_register(int bus) +{ + struct i2c_master_s *i2c; + int ret; + + i2c = lpc43_i2cbus_initialize(bus); + if (i2c == NULL) + { + _err("ERROR: Failed to get I2C%d interface\n", bus); + } + else + { + ret = i2c_register(i2c, bus); + if (ret < 0) + { + _err("ERROR: Failed to register I2C%d driver: %d\n", bus, ret); + lpc43_i2cbus_uninitialize(i2c); + } + } +} +#endif + +/**************************************************************************** + * Name: lpc43_i2ctool + * + * Description: + * Register I2C drivers for the I2C tool. + * + ****************************************************************************/ + +#ifdef HAVE_I2CTOOL +static void lpc43_i2ctool(void) +{ +#ifdef CONFIG_LPC43_I2C0 + lpc43_i2c_register(0); +#endif +#ifdef CONFIG_STM32_I2C1 + lpc43_i2c_register(1); +#endif +} +#else +# define lpc43_i2ctool() +#endif + + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -69,3 +129,40 @@ void lpc43_boardinitialize(void) board_spifi_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) +{ + int ret; + + /* Register I2C drivers on behalf of the I2C tool */ + + lpc43_i2ctool(); + +#ifdef CONFIG_ADC + /* Initialize ADC and register the ADC driver. */ + + ret = lpc43_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: lpc43_adc_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); +} +#endif diff --git a/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/CMakeLists.txt b/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/CMakeLists.txt index b932a0b0930..f93328ff05d 100644 --- a/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/CMakeLists.txt +++ b/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/CMakeLists.txt @@ -30,10 +30,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS lpc54_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS lpc54_appinit.c) -endif() - if(CONFIG_LPC54_HAVE_I2C_MASTER) list(APPEND SRCS lpc54_i2c.c) endif() diff --git a/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/Makefile b/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/Makefile index 009d42a342f..14ad685a24d 100644 --- a/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/Makefile +++ b/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/Makefile @@ -32,10 +32,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += lpc54_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lpc54_appinit.c -endif - ifeq ($(CONFIG_LPC54_HAVE_I2C_MASTER),y) CSRCS += lpc54_i2c.c endif diff --git a/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/lpc54_appinit.c b/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/lpc54_appinit.c deleted file mode 100644 index bd0bdd14a8f..00000000000 --- a/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/lpc54_appinit.c +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** - * boards/arm/lpc54xx/lpcxpresso-lpc54628/src/lpc54_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 - -#include - -#include - -#include "lpcxpresso-lpc54628.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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return lpc54_bringup(); -#endif -} diff --git a/boards/arm/max326xx/max32660-evsys/src/CMakeLists.txt b/boards/arm/max326xx/max32660-evsys/src/CMakeLists.txt index b4f41b01450..de109b1b896 100644 --- a/boards/arm/max326xx/max32660-evsys/src/CMakeLists.txt +++ b/boards/arm/max326xx/max32660-evsys/src/CMakeLists.txt @@ -22,9 +22,7 @@ set(SRCS max326_boot.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS max326_appinit.c max326_bringup.c) -elseif(CONFIG_BOARD_LATE_INITIALIZE) +if(CONFIG_BOARD_LATE_INITIALIZE) list(APPEND SRCS max326_bringup.c) endif() diff --git a/boards/arm/max326xx/max32660-evsys/src/Makefile b/boards/arm/max326xx/max32660-evsys/src/Makefile index 92d9b61070d..d29c81fdc6a 100644 --- a/boards/arm/max326xx/max32660-evsys/src/Makefile +++ b/boards/arm/max326xx/max32660-evsys/src/Makefile @@ -22,13 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = max326_boot.c - -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += max326_appinit.c max326_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += max326_bringup.c -endif +CSRCS = max326_boot.c max326_bringup.c ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += max326_autoleds.c diff --git a/boards/arm/max326xx/max32660-evsys/src/max326_appinit.c b/boards/arm/max326xx/max32660-evsys/src/max326_appinit.c deleted file mode 100644 index 2be1d57aac8..00000000000 --- a/boards/arm/max326xx/max32660-evsys/src/max326_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/max326xx/max32660-evsys/src/max326_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 - -#include - -#include - -#include "max32660-evsys.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return max326_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/mcx-nxxx/frdm-mcxn236/src/CMakeLists.txt b/boards/arm/mcx-nxxx/frdm-mcxn236/src/CMakeLists.txt index d48fb5c901d..1af7cb40be5 100644 --- a/boards/arm/mcx-nxxx/frdm-mcxn236/src/CMakeLists.txt +++ b/boards/arm/mcx-nxxx/frdm-mcxn236/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS n23x_boardinit.c n23x_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS n23x_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld") diff --git a/boards/arm/mcx-nxxx/frdm-mcxn236/src/Makefile b/boards/arm/mcx-nxxx/frdm-mcxn236/src/Makefile index b99b5913ff9..b8c695ea71c 100644 --- a/boards/arm/mcx-nxxx/frdm-mcxn236/src/Makefile +++ b/boards/arm/mcx-nxxx/frdm-mcxn236/src/Makefile @@ -24,8 +24,4 @@ include $(TOPDIR)/Make.defs CSRCS = n23x_boardinit.c n23x_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += n23x_appinit.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/mcx-nxxx/frdm-mcxn236/src/n23x_appinit.c b/boards/arm/mcx-nxxx/frdm-mcxn236/src/n23x_appinit.c deleted file mode 100644 index c026757f244..00000000000 --- a/boards/arm/mcx-nxxx/frdm-mcxn236/src/n23x_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/mcx-nxxx/frdm-mcxn236/src/n23x_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 -#include -#include - -#include "frdm-mcxn236.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) -{ - UNUSED(arg); -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return n23x_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/moxart/moxa/src/Makefile b/boards/arm/moxart/moxa/src/Makefile index f0fd79de854..11ceee4b22b 100644 --- a/boards/arm/moxart/moxa/src/Makefile +++ b/boards/arm/moxart/moxa/src/Makefile @@ -24,11 +24,8 @@ include $(TOPDIR)/Make.defs CSRCS = moxart_boot.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += moxart_appinit.c ifeq ($(CONFIG_BOARDCTL_RESET),y) CSRCS += moxart_reset.c endif -endif include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/moxart/moxa/src/moxart_appinit.c b/boards/arm/moxart/moxa/src/moxart_appinit.c deleted file mode 100644 index cf791972ccb..00000000000 --- a/boards/arm/moxart/moxa/src/moxart_appinit.c +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** - * boards/arm/moxart/moxa/src/moxart_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 - -#include -#include -#include -#include - -#include -#include - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * CONFIG_BOARDCTL=y : - * Called from the NSH library - * - * CONFIG_BOARD_LATE_INITIALIZE=y, CONFIG_NSH_LIBRARY=y, && - * CONFIG_BOARDCTL=n : - * Called from board_late_initialize(). - * - * 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 -#ifdef CONFIG_NET_FTMAC100 - /* Perform board-specific initialization */ - - ftintc010_set_trig_mode(CONFIG_FTMAC100_IRQ, 0); - ftintc010_set_trig_level(CONFIG_FTMAC100_IRQ, 0); - - ftmac100_initialize(0); -#endif -#endif - return OK; -} diff --git a/boards/arm/mps/mps2-an500/src/mps2_bringup.c b/boards/arm/mps/mps2-an500/src/mps2_bringup.c index 4c3a659cebd..8eca0570518 100644 --- a/boards/arm/mps/mps2-an500/src/mps2_bringup.c +++ b/boards/arm/mps/mps2-an500/src/mps2_bringup.c @@ -101,41 +101,3 @@ void board_late_initialize(void) mps2_bringup(); } #endif /* CONFIG_BOARD_LATE_INITIALIZE */ - -/**************************************************************************** - * 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) -{ - UNUSED(arg); -#ifndef CONFIG_BOARD_LATE_INITIALIZE - - /* Perform board initialization */ - - return mps2_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/mps/mps2-an521/src/mps2_bringup.c b/boards/arm/mps/mps2-an521/src/mps2_bringup.c index cd2d13710de..e5bcb5a5780 100644 --- a/boards/arm/mps/mps2-an521/src/mps2_bringup.c +++ b/boards/arm/mps/mps2-an521/src/mps2_bringup.c @@ -101,41 +101,3 @@ void board_late_initialize(void) mps2_bringup(); } #endif /* CONFIG_BOARD_LATE_INITIALIZE */ - -/**************************************************************************** - * 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) -{ - UNUSED(arg); -#ifndef CONFIG_BOARD_LATE_INITIALIZE - - /* Perform board initialization */ - - return mps2_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/mps/mps3-an547/src/mps3_bringup.c b/boards/arm/mps/mps3-an547/src/mps3_bringup.c index c76695952ad..5c7edfb523c 100644 --- a/boards/arm/mps/mps3-an547/src/mps3_bringup.c +++ b/boards/arm/mps/mps3-an547/src/mps3_bringup.c @@ -200,42 +200,3 @@ void board_late_initialize(void) mps3_bringup(); } #endif /* CONFIG_BOARD_LATE_INITIALIZE */ - -/**************************************************************************** - * 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) -{ - UNUSED(arg); -#ifndef CONFIG_BOARD_LATE_INITIALIZE - - /* Perform board initialization */ - - return mps3_bringup(); -#else - return OK; -#endif -} - diff --git a/boards/arm/mx8mp/verdin-mx8mp/src/CMakeLists.txt b/boards/arm/mx8mp/verdin-mx8mp/src/CMakeLists.txt index 7f0460c4299..18e37d3afe6 100644 --- a/boards/arm/mx8mp/verdin-mx8mp/src/CMakeLists.txt +++ b/boards/arm/mx8mp/verdin-mx8mp/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS mx8mp_boot.c mx8mp_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS mx8mp_appinit.c) -endif() - if(CONFIG_SENSORS_INA219) list(APPEND SRCS mx8mp_ina219.c) endif() diff --git a/boards/arm/mx8mp/verdin-mx8mp/src/Makefile b/boards/arm/mx8mp/verdin-mx8mp/src/Makefile index 0adcfdbf255..5405401e0c0 100644 --- a/boards/arm/mx8mp/verdin-mx8mp/src/Makefile +++ b/boards/arm/mx8mp/verdin-mx8mp/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = mx8mp_boot.c mx8mp_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) - CSRCS += mx8mp_appinit.c -endif - ifeq ($(CONFIG_SENSORS_INA219),y) CSRCS += mx8mp_ina219.c endif diff --git a/boards/arm/mx8mp/verdin-mx8mp/src/mx8mp_appinit.c b/boards/arm/mx8mp/verdin-mx8mp/src/mx8mp_appinit.c deleted file mode 100644 index 3b7b4d1f968..00000000000 --- a/boards/arm/mx8mp/verdin-mx8mp/src/mx8mp_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/mx8mp/verdin-mx8mp/src/mx8mp_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 - -#include - -#include - -#include "verdin-mx8mp.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 mx8mp_bringup(); -#else - return OK; -#endif /* CONFIG_BOARD_LATE_INITIALIZE */ -} diff --git a/boards/arm/nrf52/arduino-nano-33ble-rev2/src/CMakeLists.txt b/boards/arm/nrf52/arduino-nano-33ble-rev2/src/CMakeLists.txt index 3f2416725b2..2a871feac7b 100644 --- a/boards/arm/nrf52/arduino-nano-33ble-rev2/src/CMakeLists.txt +++ b/boards/arm/nrf52/arduino-nano-33ble-rev2/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS nrf52_boot.c nrf52_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS nrf52_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS nrf52_autoleds.c) else() diff --git a/boards/arm/nrf52/arduino-nano-33ble-rev2/src/Make.defs b/boards/arm/nrf52/arduino-nano-33ble-rev2/src/Make.defs index 34cf5c8e741..88e0c7d5e43 100644 --- a/boards/arm/nrf52/arduino-nano-33ble-rev2/src/Make.defs +++ b/boards/arm/nrf52/arduino-nano-33ble-rev2/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = nrf52_boot.c nrf52_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += nrf52_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += nrf52_autoleds.c else diff --git a/boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_appinit.c b/boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_appinit.c deleted file mode 100644 index ed43d5f27e0..00000000000 --- a/boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_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 - -#include -#include -#include - -#include - -#include "chip.h" -#include "arduino-nano-33ble.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return nrf52_bringup(); -#endif -} diff --git a/boards/arm/nrf52/arduino-nano-33ble/src/CMakeLists.txt b/boards/arm/nrf52/arduino-nano-33ble/src/CMakeLists.txt index 7b2c9b748aa..7654bc698be 100644 --- a/boards/arm/nrf52/arduino-nano-33ble/src/CMakeLists.txt +++ b/boards/arm/nrf52/arduino-nano-33ble/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS nrf52_boot.c nrf52_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS nrf52_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS nrf52_autoleds.c) else() diff --git a/boards/arm/nrf52/arduino-nano-33ble/src/Make.defs b/boards/arm/nrf52/arduino-nano-33ble/src/Make.defs index b61c4e963cd..33bc31d992e 100644 --- a/boards/arm/nrf52/arduino-nano-33ble/src/Make.defs +++ b/boards/arm/nrf52/arduino-nano-33ble/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = nrf52_boot.c nrf52_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += nrf52_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += nrf52_autoleds.c else diff --git a/boards/arm/nrf52/arduino-nano-33ble/src/nrf52_appinit.c b/boards/arm/nrf52/arduino-nano-33ble/src/nrf52_appinit.c deleted file mode 100644 index 29543e1d816..00000000000 --- a/boards/arm/nrf52/arduino-nano-33ble/src/nrf52_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/nrf52/arduino-nano-33ble/src/nrf52_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 - -#include -#include -#include - -#include - -#include "chip.h" -#include "arduino-nano-33ble.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return nrf52_bringup(); -#endif -} diff --git a/boards/arm/nrf52/nrf52-feather/src/CMakeLists.txt b/boards/arm/nrf52/nrf52-feather/src/CMakeLists.txt index 62b276ebc58..cac51d999c4 100644 --- a/boards/arm/nrf52/nrf52-feather/src/CMakeLists.txt +++ b/boards/arm/nrf52/nrf52-feather/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS nrf52_boot.c nrf52_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS nrf52_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS nrf52_autoleds.c) else() diff --git a/boards/arm/nrf52/nrf52-feather/src/Make.defs b/boards/arm/nrf52/nrf52-feather/src/Make.defs index 97eec9d9e92..fb258be5675 100644 --- a/boards/arm/nrf52/nrf52-feather/src/Make.defs +++ b/boards/arm/nrf52/nrf52-feather/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = nrf52_boot.c nrf52_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += nrf52_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += nrf52_autoleds.c else diff --git a/boards/arm/nrf52/nrf52-feather/src/nrf52_appinit.c b/boards/arm/nrf52/nrf52-feather/src/nrf52_appinit.c deleted file mode 100644 index 8ca3fbd21be..00000000000 --- a/boards/arm/nrf52/nrf52-feather/src/nrf52_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/nrf52/nrf52-feather/src/nrf52_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 - -#include -#include -#include - -#include - -#include "chip.h" -#include "nrf52-feather.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return nrf52_bringup(); -#endif -} diff --git a/boards/arm/nrf52/nrf52832-dk/src/CMakeLists.txt b/boards/arm/nrf52/nrf52832-dk/src/CMakeLists.txt index c2ca172e09d..3faab90f6be 100644 --- a/boards/arm/nrf52/nrf52832-dk/src/CMakeLists.txt +++ b/boards/arm/nrf52/nrf52832-dk/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS nrf52_boot.c nrf52_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS nrf52_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS nrf52_autoleds.c) else() diff --git a/boards/arm/nrf52/nrf52832-dk/src/Make.defs b/boards/arm/nrf52/nrf52832-dk/src/Make.defs index e8817659f96..2b20da6adaf 100644 --- a/boards/arm/nrf52/nrf52832-dk/src/Make.defs +++ b/boards/arm/nrf52/nrf52832-dk/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = nrf52_boot.c nrf52_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += nrf52_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += nrf52_autoleds.c else diff --git a/boards/arm/nrf52/nrf52832-dk/src/nrf52_appinit.c b/boards/arm/nrf52/nrf52832-dk/src/nrf52_appinit.c deleted file mode 100644 index d3bc29966f1..00000000000 --- a/boards/arm/nrf52/nrf52832-dk/src/nrf52_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/nrf52/nrf52832-dk/src/nrf52_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 - -#include -#include -#include - -#include - -#include "chip.h" -#include "nrf52832-dk.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return nrf52_bringup(); -#endif -} diff --git a/boards/arm/nrf52/nrf52832-mdk/src/CMakeLists.txt b/boards/arm/nrf52/nrf52832-mdk/src/CMakeLists.txt index a2ae45718ed..f015a0996d3 100644 --- a/boards/arm/nrf52/nrf52832-mdk/src/CMakeLists.txt +++ b/boards/arm/nrf52/nrf52832-mdk/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS nrf52_boot.c nrf52_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS nrf52_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS nrf52_autoleds.c) endif() diff --git a/boards/arm/nrf52/nrf52832-mdk/src/Make.defs b/boards/arm/nrf52/nrf52832-mdk/src/Make.defs index c928f6ea0a8..2c1d21841ab 100644 --- a/boards/arm/nrf52/nrf52832-mdk/src/Make.defs +++ b/boards/arm/nrf52/nrf52832-mdk/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = nrf52_boot.c nrf52_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += nrf52_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += nrf52_autoleds.c endif diff --git a/boards/arm/nrf52/nrf52832-mdk/src/nrf52_appinit.c b/boards/arm/nrf52/nrf52832-mdk/src/nrf52_appinit.c deleted file mode 100644 index 24089685944..00000000000 --- a/boards/arm/nrf52/nrf52832-mdk/src/nrf52_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/nrf52/nrf52832-mdk/src/nrf52_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 - -#include -#include -#include - -#include - -#include "chip.h" -#include "nrf52832-mdk.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return nrf52_bringup(); -#endif -} diff --git a/boards/arm/nrf52/nrf52832-sparkfun/src/CMakeLists.txt b/boards/arm/nrf52/nrf52832-sparkfun/src/CMakeLists.txt index 979d808c74e..c2a54475554 100644 --- a/boards/arm/nrf52/nrf52832-sparkfun/src/CMakeLists.txt +++ b/boards/arm/nrf52/nrf52832-sparkfun/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS nrf52_boot.c nrf52_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS nrf52_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS nrf52_autoleds.c) endif() diff --git a/boards/arm/nrf52/nrf52832-sparkfun/src/Make.defs b/boards/arm/nrf52/nrf52832-sparkfun/src/Make.defs index 9ca77094bb2..fb9c5b42193 100644 --- a/boards/arm/nrf52/nrf52832-sparkfun/src/Make.defs +++ b/boards/arm/nrf52/nrf52832-sparkfun/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = nrf52_boot.c nrf52_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += nrf52_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += nrf52_autoleds.c endif diff --git a/boards/arm/nrf52/nrf52832-sparkfun/src/nrf52_appinit.c b/boards/arm/nrf52/nrf52832-sparkfun/src/nrf52_appinit.c deleted file mode 100644 index cfa3aa199e8..00000000000 --- a/boards/arm/nrf52/nrf52832-sparkfun/src/nrf52_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/nrf52/nrf52832-sparkfun/src/nrf52_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 - -#include -#include -#include - -#include - -#include "chip.h" -#include "nrf52832-sparkfun.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return nrf52_bringup(); -#endif -} diff --git a/boards/arm/nrf52/nrf52840-dk/configs/highpri/defconfig b/boards/arm/nrf52/nrf52840-dk/configs/highpri/defconfig index a31839d123c..41d1d888e09 100644 --- a/boards/arm/nrf52/nrf52840-dk/configs/highpri/defconfig +++ b/boards/arm/nrf52/nrf52840-dk/configs/highpri/defconfig @@ -8,6 +8,7 @@ # CONFIG_ARCH_FPU is not set CONFIG_ARCH="arm" CONFIG_ARCH_BOARD="nrf52840-dk" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_NRF52840_DK=y CONFIG_ARCH_CHIP="nrf52" CONFIG_ARCH_CHIP_NRF52840=y diff --git a/boards/arm/nrf52/nrf52840-dk/src/CMakeLists.txt b/boards/arm/nrf52/nrf52840-dk/src/CMakeLists.txt index 3c970424884..15fc550a618 100644 --- a/boards/arm/nrf52/nrf52840-dk/src/CMakeLists.txt +++ b/boards/arm/nrf52/nrf52840-dk/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS nrf52_boot.c nrf52_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS nrf52_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS nrf52_autoleds.c) else() diff --git a/boards/arm/nrf52/nrf52840-dk/src/Make.defs b/boards/arm/nrf52/nrf52840-dk/src/Make.defs index 2de1ad31645..b31a20a2534 100644 --- a/boards/arm/nrf52/nrf52840-dk/src/Make.defs +++ b/boards/arm/nrf52/nrf52840-dk/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = nrf52_boot.c nrf52_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += nrf52_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += nrf52_autoleds.c else diff --git a/boards/arm/nrf52/nrf52840-dk/src/nrf52_appinit.c b/boards/arm/nrf52/nrf52840-dk/src/nrf52_appinit.c deleted file mode 100644 index e58ea4933ac..00000000000 --- a/boards/arm/nrf52/nrf52840-dk/src/nrf52_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/nrf52/nrf52840-dk/src/nrf52_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 - -#include -#include -#include - -#include - -#include "chip.h" -#include "nrf52840-dk.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return nrf52_bringup(); -#endif -} diff --git a/boards/arm/nrf52/nrf52840-dongle/src/CMakeLists.txt b/boards/arm/nrf52/nrf52840-dongle/src/CMakeLists.txt index a927b954851..79017024c2e 100644 --- a/boards/arm/nrf52/nrf52840-dongle/src/CMakeLists.txt +++ b/boards/arm/nrf52/nrf52840-dongle/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS nrf52_boot.c nrf52_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS nrf52_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS nrf52_autoleds.c) else() diff --git a/boards/arm/nrf52/nrf52840-dongle/src/Make.defs b/boards/arm/nrf52/nrf52840-dongle/src/Make.defs index 6f332700ba5..c202718c5f2 100644 --- a/boards/arm/nrf52/nrf52840-dongle/src/Make.defs +++ b/boards/arm/nrf52/nrf52840-dongle/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = nrf52_boot.c nrf52_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += nrf52_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += nrf52_autoleds.c else diff --git a/boards/arm/nrf52/nrf52840-dongle/src/nrf52_appinit.c b/boards/arm/nrf52/nrf52840-dongle/src/nrf52_appinit.c deleted file mode 100644 index 8587c00b053..00000000000 --- a/boards/arm/nrf52/nrf52840-dongle/src/nrf52_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/nrf52/nrf52840-dongle/src/nrf52_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 - -#include -#include -#include - -#include - -#include "chip.h" -#include "nrf52840-dongle.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return nrf52_bringup(); -#endif -} diff --git a/boards/arm/nrf52/nrf9160-dk-nrf52/src/CMakeLists.txt b/boards/arm/nrf52/nrf9160-dk-nrf52/src/CMakeLists.txt index c9a2a81b5eb..a8dd50e8a69 100644 --- a/boards/arm/nrf52/nrf9160-dk-nrf52/src/CMakeLists.txt +++ b/boards/arm/nrf52/nrf9160-dk-nrf52/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS nrf52_boot.c nrf52_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS nrf52_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_ARCH_BOARD_COMMON) diff --git a/boards/arm/nrf52/nrf9160-dk-nrf52/src/Make.defs b/boards/arm/nrf52/nrf9160-dk-nrf52/src/Make.defs index 5c72c8e7c13..d20fb1d48b2 100644 --- a/boards/arm/nrf52/nrf9160-dk-nrf52/src/Make.defs +++ b/boards/arm/nrf52/nrf9160-dk-nrf52/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = nrf52_boot.c nrf52_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += nrf52_appinit.c -endif - DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf52_appinit.c b/boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf52_appinit.c deleted file mode 100644 index 1c076b0db4e..00000000000 --- a/boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf52_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf52_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 - -#include -#include -#include - -#include - -#include "chip.h" -#include "nrf9160-dk-nrf52.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return nrf52_bringup(); -#endif -} diff --git a/boards/arm/nrf52/thingy52/src/CMakeLists.txt b/boards/arm/nrf52/thingy52/src/CMakeLists.txt index ee1463d8fd4..97b6c81f684 100644 --- a/boards/arm/nrf52/thingy52/src/CMakeLists.txt +++ b/boards/arm/nrf52/thingy52/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS nrf52_boot.c nrf52_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS nrf52_appinit.c) -endif() - if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS nrf52_buttons.c) endif() diff --git a/boards/arm/nrf52/thingy52/src/Make.defs b/boards/arm/nrf52/thingy52/src/Make.defs index a91cfc3041b..2028cde2d7e 100644 --- a/boards/arm/nrf52/thingy52/src/Make.defs +++ b/boards/arm/nrf52/thingy52/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = nrf52_boot.c nrf52_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += nrf52_appinit.c -endif - ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += nrf52_buttons.c endif diff --git a/boards/arm/nrf52/thingy52/src/nrf52_appinit.c b/boards/arm/nrf52/thingy52/src/nrf52_appinit.c deleted file mode 100644 index b646d5baf33..00000000000 --- a/boards/arm/nrf52/thingy52/src/nrf52_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/nrf52/thingy52/src/nrf52_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 - -#include -#include -#include - -#include - -#include "chip.h" -#include "thingy52.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return nrf52_bringup(); -#endif -} diff --git a/boards/arm/nrf52/thingy91-nrf52/src/CMakeLists.txt b/boards/arm/nrf52/thingy91-nrf52/src/CMakeLists.txt index 364a224d0f2..14a0efcdd01 100644 --- a/boards/arm/nrf52/thingy91-nrf52/src/CMakeLists.txt +++ b/boards/arm/nrf52/thingy91-nrf52/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS nrf52_boot.c nrf52_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS nrf52_appinit.c) -endif() - if(CONFIG_USBDEV) list(APPEND SRCS nrf52_usb.c) endif() diff --git a/boards/arm/nrf52/thingy91-nrf52/src/Make.defs b/boards/arm/nrf52/thingy91-nrf52/src/Make.defs index 0b8a0b5882d..d8ca53ffb65 100644 --- a/boards/arm/nrf52/thingy91-nrf52/src/Make.defs +++ b/boards/arm/nrf52/thingy91-nrf52/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = nrf52_boot.c nrf52_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += nrf52_appinit.c -endif - ifeq ($(CONFIG_USBDEV),y) CSRCS += nrf52_usb.c endif diff --git a/boards/arm/nrf52/thingy91-nrf52/src/nrf52_appinit.c b/boards/arm/nrf52/thingy91-nrf52/src/nrf52_appinit.c deleted file mode 100644 index c44b81a19da..00000000000 --- a/boards/arm/nrf52/thingy91-nrf52/src/nrf52_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/nrf52/thingy91-nrf52/src/nrf52_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 - -#include -#include -#include - -#include - -#include "chip.h" -#include "thingy91-nrf52.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return nrf52_bringup(); -#endif -} diff --git a/boards/arm/nrf52/xiao-nrf52840/src/CMakeLists.txt b/boards/arm/nrf52/xiao-nrf52840/src/CMakeLists.txt index 2c57de4d07b..50db1037f7d 100644 --- a/boards/arm/nrf52/xiao-nrf52840/src/CMakeLists.txt +++ b/boards/arm/nrf52/xiao-nrf52840/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS nrf52_boot.c nrf52_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS nrf52_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS nrf52_autoleds.c) else() diff --git a/boards/arm/nrf52/xiao-nrf52840/src/Make.defs b/boards/arm/nrf52/xiao-nrf52840/src/Make.defs index c657eab3d97..16b5978098b 100644 --- a/boards/arm/nrf52/xiao-nrf52840/src/Make.defs +++ b/boards/arm/nrf52/xiao-nrf52840/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = nrf52_boot.c nrf52_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += nrf52_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += nrf52_autoleds.c else diff --git a/boards/arm/nrf52/xiao-nrf52840/src/nrf52_appinit.c b/boards/arm/nrf52/xiao-nrf52840/src/nrf52_appinit.c deleted file mode 100644 index f81bbed6162..00000000000 --- a/boards/arm/nrf52/xiao-nrf52840/src/nrf52_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/nrf52/xiao-nrf52840/src/nrf52_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 - -#include -#include -#include - -#include - -#include "chip.h" -#include "xiao-nrf52840.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return nrf52_bringup(); -#endif -} diff --git a/boards/arm/nrf53/nrf5340-audio-dk/src/CMakeLists.txt b/boards/arm/nrf53/nrf5340-audio-dk/src/CMakeLists.txt index c081d74f19e..5ca668a3807 100644 --- a/boards/arm/nrf53/nrf5340-audio-dk/src/CMakeLists.txt +++ b/boards/arm/nrf53/nrf5340-audio-dk/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS nrf53_boot.c nrf53_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS nrf53_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS nrf53_autoleds.c) else() diff --git a/boards/arm/nrf53/nrf5340-audio-dk/src/Make.defs b/boards/arm/nrf53/nrf5340-audio-dk/src/Make.defs index 99765d48885..74a7837d9b6 100644 --- a/boards/arm/nrf53/nrf5340-audio-dk/src/Make.defs +++ b/boards/arm/nrf53/nrf5340-audio-dk/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = nrf53_boot.c nrf53_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += nrf53_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += nrf53_autoleds.c else diff --git a/boards/arm/nrf53/nrf5340-audio-dk/src/nrf53_appinit.c b/boards/arm/nrf53/nrf5340-audio-dk/src/nrf53_appinit.c deleted file mode 100644 index aec393e291c..00000000000 --- a/boards/arm/nrf53/nrf5340-audio-dk/src/nrf53_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/nrf53/nrf5340-audio-dk/src/nrf53_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 - -#include -#include -#include - -#include - -#include "chip.h" -#include "nrf5340-audio-dk.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return nrf53_bringup(); -#endif -} diff --git a/boards/arm/nrf53/nrf5340-dk/src/CMakeLists.txt b/boards/arm/nrf53/nrf5340-dk/src/CMakeLists.txt index 9955186065b..8fb097a1d95 100644 --- a/boards/arm/nrf53/nrf5340-dk/src/CMakeLists.txt +++ b/boards/arm/nrf53/nrf5340-dk/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS nrf53_boot.c nrf53_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS nrf53_appinit.c) -endif() - if(CONFIG_NRF53_APPCORE) list(APPEND SRCS nrf53_cpunet_boot.c) endif() diff --git a/boards/arm/nrf53/nrf5340-dk/src/Make.defs b/boards/arm/nrf53/nrf5340-dk/src/Make.defs index 7f9cc96e158..6a097f25196 100644 --- a/boards/arm/nrf53/nrf5340-dk/src/Make.defs +++ b/boards/arm/nrf53/nrf5340-dk/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = nrf53_boot.c nrf53_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += nrf53_appinit.c -endif - ifeq ($(CONFIG_NRF53_APPCORE),y) CSRCS += nrf53_cpunet_boot.c endif diff --git a/boards/arm/nrf53/nrf5340-dk/src/nrf53_appinit.c b/boards/arm/nrf53/nrf5340-dk/src/nrf53_appinit.c deleted file mode 100644 index 3ac59706039..00000000000 --- a/boards/arm/nrf53/nrf5340-dk/src/nrf53_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/nrf53/nrf5340-dk/src/nrf53_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 - -#include -#include -#include - -#include - -#include "chip.h" -#include "nrf5340-dk.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return nrf53_bringup(); -#endif -} diff --git a/boards/arm/nrf53/thingy53/src/CMakeLists.txt b/boards/arm/nrf53/thingy53/src/CMakeLists.txt index 629e921214a..7d4769cfe49 100644 --- a/boards/arm/nrf53/thingy53/src/CMakeLists.txt +++ b/boards/arm/nrf53/thingy53/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS nrf53_boot.c nrf53_bringup.c nrf53_sensors.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS nrf53_appinit.c) -endif() - if(CONFIG_NRF53_APPCORE) list(APPEND SRCS nrf53_cpunet_boot.c) endif() diff --git a/boards/arm/nrf53/thingy53/src/Make.defs b/boards/arm/nrf53/thingy53/src/Make.defs index c3e124b8b8b..75c4b581370 100644 --- a/boards/arm/nrf53/thingy53/src/Make.defs +++ b/boards/arm/nrf53/thingy53/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = nrf53_boot.c nrf53_bringup.c nrf53_sensors.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += nrf53_appinit.c -endif - ifeq ($(CONFIG_NRF53_APPCORE),y) CSRCS += nrf53_cpunet_boot.c endif diff --git a/boards/arm/nrf53/thingy53/src/nrf53_appinit.c b/boards/arm/nrf53/thingy53/src/nrf53_appinit.c deleted file mode 100644 index a0273e766c2..00000000000 --- a/boards/arm/nrf53/thingy53/src/nrf53_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/nrf53/thingy53/src/nrf53_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 - -#include -#include -#include - -#include - -#include "chip.h" -#include "thingy53.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return nrf53_bringup(); -#endif -} diff --git a/boards/arm/nrf91/nrf9160-dk/src/CMakeLists.txt b/boards/arm/nrf91/nrf9160-dk/src/CMakeLists.txt index 9f2614f121d..b5d695e2868 100644 --- a/boards/arm/nrf91/nrf9160-dk/src/CMakeLists.txt +++ b/boards/arm/nrf91/nrf9160-dk/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS nrf91_boot.c nrf91_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS nrf91_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS nrf91_autoleds.c) else() diff --git a/boards/arm/nrf91/nrf9160-dk/src/Make.defs b/boards/arm/nrf91/nrf9160-dk/src/Make.defs index 24deac0e54e..aad8f179fb7 100644 --- a/boards/arm/nrf91/nrf9160-dk/src/Make.defs +++ b/boards/arm/nrf91/nrf9160-dk/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = nrf91_boot.c nrf91_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += nrf91_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += nrf91_autoleds.c else diff --git a/boards/arm/nrf91/nrf9160-dk/src/nrf91_appinit.c b/boards/arm/nrf91/nrf9160-dk/src/nrf91_appinit.c deleted file mode 100644 index e2924c16db3..00000000000 --- a/boards/arm/nrf91/nrf9160-dk/src/nrf91_appinit.c +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** - * boards/arm/nrf91/nrf9160-dk/src/nrf91_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 - -#include -#include -#include - -#include - -#include "chip.h" -#include "nrf9160-dk.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: arm_netinitialize - * - * Description: - * Dummy function expected to start-up logic. - * - ****************************************************************************/ - -#if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT) -void arm_netinitialize(void) -{ -} -#endif - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return nrf91_bringup(); -#endif -} diff --git a/boards/arm/nrf91/nrf9160-dk/src/nrf91_bringup.c b/boards/arm/nrf91/nrf9160-dk/src/nrf91_bringup.c index a5b4b971827..08d42c78485 100644 --- a/boards/arm/nrf91/nrf9160-dk/src/nrf91_bringup.c +++ b/boards/arm/nrf91/nrf9160-dk/src/nrf91_bringup.c @@ -60,6 +60,7 @@ # include "nrf91_timer.h" #endif +#include "chip.h" #include "nrf9160-dk.h" /**************************************************************************** @@ -77,6 +78,20 @@ * Public Functions ****************************************************************************/ +/**************************************************************************** + * Name: arm_netinitialize + * + * Description: + * Dummy function expected to start-up logic. + * + ****************************************************************************/ + +#if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT) +void arm_netinitialize(void) +{ +} +#endif + /**************************************************************************** * Name: nrf91_bringup * diff --git a/boards/arm/nrf91/thingy91/src/CMakeLists.txt b/boards/arm/nrf91/thingy91/src/CMakeLists.txt index 3917fe8cf1c..991764c8e78 100644 --- a/boards/arm/nrf91/thingy91/src/CMakeLists.txt +++ b/boards/arm/nrf91/thingy91/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS nrf91_boot.c nrf91_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS nrf91_appinit.c) -endif() - if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS nrf91_buttons.c) endif() diff --git a/boards/arm/nrf91/thingy91/src/Make.defs b/boards/arm/nrf91/thingy91/src/Make.defs index 3d3ff590d96..599f6f5a9b8 100644 --- a/boards/arm/nrf91/thingy91/src/Make.defs +++ b/boards/arm/nrf91/thingy91/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = nrf91_boot.c nrf91_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += nrf91_appinit.c -endif - ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += nrf91_buttons.c endif diff --git a/boards/arm/nrf91/thingy91/src/nrf91_appinit.c b/boards/arm/nrf91/thingy91/src/nrf91_appinit.c deleted file mode 100644 index 09337bc5653..00000000000 --- a/boards/arm/nrf91/thingy91/src/nrf91_appinit.c +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** - * boards/arm/nrf91/thingy91/src/nrf91_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 - -#include -#include -#include - -#include - -#include "chip.h" -#include "thingy91.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: arm_netinitialize - * - * Description: - * Dummy function expected to start-up logic. - * - ****************************************************************************/ - -#if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT) -void arm_netinitialize(void) -{ -} -#endif - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return nrf91_bringup(); -#endif -} diff --git a/boards/arm/nuc1xx/nutiny-nuc120/src/nuc_boardinitialize.c b/boards/arm/nuc1xx/nutiny-nuc120/src/nuc_boardinitialize.c index fdb63717e22..43e55484c27 100644 --- a/boards/arm/nuc1xx/nutiny-nuc120/src/nuc_boardinitialize.c +++ b/boards/arm/nuc1xx/nutiny-nuc120/src/nuc_boardinitialize.c @@ -88,3 +88,23 @@ void nuc_boardinitialize(void) nuc_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/arm/phy62xx/phy6222/src/Makefile b/boards/arm/phy62xx/phy6222/src/Makefile index acc6499f6cf..2127875e556 100644 --- a/boards/arm/phy62xx/phy6222/src/Makefile +++ b/boards/arm/phy62xx/phy6222/src/Makefile @@ -27,8 +27,6 @@ CSRCS += userleds.c CSRCS += buttons.c -CSRCS += appinit.c - CSRCS += reset.c ifeq ($(CONFIG_ETC_ROMFS),y) diff --git a/boards/arm/phy62xx/phy6222/src/appinit.c b/boards/arm/phy62xx/phy6222/src/appinit.c deleted file mode 100644 index 60b5decc413..00000000000 --- a/boards/arm/phy62xx/phy6222/src/appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/phy62xx/phy6222/src/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 - -#include - -#include - -#include "phy6222.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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return phy62xx_bringup(); -#else - return 0; -#endif -} diff --git a/boards/arm/qemu/qemu-armv7a/src/CMakeLists.txt b/boards/arm/qemu/qemu-armv7a/src/CMakeLists.txt index f6c3b148d43..dbf972c8e15 100644 --- a/boards/arm/qemu/qemu-armv7a/src/CMakeLists.txt +++ b/boards/arm/qemu/qemu-armv7a/src/CMakeLists.txt @@ -21,10 +21,6 @@ # ############################################################################## set(SRCS qemu_boardinit.c qemu_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS qemu_appinit.c) -endif() - if(CONFIG_LIBC_FDT) target_include_directories(board PRIVATE ${NUTTX_DIR}/libs/libc/fdt/dtc/libfdt) diff --git a/boards/arm/qemu/qemu-armv7a/src/Makefile b/boards/arm/qemu/qemu-armv7a/src/Makefile index 7cd9e834967..d4e6c4e3595 100644 --- a/boards/arm/qemu/qemu-armv7a/src/Makefile +++ b/boards/arm/qemu/qemu-armv7a/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = qemu_boardinit.c qemu_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += qemu_appinit.c -endif - ifeq ($(CONFIG_LIBC_FDT),y) CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)libs$(DELIM)libc$(DELIM)fdt$(DELIM)dtc$(DELIM)libfdt endif diff --git a/boards/arm/qemu/qemu-armv7a/src/qemu_appinit.c b/boards/arm/qemu/qemu-armv7a/src/qemu_appinit.c deleted file mode 100644 index b8ffbb116d3..00000000000 --- a/boards/arm/qemu/qemu-armv7a/src/qemu_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/qemu/qemu-armv7a/src/qemu_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 - -#include - -#include - -#include "qemu-armv7a.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) -{ - UNUSED(arg); -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return qemu_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/qemu/qemu-armv7r/src/CMakeLists.txt b/boards/arm/qemu/qemu-armv7r/src/CMakeLists.txt index 8226e6beff1..278adf8e879 100644 --- a/boards/arm/qemu/qemu-armv7r/src/CMakeLists.txt +++ b/boards/arm/qemu/qemu-armv7r/src/CMakeLists.txt @@ -21,10 +21,6 @@ # ############################################################################## set(SRCS qemu_boardinit.c qemu_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS qemu_appinit.c) -endif() - if(CONFIG_LIBC_FDT) target_include_directories(board PRIVATE ${NUTTX_DIR}/libs/libc/fdt/dtc/libfdt) diff --git a/boards/arm/qemu/qemu-armv7r/src/Makefile b/boards/arm/qemu/qemu-armv7r/src/Makefile index 45c0664d6b8..012409219b2 100644 --- a/boards/arm/qemu/qemu-armv7r/src/Makefile +++ b/boards/arm/qemu/qemu-armv7r/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = qemu_boardinit.c qemu_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += qemu_appinit.c -endif - ifeq ($(CONFIG_LIBC_FDT),y) CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)libs$(DELIM)libc$(DELIM)fdt$(DELIM)dtc$(DELIM)libfdt endif diff --git a/boards/arm/qemu/qemu-armv7r/src/qemu_appinit.c b/boards/arm/qemu/qemu-armv7r/src/qemu_appinit.c deleted file mode 100644 index fe229524a79..00000000000 --- a/boards/arm/qemu/qemu-armv7r/src/qemu_appinit.c +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** - * boards/arm/qemu/qemu-armv7r/src/qemu_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 -#include -#include -#include "qemu-armv7r.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) -{ - UNUSED(arg); -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return qemu_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/ra4/arduino-r4-minima/src/CMakeLists.txt b/boards/arm/ra4/arduino-r4-minima/src/CMakeLists.txt index bf7885da011..a7f01a256ca 100644 --- a/boards/arm/ra4/arduino-r4-minima/src/CMakeLists.txt +++ b/boards/arm/ra4/arduino-r4-minima/src/CMakeLists.txt @@ -18,7 +18,7 @@ # # ############################################################################## -set(SRCS ra4m1_boot.c ra4m1_bringup.c ra4m1_appinit.c) +set(SRCS ra4m1_boot.c ra4m1_bringup.c) if(CONFIG_ARCH_LEDS) list(APPEND SRCS ra4m1_autoleds.c) diff --git a/boards/arm/ra4/arduino-r4-minima/src/Makefile b/boards/arm/ra4/arduino-r4-minima/src/Makefile index 2f1ed2581f2..97875297aa4 100644 --- a/boards/arm/ra4/arduino-r4-minima/src/Makefile +++ b/boards/arm/ra4/arduino-r4-minima/src/Makefile @@ -28,10 +28,6 @@ else CSRCS += ra4m1_userleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += ra4m1_appinit.c -endif - ifeq ($(CONFIG_PWM),y) CSRCS += ra4m1_pwm.c endif diff --git a/boards/arm/ra4/arduino-r4-minima/src/ra4m1_appinit.c b/boards/arm/ra4/arduino-r4-minima/src/ra4m1_appinit.c deleted file mode 100644 index 13e39f6aec6..00000000000 --- a/boards/arm/ra4/arduino-r4-minima/src/ra4m1_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/ra4/arduino-r4-minima/src/ra4m1_appinit.c - * - * 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 - -#include -#include - -#include "arduino-r4-minima.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return ra4m1_bringup(); -#endif -} diff --git a/boards/arm/ra4/xiao-ra4m1/src/CMakeLists.txt b/boards/arm/ra4/xiao-ra4m1/src/CMakeLists.txt index cfa891f1f1c..e782b1720b5 100644 --- a/boards/arm/ra4/xiao-ra4m1/src/CMakeLists.txt +++ b/boards/arm/ra4/xiao-ra4m1/src/CMakeLists.txt @@ -18,7 +18,7 @@ # # ############################################################################## -set(SRCS ra4m1_boot.c ra4m1_bringup.c ra4m1_appinit.c) +set(SRCS ra4m1_boot.c ra4m1_bringup.c) if(CONFIG_ARCH_LEDS) list(APPEND SRCS ra4m1_autoleds.c) diff --git a/boards/arm/ra4/xiao-ra4m1/src/Makefile b/boards/arm/ra4/xiao-ra4m1/src/Makefile index 395c11cb889..c1c0822e94a 100644 --- a/boards/arm/ra4/xiao-ra4m1/src/Makefile +++ b/boards/arm/ra4/xiao-ra4m1/src/Makefile @@ -28,10 +28,6 @@ else CSRCS += ra4m1_userleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += ra4m1_appinit.c -endif - ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += ra4m1_gpio.c endif diff --git a/boards/arm/ra4/xiao-ra4m1/src/ra4m1_appinit.c b/boards/arm/ra4/xiao-ra4m1/src/ra4m1_appinit.c deleted file mode 100644 index d2544fb0871..00000000000 --- a/boards/arm/ra4/xiao-ra4m1/src/ra4m1_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/ra4/xiao-ra4m1/src/ra4m1_appinit.c - * - * 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 - -#include -#include - -#include "xiao-ra4m1.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return ra4m1_bringup(); -#endif -} diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/src/CMakeLists.txt b/boards/arm/rp2040/adafruit-feather-rp2040/src/CMakeLists.txt index 0995d58e66c..c46f5eeb601 100644 --- a/boards/arm/rp2040/adafruit-feather-rp2040/src/CMakeLists.txt +++ b/boards/arm/rp2040/adafruit-feather-rp2040/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_DEV_GPIO) list(APPEND SRCS rp2040_gpio.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS rp2040_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_RP2040_FLASH_BOOT) diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/src/Make.defs b/boards/arm/rp2040/adafruit-feather-rp2040/src/Make.defs index a4cbf5ad796..c5f16f2cfe6 100644 --- a/boards/arm/rp2040/adafruit-feather-rp2040/src/Make.defs +++ b/boards/arm/rp2040/adafruit-feather-rp2040/src/Make.defs @@ -23,7 +23,6 @@ include $(TOPDIR)/Make.defs CSRCS = rp2040_boardinitialize.c -CSRCS += rp2040_appinit.c CSRCS += rp2040_bringup.c ifeq ($(CONFIG_DEV_GPIO),y) diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_appinit.c b/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_appinit.c deleted file mode 100644 index e4142e2422c..00000000000 --- a/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_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 -#include - -#include - -#include "rp2040_pico.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return rp2040_bringup(); -#endif -} diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_boardinitialize.c b/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_boardinitialize.c index 9412ea1d61e..fbc4bde86bc 100644 --- a/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_boardinitialize.c +++ b/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_boardinitialize.c @@ -38,6 +38,8 @@ #include "rp2040_common_initialize.h" #endif /* CONFIG_ARCH_BOARD_COMMON */ +#include "rp2040_pico.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -87,3 +89,29 @@ void rp2040_boardinitialize(void) /* --- Place any board specific initialization here --- */ } + +/**************************************************************************** + * 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 after up_initialize() and board_early_initialize() and just + * before the initial application is started. This additional + * initialization phase may be used, for example, to initialize board- + * specific device drivers for which board_early_initialize() is not + * suitable. + * + * Waiting for events, use of I2C, SPI, etc are permissible in the context + * of board_late_initialize(). That is because board_late_initialize() + * will run on a temporary, internal kernel thread. + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) +{ + rp2040_bringup(); +} +#endif diff --git a/boards/arm/rp2040/adafruit-kb2040/src/CMakeLists.txt b/boards/arm/rp2040/adafruit-kb2040/src/CMakeLists.txt index 0cf33ce1678..1566b4a0391 100644 --- a/boards/arm/rp2040/adafruit-kb2040/src/CMakeLists.txt +++ b/boards/arm/rp2040/adafruit-kb2040/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_DEV_GPIO) list(APPEND SRCS rp2040_gpio.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS rp2040_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_RP2040_FLASH_BOOT) diff --git a/boards/arm/rp2040/adafruit-kb2040/src/Make.defs b/boards/arm/rp2040/adafruit-kb2040/src/Make.defs index abad5b865c5..79756ce6bca 100644 --- a/boards/arm/rp2040/adafruit-kb2040/src/Make.defs +++ b/boards/arm/rp2040/adafruit-kb2040/src/Make.defs @@ -23,7 +23,6 @@ include $(TOPDIR)/Make.defs CSRCS = rp2040_boardinitialize.c -CSRCS += rp2040_appinit.c CSRCS += rp2040_bringup.c ifeq ($(CONFIG_DEV_GPIO),y) diff --git a/boards/arm/rp2040/adafruit-kb2040/src/rp2040_appinit.c b/boards/arm/rp2040/adafruit-kb2040/src/rp2040_appinit.c deleted file mode 100644 index 41f041a5c5a..00000000000 --- a/boards/arm/rp2040/adafruit-kb2040/src/rp2040_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/rp2040/adafruit-kb2040/src/rp2040_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 -#include - -#include - -#include "rp2040_pico.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return rp2040_bringup(); -#endif -} diff --git a/boards/arm/rp2040/adafruit-kb2040/src/rp2040_boardinitialize.c b/boards/arm/rp2040/adafruit-kb2040/src/rp2040_boardinitialize.c index e953cf4b51e..0dfe6ca3eaf 100644 --- a/boards/arm/rp2040/adafruit-kb2040/src/rp2040_boardinitialize.c +++ b/boards/arm/rp2040/adafruit-kb2040/src/rp2040_boardinitialize.c @@ -38,6 +38,8 @@ #include "rp2040_common_initialize.h" #endif /* CONFIG_ARCH_BOARD_COMMON */ +#include "rp2040_pico.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -81,3 +83,29 @@ void rp2040_boardinitialize(void) /* --- Place any board specific initialization here --- */ } + +/**************************************************************************** + * 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 after up_initialize() and board_early_initialize() and just + * before the initial application is started. This additional + * initialization phase may be used, for example, to initialize board- + * specific device drivers for which board_early_initialize() is not + * suitable. + * + * Waiting for events, use of I2C, SPI, etc are permissible in the context + * of board_late_initialize(). That is because board_late_initialize() + * will run on a temporary, internal kernel thread. + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) +{ + rp2040_bringup(); +} +#endif diff --git a/boards/arm/rp2040/adafruit-qt-py-rp2040/src/CMakeLists.txt b/boards/arm/rp2040/adafruit-qt-py-rp2040/src/CMakeLists.txt index 3c8f641313b..76adaa882be 100644 --- a/boards/arm/rp2040/adafruit-qt-py-rp2040/src/CMakeLists.txt +++ b/boards/arm/rp2040/adafruit-qt-py-rp2040/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_DEV_GPIO) list(APPEND SRCS rp2040_gpio.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS rp2040_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_RP2040_FLASH_BOOT) diff --git a/boards/arm/rp2040/adafruit-qt-py-rp2040/src/Make.defs b/boards/arm/rp2040/adafruit-qt-py-rp2040/src/Make.defs index 808257774c0..0c9f8f1840c 100644 --- a/boards/arm/rp2040/adafruit-qt-py-rp2040/src/Make.defs +++ b/boards/arm/rp2040/adafruit-qt-py-rp2040/src/Make.defs @@ -23,7 +23,6 @@ include $(TOPDIR)/Make.defs CSRCS = rp2040_boardinitialize.c -CSRCS += rp2040_appinit.c CSRCS += rp2040_bringup.c ifeq ($(CONFIG_DEV_GPIO),y) diff --git a/boards/arm/rp2040/adafruit-qt-py-rp2040/src/rp2040_appinit.c b/boards/arm/rp2040/adafruit-qt-py-rp2040/src/rp2040_appinit.c deleted file mode 100644 index 57cc75cbd75..00000000000 --- a/boards/arm/rp2040/adafruit-qt-py-rp2040/src/rp2040_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/rp2040/adafruit-qt-py-rp2040/src/rp2040_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 -#include - -#include - -#include "rp2040_pico.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return rp2040_bringup(); -#endif -} diff --git a/boards/arm/rp2040/adafruit-qt-py-rp2040/src/rp2040_boardinitialize.c b/boards/arm/rp2040/adafruit-qt-py-rp2040/src/rp2040_boardinitialize.c index 1538645a445..244ec491e01 100644 --- a/boards/arm/rp2040/adafruit-qt-py-rp2040/src/rp2040_boardinitialize.c +++ b/boards/arm/rp2040/adafruit-qt-py-rp2040/src/rp2040_boardinitialize.c @@ -38,6 +38,8 @@ #include "rp2040_common_initialize.h" #endif /* CONFIG_ARCH_BOARD_COMMON */ +#include "rp2040_pico.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -81,3 +83,29 @@ void rp2040_boardinitialize(void) /* --- Place any board specific initialization here --- */ } + +/**************************************************************************** + * 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 after up_initialize() and board_early_initialize() and just + * before the initial application is started. This additional + * initialization phase may be used, for example, to initialize board- + * specific device drivers for which board_early_initialize() is not + * suitable. + * + * Waiting for events, use of I2C, SPI, etc are permissible in the context + * of board_late_initialize(). That is because board_late_initialize() + * will run on a temporary, internal kernel thread. + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) +{ + rp2040_bringup(); +} +#endif diff --git a/boards/arm/rp2040/common/src/rp2040_usbmsc.c b/boards/arm/rp2040/common/src/rp2040_usbmsc.c index c49bb11615c..ce5fc7668c9 100644 --- a/boards/arm/rp2040/common/src/rp2040_usbmsc.c +++ b/boards/arm/rp2040/common/src/rp2040_usbmsc.c @@ -54,8 +54,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/rp2040/pimoroni-tiny2040/src/CMakeLists.txt b/boards/arm/rp2040/pimoroni-tiny2040/src/CMakeLists.txt index d927fbcb9c4..1a6dd5d73df 100644 --- a/boards/arm/rp2040/pimoroni-tiny2040/src/CMakeLists.txt +++ b/boards/arm/rp2040/pimoroni-tiny2040/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_DEV_GPIO) list(APPEND SRCS rp2040_gpio.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS rp2040_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_RP2040_FLASH_BOOT) diff --git a/boards/arm/rp2040/pimoroni-tiny2040/src/Make.defs b/boards/arm/rp2040/pimoroni-tiny2040/src/Make.defs index c8868476808..bfbbe16f031 100644 --- a/boards/arm/rp2040/pimoroni-tiny2040/src/Make.defs +++ b/boards/arm/rp2040/pimoroni-tiny2040/src/Make.defs @@ -23,7 +23,6 @@ include $(TOPDIR)/Make.defs CSRCS = rp2040_boardinitialize.c -CSRCS += rp2040_appinit.c CSRCS += rp2040_bringup.c ifeq ($(CONFIG_DEV_GPIO),y) diff --git a/boards/arm/rp2040/pimoroni-tiny2040/src/rp2040_appinit.c b/boards/arm/rp2040/pimoroni-tiny2040/src/rp2040_appinit.c deleted file mode 100644 index ec21692bcaa..00000000000 --- a/boards/arm/rp2040/pimoroni-tiny2040/src/rp2040_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/rp2040/pimoroni-tiny2040/src/rp2040_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 - -#include -#include - -#include "rp2040_pico.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return rp2040_bringup(); -#endif -} diff --git a/boards/arm/rp2040/pimoroni-tiny2040/src/rp2040_boardinitialize.c b/boards/arm/rp2040/pimoroni-tiny2040/src/rp2040_boardinitialize.c index d756a4d6452..9c6652fa022 100644 --- a/boards/arm/rp2040/pimoroni-tiny2040/src/rp2040_boardinitialize.c +++ b/boards/arm/rp2040/pimoroni-tiny2040/src/rp2040_boardinitialize.c @@ -38,6 +38,8 @@ #include "rp2040_common_initialize.h" #endif /* CONFIG_ARCH_BOARD_COMMON */ +#include "rp2040_pico.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -97,3 +99,29 @@ void rp2040_boardinitialize(void) /* --- Place any board specific initialization here --- */ } + +/**************************************************************************** + * 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 after up_initialize() and board_early_initialize() and just + * before the initial application is started. This additional + * initialization phase may be used, for example, to initialize board- + * specific device drivers for which board_early_initialize() is not + * suitable. + * + * Waiting for events, use of I2C, SPI, etc are permissible in the context + * of board_late_initialize(). That is because board_late_initialize() + * will run on a temporary, internal kernel thread. + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) +{ + rp2040_bringup(); +} +#endif diff --git a/boards/arm/rp2040/raspberrypi-pico-w/src/CMakeLists.txt b/boards/arm/rp2040/raspberrypi-pico-w/src/CMakeLists.txt index e0d3c69767d..4eb6344d4c6 100644 --- a/boards/arm/rp2040/raspberrypi-pico-w/src/CMakeLists.txt +++ b/boards/arm/rp2040/raspberrypi-pico-w/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_DEV_GPIO) list(APPEND SRCS rp2040_gpio.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS rp2040_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_RP2040_FLASH_BOOT) diff --git a/boards/arm/rp2040/raspberrypi-pico-w/src/Make.defs b/boards/arm/rp2040/raspberrypi-pico-w/src/Make.defs index bbab94c03f6..7b992afb05a 100644 --- a/boards/arm/rp2040/raspberrypi-pico-w/src/Make.defs +++ b/boards/arm/rp2040/raspberrypi-pico-w/src/Make.defs @@ -23,7 +23,6 @@ include $(TOPDIR)/Make.defs CSRCS = rp2040_boardinitialize.c -CSRCS += rp2040_appinit.c CSRCS += rp2040_bringup.c ifeq ($(CONFIG_DEV_GPIO),y) diff --git a/boards/arm/rp2040/raspberrypi-pico-w/src/rp2040_appinit.c b/boards/arm/rp2040/raspberrypi-pico-w/src/rp2040_appinit.c deleted file mode 100644 index 41635194a63..00000000000 --- a/boards/arm/rp2040/raspberrypi-pico-w/src/rp2040_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/rp2040/raspberrypi-pico-w/src/rp2040_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 - -#include -#include - -#include "rp2040_pico.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return rp2040_bringup(); -#endif -} diff --git a/boards/arm/rp2040/raspberrypi-pico-w/src/rp2040_boardinitialize.c b/boards/arm/rp2040/raspberrypi-pico-w/src/rp2040_boardinitialize.c index fd866465134..e1f50f8af04 100644 --- a/boards/arm/rp2040/raspberrypi-pico-w/src/rp2040_boardinitialize.c +++ b/boards/arm/rp2040/raspberrypi-pico-w/src/rp2040_boardinitialize.c @@ -38,6 +38,8 @@ #include "rp2040_common_initialize.h" #endif /* CONFIG_ARCH_BOARD_COMMON */ +#include "rp2040_pico.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -81,3 +83,29 @@ void rp2040_boardinitialize(void) /* --- Place any board specific initialization here --- */ } + +/**************************************************************************** + * 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 after up_initialize() and board_early_initialize() and just + * before the initial application is started. This additional + * initialization phase may be used, for example, to initialize board- + * specific device drivers for which board_early_initialize() is not + * suitable. + * + * Waiting for events, use of I2C, SPI, etc are permissible in the context + * of board_late_initialize(). That is because board_late_initialize() + * will run on a temporary, internal kernel thread. + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) +{ + rp2040_bringup(); +} +#endif diff --git a/boards/arm/rp2040/raspberrypi-pico/src/CMakeLists.txt b/boards/arm/rp2040/raspberrypi-pico/src/CMakeLists.txt index d332a5eb902..833d7c5be10 100644 --- a/boards/arm/rp2040/raspberrypi-pico/src/CMakeLists.txt +++ b/boards/arm/rp2040/raspberrypi-pico/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS rp2040_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS rp2040_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_RP2040_FLASH_BOOT) diff --git a/boards/arm/rp2040/raspberrypi-pico/src/Make.defs b/boards/arm/rp2040/raspberrypi-pico/src/Make.defs index 98c78e43f50..752122e6ce1 100644 --- a/boards/arm/rp2040/raspberrypi-pico/src/Make.defs +++ b/boards/arm/rp2040/raspberrypi-pico/src/Make.defs @@ -23,7 +23,6 @@ include $(TOPDIR)/Make.defs CSRCS = rp2040_boardinitialize.c -CSRCS += rp2040_appinit.c CSRCS += rp2040_bringup.c ifeq ($(CONFIG_DEV_GPIO),y) diff --git a/boards/arm/rp2040/raspberrypi-pico/src/rp2040_appinit.c b/boards/arm/rp2040/raspberrypi-pico/src/rp2040_appinit.c deleted file mode 100644 index d22e8a3f4a8..00000000000 --- a/boards/arm/rp2040/raspberrypi-pico/src/rp2040_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/rp2040/raspberrypi-pico/src/rp2040_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 - -#include -#include - -#include "rp2040_pico.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return rp2040_bringup(); -#endif -} diff --git a/boards/arm/rp2040/raspberrypi-pico/src/rp2040_boardinitialize.c b/boards/arm/rp2040/raspberrypi-pico/src/rp2040_boardinitialize.c index 6b321c98fe8..37572cb7506 100644 --- a/boards/arm/rp2040/raspberrypi-pico/src/rp2040_boardinitialize.c +++ b/boards/arm/rp2040/raspberrypi-pico/src/rp2040_boardinitialize.c @@ -38,6 +38,8 @@ #include "rp2040_common_initialize.h" #endif /* CONFIG_ARCH_BOARD_COMMON */ +#include "rp2040_pico.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -87,3 +89,29 @@ void rp2040_boardinitialize(void) /* --- Place any board specific initialization here --- */ } + +/**************************************************************************** + * 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 after up_initialize() and board_early_initialize() and just + * before the initial application is started. This additional + * initialization phase may be used, for example, to initialize board- + * specific device drivers for which board_early_initialize() is not + * suitable. + * + * Waiting for events, use of I2C, SPI, etc are permissible in the context + * of board_late_initialize(). That is because board_late_initialize() + * will run on a temporary, internal kernel thread. + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) +{ + rp2040_bringup(); +} +#endif diff --git a/boards/arm/rp2040/seeed-xiao-rp2040/src/CMakeLists.txt b/boards/arm/rp2040/seeed-xiao-rp2040/src/CMakeLists.txt index 8eee9ffef6f..e1a6fb92192 100644 --- a/boards/arm/rp2040/seeed-xiao-rp2040/src/CMakeLists.txt +++ b/boards/arm/rp2040/seeed-xiao-rp2040/src/CMakeLists.txt @@ -32,10 +32,6 @@ else() list(APPEND SRCS rp2040_userleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS rp2040_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_RP2040_FLASH_BOOT) diff --git a/boards/arm/rp2040/seeed-xiao-rp2040/src/Make.defs b/boards/arm/rp2040/seeed-xiao-rp2040/src/Make.defs index 94fb827eb98..4bace7adb8b 100644 --- a/boards/arm/rp2040/seeed-xiao-rp2040/src/Make.defs +++ b/boards/arm/rp2040/seeed-xiao-rp2040/src/Make.defs @@ -23,7 +23,6 @@ include $(TOPDIR)/Make.defs CSRCS = rp2040_boardinitialize.c -CSRCS += rp2040_appinit.c CSRCS += rp2040_bringup.c ifeq ($(CONFIG_DEV_GPIO),y) diff --git a/boards/arm/rp2040/seeed-xiao-rp2040/src/rp2040_appinit.c b/boards/arm/rp2040/seeed-xiao-rp2040/src/rp2040_appinit.c deleted file mode 100644 index f352631a022..00000000000 --- a/boards/arm/rp2040/seeed-xiao-rp2040/src/rp2040_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/rp2040/seeed-xiao-rp2040/src/rp2040_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 - -#include -#include - -#include "rp2040_pico.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return rp2040_bringup(); -#endif -} diff --git a/boards/arm/rp2040/seeed-xiao-rp2040/src/rp2040_boardinitialize.c b/boards/arm/rp2040/seeed-xiao-rp2040/src/rp2040_boardinitialize.c index 5a4a9b927b1..149f3ab0ff1 100644 --- a/boards/arm/rp2040/seeed-xiao-rp2040/src/rp2040_boardinitialize.c +++ b/boards/arm/rp2040/seeed-xiao-rp2040/src/rp2040_boardinitialize.c @@ -38,6 +38,8 @@ #include "rp2040_common_initialize.h" #endif /* CONFIG_ARCH_BOARD_COMMON */ +#include "rp2040_pico.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -95,3 +97,29 @@ void rp2040_boardinitialize(void) /* --- Place any board specific initialization here --- */ } + +/**************************************************************************** + * 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 after up_initialize() and board_early_initialize() and just + * before the initial application is started. This additional + * initialization phase may be used, for example, to initialize board- + * specific device drivers for which board_early_initialize() is not + * suitable. + * + * Waiting for events, use of I2C, SPI, etc are permissible in the context + * of board_late_initialize(). That is because board_late_initialize() + * will run on a temporary, internal kernel thread. + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) +{ + rp2040_bringup(); +} +#endif diff --git a/boards/arm/rp2040/w5500-evb-pico/src/CMakeLists.txt b/boards/arm/rp2040/w5500-evb-pico/src/CMakeLists.txt index 718b5adbc52..4e4c11b0ef6 100644 --- a/boards/arm/rp2040/w5500-evb-pico/src/CMakeLists.txt +++ b/boards/arm/rp2040/w5500-evb-pico/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS rp2040_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS rp2040_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_RP2040_FLASH_BOOT) diff --git a/boards/arm/rp2040/w5500-evb-pico/src/Make.defs b/boards/arm/rp2040/w5500-evb-pico/src/Make.defs index 7e03991e293..056abad6ae4 100644 --- a/boards/arm/rp2040/w5500-evb-pico/src/Make.defs +++ b/boards/arm/rp2040/w5500-evb-pico/src/Make.defs @@ -23,7 +23,6 @@ include $(TOPDIR)/Make.defs CSRCS = rp2040_boardinitialize.c -CSRCS += rp2040_appinit.c CSRCS += rp2040_bringup.c ifeq ($(CONFIG_DEV_GPIO),y) diff --git a/boards/arm/rp2040/w5500-evb-pico/src/rp2040_appinit.c b/boards/arm/rp2040/w5500-evb-pico/src/rp2040_appinit.c deleted file mode 100644 index ea71928c6a2..00000000000 --- a/boards/arm/rp2040/w5500-evb-pico/src/rp2040_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/rp2040/w5500-evb-pico/src/rp2040_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 - -#include -#include - -#include "rp2040_pico.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return rp2040_bringup(); -#endif -} diff --git a/boards/arm/rp2040/w5500-evb-pico/src/rp2040_boardinitialize.c b/boards/arm/rp2040/w5500-evb-pico/src/rp2040_boardinitialize.c index b483bf15b81..67b85cc16be 100644 --- a/boards/arm/rp2040/w5500-evb-pico/src/rp2040_boardinitialize.c +++ b/boards/arm/rp2040/w5500-evb-pico/src/rp2040_boardinitialize.c @@ -38,6 +38,8 @@ #include "rp2040_common_initialize.h" #endif /* CONFIG_ARCH_BOARD_COMMON */ +#include "rp2040_pico.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -87,3 +89,29 @@ void rp2040_boardinitialize(void) /* --- Place any board specific initialization here --- */ } + +/**************************************************************************** + * 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 after up_initialize() and board_early_initialize() and just + * before the initial application is started. This additional + * initialization phase may be used, for example, to initialize board- + * specific device drivers for which board_early_initialize() is not + * suitable. + * + * Waiting for events, use of I2C, SPI, etc are permissible in the context + * of board_late_initialize(). That is because board_late_initialize() + * will run on a temporary, internal kernel thread. + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) +{ + rp2040_bringup(); +} +#endif diff --git a/boards/arm/rp2040/waveshare-rp2040-lcd-1.28/src/CMakeLists.txt b/boards/arm/rp2040/waveshare-rp2040-lcd-1.28/src/CMakeLists.txt index ecf7f07357a..58962075b21 100644 --- a/boards/arm/rp2040/waveshare-rp2040-lcd-1.28/src/CMakeLists.txt +++ b/boards/arm/rp2040/waveshare-rp2040-lcd-1.28/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_DEV_GPIO) list(APPEND SRCS rp2040_gpio.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS rp2040_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_RP2040_FLASH_BOOT) diff --git a/boards/arm/rp2040/waveshare-rp2040-lcd-1.28/src/Make.defs b/boards/arm/rp2040/waveshare-rp2040-lcd-1.28/src/Make.defs index 4a80b4b94fe..a094f2af7c5 100644 --- a/boards/arm/rp2040/waveshare-rp2040-lcd-1.28/src/Make.defs +++ b/boards/arm/rp2040/waveshare-rp2040-lcd-1.28/src/Make.defs @@ -23,7 +23,6 @@ include $(TOPDIR)/Make.defs CSRCS = rp2040_boardinitialize.c -CSRCS += rp2040_appinit.c CSRCS += rp2040_bringup.c ifeq ($(CONFIG_DEV_GPIO),y) diff --git a/boards/arm/rp2040/waveshare-rp2040-lcd-1.28/src/rp2040_appinit.c b/boards/arm/rp2040/waveshare-rp2040-lcd-1.28/src/rp2040_appinit.c deleted file mode 100644 index 11c40ba8ae3..00000000000 --- a/boards/arm/rp2040/waveshare-rp2040-lcd-1.28/src/rp2040_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/rp2040/waveshare-rp2040-lcd-1.28/src/rp2040_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 - -#include -#include - -#include "rp2040_pico.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return rp2040_bringup(); -#endif -} diff --git a/boards/arm/rp2040/waveshare-rp2040-lcd-1.28/src/rp2040_boardinitialize.c b/boards/arm/rp2040/waveshare-rp2040-lcd-1.28/src/rp2040_boardinitialize.c index e29e731c325..cccde2d4cef 100644 --- a/boards/arm/rp2040/waveshare-rp2040-lcd-1.28/src/rp2040_boardinitialize.c +++ b/boards/arm/rp2040/waveshare-rp2040-lcd-1.28/src/rp2040_boardinitialize.c @@ -38,6 +38,8 @@ #include "rp2040_common_initialize.h" #endif /* CONFIG_ARCH_BOARD_COMMON */ +#include "rp2040_pico.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -87,3 +89,29 @@ void rp2040_boardinitialize(void) /* --- Place any board specific initialization here --- */ } + +/**************************************************************************** + * 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 after up_initialize() and board_early_initialize() and just + * before the initial application is started. This additional + * initialization phase may be used, for example, to initialize board- + * specific device drivers for which board_early_initialize() is not + * suitable. + * + * Waiting for events, use of I2C, SPI, etc are permissible in the context + * of board_late_initialize(). That is because board_late_initialize() + * will run on a temporary, internal kernel thread. + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) +{ + rp2040_bringup(); +} +#endif diff --git a/boards/arm/rp2040/waveshare-rp2040-zero/src/CMakeLists.txt b/boards/arm/rp2040/waveshare-rp2040-zero/src/CMakeLists.txt index fbaa24b8dfd..7be4051ef63 100644 --- a/boards/arm/rp2040/waveshare-rp2040-zero/src/CMakeLists.txt +++ b/boards/arm/rp2040/waveshare-rp2040-zero/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_DEV_GPIO) list(APPEND SRCS rp2040_gpio.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS rp2040_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_RP2040_FLASH_BOOT) diff --git a/boards/arm/rp2040/waveshare-rp2040-zero/src/Make.defs b/boards/arm/rp2040/waveshare-rp2040-zero/src/Make.defs index edb7516262d..f2a92e8ceda 100644 --- a/boards/arm/rp2040/waveshare-rp2040-zero/src/Make.defs +++ b/boards/arm/rp2040/waveshare-rp2040-zero/src/Make.defs @@ -21,7 +21,6 @@ include $(TOPDIR)/Make.defs CSRCS = rp2040_boardinitialize.c -CSRCS += rp2040_appinit.c CSRCS += rp2040_bringup.c ifeq ($(CONFIG_DEV_GPIO),y) diff --git a/boards/arm/rp2040/waveshare-rp2040-zero/src/rp2040_appinit.c b/boards/arm/rp2040/waveshare-rp2040-zero/src/rp2040_appinit.c deleted file mode 100644 index 6e89de01f1b..00000000000 --- a/boards/arm/rp2040/waveshare-rp2040-zero/src/rp2040_appinit.c +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** - * boards/arm/rp2040/waveshare-rp2040-zero/src/rp2040_appinit.c - * - * 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 -#include - -#include - -#include "rp2040_pico.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return rp2040_bringup(); -#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 after up_initialize() and board_early_initialize() and just - * before the initial application is started. This additional - * initialization phase may be used, for example, to initialize board- - * specific device drivers for which board_early_initialize() is not - * suitable. - * - * Waiting for events, use of I2C, SPI, etc are permissible in the context - * of board_late_initialize(). That is because board_late_initialize() - * will run on a temporary, internal kernel thread. - * - ****************************************************************************/ - -void board_late_initialize(void) -{ - rp2040_bringup(); -} diff --git a/boards/arm/rp2040/waveshare-rp2040-zero/src/rp2040_boardinitialize.c b/boards/arm/rp2040/waveshare-rp2040-zero/src/rp2040_boardinitialize.c index 14bfe7d8a11..ec10864091e 100644 --- a/boards/arm/rp2040/waveshare-rp2040-zero/src/rp2040_boardinitialize.c +++ b/boards/arm/rp2040/waveshare-rp2040-zero/src/rp2040_boardinitialize.c @@ -36,6 +36,8 @@ #include "rp2040_common_initialize.h" #endif /* CONFIG_ARCH_BOARD_COMMON */ +#include "rp2040_pico.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -79,3 +81,29 @@ void rp2040_boardinitialize(void) /* --- Place any board specific initialization here --- */ } + +/**************************************************************************** + * 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 after up_initialize() and board_early_initialize() and just + * before the initial application is started. This additional + * initialization phase may be used, for example, to initialize board- + * specific device drivers for which board_early_initialize() is not + * suitable. + * + * Waiting for events, use of I2C, SPI, etc are permissible in the context + * of board_late_initialize(). That is because board_late_initialize() + * will run on a temporary, internal kernel thread. + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) +{ + rp2040_bringup(); +} +#endif diff --git a/boards/arm/rp23xx/common/src/rp23xx_usbmsc.c b/boards/arm/rp23xx/common/src/rp23xx_usbmsc.c index 4bbc6af2aa9..4f3ef71bbb4 100644 --- a/boards/arm/rp23xx/common/src/rp23xx_usbmsc.c +++ b/boards/arm/rp23xx/common/src/rp23xx_usbmsc.c @@ -52,8 +52,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/rp23xx/pimoroni-pico-2-plus/src/CMakeLists.txt b/boards/arm/rp23xx/pimoroni-pico-2-plus/src/CMakeLists.txt index e90e5619041..74bce2000b0 100644 --- a/boards/arm/rp23xx/pimoroni-pico-2-plus/src/CMakeLists.txt +++ b/boards/arm/rp23xx/pimoroni-pico-2-plus/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS rp23xx_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS rp23xx_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_BOOT_RUNFROMFLASH) diff --git a/boards/arm/rp23xx/pimoroni-pico-2-plus/src/Make.defs b/boards/arm/rp23xx/pimoroni-pico-2-plus/src/Make.defs index 175ee9577b0..3da52c53f3f 100644 --- a/boards/arm/rp23xx/pimoroni-pico-2-plus/src/Make.defs +++ b/boards/arm/rp23xx/pimoroni-pico-2-plus/src/Make.defs @@ -21,7 +21,6 @@ include $(TOPDIR)/Make.defs CSRCS = rp23xx_boardinitialize.c -CSRCS += rp23xx_appinit.c CSRCS += rp23xx_bringup.c ifeq ($(CONFIG_DEV_GPIO),y) diff --git a/boards/arm/rp23xx/pimoroni-pico-2-plus/src/rp23xx_appinit.c b/boards/arm/rp23xx/pimoroni-pico-2-plus/src/rp23xx_appinit.c deleted file mode 100644 index 950224adeae..00000000000 --- a/boards/arm/rp23xx/pimoroni-pico-2-plus/src/rp23xx_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/rp23xx/pimoroni-pico-2-plus/src/rp23xx_appinit.c - * - * 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 - -#include -#include - -#include "rp23xx_pico.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return rp23xx_bringup(); -#endif -} diff --git a/boards/arm/rp23xx/pimoroni-pico-2-plus/src/rp23xx_boardinitialize.c b/boards/arm/rp23xx/pimoroni-pico-2-plus/src/rp23xx_boardinitialize.c index 8a3a683e1c0..9f215113b44 100644 --- a/boards/arm/rp23xx/pimoroni-pico-2-plus/src/rp23xx_boardinitialize.c +++ b/boards/arm/rp23xx/pimoroni-pico-2-plus/src/rp23xx_boardinitialize.c @@ -39,6 +39,8 @@ #include "rp23xx_common_initialize.h" #endif /* CONFIG_ARCH_BOARD_COMMON */ +#include "rp23xx_pico.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -92,3 +94,23 @@ void rp23xx_boardinitialize(void) /* --- Place any board specific initialization here --- */ } + +/**************************************************************************** + * 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) +{ + rp23xx_bringup(); +} +#endif diff --git a/boards/arm/rp23xx/raspberrypi-pico-2/src/CMakeLists.txt b/boards/arm/rp23xx/raspberrypi-pico-2/src/CMakeLists.txt index dea23013543..c93fc059e42 100644 --- a/boards/arm/rp23xx/raspberrypi-pico-2/src/CMakeLists.txt +++ b/boards/arm/rp23xx/raspberrypi-pico-2/src/CMakeLists.txt @@ -34,10 +34,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS rp23xx_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS rp23xx_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_BOOT_RUNFROMFLASH) diff --git a/boards/arm/rp23xx/raspberrypi-pico-2/src/Make.defs b/boards/arm/rp23xx/raspberrypi-pico-2/src/Make.defs index bae9125fd79..bde8c6216a2 100644 --- a/boards/arm/rp23xx/raspberrypi-pico-2/src/Make.defs +++ b/boards/arm/rp23xx/raspberrypi-pico-2/src/Make.defs @@ -21,7 +21,6 @@ include $(TOPDIR)/Make.defs CSRCS = rp23xx_boardinitialize.c -CSRCS += rp23xx_appinit.c CSRCS += rp23xx_bringup.c ifeq ($(CONFIG_DEV_GPIO),y) diff --git a/boards/arm/rp23xx/raspberrypi-pico-2/src/rp23xx_appinit.c b/boards/arm/rp23xx/raspberrypi-pico-2/src/rp23xx_appinit.c deleted file mode 100644 index 491d6f46044..00000000000 --- a/boards/arm/rp23xx/raspberrypi-pico-2/src/rp23xx_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/rp23xx/raspberrypi-pico-2/src/rp23xx_appinit.c - * - * 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 - -#include -#include - -#include "rp23xx_pico.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return rp23xx_bringup(); -#endif -} diff --git a/boards/arm/rp23xx/raspberrypi-pico-2/src/rp23xx_boardinitialize.c b/boards/arm/rp23xx/raspberrypi-pico-2/src/rp23xx_boardinitialize.c index 61d8d5dbd3b..274767b5cf8 100644 --- a/boards/arm/rp23xx/raspberrypi-pico-2/src/rp23xx_boardinitialize.c +++ b/boards/arm/rp23xx/raspberrypi-pico-2/src/rp23xx_boardinitialize.c @@ -39,6 +39,8 @@ #include "rp23xx_common_initialize.h" #endif /* CONFIG_ARCH_BOARD_COMMON */ +#include "rp23xx_pico.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -92,3 +94,23 @@ void rp23xx_boardinitialize(void) /* --- Place any board specific initialization here --- */ } + +/**************************************************************************** + * 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) +{ + rp23xx_bringup(); +} +#endif diff --git a/boards/arm/rp23xx/xiao-rp2350/src/CMakeLists.txt b/boards/arm/rp23xx/xiao-rp2350/src/CMakeLists.txt index 8abdb1c0feb..ae1c0b947db 100644 --- a/boards/arm/rp23xx/xiao-rp2350/src/CMakeLists.txt +++ b/boards/arm/rp23xx/xiao-rp2350/src/CMakeLists.txt @@ -34,10 +34,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS rp23xx_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS rp23xx_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_BOOT_RUNFROMFLASH) diff --git a/boards/arm/rp23xx/xiao-rp2350/src/Make.defs b/boards/arm/rp23xx/xiao-rp2350/src/Make.defs index f1ab8b40fec..eb07ce8c7d2 100644 --- a/boards/arm/rp23xx/xiao-rp2350/src/Make.defs +++ b/boards/arm/rp23xx/xiao-rp2350/src/Make.defs @@ -21,7 +21,6 @@ include $(TOPDIR)/Make.defs CSRCS = rp23xx_boardinitialize.c -CSRCS += rp23xx_appinit.c CSRCS += rp23xx_bringup.c ifeq ($(CONFIG_DEV_GPIO),y) diff --git a/boards/arm/rp23xx/xiao-rp2350/src/rp23xx_appinit.c b/boards/arm/rp23xx/xiao-rp2350/src/rp23xx_appinit.c deleted file mode 100644 index 9eb1060ce21..00000000000 --- a/boards/arm/rp23xx/xiao-rp2350/src/rp23xx_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/rp23xx/xiao-rp2350/src/rp23xx_appinit.c - * - * 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 - -#include -#include - -#include "rp23xx_pico.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return rp23xx_bringup(); -#endif -} diff --git a/boards/arm/rp23xx/xiao-rp2350/src/rp23xx_boardinitialize.c b/boards/arm/rp23xx/xiao-rp2350/src/rp23xx_boardinitialize.c index 108e4f69d52..41e231a6103 100644 --- a/boards/arm/rp23xx/xiao-rp2350/src/rp23xx_boardinitialize.c +++ b/boards/arm/rp23xx/xiao-rp2350/src/rp23xx_boardinitialize.c @@ -39,6 +39,8 @@ #include "rp23xx_common_initialize.h" #endif /* CONFIG_ARCH_BOARD_COMMON */ +#include "rp23xx_pico.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -92,3 +94,23 @@ void rp23xx_boardinitialize(void) /* --- Place any board specific initialization here --- */ } + +/**************************************************************************** + * 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) +{ + rp23xx_bringup(); +} +#endif diff --git a/boards/arm/s32k1xx/rddrone-bms772/src/Makefile b/boards/arm/s32k1xx/rddrone-bms772/src/Makefile index a2655e2ca35..77b2d200f6a 100644 --- a/boards/arm/s32k1xx/rddrone-bms772/src/Makefile +++ b/boards/arm/s32k1xx/rddrone-bms772/src/Makefile @@ -33,10 +33,6 @@ else CSRCS += s32k1xx_userleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += s32k1xx_appinit.c -endif - ifeq ($(CONFIG_BOARDCTL_RESET),y) CSRCS += s32k1xx_reset.c endif diff --git a/boards/arm/s32k1xx/rddrone-bms772/src/s32k1xx_appinit.c b/boards/arm/s32k1xx/rddrone-bms772/src/s32k1xx_appinit.c deleted file mode 100644 index d7f61f76041..00000000000 --- a/boards/arm/s32k1xx/rddrone-bms772/src/s32k1xx_appinit.c +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** - * boards/arm/s32k1xx/rddrone-bms772/src/s32k1xx_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. - * - ****************************************************************************/ - -/* Copyright 2022 NXP */ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#include -#include - -#include "rddrone-bms772.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return s32k1xx_bringup(); -#endif -} diff --git a/boards/arm/s32k1xx/s32k118evb/src/CMakeLists.txt b/boards/arm/s32k1xx/s32k118evb/src/CMakeLists.txt index a90d36a7add..8b180264800 100644 --- a/boards/arm/s32k1xx/s32k118evb/src/CMakeLists.txt +++ b/boards/arm/s32k1xx/s32k118evb/src/CMakeLists.txt @@ -33,10 +33,6 @@ else() list(APPEND SRCS s32k1xx_userleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS s32k1xx_appinit.c) -endif() - if(CONFIG_S32K1XX_LPI2C) list(APPEND SRCS s32k1xx_i2c.c) endif() diff --git a/boards/arm/s32k1xx/s32k118evb/src/Makefile b/boards/arm/s32k1xx/s32k118evb/src/Makefile index cc3a1362b0f..9e567f2fe8f 100644 --- a/boards/arm/s32k1xx/s32k118evb/src/Makefile +++ b/boards/arm/s32k1xx/s32k118evb/src/Makefile @@ -35,10 +35,6 @@ else CSRCS += s32k1xx_userleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += s32k1xx_appinit.c -endif - ifeq ($(CONFIG_S32K1XX_LPI2C),y) CSRCS += s32k1xx_i2c.c endif diff --git a/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_appinit.c b/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_appinit.c deleted file mode 100644 index 0f05471074e..00000000000 --- a/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_appinit.c +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** - * boards/arm/s32k1xx/s32k118evb/src/s32k1xx_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 -#include - -#include -#include - -#include "s32k118evb.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return s32k1xx_bringup(); -#endif -} diff --git a/boards/arm/s32k1xx/s32k144evb/src/CMakeLists.txt b/boards/arm/s32k1xx/s32k144evb/src/CMakeLists.txt index fc12ef06132..c7e23d3027f 100644 --- a/boards/arm/s32k1xx/s32k144evb/src/CMakeLists.txt +++ b/boards/arm/s32k1xx/s32k144evb/src/CMakeLists.txt @@ -33,10 +33,6 @@ else() list(APPEND SRCS s32k1xx_userleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS s32k1xx_appinit.c) -endif() - if(CONFIG_BOARDCTL_UNIQUEID) list(APPEND SRCS s32k1xx_uid.c) endif() diff --git a/boards/arm/s32k1xx/s32k144evb/src/Makefile b/boards/arm/s32k1xx/s32k144evb/src/Makefile index 3b364f45b77..14436bd46dd 100644 --- a/boards/arm/s32k1xx/s32k144evb/src/Makefile +++ b/boards/arm/s32k1xx/s32k144evb/src/Makefile @@ -35,10 +35,6 @@ else CSRCS += s32k1xx_userleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += s32k1xx_appinit.c -endif - ifeq ($(CONFIG_BOARDCTL_UNIQUEID),y) CSRCS += s32k1xx_uid.c endif diff --git a/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_appinit.c b/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_appinit.c deleted file mode 100644 index b928067dabb..00000000000 --- a/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_appinit.c +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** - * boards/arm/s32k1xx/s32k144evb/src/s32k1xx_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 -#include - -#include -#include - -#include "s32k144evb.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return s32k1xx_bringup(); -#endif -} diff --git a/boards/arm/s32k1xx/s32k146evb/src/CMakeLists.txt b/boards/arm/s32k1xx/s32k146evb/src/CMakeLists.txt index b1be587fc9d..536d7b99069 100644 --- a/boards/arm/s32k1xx/s32k146evb/src/CMakeLists.txt +++ b/boards/arm/s32k1xx/s32k146evb/src/CMakeLists.txt @@ -33,10 +33,6 @@ else() list(APPEND SRCS s32k1xx_userleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS s32k1xx_appinit.c) -endif() - if(CONFIG_S32K1XX_LPI2C) list(APPEND SRCS s32k1xx_i2c.c) endif() diff --git a/boards/arm/s32k1xx/s32k146evb/src/Makefile b/boards/arm/s32k1xx/s32k146evb/src/Makefile index 890e8c068c1..536f51627cf 100644 --- a/boards/arm/s32k1xx/s32k146evb/src/Makefile +++ b/boards/arm/s32k1xx/s32k146evb/src/Makefile @@ -35,10 +35,6 @@ else CSRCS += s32k1xx_userleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += s32k1xx_appinit.c -endif - ifeq ($(CONFIG_S32K1XX_LPI2C),y) CSRCS += s32k1xx_i2c.c endif diff --git a/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_appinit.c b/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_appinit.c deleted file mode 100644 index fb18b57f35a..00000000000 --- a/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_appinit.c +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** - * boards/arm/s32k1xx/s32k146evb/src/s32k1xx_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 -#include - -#include -#include - -#include "s32k146evb.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return s32k1xx_bringup(); -#endif -} diff --git a/boards/arm/s32k1xx/s32k148evb/src/CMakeLists.txt b/boards/arm/s32k1xx/s32k148evb/src/CMakeLists.txt index c714e6f1a83..37fc12917ca 100644 --- a/boards/arm/s32k1xx/s32k148evb/src/CMakeLists.txt +++ b/boards/arm/s32k1xx/s32k148evb/src/CMakeLists.txt @@ -33,10 +33,6 @@ else() list(APPEND SRCS s32k1xx_userleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS s32k1xx_appinit.c) -endif() - if(CONFIG_S32K1XX_LPI2C) list(APPEND SRCS s32k1xx_i2c.c) endif() diff --git a/boards/arm/s32k1xx/s32k148evb/src/Makefile b/boards/arm/s32k1xx/s32k148evb/src/Makefile index 20c230cea67..32b0126d656 100644 --- a/boards/arm/s32k1xx/s32k148evb/src/Makefile +++ b/boards/arm/s32k1xx/s32k148evb/src/Makefile @@ -35,10 +35,6 @@ else CSRCS += s32k1xx_userleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += s32k1xx_appinit.c -endif - ifeq ($(CONFIG_S32K1XX_LPI2C),y) CSRCS += s32k1xx_i2c.c endif diff --git a/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_appinit.c b/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_appinit.c deleted file mode 100644 index 147cf7423c1..00000000000 --- a/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_appinit.c +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** - * boards/arm/s32k1xx/s32k148evb/src/s32k1xx_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 -#include - -#include -#include - -#include "s32k148evb.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return s32k1xx_bringup(); -#endif -} diff --git a/boards/arm/s32k1xx/ucans32k146/src/CMakeLists.txt b/boards/arm/s32k1xx/ucans32k146/src/CMakeLists.txt index fda3e69bbb6..f1be68c82c9 100644 --- a/boards/arm/s32k1xx/ucans32k146/src/CMakeLists.txt +++ b/boards/arm/s32k1xx/ucans32k146/src/CMakeLists.txt @@ -33,10 +33,6 @@ else() list(APPEND SRCS s32k1xx_userleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS s32k1xx_appinit.c) -endif() - if(CONFIG_I2C_DRIVER) list(APPEND SRCS s32k1xx_i2c.c) endif() diff --git a/boards/arm/s32k1xx/ucans32k146/src/Makefile b/boards/arm/s32k1xx/ucans32k146/src/Makefile index 3ce33a32721..72cf943a341 100644 --- a/boards/arm/s32k1xx/ucans32k146/src/Makefile +++ b/boards/arm/s32k1xx/ucans32k146/src/Makefile @@ -35,10 +35,6 @@ else CSRCS += s32k1xx_userleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += s32k1xx_appinit.c -endif - ifeq ($(CONFIG_I2C_DRIVER),y) CSRCS += s32k1xx_i2c.c endif diff --git a/boards/arm/s32k1xx/ucans32k146/src/s32k1xx_appinit.c b/boards/arm/s32k1xx/ucans32k146/src/s32k1xx_appinit.c deleted file mode 100644 index 42b6ec7975c..00000000000 --- a/boards/arm/s32k1xx/ucans32k146/src/s32k1xx_appinit.c +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** - * boards/arm/s32k1xx/ucans32k146/src/s32k1xx_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 -#include - -#include -#include - -#include "ucans32k146.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return s32k1xx_bringup(); -#endif -} diff --git a/boards/arm/s32k3xx/mr-canhubk3/src/CMakeLists.txt b/boards/arm/s32k3xx/mr-canhubk3/src/CMakeLists.txt index 8fd5d762ddc..57d9107fb95 100644 --- a/boards/arm/s32k3xx/mr-canhubk3/src/CMakeLists.txt +++ b/boards/arm/s32k3xx/mr-canhubk3/src/CMakeLists.txt @@ -33,10 +33,6 @@ else() list(APPEND SRCS s32k3xx_userleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS s32k3xx_appinit.c) -endif() - if(CONFIG_FAT_DMAMEMORY) list(APPEND SRCS s32k3xx_dma_alloc.c) endif() diff --git a/boards/arm/s32k3xx/mr-canhubk3/src/Makefile b/boards/arm/s32k3xx/mr-canhubk3/src/Makefile index 78a95dd706c..62e37ef5dfc 100644 --- a/boards/arm/s32k3xx/mr-canhubk3/src/Makefile +++ b/boards/arm/s32k3xx/mr-canhubk3/src/Makefile @@ -35,10 +35,6 @@ else CSRCS += s32k3xx_userleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += s32k3xx_appinit.c -endif - ifeq ($(CONFIG_FAT_DMAMEMORY),y) CSRCS += s32k3xx_dma_alloc.c endif diff --git a/boards/arm/s32k3xx/mr-canhubk3/src/s32k3xx_appinit.c b/boards/arm/s32k3xx/mr-canhubk3/src/s32k3xx_appinit.c deleted file mode 100644 index 82a872cb124..00000000000 --- a/boards/arm/s32k3xx/mr-canhubk3/src/s32k3xx_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/s32k3xx/mr-canhubk3/src/s32k3xx_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. - * - ****************************************************************************/ - -/* Copyright 2022 NXP */ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#include - -#include "mr-canhubk3.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 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return s32k3xx_bringup(); -#endif -} diff --git a/boards/arm/s32k3xx/s32k344evb/src/CMakeLists.txt b/boards/arm/s32k3xx/s32k344evb/src/CMakeLists.txt index bcfe68442c7..c53340ff907 100644 --- a/boards/arm/s32k3xx/s32k344evb/src/CMakeLists.txt +++ b/boards/arm/s32k3xx/s32k344evb/src/CMakeLists.txt @@ -33,10 +33,6 @@ else() list(APPEND SRCS s32k3xx_userleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS s32k3xx_appinit.c) -endif() - if(CONFIG_S32K3XX_LPI2C) list(APPEND SRCS s32k3xx_i2c.c) endif() diff --git a/boards/arm/s32k3xx/s32k344evb/src/Makefile b/boards/arm/s32k3xx/s32k344evb/src/Makefile index 620e02abc8c..bbb72cd73ce 100644 --- a/boards/arm/s32k3xx/s32k344evb/src/Makefile +++ b/boards/arm/s32k3xx/s32k344evb/src/Makefile @@ -37,10 +37,6 @@ else CSRCS += s32k3xx_userleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += s32k3xx_appinit.c -endif - ifeq ($(CONFIG_S32K3XX_LPI2C),y) CSRCS += s32k3xx_i2c.c endif diff --git a/boards/arm/s32k3xx/s32k344evb/src/s32k3xx_appinit.c b/boards/arm/s32k3xx/s32k344evb/src/s32k3xx_appinit.c deleted file mode 100644 index 4e5d0cd6319..00000000000 --- a/boards/arm/s32k3xx/s32k344evb/src/s32k3xx_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/s32k3xx/s32k344evb/src/s32k3xx_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. - * - ****************************************************************************/ - -/* Copyright 2022 NXP */ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include - -#include - -#include "s32k344evb.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 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return s32k3xx_bringup(); -#endif -} diff --git a/boards/arm/sam34/arduino-due/src/CMakeLists.txt b/boards/arm/sam34/arduino-due/src/CMakeLists.txt index f2dc821be84..6cbaca9a587 100644 --- a/boards/arm/sam34/arduino-due/src/CMakeLists.txt +++ b/boards/arm/sam34/arduino-due/src/CMakeLists.txt @@ -45,10 +45,6 @@ if(CONFIG_ARDUINO_ITHEAD_TFT) endif() endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS sam_appinit.c) -endif() - if(CONFIG_SAM34_SPI0) list(APPEND SRCS sam_spidev.c) endif() diff --git a/boards/arm/sam34/arduino-due/src/Makefile b/boards/arm/sam34/arduino-due/src/Makefile index f30690d0f0d..175c06ded76 100644 --- a/boards/arm/sam34/arduino-due/src/Makefile +++ b/boards/arm/sam34/arduino-due/src/Makefile @@ -47,10 +47,6 @@ CSRCS += sam_lcd.c endif endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -endif - ifeq ($(CONFIG_SAM34_SPI0),y) CSRCS += sam_spidev.c endif diff --git a/boards/arm/sam34/arduino-due/src/sam_appinit.c b/boards/arm/sam34/arduino-due/src/sam_appinit.c deleted file mode 100644 index c0797d02357..00000000000 --- a/boards/arm/sam34/arduino-due/src/sam_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/sam34/arduino-due/src/sam_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 - -#include -#include - -#include "arduino-due.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return sam_bringup(); -#endif -} diff --git a/boards/arm/sam34/arduino-due/src/sam_bringup.c b/boards/arm/sam34/arduino-due/src/sam_bringup.c index e250294a1f2..f8ab5ba24e5 100644 --- a/boards/arm/sam34/arduino-due/src/sam_bringup.c +++ b/boards/arm/sam34/arduino-due/src/sam_bringup.c @@ -111,9 +111,7 @@ int sam_bringup(void) int ret = sam_sdinitialize(CONFIG_NSH_MMCSDMINOR); if (ret < 0) { - syslog(LOG_ERR, - "board_app_initialize: Failed to initialize MMC/SD slot: %d\n", - ret); + syslog(LOG_ERR, "Failed to initialize MMC/SD slot: %d\n", ret); return ret; } #endif diff --git a/boards/arm/sam34/flipnclick-sam3x/src/CMakeLists.txt b/boards/arm/sam34/flipnclick-sam3x/src/CMakeLists.txt index 9be0481a152..c9c615bf06c 100644 --- a/boards/arm/sam34/flipnclick-sam3x/src/CMakeLists.txt +++ b/boards/arm/sam34/flipnclick-sam3x/src/CMakeLists.txt @@ -28,10 +28,6 @@ else() list(APPEND SRCS sam_userleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS sam_appinit.c) -endif() - if(CONFIG_SAM34_SPI0) list(APPEND SRCS sam_spi0.c) endif() diff --git a/boards/arm/sam34/flipnclick-sam3x/src/Makefile b/boards/arm/sam34/flipnclick-sam3x/src/Makefile index eeffe1bb5aa..4cfc218ab8c 100644 --- a/boards/arm/sam34/flipnclick-sam3x/src/Makefile +++ b/boards/arm/sam34/flipnclick-sam3x/src/Makefile @@ -30,10 +30,6 @@ else CSRCS += sam_userleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -endif - ifeq ($(CONFIG_SAM34_SPI0),y) CSRCS += sam_spi0.c endif diff --git a/boards/arm/sam34/flipnclick-sam3x/src/sam_appinit.c b/boards/arm/sam34/flipnclick-sam3x/src/sam_appinit.c deleted file mode 100644 index c70c7aea3a3..00000000000 --- a/boards/arm/sam34/flipnclick-sam3x/src/sam_appinit.c +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** - * boards/arm/sam34/flipnclick-sam3x/src/sam_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 - -#include -#include - -#include "flipnclick-sam3x.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - - /* Perform board-specific initialization */ - - return sam_bringup(); -#endif -} diff --git a/boards/arm/sam34/sam3u-ek/src/CMakeLists.txt b/boards/arm/sam34/sam3u-ek/src/CMakeLists.txt index d1f04aa1448..1f85e6a5221 100644 --- a/boards/arm/sam34/sam3u-ek/src/CMakeLists.txt +++ b/boards/arm/sam34/sam3u-ek/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_LCD) list(APPEND SRCS sam_lcd.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS sam_appinit.c) -endif() - if(CONFIG_SAM34_HSMCI) list(APPEND SRCS sam_mmcsd.c) endif() diff --git a/boards/arm/sam34/sam3u-ek/src/Makefile b/boards/arm/sam34/sam3u-ek/src/Makefile index 77c0d921574..d9f2bd89558 100644 --- a/boards/arm/sam34/sam3u-ek/src/Makefile +++ b/boards/arm/sam34/sam3u-ek/src/Makefile @@ -28,10 +28,6 @@ ifeq ($(CONFIG_LCD),y) CSRCS += sam_lcd.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -endif - ifeq ($(CONFIG_SAM34_HSMCI),y) CSRCS += sam_mmcsd.c endif diff --git a/boards/arm/sam34/sam3u-ek/src/sam_appinit.c b/boards/arm/sam34/sam3u-ek/src/sam_appinit.c deleted file mode 100644 index f62e23ff420..00000000000 --- a/boards/arm/sam34/sam3u-ek/src/sam_appinit.c +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************************** - * boards/arm/sam34/sam3u-ek/src/sam_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 - -#include -#include -#include -#include - -#include -#include -#include - -#include "sam_hsmci.h" -#include "sam3u-ek.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -/* PORT and SLOT number probably depend on the board configuration */ - -#define NSH_HAVE_USBDEV 1 -#define NSH_HAVE_MMCSD 1 - -/* Can't support MMC/SD if the card interface is not enable */ - -#ifndef CONFIG_SAM34_HSMCI -# undef NSH_HAVE_MMCSD -#endif - -/* Can't support MMC/SD features if mountpoints are disabled or if SDIO - * support is not enabled. - */ - -#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAM34_HSMCI) -# undef NSH_HAVE_MMCSD -#endif - -#ifdef NSH_HAVE_MMCSD -# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 -# error "Only one MMC/SD slot" -# undef CONFIG_NSH_MMCSDSLOTNO -# endif - -# ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -# endif - -# ifndef CONFIG_NSH_MMCSDSLOTNO -# define CONFIG_NSH_MMCSDSLOTNO 0 -# endif -#endif - -/* Can't support USB features if USB is not enabled */ - -#ifndef CONFIG_USBDEV -# undef NSH_HAVE_USBDEV -#endif - -/**************************************************************************** - * 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) -{ - int ret; - -#ifdef NSH_HAVE_MMCSD - struct sdio_dev_s *sdio; - - /* Mount the SDIO-based MMC/SD block driver */ - - /* First, get an instance of the SDIO interface */ - - syslog(LOG_INFO, "Initializing SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); - - sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); - if (!sdio) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); - return -ENODEV; - } - - /* Now bind the SDIO interface to the MMC/SD driver */ - - syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=%d\n", - CONFIG_NSH_MMCSDMINOR); - - ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio); - if (ret != OK) - { - syslog(LOG_ERR, - "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); - return ret; - } - - syslog(LOG_INFO, "Successfully bound SDIO to the MMC/SD driver\n"); - - /* Then inform the HSMCI driver if there is or is not a card in the slot. */ - - sdio_mediachange(sdio, sam_cardinserted(0)); -#endif - -#ifdef CONFIG_INPUT - /* Initialize the touchscreen */ - - ret = sam_tsc_setup(0); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/sam34/sam3u-ek/src/sam_boot.c b/boards/arm/sam34/sam3u-ek/src/sam_boot.c index e327e565cdb..340eaf37030 100644 --- a/boards/arm/sam34/sam3u-ek/src/sam_boot.c +++ b/boards/arm/sam34/sam3u-ek/src/sam_boot.c @@ -28,16 +28,66 @@ #include +#include +#include +#include +#include + #include #include +#include +#include #include "arm_internal.h" +#include "sam_hsmci.h" #include "sam3u-ek.h" /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +/* PORT and SLOT number probably depend on the board configuration */ + +#define NSH_HAVE_USBDEV 1 +#define NSH_HAVE_MMCSD 1 + +/* Can't support MMC/SD if the card interface is not enable */ + +#ifndef CONFIG_SAM34_HSMCI +# undef NSH_HAVE_MMCSD +#endif + +/* Can't support MMC/SD features if mountpoints are disabled or if SDIO + * support is not enabled. + */ + +#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAM34_HSMCI) +# undef NSH_HAVE_MMCSD +#endif + +#ifdef NSH_HAVE_MMCSD +# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 +# error "Only one MMC/SD slot" +# undef CONFIG_NSH_MMCSDSLOTNO +# endif + +# ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +# endif + +# ifndef CONFIG_NSH_MMCSDSLOTNO +# define CONFIG_NSH_MMCSDSLOTNO 0 +# endif +#endif + +/* Can't support USB features if USB is not enabled */ + +#ifndef CONFIG_USBDEV +# undef NSH_HAVE_USBDEV +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -87,3 +137,73 @@ void sam_boardinitialize(void) } #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) +{ + int ret; + +#ifdef NSH_HAVE_MMCSD + struct sdio_dev_s *sdio; + + /* Mount the SDIO-based MMC/SD block driver */ + + /* First, get an instance of the SDIO interface */ + + syslog(LOG_INFO, "Initializing SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + + sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); + if (!sdio) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + return; + } + + /* Now bind the SDIO interface to the MMC/SD driver */ + + syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=%d\n", + CONFIG_NSH_MMCSDMINOR); + + ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio); + if (ret != OK) + { + syslog(LOG_ERR, + "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); + return; + } + + syslog(LOG_INFO, "Successfully bound SDIO to the MMC/SD driver\n"); + + /* Then inform the HSMCI driver if there is or is not a card in the slot. */ + + sdio_mediachange(sdio, sam_cardinserted(0)); +#endif + +#ifdef CONFIG_INPUT + /* Initialize the touchscreen */ + + ret = sam_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); +} +#endif diff --git a/boards/arm/sam34/sam4cmp-db/src/CMakeLists.txt b/boards/arm/sam34/sam4cmp-db/src/CMakeLists.txt index 7b04707c27d..8e3cf7ced48 100644 --- a/boards/arm/sam34/sam4cmp-db/src/CMakeLists.txt +++ b/boards/arm/sam34/sam4cmp-db/src/CMakeLists.txt @@ -20,13 +20,7 @@ # # ############################################################################## -set(SRCS sam_boot.c) - -if(CONFIG_BOARDCTL) - list(APPEND SRCS sam_appinit.c sam_bringup.c) -elseif(CONFIG_BOARD_LATE_INITIALIZE) - list(APPEND SRCS sam_bringup.c) -endif() +set(SRCS sam_boot.c sam_bringup.c) target_sources(board PRIVATE ${SRCS}) diff --git a/boards/arm/sam34/sam4cmp-db/src/Makefile b/boards/arm/sam34/sam4cmp-db/src/Makefile index 60c251a3c27..0bf1cae39ef 100644 --- a/boards/arm/sam34/sam4cmp-db/src/Makefile +++ b/boards/arm/sam34/sam4cmp-db/src/Makefile @@ -22,12 +22,6 @@ include $(TOPDIR)/Make.defs -CSRCS = sam_boot.c - -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c sam_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += sam_bringup.c -endif +CSRCS = sam_boot.c sam_bringup.c include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/sam34/sam4cmp-db/src/sam_appinit.c b/boards/arm/sam34/sam4cmp-db/src/sam_appinit.c deleted file mode 100644 index 12dd442304d..00000000000 --- a/boards/arm/sam34/sam4cmp-db/src/sam_appinit.c +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** - * boards/arm/sam34/sam4cmp-db/src/sam_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 - -#include - -#include "sam4cmp-db.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return sam_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/sam34/sam4e-ek/src/CMakeLists.txt b/boards/arm/sam34/sam4e-ek/src/CMakeLists.txt index 4f076e6ba3c..32db279ddea 100644 --- a/boards/arm/sam34/sam4e-ek/src/CMakeLists.txt +++ b/boards/arm/sam34/sam4e-ek/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS sam_boot.c sam_leds.c sam_buttons.c sam_udp.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS sam_appinit.c) -endif() - if(CONFIG_SAM34_HSMCI) list(APPEND SRCS sam_hsmci.c) endif() diff --git a/boards/arm/sam34/sam4e-ek/src/Makefile b/boards/arm/sam34/sam4e-ek/src/Makefile index 8eb4a01fc2c..3ac9e9a9464 100644 --- a/boards/arm/sam34/sam4e-ek/src/Makefile +++ b/boards/arm/sam34/sam4e-ek/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = sam_boot.c sam_leds.c sam_buttons.c sam_udp.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -endif - ifeq ($(CONFIG_SAM34_HSMCI),y) CSRCS += sam_hsmci.c endif diff --git a/boards/arm/sam34/sam4e-ek/src/sam_appinit.c b/boards/arm/sam34/sam4e-ek/src/sam_appinit.c deleted file mode 100644 index 3724ef938dc..00000000000 --- a/boards/arm/sam34/sam4e-ek/src/sam_appinit.c +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** - * boards/arm/sam34/sam4e-ek/src/sam_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 - -#include -#include -#include -#include - -#include - -#ifdef CONFIG_USBMONITOR -# include -#endif - -#include "sam4e-ek.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ - int ret; - -#ifdef HAVE_AT25 - /* Initialize the AT25 driver */ - - ret = sam_at25_automount(0); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: sam_at25_automount() failed: %d\n", ret); - return ret; - } -#endif - -#ifdef HAVE_HSMCI - /* Initialize the HSMCI driver */ - - ret = sam_hsmci_initialize(0); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: sam_hsmci_initialize(0) failed: %d\n", ret); - return ret; - } -#endif - -#ifdef CONFIG_INPUT_ADS7843E - /* Initialize the touchscreen */ - - ret = sam_tsc_setup(0); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); - } -#endif - -#ifdef HAVE_USBMONITOR - /* Start the USB Monitor */ - - ret = usbmonitor_start(); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); - return ret; - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/sam34/sam4e-ek/src/sam_boot.c b/boards/arm/sam34/sam4e-ek/src/sam_boot.c index d388a4a9155..b27d3dbc6b8 100644 --- a/boards/arm/sam34/sam4e-ek/src/sam_boot.c +++ b/boards/arm/sam34/sam4e-ek/src/sam_boot.c @@ -28,9 +28,18 @@ #include +#include +#include +#include +#include + #include #include +#ifdef CONFIG_USBMONITOR +# include +#endif + #include "arm_internal.h" #include "sam4e-ek.h" @@ -130,13 +139,49 @@ void sam_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform NSH initialization here instead of from the NSH. - * This alternative NSH initialization is necessary when NSH is ran in - * user-space but the initialization function must run in kernel space. - */ + int ret; -#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) - board_app_initialize(0); +#ifdef HAVE_AT25 + /* Initialize the AT25 driver */ + + ret = sam_at25_automount(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_at25_automount() failed: %d\n", ret); + return; + } +#endif + +#ifdef HAVE_HSMCI + /* Initialize the HSMCI driver */ + + ret = sam_hsmci_initialize(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_hsmci_initialize(0) failed: %d\n", ret); + return; + } +#endif + +#ifdef CONFIG_INPUT_ADS7843E + /* Initialize the touchscreen */ + + ret = sam_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); + } +#endif + +#ifdef HAVE_USBMONITOR + /* Start the USB Monitor */ + + ret = usbmonitor_start(); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); + return; + } #endif } #endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/sam34/sam4l-xplained/src/CMakeLists.txt b/boards/arm/sam34/sam4l-xplained/src/CMakeLists.txt index df6ab88bdca..2cbd47916db 100644 --- a/boards/arm/sam34/sam4l-xplained/src/CMakeLists.txt +++ b/boards/arm/sam34/sam4l-xplained/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS sam_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS sam_appinit.c) -endif() - if(CONFIG_SAM34_LCDCA) if(CONFIG_SAM4L_XPLAINED_SLCD1MODULE) list(APPEND SRCS sam_slcd.c) diff --git a/boards/arm/sam34/sam4l-xplained/src/Makefile b/boards/arm/sam34/sam4l-xplained/src/Makefile index 527ca0f45b5..714792ee519 100644 --- a/boards/arm/sam34/sam4l-xplained/src/Makefile +++ b/boards/arm/sam34/sam4l-xplained/src/Makefile @@ -38,10 +38,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += sam_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -endif - ifeq ($(CONFIG_SAM34_LCDCA),y) ifeq ($(CONFIG_SAM4L_XPLAINED_SLCD1MODULE),y) CSRCS += sam_slcd.c diff --git a/boards/arm/sam34/sam4l-xplained/src/sam_appinit.c b/boards/arm/sam34/sam4l-xplained/src/sam_appinit.c deleted file mode 100644 index b13b37c1b5f..00000000000 --- a/boards/arm/sam34/sam4l-xplained/src/sam_appinit.c +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** - * boards/arm/sam34/sam4l-xplained/src/sam_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 - -#include -#include - -#include - -#include "sam4l-xplained.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE -/* Support for the SD card slot on the I/O1 module */ - -/* Verify NSH PORT and SLOT settings */ - -# define SAM34_MMCSDSLOTNO 0 /* There is only one slot */ - -# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != SAM34_MMCSDSLOTNO -# error Only one MMC/SD slot: Slot 0 (CONFIG_NSH_MMCSDSLOTNO) -# endif - -# if defined(CONFIG_NSH_MMCSDSPIPORTNO) && CONFIG_NSH_MMCSDSPIPORTNO != SD_CSNO -# error CONFIG_NSH_MMCSDSPIPORTNO must have the same value as SD_CSNO -# endif - -/* Default MMC/SD minor number */ - -# ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -# endif -#endif - -/**************************************************************************** - * 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) -{ -#if defined(CONFIG_SAM34_LCDCA) && defined(CONFIG_SAM4L_XPLAINED_SLCD1MODULE) - /* Initialize the SLCD and register the SLCD device as /dev/slcd0 */ - - int ret = sam_slcd_initialize(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to initialize the LCD: %d\n", - ret); - return ret; - } -#endif -#if defined(CONFIG_SAM34_SPI0) && defined(CONFIG_SAM4L_XPLAINED_IOMODULE) - - /* Initialize the SPI-based MMC/SD slot */ - - int ret = sam_sdinitialize(CONFIG_NSH_MMCSDMINOR); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n", - ret); - return ret; - } -#endif - - return OK; -} diff --git a/boards/arm/sam34/sam4l-xplained/src/sam_boot.c b/boards/arm/sam34/sam4l-xplained/src/sam_boot.c index 0a55ded38fb..9ef93db9ed6 100644 --- a/boards/arm/sam34/sam4l-xplained/src/sam_boot.c +++ b/boards/arm/sam34/sam4l-xplained/src/sam_boot.c @@ -28,6 +28,9 @@ #include +#include +#include + #include #include "sam4l-xplained.h" @@ -36,6 +39,28 @@ * Pre-processor Definitions ****************************************************************************/ +#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE +/* Support for the SD card slot on the I/O1 module */ + +/* Verify NSH PORT and SLOT settings */ + +# define SAM34_MMCSDSLOTNO 0 /* There is only one slot */ + +# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != SAM34_MMCSDSLOTNO +# error Only one MMC/SD slot: Slot 0 (CONFIG_NSH_MMCSDSLOTNO) +# endif + +# if defined(CONFIG_NSH_MMCSDSPIPORTNO) && CONFIG_NSH_MMCSDSPIPORTNO != SD_CSNO +# error CONFIG_NSH_MMCSDSPIPORTNO must have the same value as SD_CSNO +# endif + +/* Default MMC/SD minor number */ + +# ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +# endif +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -74,3 +99,45 @@ void sam_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) +{ +#if defined(CONFIG_SAM34_LCDCA) && defined(CONFIG_SAM4L_XPLAINED_SLCD1MODULE) + /* Initialize the SLCD and register the SLCD device as /dev/slcd0 */ + + int ret = sam_slcd_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize the LCD: %d\n", + ret); + return; + } +#endif +#if defined(CONFIG_SAM34_SPI0) && defined(CONFIG_SAM4L_XPLAINED_IOMODULE) + + /* Initialize the SPI-based MMC/SD slot */ + + int ret = sam_sdinitialize(CONFIG_NSH_MMCSDMINOR); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n", + ret); + return; + } +#endif +} +#endif diff --git a/boards/arm/sam34/sam4s-xplained-pro/src/Makefile b/boards/arm/sam34/sam4s-xplained-pro/src/Makefile index 33c990d6bb9..f87e78bbed6 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/src/Makefile +++ b/boards/arm/sam34/sam4s-xplained-pro/src/Makefile @@ -28,10 +28,6 @@ ifeq ($(CONFIG_MMCSD_SPI),y) CSRCS += sam_spi.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -endif - ifeq ($(CONFIG_SAM34_EXTNAND),y) ifeq ($(CONFIG_MTD_NAND),y) CSRCS += sam_nandflash.c diff --git a/boards/arm/sam34/sam4s-xplained-pro/src/sam_appinit.c b/boards/arm/sam34/sam4s-xplained-pro/src/sam_appinit.c deleted file mode 100644 index 1b448b48a24..00000000000 --- a/boards/arm/sam34/sam4s-xplained-pro/src/sam_appinit.c +++ /dev/null @@ -1,173 +0,0 @@ -/**************************************************************************** - * boards/arm/sam34/sam4s-xplained-pro/src/sam_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 - -#include -#include -#include -#include -#include - -#include -#include -#include - -#ifdef CONFIG_CDCACM -# include -#endif - -#ifdef CONFIG_PL2303 -# include -#endif - -#ifdef CONFIG_USBMONITOR -# include -#endif - -#include "sam4s-xplained-pro.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) -{ -#if defined (HAVE_USBDEV) || defined(HAVE_HSMCI) || defined (HAVE_PROC) || \ - defined(HAVE_USBMONITOR) - int ret; -#endif - -#ifdef HAVE_USBDEV - syslog(LOG_INFO, "Registering CDC/ACM serial driver\n"); - - ret = cdcacm_initialize(CONFIG_SAM4S_XPLAINED_PRO_CDCACM_DEVMINOR, NULL); - if (ret < 0) - { - syslog(LOG_ERR, - "ERROR: Failed to create the CDC/ACM serial device: %d\n", ret); - return ret; - } -#endif - -#ifdef HAVE_NAND - ret = sam_nand_automount(SAM_SMC_CS0); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to initialize the NAND: %d\n", ret); - return ret; - } -#endif - -#ifdef HAVE_HSMCI - /* Initialize the HSMCI driver */ - - syslog(LOG_INFO, "initializing HSMCI\n"); - - ret = sam_hsmci_initialize(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: sam_hsmci_initialize() failed: %d\n", ret); - return ret; - } -#endif - -#ifdef HAVE_PROC - /* mount the proc filesystem */ - - syslog(LOG_INFO, "Mounting procfs to /proc\n"); - - ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); - if (ret < 0) - { - syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d\n", ret); - return ret; - } -#endif - -#if HAVE_HSMCI - syslog(LOG_INFO, "Mounting /dev/mmcsd0 to /fat\n"); - - ret = nx_mount("/dev/mmcsd0", "/fat", "vfat", 0, NULL); - if (ret < 0) - { - syslog(LOG_ERR, - "ERROR: Failed to mount the FAT filesystem: %d\n", ret); - return ret; - } -#endif - - /* SPI */ - -#ifdef HAVE_MMCSD_SPI - ret = sam_sdinitialize(0, 0); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n", ret); - return ret; - } -#endif - -#ifdef HAVE_USBMONITOR - /* Start the USB Monitor */ - - syslog(LOG_INFO, "Starting USB Monitor\n"); - ret = usbmonitor_start(); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); - return ret; - } -#endif - - return OK; -} diff --git a/boards/arm/sam34/sam4s-xplained-pro/src/sam_boot.c b/boards/arm/sam34/sam4s-xplained-pro/src/sam_boot.c index 73c34283828..b38f75e0814 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/src/sam_boot.c +++ b/boards/arm/sam34/sam4s-xplained-pro/src/sam_boot.c @@ -27,10 +27,31 @@ #include #include + #include +#include +#include +#include +#include +#include + #include #include +#include +#include + +#ifdef CONFIG_CDCACM +# include +#endif + +#ifdef CONFIG_PL2303 +# include +#endif + +#ifdef CONFIG_USBMONITOR +# include +#endif #include "sam4s-xplained-pro.h" @@ -75,6 +96,11 @@ void sam_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { +#if defined (HAVE_USBDEV) || defined(HAVE_HSMCI) || defined (HAVE_PROC) || \ + defined(HAVE_USBMONITOR) + int ret; +#endif + #if (defined(CONFIG_SAM34_WDT) && !defined(CONFIG_WDT_DISABLE_ON_RESET)) /* Configure watchdog timer and enable kicker kernel thread. */ @@ -88,5 +114,88 @@ void board_late_initialize(void) sam_led_initialize(); #endif + +#ifdef HAVE_USBDEV + syslog(LOG_INFO, "Registering CDC/ACM serial driver\n"); + + ret = cdcacm_initialize(CONFIG_SAM4S_XPLAINED_PRO_CDCACM_DEVMINOR, NULL); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to create the CDC/ACM serial device: %d\n", ret); + return; + } +#endif + +#ifdef HAVE_NAND + ret = sam_nand_automount(SAM_SMC_CS0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize the NAND: %d\n", ret); + return; + } +#endif + +#ifdef HAVE_HSMCI + /* Initialize the HSMCI driver */ + + syslog(LOG_INFO, "initializing HSMCI\n"); + + ret = sam_hsmci_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_hsmci_initialize() failed: %d\n", ret); + return; + } +#endif + +#ifdef HAVE_PROC + /* mount the proc filesystem */ + + syslog(LOG_INFO, "Mounting procfs to /proc\n"); + + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); + return; + } +#endif + +#if HAVE_HSMCI + syslog(LOG_INFO, "Mounting /dev/mmcsd0 to /fat\n"); + + ret = nx_mount("/dev/mmcsd0", "/fat", "vfat", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to mount the FAT filesystem: %d\n", ret); + return; + } +#endif + + /* SPI */ + +#ifdef HAVE_MMCSD_SPI + ret = sam_sdinitialize(0, 0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n", ret); + return; + } +#endif + +#ifdef HAVE_USBMONITOR + /* Start the USB Monitor */ + + syslog(LOG_INFO, "Starting USB Monitor\n"); + ret = usbmonitor_start(); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); + return; + } +#endif } #endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/sam34/sam4s-xplained/src/sam_boot.c b/boards/arm/sam34/sam4s-xplained/src/sam_boot.c index 21dd4d23cf3..e2bef2f5253 100644 --- a/boards/arm/sam34/sam4s-xplained/src/sam_boot.c +++ b/boards/arm/sam34/sam4s-xplained/src/sam_boot.c @@ -69,3 +69,23 @@ void sam_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 diff --git a/boards/arm/sama5/giant-board/src/Makefile b/boards/arm/sama5/giant-board/src/Makefile index 4d593b3715c..d49a8d831e7 100644 --- a/boards/arm/sama5/giant-board/src/Makefile +++ b/boards/arm/sama5/giant-board/src/Makefile @@ -22,7 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = sam_boot.c +CSRCS = sam_boot.c sam_bringup.c ifeq ($(CONFIG_SAMA5_SPI0),y) CSRCS += sam_spi.c @@ -60,11 +60,6 @@ CSRCS += sam_usb.c endif endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -CSRCS += sam_bringup.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += sam_adc.c ifeq ($(CONFIG_INPUT_AJOYSTICK),y) diff --git a/boards/arm/sama5/giant-board/src/sam_appinit.c b/boards/arm/sama5/giant-board/src/sam_appinit.c deleted file mode 100644 index a24d4714d5b..00000000000 --- a/boards/arm/sama5/giant-board/src/sam_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/sama5/giant-board/src/sam_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 -#include -#include - -#include - -#include "giant-board.h" - -#ifndef CONFIG_BUILD_KERNEL - -/**************************************************************************** - * 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 */ - - mcinfo("Entry\n"); - return sam_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BUILD_KERNEL */ diff --git a/boards/arm/sama5/jupiter-nano/src/Makefile b/boards/arm/sama5/jupiter-nano/src/Makefile index 8c4cba5b314..66f33d56e5f 100644 --- a/boards/arm/sama5/jupiter-nano/src/Makefile +++ b/boards/arm/sama5/jupiter-nano/src/Makefile @@ -22,7 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = sam_boot.c +CSRCS = sam_boot.c sam_bringup.c ifeq ($(CONFIG_SAMA5_SPI0),y) CSRCS += sam_spi.c @@ -78,11 +78,6 @@ CSRCS += sam_ethernet.c endif endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -CSRCS += sam_bringup.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += sam_adc.c ifeq ($(CONFIG_INPUT_AJOYSTICK),y) diff --git a/boards/arm/sama5/jupiter-nano/src/sam_appinit.c b/boards/arm/sama5/jupiter-nano/src/sam_appinit.c deleted file mode 100644 index 4ba39ccc35e..00000000000 --- a/boards/arm/sama5/jupiter-nano/src/sam_appinit.c +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** - * boards/arm/sama5/jupiter-nano/src/sam_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 -#include -#include - -#include - -#include "jupiter-nano.h" - -#ifndef CONFIG_BUILD_KERNEL - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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 */ - - mcinfo("Entry\n"); - return sam_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BUILD_KERNEL */ diff --git a/boards/arm/sama5/sama5d2-xult/src/Makefile b/boards/arm/sama5/sama5d2-xult/src/Makefile index 5067d286ad2..bf6252bc732 100644 --- a/boards/arm/sama5/sama5d2-xult/src/Makefile +++ b/boards/arm/sama5/sama5d2-xult/src/Makefile @@ -22,7 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = sam_boot.c +CSRCS = sam_boot.c sam_bringup.c ifeq ($(CONFIG_SAMA5_SPI0),y) CSRCS += sam_spi.c @@ -78,11 +78,6 @@ CSRCS += sam_ethernet.c endif endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -CSRCS += sam_bringup.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += sam_adc.c ifeq ($(CONFIG_INPUT_AJOYSTICK),y) diff --git a/boards/arm/sama5/sama5d2-xult/src/sam_appinit.c b/boards/arm/sama5/sama5d2-xult/src/sam_appinit.c deleted file mode 100644 index 6480aaae075..00000000000 --- a/boards/arm/sama5/sama5d2-xult/src/sam_appinit.c +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** - * boards/arm/sama5/sama5d2-xult/src/sam_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 -#include -#include - -#include - -#include "sama5d2-xult.h" - -#ifndef CONFIG_BUILD_KERNEL - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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 */ - - mcinfo("Entry\n"); - return sam_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BUILD_KERNEL */ diff --git a/boards/arm/sama5/sama5d3-xplained/src/CMakeLists.txt b/boards/arm/sama5/sama5d3-xplained/src/CMakeLists.txt index 264a89dee99..e2d57f3b36f 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/CMakeLists.txt +++ b/boards/arm/sama5/sama5d3-xplained/src/CMakeLists.txt @@ -20,7 +20,7 @@ # # ############################################################################## -set(SRCS sam_boot.c) +set(SRCS sam_boot.c sam_bringup.c) if(CONFIG_SAMA5_SPI0) list(APPEND SRCS sam_spi.c) @@ -68,11 +68,6 @@ else() endif() endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS sam_appinit.c) - list(APPEND SRCS sam_bringup.c) -endif() - if(CONFIG_ADC) list(APPEND SRCS sam_adc.c) if(CONFIG_INPUT_AJOYSTICK) diff --git a/boards/arm/sama5/sama5d3-xplained/src/Makefile b/boards/arm/sama5/sama5d3-xplained/src/Makefile index c5407450242..4b7a7008301 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/Makefile +++ b/boards/arm/sama5/sama5d3-xplained/src/Makefile @@ -22,7 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = sam_boot.c +CSRCS = sam_boot.c sam_bringup.c ifeq ($(CONFIG_SAMA5_SPI0),y) CSRCS += sam_spi.c @@ -70,11 +70,6 @@ CSRCS += sam_ethernet.c endif endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -CSRCS += sam_bringup.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += sam_adc.c ifeq ($(CONFIG_INPUT_AJOYSTICK),y) diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_appinit.c b/boards/arm/sama5/sama5d3-xplained/src/sam_appinit.c deleted file mode 100644 index 4339b5f01c5..00000000000 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/sama5/sama5d3-xplained/src/sam_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 - -#include -#include -#include -#include - -#include - -#ifdef CONFIG_USBMONITOR -# include -#endif - -#include "sama5d3-xplained.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. - * This function is also called by board_late_initialize if - * CONFIG_BOARD_LATE_INITIALIZE is defined. - * - * 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) -{ - /* Perform board initialization */ - - return sam_bringup(); -} diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_boot.c b/boards/arm/sama5/sama5d3-xplained/src/sam_boot.c index 97e8d740750..d81269be555 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_boot.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_boot.c @@ -28,8 +28,17 @@ #include +#include +#include +#include +#include + #include +#ifdef CONFIG_USBMONITOR +# include +#endif + #include "sam_sckc.h" #include "sama5d3-xplained.h" @@ -135,6 +144,6 @@ void sam_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - board_app_initialize(0); + sam_bringup(); } #endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/sama5/sama5d3x-ek/src/CMakeLists.txt b/boards/arm/sama5/sama5d3x-ek/src/CMakeLists.txt index 5e38173c135..2f4abafdb2d 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/CMakeLists.txt +++ b/boards/arm/sama5/sama5d3x-ek/src/CMakeLists.txt @@ -90,10 +90,6 @@ if(CONFIG_AUDIO_WM8904) endif() endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS sam_appinit.c) -endif() - if(CONFIG_ADC) list(APPEND SRCS sam_adc.c) endif() diff --git a/boards/arm/sama5/sama5d3x-ek/src/Makefile b/boards/arm/sama5/sama5d3x-ek/src/Makefile index 989c2261f35..fd422e0fad6 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/Makefile +++ b/boards/arm/sama5/sama5d3x-ek/src/Makefile @@ -92,10 +92,6 @@ endif endif endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += sam_adc.c endif diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_appinit.c b/boards/arm/sama5/sama5d3x-ek/src/sam_appinit.c deleted file mode 100644 index e474d39cd9e..00000000000 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_appinit.c +++ /dev/null @@ -1,226 +0,0 @@ -/**************************************************************************** - * boards/arm/sama5/sama5d3x-ek/src/sam_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 - -#include -#include -#include -#include - -#include -#include - -#ifdef CONFIG_USBMONITOR -# include -#endif - -#include "sama5d3x-ek.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ - int ret; - -#ifdef HAVE_NAND - /* Initialize the NAND driver */ - - ret = sam_nand_automount(NAND_MINOR); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: sam_nand_automount failed: %d\n", ret); - return ret; - } -#endif - -#ifdef HAVE_AT25 - /* Initialize the AT25 driver */ - - ret = sam_at25_automount(AT25_MINOR); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: sam_at25_automount failed: %d\n", ret); - return ret; - } -#endif - -#ifdef HAVE_AT24 - /* Initialize the AT24 driver */ - - ret = sam_at24_automount(AT24_MINOR); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: sam_at24_automount failed: %d\n", ret); - return ret; - } -#endif - -#ifdef HAVE_HSMCI -#ifdef CONFIG_SAMA5_HSMCI0 - /* Initialize the HSMCI0 driver */ - - ret = sam_hsmci_initialize(HSMCI0_SLOTNO, HSMCI0_MINOR); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: sam_hsmci_initialize(%d,%d) failed: %d\n", - HSMCI0_SLOTNO, HSMCI0_MINOR, ret); - return ret; - } -#endif - -#ifdef CONFIG_SAMA5_HSMCI1 - /* Initialize the HSMCI1 driver */ - - ret = sam_hsmci_initialize(HSMCI1_SLOTNO, HSMCI1_MINOR); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: sam_hsmci_initialize(%d,%d) failed: %d\n", - HSMCI1_SLOTNO, HSMCI1_MINOR, ret); - return ret; - } -#endif -#endif - -#ifdef HAVE_USBHOST - /* Initialize USB host operation. sam_usbhost_initialize() starts a thread - * will monitor for USB connection and disconnection events. - */ - - ret = sam_usbhost_initialize(); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); - return ret; - } -#endif - -#ifdef HAVE_USBMONITOR - /* Start the USB Monitor */ - - ret = usbmonitor_start(); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: Start USB monitor: %d\n", ret); - } -#endif - -#ifdef CONFIG_SAMA5_TSD - /* Initialize the touchscreen */ - - ret = sam_tsc_setup(0); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); - } -#endif - -#ifdef HAVE_WM8904 - /* Configure WM8904 audio */ - - ret = sam_wm8904_initialize(0); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: Failed to initialize WM8904 audio: %d\n", - ret); - } -#endif - -#ifdef CONFIG_PWM - /* Initialize PWM and register the PWM device. */ - - ret = sam_pwm_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: sam_pwm_setup() failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_ADC - /* Initialize ADC and register the ADC driver. */ - - ret = sam_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: sam_adc_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_CAN - /* Initialize CAN and register the CAN driver. */ - - ret = sam_can_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: sam_can_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_FS_PROCFS - /* Mount the procfs file system */ - - ret = nx_mount(NULL, SAMA5_PROCFS_MOUNTPOINT, "procfs", 0, NULL); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", - SAMA5_PROCFS_MOUNTPOINT, ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_boot.c b/boards/arm/sama5/sama5d3x-ek/src/sam_boot.c index b4639b1f73b..4e25212bf30 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_boot.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_boot.c @@ -28,7 +28,17 @@ #include +#include +#include +#include +#include + #include +#include + +#ifdef CONFIG_USBMONITOR +# include +#endif #include "sam_sckc.h" #include "sama5d3x-ek.h" @@ -139,13 +149,152 @@ void sam_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform NSH initialization here instead of from the NSH. - * This alternative NSH initialization is necessary when NSH is ran in - * user-space but the initialization function must run in kernel space. + int ret; + +#ifdef HAVE_NAND + /* Initialize the NAND driver */ + + ret = sam_nand_automount(NAND_MINOR); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_nand_automount failed: %d\n", ret); + return; + } +#endif + +#ifdef HAVE_AT25 + /* Initialize the AT25 driver */ + + ret = sam_at25_automount(AT25_MINOR); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_at25_automount failed: %d\n", ret); + return; + } +#endif + +#ifdef HAVE_AT24 + /* Initialize the AT24 driver */ + + ret = sam_at24_automount(AT24_MINOR); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_at24_automount failed: %d\n", ret); + return ret; + } +#endif + +#ifdef HAVE_HSMCI +#ifdef CONFIG_SAMA5_HSMCI0 + /* Initialize the HSMCI0 driver */ + + ret = sam_hsmci_initialize(HSMCI0_SLOTNO, HSMCI0_MINOR); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_hsmci_initialize(%d,%d) failed: %d\n", + HSMCI0_SLOTNO, HSMCI0_MINOR, ret); + return; + } +#endif + +#ifdef CONFIG_SAMA5_HSMCI1 + /* Initialize the HSMCI1 driver */ + + ret = sam_hsmci_initialize(HSMCI1_SLOTNO, HSMCI1_MINOR); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_hsmci_initialize(%d,%d) failed: %d\n", + HSMCI1_SLOTNO, HSMCI1_MINOR, ret); + return; + } +#endif +#endif + +#ifdef HAVE_USBHOST + /* Initialize USB host operation. sam_usbhost_initialize() starts a thread + * will monitor for USB connection and disconnection events. */ -#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) - board_app_initialize(0); + ret = sam_usbhost_initialize(); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); + return; + } #endif + +#ifdef HAVE_USBMONITOR + /* Start the USB Monitor */ + + ret = usbmonitor_start(); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: Start USB monitor: %d\n", ret); + } +#endif + +#ifdef CONFIG_SAMA5_TSD + /* Initialize the touchscreen */ + + ret = sam_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_tsc_setup failed: %d\n", ret); + } +#endif + +#ifdef HAVE_WM8904 + /* Configure WM8904 audio */ + + ret = sam_wm8904_initialize(0); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: Failed to initialize WM8904 audio: %d\n", + ret); + } +#endif + +#ifdef CONFIG_PWM + /* Initialize PWM and register the PWM device. */ + + ret = sam_pwm_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_pwm_setup() failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_ADC + /* Initialize ADC and register the ADC driver. */ + + ret = sam_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_adc_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_CAN + /* Initialize CAN and register the CAN driver. */ + + ret = sam_can_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: sam_can_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_FS_PROCFS + /* Mount the procfs file system */ + + ret = nx_mount(NULL, SAMA5_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", + SAMA5_PROCFS_MOUNTPOINT, ret); + } +#endif + + UNUSED(ret); } #endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/sama5/sama5d4-ek/src/Makefile b/boards/arm/sama5/sama5d4-ek/src/Makefile index fcf53d81722..1705067c351 100644 --- a/boards/arm/sama5/sama5d4-ek/src/Makefile +++ b/boards/arm/sama5/sama5d4-ek/src/Makefile @@ -22,7 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = sam_boot.c +CSRCS = sam_boot.c sam_bringup.c ifeq ($(CONFIG_SAMA5_SPI0),y) CSRCS += sam_spi.c @@ -98,14 +98,6 @@ ifeq ($(CONFIG_INPUT_MXT),y) CSRCS += sam_maxtouch.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c sam_bringup.c -else -ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += sam_bringup.c -endif -endif - ifeq ($(CONFIG_ADC),y) CSRCS += sam_adc.c endif diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_appinit.c b/boards/arm/sama5/sama5d4-ek/src/sam_appinit.c deleted file mode 100644 index 8e031ea4580..00000000000 --- a/boards/arm/sama5/sama5d4-ek/src/sam_appinit.c +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** - * boards/arm/sama5/sama5d4-ek/src/sam_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 - -#include - -#include "sama5d4-ek.h" - -#ifdef CONFIG_BOARDCTL - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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 sam_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/samd2l2/arduino-m0/src/CMakeLists.txt b/boards/arm/samd2l2/arduino-m0/src/CMakeLists.txt index 89239331588..0853eb2172a 100644 --- a/boards/arm/samd2l2/arduino-m0/src/CMakeLists.txt +++ b/boards/arm/samd2l2/arduino-m0/src/CMakeLists.txt @@ -40,10 +40,6 @@ if(CONFIG_SAMD2L2_ADC) list(APPEND SRCS sam_adc.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS sam_appinit.c) -endif() - if(CONFIG_USBDEV) list(APPEND SRCS sam_usb.c) endif() diff --git a/boards/arm/samd2l2/arduino-m0/src/Makefile b/boards/arm/samd2l2/arduino-m0/src/Makefile index 589a77a2e66..353c3f02a21 100644 --- a/boards/arm/samd2l2/arduino-m0/src/Makefile +++ b/boards/arm/samd2l2/arduino-m0/src/Makefile @@ -42,10 +42,6 @@ ifeq ($(CONFIG_SAMD2L2_ADC),y) CSRCS += sam_adc.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -endif - ifeq ($(CONFIG_USBDEV),y) CSRCS += sam_usb.c endif diff --git a/boards/arm/samd2l2/arduino-m0/src/sam_appinit.c b/boards/arm/samd2l2/arduino-m0/src/sam_appinit.c deleted file mode 100644 index 0c0b0ad0c53..00000000000 --- a/boards/arm/samd2l2/arduino-m0/src/sam_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/samd2l2/arduino-m0/src/sam_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 - -#include -#include - -#include - -#include "sam_config.h" -#include "arduino_m0.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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; -} diff --git a/boards/arm/samd2l2/circuit-express/src/CMakeLists.txt b/boards/arm/samd2l2/circuit-express/src/CMakeLists.txt index 9cb752dde4a..4a9ee83e10a 100644 --- a/boards/arm/samd2l2/circuit-express/src/CMakeLists.txt +++ b/boards/arm/samd2l2/circuit-express/src/CMakeLists.txt @@ -30,10 +30,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS sam_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS sam_appinit.c) -endif() - if(CONFIG_USBDEV) list(APPEND SRCS sam_usb.c) endif() diff --git a/boards/arm/samd2l2/circuit-express/src/Makefile b/boards/arm/samd2l2/circuit-express/src/Makefile index 4c900778633..4358cafdba0 100644 --- a/boards/arm/samd2l2/circuit-express/src/Makefile +++ b/boards/arm/samd2l2/circuit-express/src/Makefile @@ -32,10 +32,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += sam_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -endif - ifeq ($(CONFIG_USBDEV),y) CSRCS += sam_usb.c endif diff --git a/boards/arm/samd2l2/circuit-express/src/sam_appinit.c b/boards/arm/samd2l2/circuit-express/src/sam_appinit.c deleted file mode 100644 index 3ed179cde26..00000000000 --- a/boards/arm/samd2l2/circuit-express/src/sam_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/samd2l2/circuit-express/src/sam_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 - -#include -#include - -#include - -#include "sam_config.h" -#include "circuit_express.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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; -} diff --git a/boards/arm/samd2l2/samd20-xplained/src/CMakeLists.txt b/boards/arm/samd2l2/samd20-xplained/src/CMakeLists.txt index a44b6acffab..b0b8bf4fd1a 100644 --- a/boards/arm/samd2l2/samd20-xplained/src/CMakeLists.txt +++ b/boards/arm/samd2l2/samd20-xplained/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS sam_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS sam_appinit.c) -endif() - if(CONFIG_SAMD20_XPLAINED_IOMODULE) list(APPEND SRCS sam_mmcsd.c) endif() diff --git a/boards/arm/samd2l2/samd20-xplained/src/Makefile b/boards/arm/samd2l2/samd20-xplained/src/Makefile index 689ba85d40d..989bc90eb35 100644 --- a/boards/arm/samd2l2/samd20-xplained/src/Makefile +++ b/boards/arm/samd2l2/samd20-xplained/src/Makefile @@ -38,10 +38,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += sam_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -endif - ifeq ($(CONFIG_SAMD20_XPLAINED_IOMODULE),y) CSRCS += sam_mmcsd.c endif diff --git a/boards/arm/samd2l2/samd20-xplained/src/sam_appinit.c b/boards/arm/samd2l2/samd20-xplained/src/sam_appinit.c deleted file mode 100644 index a6253c78497..00000000000 --- a/boards/arm/samd2l2/samd20-xplained/src/sam_appinit.c +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** - * boards/arm/samd2l2/samd20-xplained/src/sam_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 - -#include -#include - -#include - -#include "sam_config.h" -#include "samd20-xplained.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Some configuration checks */ - -#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE_EXT1 -# ifndef SAMD2L2_HAVE_SPI0 -# error I/O1 module on EXT1 requires SERCOM SPI0 -# undef CONFIG_SAMD20_XPLAINED_IOMODULE -# endif -# define SPI_PORTNO 0 -#endif - -#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE_EXT2 -# ifndef SAMD2L2_HAVE_SPI1 -# error I/O1 module on EXT2 requires SERCOM SPI1 -# undef CONFIG_SAMD20_XPLAINED_IOMODULE -# endif -# define SPI_PORTNO 1 -#endif - -#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE -/* Support for the SD card slot on the I/O1 module */ - -/* Verify NSH PORT and SLOT settings */ - -# define SAMD2L2_MMCSDSLOTNO 0 /* There is only one slot */ - -# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != SAMD2L2_MMCSDSLOTNO -# error Only one MMC/SD slot: Slot 0 (CONFIG_NSH_MMCSDSLOTNO) -# endif - -# if defined(CONFIG_NSH_MMCSDSPIPORTNO) && CONFIG_NSH_MMCSDSPIPORTNO != SPI_PORTNO -# error CONFIG_NSH_MMCSDSPIPORTNO must have the same value as SPI_PORTNO -# endif - -/* Default MMC/SD minor number */ - -# ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -# endif -#endif - -/**************************************************************************** - * 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) -{ -#if defined(SAMD2L2_HAVE_SPI0) && defined(CONFIG_SAMD20_XPLAINED_IOMODULE) - /* Initialize the SPI-based MMC/SD slot */ - - int ret = sam_sdinitialize(SPI_PORTNO, CONFIG_NSH_MMCSDMINOR); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n", - ret); - return ret; - } -#endif - - return OK; -} diff --git a/boards/arm/samd2l2/samd20-xplained/src/sam_boot.c b/boards/arm/samd2l2/samd20-xplained/src/sam_boot.c index 9e895df2a61..0c46f02937d 100644 --- a/boards/arm/samd2l2/samd20-xplained/src/sam_boot.c +++ b/boards/arm/samd2l2/samd20-xplained/src/sam_boot.c @@ -28,6 +28,9 @@ #include +#include +#include + #include #include "sam_config.h" @@ -37,6 +40,46 @@ * Pre-processor Definitions ****************************************************************************/ +/* Some configuration checks */ + +#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE_EXT1 +# ifndef SAMD2L2_HAVE_SPI0 +# error I/O1 module on EXT1 requires SERCOM SPI0 +# undef CONFIG_SAMD20_XPLAINED_IOMODULE +# endif +# define SPI_PORTNO 0 +#endif + +#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE_EXT2 +# ifndef SAMD2L2_HAVE_SPI1 +# error I/O1 module on EXT2 requires SERCOM SPI1 +# undef CONFIG_SAMD20_XPLAINED_IOMODULE +# endif +# define SPI_PORTNO 1 +#endif + +#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE +/* Support for the SD card slot on the I/O1 module */ + +/* Verify NSH PORT and SLOT settings */ + +# define SAMD2L2_MMCSDSLOTNO 0 /* There is only one slot */ + +# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != SAMD2L2_MMCSDSLOTNO +# error Only one MMC/SD slot: Slot 0 (CONFIG_NSH_MMCSDSLOTNO) +# endif + +# if defined(CONFIG_NSH_MMCSDSPIPORTNO) && CONFIG_NSH_MMCSDSPIPORTNO != SPI_PORTNO +# error CONFIG_NSH_MMCSDSPIPORTNO must have the same value as SPI_PORTNO +# endif + +/* Default MMC/SD minor number */ + +# ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +# endif +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -76,3 +119,33 @@ void sam_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_intitialize() 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) +{ +#if defined(SAMD2L2_HAVE_SPI0) && defined(CONFIG_SAMD20_XPLAINED_IOMODULE) + /* Initialize the SPI-based MMC/SD slot */ + + int ret = sam_sdinitialize(SPI_PORTNO, CONFIG_NSH_MMCSDMINOR); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n", + ret); + return; + } +#endif +} +#endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/samd2l2/samd21-xplained/src/CMakeLists.txt b/boards/arm/samd2l2/samd21-xplained/src/CMakeLists.txt index 9a63d81bbc9..b10b38f564a 100644 --- a/boards/arm/samd2l2/samd21-xplained/src/CMakeLists.txt +++ b/boards/arm/samd2l2/samd21-xplained/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS sam_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS sam_appinit.c) -endif() - if(CONFIG_SAMD21_XPLAINED_IOMODULE) list(APPEND SRCS sam_mmcsd.c) endif() diff --git a/boards/arm/samd2l2/samd21-xplained/src/Makefile b/boards/arm/samd2l2/samd21-xplained/src/Makefile index cb5b4d63f3b..4a5056cedaa 100644 --- a/boards/arm/samd2l2/samd21-xplained/src/Makefile +++ b/boards/arm/samd2l2/samd21-xplained/src/Makefile @@ -38,10 +38,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += sam_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -endif - ifeq ($(CONFIG_SAMD21_XPLAINED_IOMODULE),y) CSRCS += sam_mmcsd.c endif diff --git a/boards/arm/samd2l2/samd21-xplained/src/sam_appinit.c b/boards/arm/samd2l2/samd21-xplained/src/sam_appinit.c deleted file mode 100644 index 48db7a3097e..00000000000 --- a/boards/arm/samd2l2/samd21-xplained/src/sam_appinit.c +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** - * boards/arm/samd2l2/samd21-xplained/src/sam_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 - -#include -#include - -#include - -#include "sam_config.h" -#include "samd21-xplained.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Some configuration checks */ - -#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT1 -# ifndef SAMD2L2_HAVE_SPI0 -# error I/O1 module on EXT1 requires SERCOM SPI0 -# undef CONFIG_SAMD21_XPLAINED_IOMODULE -# endif -# define SPI_PORTNO 0 -#endif - -#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT2 -# ifndef SAMD2L2_HAVE_SPI1 -# error I/O1 module on EXT2 requires SERCOM SPI1 -# undef CONFIG_SAMD21_XPLAINED_IOMODULE -# endif -# define SPI_PORTNO 1 -#endif - -#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE -/* Support for the SD card slot on the I/O1 module */ - -/* Verify NSH PORT and SLOT settings */ - -# define SAMD2L2_MMCSDSLOTNO 0 /* There is only one slot */ - -# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != SAMD2L2_MMCSDSLOTNO -# error Only one MMC/SD slot: Slot 0 (CONFIG_NSH_MMCSDSLOTNO) -# endif - -# if defined(CONFIG_NSH_MMCSDSPIPORTNO) && CONFIG_NSH_MMCSDSPIPORTNO != SPI_PORTNO -# error CONFIG_NSH_MMCSDSPIPORTNO must have the same value as SPI_PORTNO -# endif - -/* Default MMC/SD minor number */ - -# ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -# endif -#endif - -/**************************************************************************** - * 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) -{ -#if defined(SAMD2L2_HAVE_SPI0) && defined(CONFIG_SAMD21_XPLAINED_IOMODULE) - /* Initialize the SPI-based MMC/SD slot */ - - int ret = sam_sdinitialize(SPI_PORTNO, CONFIG_NSH_MMCSDMINOR); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n", - ret); - return ret; - } -#endif - - return OK; -} diff --git a/boards/arm/samd2l2/samd21-xplained/src/sam_boot.c b/boards/arm/samd2l2/samd21-xplained/src/sam_boot.c index 96db7e21c17..c309ae771c7 100644 --- a/boards/arm/samd2l2/samd21-xplained/src/sam_boot.c +++ b/boards/arm/samd2l2/samd21-xplained/src/sam_boot.c @@ -28,6 +28,9 @@ #include +#include +#include + #include #include "sam_config.h" @@ -37,6 +40,46 @@ * Pre-processor Definitions ****************************************************************************/ +/* Some configuration checks */ + +#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT1 +# ifndef SAMD2L2_HAVE_SPI0 +# error I/O1 module on EXT1 requires SERCOM SPI0 +# undef CONFIG_SAMD21_XPLAINED_IOMODULE +# endif +# define SPI_PORTNO 0 +#endif + +#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT2 +# ifndef SAMD2L2_HAVE_SPI1 +# error I/O1 module on EXT2 requires SERCOM SPI1 +# undef CONFIG_SAMD21_XPLAINED_IOMODULE +# endif +# define SPI_PORTNO 1 +#endif + +#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE +/* Support for the SD card slot on the I/O1 module */ + +/* Verify NSH PORT and SLOT settings */ + +# define SAMD2L2_MMCSDSLOTNO 0 /* There is only one slot */ + +# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != SAMD2L2_MMCSDSLOTNO +# error Only one MMC/SD slot: Slot 0 (CONFIG_NSH_MMCSDSLOTNO) +# endif + +# if defined(CONFIG_NSH_MMCSDSPIPORTNO) && CONFIG_NSH_MMCSDSPIPORTNO != SPI_PORTNO +# error CONFIG_NSH_MMCSDSPIPORTNO must have the same value as SPI_PORTNO +# endif + +/* Default MMC/SD minor number */ + +# ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +# endif +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -77,3 +120,33 @@ void sam_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_intitialize() 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) +{ +#if defined(SAMD2L2_HAVE_SPI0) && defined(CONFIG_SAMD21_XPLAINED_IOMODULE) + /* Initialize the SPI-based MMC/SD slot */ + + int ret = sam_sdinitialize(SPI_PORTNO, CONFIG_NSH_MMCSDMINOR); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n", + ret); + return; + } +#endif +} +#endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/samd2l2/saml21-xplained/src/CMakeLists.txt b/boards/arm/samd2l2/saml21-xplained/src/CMakeLists.txt index 7395e6f3a03..49fc9ccc270 100644 --- a/boards/arm/samd2l2/saml21-xplained/src/CMakeLists.txt +++ b/boards/arm/samd2l2/saml21-xplained/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS sam_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS sam_appinit.c) -endif() - if(CONFIG_SAML21_XPLAINED_IOMODULE) list(APPEND SRCS sam_mmcsd.c) endif() diff --git a/boards/arm/samd2l2/saml21-xplained/src/Makefile b/boards/arm/samd2l2/saml21-xplained/src/Makefile index 0ec3b38d432..672ca0a11e7 100644 --- a/boards/arm/samd2l2/saml21-xplained/src/Makefile +++ b/boards/arm/samd2l2/saml21-xplained/src/Makefile @@ -38,10 +38,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += sam_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -endif - ifeq ($(CONFIG_SAML21_XPLAINED_IOMODULE),y) CSRCS += sam_mmcsd.c endif diff --git a/boards/arm/samd2l2/saml21-xplained/src/sam_appinit.c b/boards/arm/samd2l2/saml21-xplained/src/sam_appinit.c deleted file mode 100644 index 9983d79e8ec..00000000000 --- a/boards/arm/samd2l2/saml21-xplained/src/sam_appinit.c +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** - * boards/arm/samd2l2/saml21-xplained/src/sam_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 - -#include -#include - -#include - -#include "sam_config.h" -#include "saml21-xplained.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Some configuration checks */ - -#ifdef CONFIG_SAML21_XPLAINED_IOMODULE_EXT1 -# ifndef SAMD2L2_HAVE_SPI0 -# error I/O1 module on EXT1 requires SERCOM SPI0 -# undef CONFIG_SAML21_XPLAINED_IOMODULE -# endif -# define SPI_PORTNO 0 -#endif - -#ifdef CONFIG_SAML21_XPLAINED_IOMODULE_EXT2 -# ifndef SAMD2L2_HAVE_SPI1 -# error I/O1 module on EXT2 requires SERCOM SPI1 -# undef CONFIG_SAML21_XPLAINED_IOMODULE -# endif -# define SPI_PORTNO 1 -#endif - -#ifdef CONFIG_SAML21_XPLAINED_IOMODULE -/* Support for the SD card slot on the I/O1 module */ - -/* Verify NSH PORT and SLOT settings */ - -# define SAMD2L2_MMCSDSLOTNO 0 /* There is only one slot */ - -# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != SAMD2L2_MMCSDSLOTNO -# error Only one MMC/SD slot: Slot 0 (CONFIG_NSH_MMCSDSLOTNO) -# endif - -# if defined(CONFIG_NSH_MMCSDSPIPORTNO) && CONFIG_NSH_MMCSDSPIPORTNO != SPI_PORTNO -# error CONFIG_NSH_MMCSDSPIPORTNO must have the same value as SPI_PORTNO -# endif - -/* Default MMC/SD minor number */ - -# ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -# endif -#endif - -/**************************************************************************** - * 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) -{ -#if defined(SAMD2L2_HAVE_SPI0) && defined(CONFIG_SAML21_XPLAINED_IOMODULE) - /* Initialize the SPI-based MMC/SD slot */ - - int ret = sam_sdinitialize(SPI_PORTNO, CONFIG_NSH_MMCSDMINOR); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n", - ret); - return ret; - } -#endif - - return OK; -} diff --git a/boards/arm/samd2l2/saml21-xplained/src/sam_boot.c b/boards/arm/samd2l2/saml21-xplained/src/sam_boot.c index c5578e6bab4..2022f154010 100644 --- a/boards/arm/samd2l2/saml21-xplained/src/sam_boot.c +++ b/boards/arm/samd2l2/saml21-xplained/src/sam_boot.c @@ -28,6 +28,9 @@ #include +#include +#include + #include #include "sam_config.h" @@ -37,6 +40,47 @@ * Pre-processor Definitions ****************************************************************************/ +/* Some configuration checks */ + +#ifdef CONFIG_SAML21_XPLAINED_IOMODULE_EXT1 +# ifndef SAMD2L2_HAVE_SPI0 +# error I/O1 module on EXT1 requires SERCOM SPI0 +# undef CONFIG_SAML21_XPLAINED_IOMODULE +# endif +# define SPI_PORTNO 0 +#endif + +#ifdef CONFIG_SAML21_XPLAINED_IOMODULE_EXT2 +# ifndef SAMD2L2_HAVE_SPI1 +# error I/O1 module on EXT2 requires SERCOM SPI1 +# undef CONFIG_SAML21_XPLAINED_IOMODULE +# endif +# define SPI_PORTNO 1 +#endif + +#ifdef CONFIG_SAML21_XPLAINED_IOMODULE +/* Support for the SD card slot on the I/O1 module */ + +/* Verify NSH PORT and SLOT settings */ + +# define SAMD2L2_MMCSDSLOTNO 0 /* There is only one slot */ + +# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != SAMD2L2_MMCSDSLOTNO +# error Only one MMC/SD slot: Slot 0 (CONFIG_NSH_MMCSDSLOTNO) +# endif + +# if defined(CONFIG_NSH_MMCSDSPIPORTNO) && CONFIG_NSH_MMCSDSPIPORTNO != SPI_PORTNO +# error CONFIG_NSH_MMCSDSPIPORTNO must have the same value as SPI_PORTNO +# endif + +/* Default MMC/SD minor number */ + +# ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +# endif +#endif + + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -77,3 +121,32 @@ void sam_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_intitialize() 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) +{ +#if defined(SAMD2L2_HAVE_SPI0) && defined(CONFIG_SAML21_XPLAINED_IOMODULE) + /* Initialize the SPI-based MMC/SD slot */ + + int ret = sam_sdinitialize(SPI_PORTNO, CONFIG_NSH_MMCSDMINOR); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n", + ret); + } +#endif +} +#endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/samd2l2/xiao-seeeduino/src/CMakeLists.txt b/boards/arm/samd2l2/xiao-seeeduino/src/CMakeLists.txt index 2d255c5acbf..41e865ce675 100644 --- a/boards/arm/samd2l2/xiao-seeeduino/src/CMakeLists.txt +++ b/boards/arm/samd2l2/xiao-seeeduino/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_ARCH_LEDS) list(APPEND SRCS sam_autoleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS sam_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld") diff --git a/boards/arm/samd2l2/xiao-seeeduino/src/Makefile b/boards/arm/samd2l2/xiao-seeeduino/src/Makefile index 846040a6777..b7269c5f1c1 100644 --- a/boards/arm/samd2l2/xiao-seeeduino/src/Makefile +++ b/boards/arm/samd2l2/xiao-seeeduino/src/Makefile @@ -28,8 +28,4 @@ ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += sam_autoleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/samd2l2/xiao-seeeduino/src/sam_appinit.c b/boards/arm/samd2l2/xiao-seeeduino/src/sam_appinit.c deleted file mode 100644 index d4560785af4..00000000000 --- a/boards/arm/samd2l2/xiao-seeeduino/src/sam_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/samd2l2/xiao-seeeduino/src/sam_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 - -#include -#include - -#include - -#include "sam_config.h" -#include "xiao-seeeduino.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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; -} diff --git a/boards/arm/samd2l2/xiao-seeeduino/src/sam_boot.c b/boards/arm/samd2l2/xiao-seeeduino/src/sam_boot.c index f9d90e579b0..00d75745ebb 100644 --- a/boards/arm/samd2l2/xiao-seeeduino/src/sam_boot.c +++ b/boards/arm/samd2l2/xiao-seeeduino/src/sam_boot.c @@ -64,3 +64,23 @@ void sam_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 diff --git a/boards/arm/samd5e5/metro-m4/src/CMakeLists.txt b/boards/arm/samd5e5/metro-m4/src/CMakeLists.txt index a5fbd6fc02a..142f6d03fe4 100644 --- a/boards/arm/samd5e5/metro-m4/src/CMakeLists.txt +++ b/boards/arm/samd5e5/metro-m4/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS sam_boot.c sam_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS sam_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS sam_autoleds.c) else() diff --git a/boards/arm/samd5e5/metro-m4/src/Makefile b/boards/arm/samd5e5/metro-m4/src/Makefile index 3fdbb2738dc..24c5e9a4c8f 100644 --- a/boards/arm/samd5e5/metro-m4/src/Makefile +++ b/boards/arm/samd5e5/metro-m4/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = sam_boot.c sam_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += sam_autoleds.c else diff --git a/boards/arm/samd5e5/metro-m4/src/sam_appinit.c b/boards/arm/samd5e5/metro-m4/src/sam_appinit.c deleted file mode 100644 index a1b33869e14..00000000000 --- a/boards/arm/samd5e5/metro-m4/src/sam_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/samd5e5/metro-m4/src/sam_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 - -#include -#include - -#include "metro-m4.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return sam_bringup(); -#endif -} diff --git a/boards/arm/samd5e5/same54-xplained-pro/src/CMakeLists.txt b/boards/arm/samd5e5/same54-xplained-pro/src/CMakeLists.txt index 4b45fadadf5..52b25265666 100644 --- a/boards/arm/samd5e5/same54-xplained-pro/src/CMakeLists.txt +++ b/boards/arm/samd5e5/same54-xplained-pro/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS sam_boot.c sam_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS sam_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS sam_autoleds.c) else() diff --git a/boards/arm/samd5e5/same54-xplained-pro/src/Makefile b/boards/arm/samd5e5/same54-xplained-pro/src/Makefile index f84d4e763c2..d82c6b1d64d 100644 --- a/boards/arm/samd5e5/same54-xplained-pro/src/Makefile +++ b/boards/arm/samd5e5/same54-xplained-pro/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = sam_boot.c sam_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += sam_autoleds.c else diff --git a/boards/arm/samd5e5/same54-xplained-pro/src/sam_appinit.c b/boards/arm/samd5e5/same54-xplained-pro/src/sam_appinit.c deleted file mode 100644 index 01300a0c4cc..00000000000 --- a/boards/arm/samd5e5/same54-xplained-pro/src/sam_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/samd5e5/same54-xplained-pro/src/sam_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 - -#include -#include - -#include "same54-xplained-pro.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return sam_bringup(); -#endif -} diff --git a/boards/arm/samv7/pic32czca70-curiosity/src/Make.defs b/boards/arm/samv7/pic32czca70-curiosity/src/Make.defs index 05abb52b1f1..d823ee6b9c1 100644 --- a/boards/arm/samv7/pic32czca70-curiosity/src/Make.defs +++ b/boards/arm/samv7/pic32czca70-curiosity/src/Make.defs @@ -22,12 +22,10 @@ include $(TOPDIR)/Make.defs -CSRCS = sam_boot.c +CSRCS = sam_boot.c sam_bringup.c ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c sam_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += sam_bringup.c +CSRCS += sam_boardctl.c endif ifeq ($(CONFIG_ARCH_LEDS),y) diff --git a/boards/arm/samv7/pic32czca70-curiosity/src/sam_appinit.c b/boards/arm/samv7/pic32czca70-curiosity/src/sam_boardctl.c similarity index 57% rename from boards/arm/samv7/pic32czca70-curiosity/src/sam_appinit.c rename to boards/arm/samv7/pic32czca70-curiosity/src/sam_boardctl.c index d75e50d7328..589f2b9899f 100644 --- a/boards/arm/samv7/pic32czca70-curiosity/src/sam_appinit.c +++ b/boards/arm/samv7/pic32czca70-curiosity/src/sam_boardctl.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/samv7/pic32czca70-curiosity/src/sam_appinit.c + * boards/arm/samv7/pic32czca70-curiosity/src/sam_boardctl.c * * SPDX-License-Identifier: Apache-2.0 * @@ -41,42 +41,6 @@ * 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 sam_bringup(); -#else - return OK; -#endif -} - #ifdef CONFIG_BOARDCTL_IOCTL int board_ioctl(unsigned int cmd, uintptr_t arg) { diff --git a/boards/arm/samv7/same70-qmtech/src/Make.defs b/boards/arm/samv7/same70-qmtech/src/Make.defs index 642b01626a6..01bf7306774 100644 --- a/boards/arm/samv7/same70-qmtech/src/Make.defs +++ b/boards/arm/samv7/same70-qmtech/src/Make.defs @@ -22,12 +22,10 @@ include $(TOPDIR)/Make.defs -CSRCS = sam_boot.c +CSRCS = sam_boot.c sam_bringup.c ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c sam_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += sam_bringup.c +CSRCS += sam_boardctl.c endif ifeq ($(CONFIG_ARCH_LEDS),y) diff --git a/boards/arm/samv7/same70-qmtech/src/sam_appinit.c b/boards/arm/samv7/same70-qmtech/src/sam_boardctl.c similarity index 57% rename from boards/arm/samv7/same70-qmtech/src/sam_appinit.c rename to boards/arm/samv7/same70-qmtech/src/sam_boardctl.c index 4031d5a615c..d480307bdf3 100644 --- a/boards/arm/samv7/same70-qmtech/src/sam_appinit.c +++ b/boards/arm/samv7/same70-qmtech/src/sam_boardctl.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/samv7/same70-qmtech/src/sam_appinit.c + * boards/arm/samv7/same70-qmtech/src/sam_boardctl.c * * SPDX-License-Identifier: Apache-2.0 * @@ -41,42 +41,6 @@ * 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 sam_bringup(); -#else - return OK; -#endif -} - #ifdef CONFIG_BOARDCTL_IOCTL int board_ioctl(unsigned int cmd, uintptr_t arg) { diff --git a/boards/arm/samv7/same70-xplained/src/Make.defs b/boards/arm/samv7/same70-xplained/src/Make.defs index fd88fa181bf..41aec8068d1 100644 --- a/boards/arm/samv7/same70-xplained/src/Make.defs +++ b/boards/arm/samv7/same70-xplained/src/Make.defs @@ -22,16 +22,14 @@ include $(TOPDIR)/Make.defs -CSRCS = sam_boot.c +CSRCS = sam_boot.c sam_bringup.c ifeq ($(CONFIG_SAMV7_SDRAMC),y) CSRCS += sam_sdram.c endif ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c sam_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += sam_bringup.c +CSRCS += sam_boardctl.c endif ifeq ($(CONFIG_ARCH_LEDS),y) diff --git a/boards/arm/samv7/same70-xplained/src/sam_appinit.c b/boards/arm/samv7/same70-xplained/src/sam_boardctl.c similarity index 57% rename from boards/arm/samv7/same70-xplained/src/sam_appinit.c rename to boards/arm/samv7/same70-xplained/src/sam_boardctl.c index b9e392bd297..38ea3a8625c 100644 --- a/boards/arm/samv7/same70-xplained/src/sam_appinit.c +++ b/boards/arm/samv7/same70-xplained/src/sam_boardctl.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/samv7/same70-xplained/src/sam_appinit.c + * boards/arm/samv7/same70-xplained/src/sam_boarctl.c * * SPDX-License-Identifier: Apache-2.0 * @@ -41,42 +41,6 @@ * 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 sam_bringup(); -#else - return OK; -#endif -} - #ifdef CONFIG_BOARDCTL_IOCTL int board_ioctl(unsigned int cmd, uintptr_t arg) { diff --git a/boards/arm/samv7/samv71-xult/src/Make.defs b/boards/arm/samv7/samv71-xult/src/Make.defs index 0a7984b2f93..d201ceb5f45 100644 --- a/boards/arm/samv7/samv71-xult/src/Make.defs +++ b/boards/arm/samv7/samv71-xult/src/Make.defs @@ -22,16 +22,14 @@ include $(TOPDIR)/Make.defs -CSRCS = sam_boot.c +CSRCS = sam_boot.c sam_bringup.c ifeq ($(CONFIG_SAMV7_SDRAMC),y) CSRCS += sam_sdram.c endif ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += sam_appinit.c sam_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += sam_bringup.c +CSRCS += sam_boardctl.c endif ifeq ($(CONFIG_ARCH_LEDS),y) diff --git a/boards/arm/samv7/samv71-xult/src/sam_appinit.c b/boards/arm/samv7/samv71-xult/src/sam_boardctl.c similarity index 57% rename from boards/arm/samv7/samv71-xult/src/sam_appinit.c rename to boards/arm/samv7/samv71-xult/src/sam_boardctl.c index 801a8adfe28..e3d662c731e 100644 --- a/boards/arm/samv7/samv71-xult/src/sam_appinit.c +++ b/boards/arm/samv7/samv71-xult/src/sam_boardctl.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/samv7/samv71-xult/src/sam_appinit.c + * boards/arm/samv7/samv71-xult/src/sam_boardctl.c * * SPDX-License-Identifier: Apache-2.0 * @@ -41,42 +41,6 @@ * 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 sam_bringup(); -#else - return OK; -#endif -} - #ifdef CONFIG_BOARDCTL_IOCTL int board_ioctl(unsigned int cmd, uintptr_t arg) { diff --git a/boards/arm/stm32/axoloti/src/CMakeLists.txt b/boards/arm/stm32/axoloti/src/CMakeLists.txt index bf86fbd0f4c..c232216905b 100644 --- a/boards/arm/stm32/axoloti/src/CMakeLists.txt +++ b/boards/arm/stm32/axoloti/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS stm32_boot.c stm32_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_STM32_FMC) list(APPEND SRCS stm32_extmem.c) endif() diff --git a/boards/arm/stm32/axoloti/src/Make.defs b/boards/arm/stm32/axoloti/src/Make.defs index ea5c39e7625..e13a8e82802 100644 --- a/boards/arm/stm32/axoloti/src/Make.defs +++ b/boards/arm/stm32/axoloti/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = stm32_boot.c stm32_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_STM32_FMC),y) CSRCS += stm32_extmem.c endif diff --git a/boards/arm/stm32/axoloti/src/stm32_appinit.c b/boards/arm/stm32/axoloti/src/stm32_appinit.c deleted file mode 100644 index 46dc37e6a29..00000000000 --- a/boards/arm/stm32/axoloti/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/axoloti/src/stm32_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 - -#include -#include - -#include "axoloti.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/b-g431b-esc1/src/CMakeLists.txt b/boards/arm/stm32/b-g431b-esc1/src/CMakeLists.txt index f50a5838b73..76a72b59c7a 100644 --- a/boards/arm/stm32/b-g431b-esc1/src/CMakeLists.txt +++ b/boards/arm/stm32/b-g431b-esc1/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_STM32_FOC) list(APPEND SRCS stm32_foc.c) endif() diff --git a/boards/arm/stm32/b-g431b-esc1/src/Make.defs b/boards/arm/stm32/b-g431b-esc1/src/Make.defs index 2347000e544..2d49b9a66c9 100644 --- a/boards/arm/stm32/b-g431b-esc1/src/Make.defs +++ b/boards/arm/stm32/b-g431b-esc1/src/Make.defs @@ -35,10 +35,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_STM32_FOC),y) CSRCS += stm32_foc.c endif diff --git a/boards/arm/stm32/b-g431b-esc1/src/b-g431b-esc1.h b/boards/arm/stm32/b-g431b-esc1/src/b-g431b-esc1.h index bf580140367..40e7863bd06 100644 --- a/boards/arm/stm32/b-g431b-esc1/src/b-g431b-esc1.h +++ b/boards/arm/stm32/b-g431b-esc1/src/b-g431b-esc1.h @@ -124,12 +124,7 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * * Otherwise, bad news: Never called diff --git a/boards/arm/stm32/b-g431b-esc1/src/stm32_appinit.c b/boards/arm/stm32/b-g431b-esc1/src/stm32_appinit.c deleted file mode 100644 index 650cc5753f1..00000000000 --- a/boards/arm/stm32/b-g431b-esc1/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/b-g431b-esc1/src/stm32_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 - -#include -#include - -#include "b-g431b-esc1.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/b-g431b-esc1/src/stm32_foc.c b/boards/arm/stm32/b-g431b-esc1/src/stm32_foc.c index 80ddc034eba..6b22e655b38 100644 --- a/boards/arm/stm32/b-g431b-esc1/src/stm32_foc.c +++ b/boards/arm/stm32/b-g431b-esc1/src/stm32_foc.c @@ -653,8 +653,6 @@ static void board_foc_trace(struct foc_dev_s *dev, int type, bool state) * Description: * Initialize FOC driver. * - * This function should be call by board_app_initialize(). - * * Returned Value: * 0 on success, a negated errno value on failure * diff --git a/boards/arm/stm32/b-g474e-dpow1/src/CMakeLists.txt b/boards/arm/stm32/b-g474e-dpow1/src/CMakeLists.txt index f979686c1e1..87e3c2b6ee9 100644 --- a/boards/arm/stm32/b-g474e-dpow1/src/CMakeLists.txt +++ b/boards/arm/stm32/b-g474e-dpow1/src/CMakeLists.txt @@ -28,10 +28,6 @@ else() list(APPEND SRCS stm32_userleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_DRIVERS_SMPS) list(APPEND SRCS stm32_smps.c) endif() diff --git a/boards/arm/stm32/b-g474e-dpow1/src/Make.defs b/boards/arm/stm32/b-g474e-dpow1/src/Make.defs index 66d12c6a7eb..e91f93fd7a5 100644 --- a/boards/arm/stm32/b-g474e-dpow1/src/Make.defs +++ b/boards/arm/stm32/b-g474e-dpow1/src/Make.defs @@ -31,10 +31,6 @@ else CSRCS += stm32_userleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_DRIVERS_SMPS),y) CSRCS += stm32_smps.c endif diff --git a/boards/arm/stm32/b-g474e-dpow1/src/stm32_appinit.c b/boards/arm/stm32/b-g474e-dpow1/src/stm32_appinit.c deleted file mode 100644 index a23020483b6..00000000000 --- a/boards/arm/stm32/b-g474e-dpow1/src/stm32_appinit.c +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/b-g474e-dpow1/src/stm32_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 - -#include -#include - -#include -#include - -#include "b-g474e-dpow1.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#undef HAVE_LEDS - -#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) -# define HAVE_LEDS 1 -#endif - -/**************************************************************************** - * 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 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) -{ - int ret; - -#if defined(HAVE_LEDS) - /* Register the LED driver */ - - ret = userled_lower_initialize(LED_DRIVER_PATH); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); - return ret; - } -#endif - -#ifdef CONFIG_DRIVERS_SMPS - /* Initialize smps and register the smps driver */ - - ret = stm32_smps_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_smps_setup failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/stm32/b-g474e-dpow1/src/stm32_boot.c b/boards/arm/stm32/b-g474e-dpow1/src/stm32_boot.c index 84d04c8b616..f901b448b02 100644 --- a/boards/arm/stm32/b-g474e-dpow1/src/stm32_boot.c +++ b/boards/arm/stm32/b-g474e-dpow1/src/stm32_boot.c @@ -26,8 +26,12 @@ #include +#include +#include + #include #include +#include #include "b-g474e-dpow1.h" @@ -35,6 +39,12 @@ * Pre-processor Definitions ****************************************************************************/ +#undef HAVE_LEDS + +#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) +# define HAVE_LEDS 1 +#endif + /**************************************************************************** * Private Function Prototypes ****************************************************************************/ @@ -70,3 +80,46 @@ void stm32_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) +{ + int ret; + +#if defined(HAVE_LEDS) + /* Register the LED driver */ + + ret = userled_lower_initialize(LED_DRIVER_PATH); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); + return; + } +#endif + +#ifdef CONFIG_DRIVERS_SMPS + /* Initialize smps and register the smps driver */ + + ret = stm32_smps_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_smps_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); +} +#endif diff --git a/boards/arm/stm32/b-g474e-dpow1/src/stm32_smps.c b/boards/arm/stm32/b-g474e-dpow1/src/stm32_smps.c index 3b8f492a895..9d06a98c8b6 100644 --- a/boards/arm/stm32/b-g474e-dpow1/src/stm32_smps.c +++ b/boards/arm/stm32/b-g474e-dpow1/src/stm32_smps.c @@ -1164,8 +1164,6 @@ static void adc12_handler(void) * Description: * Initialize SMPS driver. * - * This function should be call by board_app_initialize(). - * * Returned Value: * 0 on success, a negated errno value on failure * diff --git a/boards/arm/stm32/clicker2-stm32/src/CMakeLists.txt b/boards/arm/stm32/clicker2-stm32/src/CMakeLists.txt index 9c14e3f4e8d..cb3d46c6c34 100644 --- a/boards/arm/stm32/clicker2-stm32/src/CMakeLists.txt +++ b/boards/arm/stm32/clicker2-stm32/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_STM32_OTGFS) list(APPEND SRCS stm32_usb.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_IEEE802154_MRF24J40) list(APPEND SRCS stm32_mrf24j40.c) endif() diff --git a/boards/arm/stm32/clicker2-stm32/src/Make.defs b/boards/arm/stm32/clicker2-stm32/src/Make.defs index 0552e97d45f..6079d7268ea 100644 --- a/boards/arm/stm32/clicker2-stm32/src/Make.defs +++ b/boards/arm/stm32/clicker2-stm32/src/Make.defs @@ -38,10 +38,6 @@ ifeq ($(CONFIG_STM32_OTGFS),y) CSRCS += stm32_usb.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_IEEE802154_MRF24J40),y) CSRCS += stm32_mrf24j40.c endif diff --git a/boards/arm/stm32/clicker2-stm32/src/stm32_appinit.c b/boards/arm/stm32/clicker2-stm32/src/stm32_appinit.c deleted file mode 100644 index 5d2f5e624e4..00000000000 --- a/boards/arm/stm32/clicker2-stm32/src/stm32_appinit.c +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/clicker2-stm32/src/stm32_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 - -#include -#include -#include -#include - -#include -#include -#include - -#include "clicker2-stm32.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. - * - * CONFIG_BOARDCTL=y : - * Called from the NSH library - * - * CONFIG_BOARD_LATE_INITIALIZE=y, CONFIG_NSH_LIBRARY=y, && - * CONFIG_BOARDCTL=n : - * Called from board_late_initialize(). - * - * 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) -{ - int ret; - - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - ret = stm32_bringup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_bringup() failed: %d\n", ret); - return ret; - } -#endif - -#ifdef CONFIG_CLICKER2_STM32_SYSLOG_FILE - - /* Delay some time for the automounter to finish mounting before - * bringing up file syslog. - */ - - nxsched_usleep(CONFIG_CLICKER2_STM32_SYSLOG_FILE_DELAY * 1000); - - syslog_channel_t *channel; - channel = syslog_file_channel(CONFIG_CLICKER2_STM32_SYSLOG_FILE_PATH); - if (channel == NULL) - { - syslog(LOG_ERR, "ERROR: syslog_file_channel() failed\n"); - return -EINVAL; - } -#endif - - UNUSED(ret); - return OK; -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/stm32/clicker2-stm32/src/stm32_boot.c b/boards/arm/stm32/clicker2-stm32/src/stm32_boot.c index de2d8d1f820..7c6c0bd27c7 100644 --- a/boards/arm/stm32/clicker2-stm32/src/stm32_boot.c +++ b/boards/arm/stm32/clicker2-stm32/src/stm32_boot.c @@ -28,8 +28,15 @@ #include +#include +#include +#include +#include + #include #include +#include +#include #include #include "clicker2-stm32.h" @@ -101,8 +108,32 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform board-specific initialization here if so configured */ + int ret; - stm32_bringup(); + ret = stm32_bringup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_bringup() failed: %d\n", ret); + return; + } + +#ifdef CONFIG_CLICKER2_STM32_SYSLOG_FILE + + /* Delay some time for the automounter to finish mounting before + * bringing up file syslog. + */ + + nxsched_usleep(CONFIG_CLICKER2_STM32_SYSLOG_FILE_DELAY * 1000); + + syslog_channel_t *channel; + channel = syslog_file_channel(CONFIG_CLICKER2_STM32_SYSLOG_FILE_PATH); + if (channel == NULL) + { + syslog(LOG_ERR, "ERROR: syslog_file_channel() failed\n"); + return; + } +#endif + + UNUSED(ret); } #endif diff --git a/boards/arm/stm32/cloudctrl/src/CMakeLists.txt b/boards/arm/stm32/cloudctrl/src/CMakeLists.txt index c0d9f8dd4e2..2c62ad02c35 100644 --- a/boards/arm/stm32/cloudctrl/src/CMakeLists.txt +++ b/boards/arm/stm32/cloudctrl/src/CMakeLists.txt @@ -40,10 +40,6 @@ if(CONFIG_STM32_OTGFS) list(APPEND SRCS stm32_usb.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_MTD_W25) list(APPEND SRCS stm32_w25.c) endif() diff --git a/boards/arm/stm32/cloudctrl/src/Make.defs b/boards/arm/stm32/cloudctrl/src/Make.defs index 14617e65f12..746c1618cf6 100644 --- a/boards/arm/stm32/cloudctrl/src/Make.defs +++ b/boards/arm/stm32/cloudctrl/src/Make.defs @@ -42,10 +42,6 @@ ifeq ($(CONFIG_STM32_OTGFS),y) CSRCS += stm32_usb.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_MTD_W25),y) CSRCS += stm32_w25.c endif diff --git a/boards/arm/stm32/cloudctrl/src/stm32_appinit.c b/boards/arm/stm32/cloudctrl/src/stm32_appinit.c deleted file mode 100644 index 82d98ca45a5..00000000000 --- a/boards/arm/stm32/cloudctrl/src/stm32_appinit.c +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/cloudctrl/src/stm32_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 - -#include -#include -#include -#include - -#include - -#include "stm32.h" -#include "cloudctrl.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -/* Assume that we support everything until convinced otherwise */ - -#define HAVE_USBDEV 1 -#define HAVE_USBHOST 1 -#define HAVE_W25 1 - -/* Can't support the W25 device if it SPI1 or W25 support is not enabled */ - -#if !defined(CONFIG_STM32_SPI1) || !defined(CONFIG_MTD_W25) -# undef HAVE_W25 -#endif - -/* Can't support W25 features if mountpoints are disabled */ - -#ifdef CONFIG_DISABLE_MOUNTPOINT -# undef HAVE_W25 -#endif - -/* Default W25 minor number */ - -#if defined(HAVE_W25) && !defined(CONFIG_NSH_W25MINOR) -# define CONFIG_NSH_W25MINOR 0 -#endif - -/* Can't support USB host or device features if USB OTG FS is not enabled */ - -#ifndef CONFIG_STM32_OTGFS -# undef HAVE_USBDEV -# undef HAVE_USBHOST -#endif - -/* Can't support USB device is USB device is not enabled */ - -#ifndef CONFIG_USBDEV -# undef HAVE_USBDEV -#endif - -/* Can't support USB host is USB host is not enabled */ - -#ifndef CONFIG_USBHOST -# undef HAVE_USBHOST -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ - int ret; - - /* Initialize and register the W25 FLASH file system. */ - -#ifdef HAVE_W25 - ret = stm32_w25initialize(CONFIG_NSH_W25MINOR); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to initialize W25 minor %d: %d\n", - CONFIG_NSH_W25MINOR, ret); - return ret; - } -#endif - - /* Initialize USB host operation. stm32_usbhost_initialize() starts a - * thread will monitor for USB connection and disconnection events. - */ - -#ifdef HAVE_USBHOST - ret = stm32_usbhost_initialize(); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); - return ret; - } -#endif - -#ifdef CONFIG_ADC - /* Initialize ADC and register the ADC driver. */ - - ret = stm32_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); - return ret; - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/stm32/cloudctrl/src/stm32_boot.c b/boards/arm/stm32/cloudctrl/src/stm32_boot.c index b5dddfd0791..cd489c2ae3d 100644 --- a/boards/arm/stm32/cloudctrl/src/stm32_boot.c +++ b/boards/arm/stm32/cloudctrl/src/stm32_boot.c @@ -28,16 +28,67 @@ #include +#include +#include +#include +#include + #include #include #include "arm_internal.h" +#include "stm32.h" #include "cloudctrl.h" /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +/* Assume that we support everything until convinced otherwise */ + +#define HAVE_USBDEV 1 +#define HAVE_USBHOST 1 +#define HAVE_W25 1 + +/* Can't support the W25 device if it SPI1 or W25 support is not enabled */ + +#if !defined(CONFIG_STM32_SPI1) || !defined(CONFIG_MTD_W25) +# undef HAVE_W25 +#endif + +/* Can't support W25 features if mountpoints are disabled */ + +#ifdef CONFIG_DISABLE_MOUNTPOINT +# undef HAVE_W25 +#endif + +/* Default W25 minor number */ + +#if defined(HAVE_W25) && !defined(CONFIG_NSH_W25MINOR) +# define CONFIG_NSH_W25MINOR 0 +#endif + +/* Can't support USB host or device features if USB OTG FS is not enabled */ + +#ifndef CONFIG_STM32_OTGFS +# undef HAVE_USBDEV +# undef HAVE_USBHOST +#endif + +/* Can't support USB device is USB device is not enabled */ + +#ifndef CONFIG_USBDEV +# undef HAVE_USBDEV +#endif + +/* Can't support USB host is USB host is not enabled */ + +#ifndef CONFIG_USBHOST +# undef HAVE_USBHOST +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -88,3 +139,62 @@ void stm32_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) +{ + int ret; + + /* Initialize and register the W25 FLASH file system. */ + +#ifdef HAVE_W25 + ret = stm32_w25initialize(CONFIG_NSH_W25MINOR); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize W25 minor %d: %d\n", + CONFIG_NSH_W25MINOR, ret); + return; + } +#endif + + /* Initialize USB host operation. stm32_usbhost_initialize() starts a + * thread will monitor for USB connection and disconnection events. + */ + +#ifdef HAVE_USBHOST + ret = stm32_usbhost_initialize(); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); + return; + } +#endif + +#ifdef CONFIG_ADC + /* Initialize ADC and register the ADC driver. */ + + ret = stm32_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); + return; + } +#endif + + UNUSED(ret); +} +#endif diff --git a/boards/arm/stm32/cloudctrl/src/stm32_usbmsc.c b/boards/arm/stm32/cloudctrl/src/stm32_usbmsc.c index 282fc28161f..ab372b7c355 100644 --- a/boards/arm/stm32/cloudctrl/src/stm32_usbmsc.c +++ b/boards/arm/stm32/cloudctrl/src/stm32_usbmsc.c @@ -59,8 +59,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/stm32/emw3162/src/CMakeLists.txt b/boards/arm/stm32/emw3162/src/CMakeLists.txt index f589f799027..8c94250123d 100644 --- a/boards/arm/stm32/emw3162/src/CMakeLists.txt +++ b/boards/arm/stm32/emw3162/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS stm32_boot.c stm32_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS stm32_autoleds.c) else() diff --git a/boards/arm/stm32/emw3162/src/Make.defs b/boards/arm/stm32/emw3162/src/Make.defs index 3c904048056..f397baef02b 100644 --- a/boards/arm/stm32/emw3162/src/Make.defs +++ b/boards/arm/stm32/emw3162/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = stm32_boot.c stm32_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += stm32_autoleds.c else diff --git a/boards/arm/stm32/emw3162/src/emw3162.h b/boards/arm/stm32/emw3162/src/emw3162.h index 6400db057e7..6142ab2310e 100644 --- a/boards/arm/stm32/emw3162/src/emw3162.h +++ b/boards/arm/stm32/emw3162/src/emw3162.h @@ -75,16 +75,12 @@ * Name: stm32_bringup * * Description: - * Called either by board_initialize() if CONFIG_BOARD_LATE_INITIALIZE or - * by board_app_initialize if CONFIG_BOARDCTL is selected. This - * function initializes and configures all on-board features appropriate - * for the selected configuration. + * This function initializes and configures all on-board features + * appropriate for the selected configuration. * ****************************************************************************/ -#if defined(CONFIG_BOARDCTL) || defined(CONFIG_BOARD_LATE_INITIALIZE) int stm32_bringup(void); -#endif /**************************************************************************** * Name: emw3162_wlan_initialize diff --git a/boards/arm/stm32/emw3162/src/stm32_appinit.c b/boards/arm/stm32/emw3162/src/stm32_appinit.c deleted file mode 100644 index 9609c639803..00000000000 --- a/boards/arm/stm32/emw3162/src/stm32_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/emw3162/src/stm32_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 - -#include - -#include - -#include "emw3162.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return stm32_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/stm32/emw3162/src/stm32_bringup.c b/boards/arm/stm32/emw3162/src/stm32_bringup.c index 4fcbdfed26e..0ffd40553fc 100644 --- a/boards/arm/stm32/emw3162/src/stm32_bringup.c +++ b/boards/arm/stm32/emw3162/src/stm32_bringup.c @@ -45,8 +45,6 @@ * Name: stm32_bringup * * Description: - * Called either by board_initialize() if CONFIG_BOARD_LATE_INITIALIZE or - * by board_app_initialize if CONFIG_BOARDCTL is selected. * This function initializes and configures all on-board features * appropriate for the selected configuration. * diff --git a/boards/arm/stm32/et-stm32-stamp/src/CMakeLists.txt b/boards/arm/stm32/et-stm32-stamp/src/CMakeLists.txt index 4e33c6c91c8..3aa3d6093c6 100644 --- a/boards/arm/stm32/et-stm32-stamp/src/CMakeLists.txt +++ b/boards/arm/stm32/et-stm32-stamp/src/CMakeLists.txt @@ -22,22 +22,6 @@ set(SRCS stm32_boot.c) -if(CONFIG_BOARDCTL) - -endif() - -if(CONFIG_INPUT) - -endif() - -if(CONFIG_USBMSC) - -endif() - -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/ld.script") diff --git a/boards/arm/stm32/et-stm32-stamp/src/Make.defs b/boards/arm/stm32/et-stm32-stamp/src/Make.defs index ae14d9ec890..009c8104955 100644 --- a/boards/arm/stm32/et-stm32-stamp/src/Make.defs +++ b/boards/arm/stm32/et-stm32-stamp/src/Make.defs @@ -24,19 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = stm32_boot.c -ifeq ($(CONFIG_BOARDCTL),y) -endif - -ifeq ($(CONFIG_INPUT),y) -endif - -ifeq ($(CONFIG_USBMSC),y) -endif - -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/arm/stm32/et-stm32-stamp/src/stm32_appinit.c b/boards/arm/stm32/et-stm32-stamp/src/stm32_appinit.c deleted file mode 100644 index 2957d961544..00000000000 --- a/boards/arm/stm32/et-stm32-stamp/src/stm32_appinit.c +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/et-stm32-stamp/src/stm32_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 - -#include - -#include - -#include "et-stm32-stamp.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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; -} diff --git a/boards/arm/stm32/et-stm32-stamp/src/stm32_boot.c b/boards/arm/stm32/et-stm32-stamp/src/stm32_boot.c index 557a8f0ddde..b56fe99ba71 100644 --- a/boards/arm/stm32/et-stm32-stamp/src/stm32_boot.c +++ b/boards/arm/stm32/et-stm32-stamp/src/stm32_boot.c @@ -61,3 +61,23 @@ void stm32_boardinitialize(void) { /* Empty for now. */ } + +/**************************************************************************** + * 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/arm/stm32/fire-stm32v2/src/CMakeLists.txt b/boards/arm/stm32/fire-stm32v2/src/CMakeLists.txt index 3c819489039..8d9a77eabc3 100644 --- a/boards/arm/stm32/fire-stm32v2/src/CMakeLists.txt +++ b/boards/arm/stm32/fire-stm32v2/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ENC28J60) list(APPEND SRCS stm32_enc28j60.c) endif() diff --git a/boards/arm/stm32/fire-stm32v2/src/Make.defs b/boards/arm/stm32/fire-stm32v2/src/Make.defs index 6dca9019802..fdfe1aaa4b3 100644 --- a/boards/arm/stm32/fire-stm32v2/src/Make.defs +++ b/boards/arm/stm32/fire-stm32v2/src/Make.defs @@ -38,10 +38,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ENC28J60),y) CSRCS += stm32_enc28j60.c endif diff --git a/boards/arm/stm32/fire-stm32v2/src/stm32_appinit.c b/boards/arm/stm32/fire-stm32v2/src/stm32_appinit.c deleted file mode 100644 index de7e0a22052..00000000000 --- a/boards/arm/stm32/fire-stm32v2/src/stm32_appinit.c +++ /dev/null @@ -1,240 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/fire-stm32v2/src/stm32_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 - -#include -#include -#include -#include - -#include -#include - -#include "stm32.h" -#include "stm32_i2c.h" -#include "fire-stm32v2.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -/* Assume that we support everything until convinced otherwise */ - -#define HAVE_MMCSD 1 -#define HAVE_USBDEV 1 -#define HAVE_W25 1 - -/* Configuration ************************************************************/ - -/* SPI1 connects to the SD CARD (and to the SPI FLASH) */ - -#define STM32_MMCSDSPIPORTNO 1 /* SPI1 */ -#define STM32_MMCSDSLOTNO 0 /* Only one slot */ - -/* Can't support MMC/SD features if the SDIO peripheral is disabled */ - -#ifndef CONFIG_STM32_SDIO -# undef HAVE_MMCSD -#endif - -/* Can't support MMC/SD features if mountpoints are disabled */ - -#ifdef CONFIG_DISABLE_MOUNTPOINT -# undef HAVE_MMCSD -#endif - -/* Default MMC/SD minor number */ - -#ifdef HAVE_MMCSD -# ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -# endif - -/* Default MMC/SD SLOT number */ - -# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != STM32_MMCSDSLOTNO -# error "Only one MMC/SD slot: Slot 0" -# undef CONFIG_NSH_MMCSDSLOTNO -# define CONFIG_NSH_MMCSDSLOTNO STM32_MMCSDSLOTNO -# endif - -# ifndef CONFIG_NSH_MMCSDSLOTNO -# define CONFIG_NSH_MMCSDSLOTNO STM32_MMCSDSLOTNO -# endif -#endif - -/* Can't support the W25 device if it SPI1 or W25 support is not enabled */ - -#if !defined(CONFIG_STM32_SPI1) || !defined(CONFIG_MTD_W25) -# undef HAVE_W25 -#endif - -/* Can't support W25 features if mountpoints are disabled */ - -#if defined(CONFIG_DISABLE_MOUNTPOINT) -# undef HAVE_W25 -#endif - -/* Default W25 minor number */ - -#if defined(HAVE_W25) && !defined(CONFIG_NSH_W25MINOR) -# define CONFIG_NSH_W25MINOR 0 -#endif - -/* Can't support USB host or device features if the USB peripheral or the USB - * device infrastructure is not enabled - */ - -#if !defined(CONFIG_STM32_USB) || !defined(CONFIG_USBDEV) -# undef HAVE_USBDEV -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: stm32_i2c_register - * - * Description: - * Register one I2C drivers for the I2C tool. - * - ****************************************************************************/ - -#ifdef HAVE_I2CTOOL -static void stm32_i2c_register(int bus) -{ - struct i2c_master_s *i2c; - int ret; - - i2c = stm32_i2cbus_initialize(bus); - if (i2c == NULL) - { - _err("ERROR: Failed to get I2C%d interface\n", bus); - } - else - { - ret = i2c_register(i2c, bus); - if (ret < 0) - { - _err("ERROR: Failed to register I2C%d driver: %d\n", bus, ret); - stm32_i2cbus_uninitialize(i2c); - } - } -} -#endif - -/**************************************************************************** - * Name: stm32_i2ctool - * - * Description: - * Register I2C drivers for the I2C tool. - * - ****************************************************************************/ - -#ifdef HAVE_I2CTOOL -static void stm32_i2ctool(void) -{ -#ifdef CONFIG_STM32_I2C1 - stm32_i2c_register(1); -#endif -#ifdef CONFIG_STM32_I2C2 - stm32_i2c_register(2); -#endif -#ifdef CONFIG_STM32_I2C3 - stm32_i2c_register(3); -#endif -} -#else -# define stm32_i2ctool() -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#if defined(HAVE_MMCSD) || defined(HAVE_W25) - int ret; -#endif - - /* Register I2C drivers on behalf of the I2C tool */ - - stm32_i2ctool(); - -#ifdef HAVE_W25 - /* Initialize and register the W25 FLASH file system. */ - - ret = stm32_w25initialize(CONFIG_NSH_W25MINOR); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to initialize W25 minor %d: %d\n", - CONFIG_NSH_W25MINOR, ret); - return ret; - } -#endif - -#ifdef HAVE_MMCSD - /* Initialize the SDIO-based MMC/SD slot */ - - ret = stm32_sdinitialize(CONFIG_NSH_MMCSDMINOR); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSLOTNO, ret); - return ret; - } -#endif - - return OK; -} diff --git a/boards/arm/stm32/fire-stm32v2/src/stm32_boot.c b/boards/arm/stm32/fire-stm32v2/src/stm32_boot.c index 1502c1cfe3d..9ee669b3fbc 100644 --- a/boards/arm/stm32/fire-stm32v2/src/stm32_boot.c +++ b/boards/arm/stm32/fire-stm32v2/src/stm32_boot.c @@ -28,9 +28,16 @@ #include +#include +#include +#include + #include +#include #include +#include "stm32.h" +#include "stm32_i2c.h" #include "arm_internal.h" #include "fire-stm32v2.h" @@ -38,10 +45,139 @@ * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +/* Assume that we support everything until convinced otherwise */ + +#define HAVE_MMCSD 1 +#define HAVE_USBDEV 1 +#define HAVE_W25 1 + +/* Configuration ************************************************************/ + +/* SPI1 connects to the SD CARD (and to the SPI FLASH) */ + +#define STM32_MMCSDSPIPORTNO 1 /* SPI1 */ +#define STM32_MMCSDSLOTNO 0 /* Only one slot */ + +/* Can't support MMC/SD features if the SDIO peripheral is disabled */ + +#ifndef CONFIG_STM32_SDIO +# undef HAVE_MMCSD +#endif + +/* Can't support MMC/SD features if mountpoints are disabled */ + +#ifdef CONFIG_DISABLE_MOUNTPOINT +# undef HAVE_MMCSD +#endif + +/* Default MMC/SD minor number */ + +#ifdef HAVE_MMCSD +# ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +# endif + +/* Default MMC/SD SLOT number */ + +# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != STM32_MMCSDSLOTNO +# error "Only one MMC/SD slot: Slot 0" +# undef CONFIG_NSH_MMCSDSLOTNO +# define CONFIG_NSH_MMCSDSLOTNO STM32_MMCSDSLOTNO +# endif + +# ifndef CONFIG_NSH_MMCSDSLOTNO +# define CONFIG_NSH_MMCSDSLOTNO STM32_MMCSDSLOTNO +# endif +#endif + +/* Can't support the W25 device if it SPI1 or W25 support is not enabled */ + +#if !defined(CONFIG_STM32_SPI1) || !defined(CONFIG_MTD_W25) +# undef HAVE_W25 +#endif + +/* Can't support W25 features if mountpoints are disabled */ + +#if defined(CONFIG_DISABLE_MOUNTPOINT) +# undef HAVE_W25 +#endif + +/* Default W25 minor number */ + +#if defined(HAVE_W25) && !defined(CONFIG_NSH_W25MINOR) +# define CONFIG_NSH_W25MINOR 0 +#endif + +/* Can't support USB host or device features if the USB peripheral or the USB + * device infrastructure is not enabled + */ + +#if !defined(CONFIG_STM32_USB) || !defined(CONFIG_USBDEV) +# undef HAVE_USBDEV +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: stm32_i2c_register + * + * Description: + * Register one I2C drivers for the I2C tool. + * + ****************************************************************************/ + +#ifdef HAVE_I2CTOOL +static void stm32_i2c_register(int bus) +{ + struct i2c_master_s *i2c; + int ret; + + i2c = stm32_i2cbus_initialize(bus); + if (i2c == NULL) + { + _err("ERROR: Failed to get I2C%d interface\n", bus); + } + else + { + ret = i2c_register(i2c, bus); + if (ret < 0) + { + _err("ERROR: Failed to register I2C%d driver: %d\n", bus, ret); + stm32_i2cbus_uninitialize(i2c); + } + } +} +#endif + +/**************************************************************************** + * Name: stm32_i2ctool + * + * Description: + * Register I2C drivers for the I2C tool. + * + ****************************************************************************/ + +#ifdef HAVE_I2CTOOL +static void stm32_i2ctool(void) +{ +#ifdef CONFIG_STM32_I2C1 + stm32_i2c_register(1); +#endif +#ifdef CONFIG_STM32_I2C2 + stm32_i2c_register(2); +#endif +#ifdef CONFIG_STM32_I2C3 + stm32_i2c_register(3); +#endif +} +#else +# define stm32_i2ctool() +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -88,3 +224,54 @@ void stm32_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) +{ +#if defined(HAVE_MMCSD) || defined(HAVE_W25) + int ret; +#endif + + /* Register I2C drivers on behalf of the I2C tool */ + + stm32_i2ctool(); + +#ifdef HAVE_W25 + /* Initialize and register the W25 FLASH file system. */ + + ret = stm32_w25initialize(CONFIG_NSH_W25MINOR); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize W25 minor %d: %d\n", + CONFIG_NSH_W25MINOR, ret); + return; + } +#endif + +#ifdef HAVE_MMCSD + /* Initialize the SDIO-based MMC/SD slot */ + + ret = stm32_sdinitialize(CONFIG_NSH_MMCSDMINOR); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSLOTNO, ret); + return; + } +#endif +} +#endif diff --git a/boards/arm/stm32/fire-stm32v2/src/stm32_usbmsc.c b/boards/arm/stm32/fire-stm32v2/src/stm32_usbmsc.c index b5b8f4471e0..dd87c605e78 100644 --- a/boards/arm/stm32/fire-stm32v2/src/stm32_usbmsc.c +++ b/boards/arm/stm32/fire-stm32v2/src/stm32_usbmsc.c @@ -59,8 +59,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/stm32/hymini-stm32v/src/CMakeLists.txt b/boards/arm/stm32/hymini-stm32v/src/CMakeLists.txt index 548a99a4ed9..e31d5a0ca4c 100644 --- a/boards/arm/stm32/hymini-stm32v/src/CMakeLists.txt +++ b/boards/arm/stm32/hymini-stm32v/src/CMakeLists.txt @@ -30,10 +30,6 @@ else() endif() endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_INPUT) list(APPEND SRCS stm32_ts.c) endif() diff --git a/boards/arm/stm32/hymini-stm32v/src/Make.defs b/boards/arm/stm32/hymini-stm32v/src/Make.defs index 7bbf03e3b28..d96eeceb4ad 100644 --- a/boards/arm/stm32/hymini-stm32v/src/Make.defs +++ b/boards/arm/stm32/hymini-stm32v/src/Make.defs @@ -32,10 +32,6 @@ CSRCS += stm32_r61505u.c endif endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_INPUT),y) CSRCS += stm32_ts.c endif diff --git a/boards/arm/stm32/hymini-stm32v/src/stm32_appinit.c b/boards/arm/stm32/hymini-stm32v/src/stm32_appinit.c deleted file mode 100644 index f0de5f9e857..00000000000 --- a/boards/arm/stm32/hymini-stm32v/src/stm32_appinit.c +++ /dev/null @@ -1,222 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/hymini-stm32v/src/stm32_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 - -#include -#include -#include -#include - -#include - -#ifdef CONFIG_STM32_SPI1 -# include -# include -#endif - -#ifdef CONFIG_STM32_SDIO -# include -# include -#endif - -#include "stm32.h" -#include "hymini-stm32v.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -/* For now, don't build in any SPI1 support -- NSH is not using it */ - -#undef CONFIG_STM32_SPI1 - -/* Check if we can have USB device in NSH */ - -#define NSH_HAVEUSBDEV 1 - -/* Can't support USB features if USB is not enabled */ - -#ifndef CONFIG_USBDEV -# undef NSH_HAVEUSBDEV -#endif - -/* Check if we can have MMC/SD slot support in NSH */ - -#define NSH_HAVEMMCSD 1 - -/* Can't support MMC/SD features if mountpoints are disabled or if SDIO - * support is not enabled. - */ - -#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_STM32_SDIO) -# undef NSH_HAVEMMCSD -#endif - -#ifdef NSH_HAVEMMCSD -# ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -# endif -# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 -# error "Only one MMC/SD slot" -# undef CONFIG_NSH_MMCSDSLOTNO -# endif -# ifndef CONFIG_NSH_MMCSDSLOTNO -# define CONFIG_NSH_MMCSDSLOTNO 0 -# endif -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -#ifdef CONFIG_MMCSD -static struct sdio_dev_s *g_sdiodev; -static bool g_sd_inserted; -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nsh_cdinterrupt - * - * Description: - * Card detect interrupt handler. - * - ****************************************************************************/ - -#ifdef NSH_HAVEMMCSD -static int nsh_cdinterrupt(int irq, void *context, void *arg) -{ - bool present; - - present = !stm32_gpioread(GPIO_SD_CD); - if (present != g_sd_inserted) - { - sdio_mediachange(g_sdiodev, present); - g_sd_inserted = present; - } - - return OK; -} -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ - int ret; - -#ifdef NSH_HAVEMMCSD - /* Configure the card detect GPIO */ - - stm32_configgpio(GPIO_SD_CD); - - /* Register an interrupt handler for the card detect pin */ - - stm32_gpiosetevent(GPIO_SD_CD, true, true, true, nsh_cdinterrupt, NULL); - - /* Mount the SDIO-based MMC/SD block driver */ - - /* First, get an instance of the SDIO interface */ - - syslog(LOG_INFO, "Initializing SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); - - g_sdiodev = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); - if (!g_sdiodev) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); - return -ENODEV; - } - - /* Now bind the SDIO interface to the MMC/SD driver */ - - syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=%d\n", - CONFIG_NSH_MMCSDMINOR); - - ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_sdiodev); - if (ret != OK) - { - syslog(LOG_ERR, - "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", - ret); - return ret; - } - - syslog(LOG_INFO, "Successfully bound SDIO to the MMC/SD driver\n"); - - /* Use SD card detect pin to check if a card is inserted */ - - g_sd_inserted = !stm32_gpioread(GPIO_SD_CD); - _info("Card detect : %hhu\n", g_sd_inserted); - - sdio_mediachange(g_sdiodev, g_sd_inserted); -#endif - -#ifdef CONFIG_INPUT - /* Initialize the touchscreen */ - - ret = stm32_tsc_setup(0); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/stm32/hymini-stm32v/src/stm32_boot.c b/boards/arm/stm32/hymini-stm32v/src/stm32_boot.c index dcb4a17287c..755f41cf039 100644 --- a/boards/arm/stm32/hymini-stm32v/src/stm32_boot.c +++ b/boards/arm/stm32/hymini-stm32v/src/stm32_boot.c @@ -26,15 +26,113 @@ #include #include + #include +#include +#include +#include + #include +#ifdef CONFIG_STM32_SPI1 +# include +# include +#endif + +#ifdef CONFIG_STM32_SDIO +# include +# include +#endif + #include "arm_internal.h" +#include "stm32.h" #include "hymini-stm32v.h" #include /* Should always be included last due to dependencies */ +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +/* For now, don't build in any SPI1 support -- NSH is not using it */ + +#undef CONFIG_STM32_SPI1 + +/* Check if we can have USB device in NSH */ + +#define NSH_HAVEUSBDEV 1 + +/* Can't support USB features if USB is not enabled */ + +#ifndef CONFIG_USBDEV +# undef NSH_HAVEUSBDEV +#endif + +/* Check if we can have MMC/SD slot support in NSH */ + +#define NSH_HAVEMMCSD 1 + +/* Can't support MMC/SD features if mountpoints are disabled or if SDIO + * support is not enabled. + */ + +#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_STM32_SDIO) +# undef NSH_HAVEMMCSD +#endif + +#ifdef NSH_HAVEMMCSD +# ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +# endif +# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 +# error "Only one MMC/SD slot" +# undef CONFIG_NSH_MMCSDSLOTNO +# endif +# ifndef CONFIG_NSH_MMCSDSLOTNO +# define CONFIG_NSH_MMCSDSLOTNO 0 +# endif +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +#ifdef CONFIG_MMCSD +static struct sdio_dev_s *g_sdiodev; +static bool g_sd_inserted; +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nsh_cdinterrupt + * + * Description: + * Card detect interrupt handler. + * + ****************************************************************************/ + +#ifdef NSH_HAVEMMCSD +static int nsh_cdinterrupt(int irq, void *context, void *arg) +{ + bool present; + + present = !stm32_gpioread(GPIO_SD_CD); + if (present != g_sd_inserted) + { + sdio_mediachange(g_sdiodev, present); + g_sd_inserted = present; + } + + return OK; +} +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -83,3 +181,84 @@ void stm32_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) +{ + int ret; + +#ifdef NSH_HAVEMMCSD + /* Configure the card detect GPIO */ + + stm32_configgpio(GPIO_SD_CD); + + /* Register an interrupt handler for the card detect pin */ + + stm32_gpiosetevent(GPIO_SD_CD, true, true, true, nsh_cdinterrupt, NULL); + + /* Mount the SDIO-based MMC/SD block driver */ + + /* First, get an instance of the SDIO interface */ + + syslog(LOG_INFO, "Initializing SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + + g_sdiodev = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); + if (!g_sdiodev) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + return; + } + + /* Now bind the SDIO interface to the MMC/SD driver */ + + syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=%d\n", + CONFIG_NSH_MMCSDMINOR); + + ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_sdiodev); + if (ret != OK) + { + syslog(LOG_ERR, + "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", + ret); + return; + } + + syslog(LOG_INFO, "Successfully bound SDIO to the MMC/SD driver\n"); + + /* Use SD card detect pin to check if a card is inserted */ + + g_sd_inserted = !stm32_gpioread(GPIO_SD_CD); + _info("Card detect : %hhu\n", g_sd_inserted); + + sdio_mediachange(g_sdiodev, g_sd_inserted); +#endif + +#ifdef CONFIG_INPUT + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); +} +#endif diff --git a/boards/arm/stm32/hymini-stm32v/src/stm32_usbmsc.c b/boards/arm/stm32/hymini-stm32v/src/stm32_usbmsc.c index 75bba9a9514..5072bc4531f 100644 --- a/boards/arm/stm32/hymini-stm32v/src/stm32_usbmsc.c +++ b/boards/arm/stm32/hymini-stm32v/src/stm32_usbmsc.c @@ -76,8 +76,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/stm32/maple/src/CMakeLists.txt b/boards/arm/stm32/maple/src/CMakeLists.txt index af62be236d5..9eec7a7387b 100644 --- a/boards/arm/stm32/maple/src/CMakeLists.txt +++ b/boards/arm/stm32/maple/src/CMakeLists.txt @@ -38,10 +38,6 @@ if(CONFIG_USBMSC) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/ld.script") diff --git a/boards/arm/stm32/maple/src/Make.defs b/boards/arm/stm32/maple/src/Make.defs index b0aa728a66b..90ae23399e3 100644 --- a/boards/arm/stm32/maple/src/Make.defs +++ b/boards/arm/stm32/maple/src/Make.defs @@ -37,10 +37,6 @@ endif ifeq ($(CONFIG_USBMSC),y) endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/arm/stm32/maple/src/stm32_appinit.c b/boards/arm/stm32/maple/src/stm32_appinit.c deleted file mode 100644 index 88be3e3d0c8..00000000000 --- a/boards/arm/stm32/maple/src/stm32_appinit.c +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/maple/src/stm32_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 - -#include - -#include - -#include "maple.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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; -} diff --git a/boards/arm/stm32/maple/src/stm32_boot.c b/boards/arm/stm32/maple/src/stm32_boot.c index 58b9d682aed..56d8a61eb6d 100644 --- a/boards/arm/stm32/maple/src/stm32_boot.c +++ b/boards/arm/stm32/maple/src/stm32_boot.c @@ -82,3 +82,28 @@ void stm32_boardinitialize(void) stm32_usbinitialize(); #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 after up_initialize() and board_early_initialize() and just + * before the initial application is started. This additional + * initialization phase may be used, for example, to initialize board- + * specific device drivers for which board_early_initialize() is not + * suitable. + * + * Waiting for events, use of I2C, SPI, etc are permissible in the context + * of board_late_initialize(). That is because board_late_initialize() + * will run on a temporary, internal kernel thread. + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) +{ +} +#endif diff --git a/boards/arm/stm32/mikroe-stm32f4/src/CMakeLists.txt b/boards/arm/stm32/mikroe-stm32f4/src/CMakeLists.txt index 7ff8c5d4a90..ccadb52a739 100644 --- a/boards/arm/stm32/mikroe-stm32f4/src/CMakeLists.txt +++ b/boards/arm/stm32/mikroe-stm32f4/src/CMakeLists.txt @@ -34,10 +34,6 @@ if(CONFIG_PWM) list(APPEND SRCS stm32_pwm.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ARCH_CUSTOM_PMINIT) list(APPEND SRCS stm32_pm.c) endif() diff --git a/boards/arm/stm32/mikroe-stm32f4/src/Make.defs b/boards/arm/stm32/mikroe-stm32f4/src/Make.defs index 423a62548c2..4d1e116adb8 100644 --- a/boards/arm/stm32/mikroe-stm32f4/src/Make.defs +++ b/boards/arm/stm32/mikroe-stm32f4/src/Make.defs @@ -36,10 +36,6 @@ ifeq ($(CONFIG_PWM),y) CSRCS += stm32_pwm.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ARCH_CUSTOM_PMINIT),y) CSRCS += stm32_pm.c endif diff --git a/boards/arm/stm32/mikroe-stm32f4/src/stm32_appinit.c b/boards/arm/stm32/mikroe-stm32f4/src/stm32_appinit.c deleted file mode 100644 index c7c84e78e07..00000000000 --- a/boards/arm/stm32/mikroe-stm32f4/src/stm32_appinit.c +++ /dev/null @@ -1,416 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/mikroe-stm32f4/src/stm32_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 - -#include -#include -#include -#include - -#include -#include - -#ifdef CONFIG_STM32_SPI3 -# include -#endif - -#ifdef CONFIG_MTD_M25P -# include -#endif - -#ifdef CONFIG_USBMONITOR -# include -#endif - -#ifdef CONFIG_MIKROE_FLASH_CONFIG_PART -#ifdef CONFIG_PLATFORM_CONFIGDATA -# include -#endif -#endif - -#ifdef CONFIG_AUDIO -# include -#endif - -#ifdef CONFIG_STM32_OTGFS -# include "stm32_usbhost.h" -#endif - -#include "stm32.h" -#include "mikroe-stm32f4.h" - -#ifdef CONFIG_SENSORS_QENCODER -#include "board_qencoder.h" -#endif - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#define HAVE_USBDEV 1 -#define HAVE_USBHOST 1 -#define HAVE_USBMONITOR 1 -#define NSH_HAVEMMCSD 1 - -/* Can't support USB host or device features if USB OTG FS is not enabled */ - -#ifndef CONFIG_STM32_OTGFS -# undef HAVE_USBDEV -# undef HAVE_USBHOST -#endif - -/* Can't support USB device is USB device is not enabled */ - -#ifndef CONFIG_USBDEV -# undef HAVE_USBDEV -#endif - -/* Can't support USB host is USB host is not enabled */ - -#ifndef CONFIG_USBHOST -# undef HAVE_USBHOST -#endif - -/* Check if we should enable the USB monitor before starting NSH */ - -#ifndef CONFIG_USBMONITOR -# undef HAVE_USBMONITOR -#endif - -#ifndef HAVE_USBDEV -# undef CONFIG_USBDEV_TRACE -#endif - -#ifndef HAVE_USBHOST -# undef CONFIG_USBHOST_TRACE -#endif - -#if !defined(CONFIG_USBDEV_TRACE) && !defined(CONFIG_USBHOST_TRACE) -# undef HAVE_USBMONITOR -#endif - -/* Can't support MMC/SD features if mountpoints are disabled or if SDIO - * support is not enabled. - */ - -#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_STM32_SPI3) -# undef NSH_HAVEMMCSD -#endif - -#ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -#endif - -# ifndef CONFIG_RAMMTD_BLOCKSIZE -# define CONFIG_RAMMTD_BLOCKSIZE 512 -# endif - -# ifndef CONFIG_RAMMTD_ERASESIZE -# define CONFIG_RAMMTD_ERASESIZE 4096 -# endif - -# ifndef CONFIG_TESTING_SMART_NEBLOCKS -# define CONFIG_TESTING_SMART_NEBLOCKS (22) -# endif - -#ifdef CONFIG_MIKROE_RAMMTD -# ifndef CONFIG_MIKROE_RAMMTD_MINOR -# define CONFIG_MIKROE_RAMMTD_MINOR 1 -# endif -# ifndef CONFIG_MIKROE_RAMMTD_SIZE -# define CONFIG_MIKROE_RAMMTD_SIZE 32 -# endif -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef CONFIG_STM32_SPI3 - struct spi_dev_s *spi; - struct mtd_dev_s *mtd; -#endif - int ret = OK; - - /* Configure SPI-based devices */ - -#ifdef CONFIG_STM32_SPI3 - /* Get the SPI port */ - - syslog(LOG_INFO, "Initializing SPI port 3\n"); - spi = stm32_spibus_initialize(3); - if (!spi) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SPI port 3\n"); - return -ENODEV; - } - - syslog(LOG_INFO, "Successfully initialized SPI port 3\n"); - - /* Now bind the SPI interface to the M25P8 SPI FLASH driver */ - -#if defined(CONFIG_MTD) && defined(CONFIG_MIKROE_FLASH) - syslog(LOG_INFO, "Bind SPI to the SPI flash driver\n"); - - mtd = m25p_initialize(spi); - if (!mtd) - { - syslog(LOG_ERR, "ERROR: Failed to bind SPI port 3 to the SPI" - " FLASH driver\n"); - } - else - { - syslog(LOG_INFO, "Successfully bound SPI port 3 to the SPI" - " FLASH driver\n"); - -#ifdef CONFIG_MIKROE_FLASH_PART - { - int partno; - int partsize; - int partoffset; - const char *partstring = CONFIG_MIKROE_FLASH_PART_LIST; - const char *ptr; - struct mtd_dev_s *mtd_part; - char partname[16]; - - /* Now create a partition on the FLASH device */ - - partno = 0; - ptr = partstring; - partoffset = 0; - - while (*ptr != '\0') - { - /* Get the partition size */ - - partsize = atoi(ptr); - mtd_part = mtd_partition(mtd, partoffset, - (partsize >> 2) * 16); - partoffset += (partsize >> 2) * 16; - -#ifdef CONFIG_MIKROE_FLASH_CONFIG_PART - /* Test if this is the config partition */ - - if (CONFIG_MIKROE_FLASH_CONFIG_PART_NUMBER == partno) - { - /* Register the partition as the config device */ - - mtdconfig_register(mtd_part); - } - else -#endif - { - /* Now initialize a SMART Flash block device and bind it - * to the MTD device. - */ - - #if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS) - snprintf(partname, sizeof(partname), "p%d", partno); - smart_initialize(CONFIG_MIKROE_FLASH_MINOR, mtd_part, - partname); -#endif - } - - /* Update the pointer to point to the next size in the list */ - - while ((*ptr >= '0') && (*ptr <= '9')) - { - ptr++; - } - - if (*ptr == ',') - { - ptr++; - } - - /* Increment the part number */ - - partno++; - } - } -#else /* CONFIG_MIKROE_FLASH_PART */ - - /* Configure the device with no partition support */ - - smart_initialize(CONFIG_MIKROE_FLASH_MINOR, mtd, NULL); - -#endif /* CONFIG_MIKROE_FLASH_PART */ - } - - /* Create a RAM MTD device if configured */ - -#if defined(CONFIG_RAMMTD) && defined(CONFIG_MIKROE_RAMMTD) - { - uint8_t *start = - kmm_malloc(CONFIG_MIKROE_RAMMTD_SIZE * 1024); - mtd = rammtd_initialize(start, CONFIG_MIKROE_RAMMTD_SIZE * 1024); - mtd->ioctl(mtd, MTDIOC_BULKERASE, 0); - - /* Now initialize a SMART Flash block device and bind it to the - * MTD device - */ - -#if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS) - smart_initialize(CONFIG_MIKROE_RAMMTD_MINOR, mtd, NULL); -#endif - } - -#endif /* CONFIG_RAMMTD && CONFIG_MIKROE_RAMMTD */ - -#endif /* CONFIG_MTD */ -#endif /* CONFIG_STM32_SPI3 */ - - /* Create the SPI FLASH MTD instance */ - - /* The M25Pxx is not a good media to implement a file system.. - * its block sizes are too large - */ - - /* Mount the SDIO-based MMC/SD block driver */ - -#ifdef NSH_HAVEMMCSD - /* Bind the spi interface to the MMC/SD driver */ - - syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=%d\n", - CONFIG_NSH_MMCSDMINOR); - - ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, - CONFIG_NSH_MMCSDSLOTNO, spi); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: Failed to bind SPI to the MMC/SD driver:" - " %d\n", ret); - } - else - { - syslog(LOG_INFO, "Successfully bound SPI to the MMC/SD driver\n"); - } -#endif - -#ifdef HAVE_USBHOST - /* Initialize USB host operation. stm32_usbhost_initialize() starts a - * thread will monitor for USB connection and disconnection events. - */ - - ret = stm32_usbhost_initialize(); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); - return ret; - } -#endif - -#ifdef HAVE_USBMONITOR - /* Start the USB Monitor */ - - ret = usbmonitor_start(); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); - } -#endif - -#ifdef CONFIG_INPUT - /* Initialize the touchscreen */ - - ret = stm32_tsc_setup(0); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_PWM - /* Initialize PWM and register the PWM device. */ - - ret = stm32_pwm_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret); - } -#endif - -#if defined(CONFIG_LCD_MIO283QT2) || defined(CONFIG_LCD_MIO283QT9A) - /* Configure the TFT LCD module */ - - syslog(LOG_INFO, "Initializing TFT LCD module\n"); - - ret = board_lcd_initialize(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to initialize TFT LCD module\n"); - } -#endif - -#ifdef CONFIG_SENSORS_QENCODER - /* Initialize and register the qencoder driver */ - - ret = board_qencoder_initialize(0, CONFIG_MIKROE_QETIMER); - if (ret != OK) - { - syslog(LOG_ERR, - "ERROR: Failed to register the qencoder: %d\n", - ret); - return ret; - } -#endif - -#ifdef CONFIG_AUDIO - /* Configure the Audio sub-system if enabled and bind it to SPI 3 */ - - up_vs1053initialize(spi); -#endif - - return ret; -} diff --git a/boards/arm/stm32/mikroe-stm32f4/src/stm32_boot.c b/boards/arm/stm32/mikroe-stm32f4/src/stm32_boot.c index 971f8ec1cec..aa2a1c87b09 100644 --- a/boards/arm/stm32/mikroe-stm32f4/src/stm32_boot.c +++ b/boards/arm/stm32/mikroe-stm32f4/src/stm32_boot.c @@ -28,15 +28,130 @@ #include -#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_STM32_SPI3 +# include +#endif + +#ifdef CONFIG_MTD_M25P +# include +#endif + +#ifdef CONFIG_USBMONITOR +# include +#endif + +#ifdef CONFIG_MIKROE_FLASH_CONFIG_PART +#ifdef CONFIG_PLATFORM_CONFIGDATA +# include +#endif +#endif + +#ifdef CONFIG_AUDIO +# include +#endif + +#ifdef CONFIG_STM32_OTGFS +# include "stm32_usbhost.h" +#endif + +#include "stm32.h" #include "arm_internal.h" #include "mikroe-stm32f4.h" +#ifdef CONFIG_SENSORS_QENCODER +#include "board_qencoder.h" +#endif + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +#define HAVE_USBDEV 1 +#define HAVE_USBHOST 1 +#define HAVE_USBMONITOR 1 +#define NSH_HAVEMMCSD 1 + +/* Can't support USB host or device features if USB OTG FS is not enabled */ + +#ifndef CONFIG_STM32_OTGFS +# undef HAVE_USBDEV +# undef HAVE_USBHOST +#endif + +/* Can't support USB device is USB device is not enabled */ + +#ifndef CONFIG_USBDEV +# undef HAVE_USBDEV +#endif + +/* Can't support USB host is USB host is not enabled */ + +#ifndef CONFIG_USBHOST +# undef HAVE_USBHOST +#endif + +/* Check if we should enable the USB monitor before starting NSH */ + +#ifndef CONFIG_USBMONITOR +# undef HAVE_USBMONITOR +#endif + +#ifndef HAVE_USBDEV +# undef CONFIG_USBDEV_TRACE +#endif + +#ifndef HAVE_USBHOST +# undef CONFIG_USBHOST_TRACE +#endif + +#if !defined(CONFIG_USBDEV_TRACE) && !defined(CONFIG_USBHOST_TRACE) +# undef HAVE_USBMONITOR +#endif + +/* Can't support MMC/SD features if mountpoints are disabled or if SDIO + * support is not enabled. + */ + +#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_STM32_SPI3) +# undef NSH_HAVEMMCSD +#endif + +#ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +#endif + +# ifndef CONFIG_RAMMTD_BLOCKSIZE +# define CONFIG_RAMMTD_BLOCKSIZE 512 +# endif + +# ifndef CONFIG_RAMMTD_ERASESIZE +# define CONFIG_RAMMTD_ERASESIZE 4096 +# endif + +# ifndef CONFIG_TESTING_SMART_NEBLOCKS +# define CONFIG_TESTING_SMART_NEBLOCKS (22) +# endif + +#ifdef CONFIG_MIKROE_RAMMTD +# ifndef CONFIG_MIKROE_RAMMTD_MINOR +# define CONFIG_MIKROE_RAMMTD_MINOR 1 +# endif +# ifndef CONFIG_MIKROE_RAMMTD_SIZE +# define CONFIG_MIKROE_RAMMTD_SIZE 32 +# endif +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -96,3 +211,257 @@ void stm32_boardinitialize(void) } #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) +{ +#ifdef CONFIG_STM32_SPI3 + struct spi_dev_s *spi; + struct mtd_dev_s *mtd; +#endif + int ret = OK; + + /* Configure SPI-based devices */ + +#ifdef CONFIG_STM32_SPI3 + /* Get the SPI port */ + + syslog(LOG_INFO, "Initializing SPI port 3\n"); + spi = stm32_spibus_initialize(3); + if (!spi) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port 3\n"); + return; + } + + syslog(LOG_INFO, "Successfully initialized SPI port 3\n"); + + /* Now bind the SPI interface to the M25P8 SPI FLASH driver */ + +#if defined(CONFIG_MTD) && defined(CONFIG_MIKROE_FLASH) + syslog(LOG_INFO, "Bind SPI to the SPI flash driver\n"); + + mtd = m25p_initialize(spi); + if (!mtd) + { + syslog(LOG_ERR, "ERROR: Failed to bind SPI port 3 to the SPI" + " FLASH driver\n"); + } + else + { + syslog(LOG_INFO, "Successfully bound SPI port 3 to the SPI" + " FLASH driver\n"); + +#ifdef CONFIG_MIKROE_FLASH_PART + { + int partno; + int partsize; + int partoffset; + const char *partstring = CONFIG_MIKROE_FLASH_PART_LIST; + const char *ptr; + struct mtd_dev_s *mtd_part; + char partname[16]; + + /* Now create a partition on the FLASH device */ + + partno = 0; + ptr = partstring; + partoffset = 0; + + while (*ptr != '\0') + { + /* Get the partition size */ + + partsize = atoi(ptr); + mtd_part = mtd_partition(mtd, partoffset, + (partsize >> 2) * 16); + partoffset += (partsize >> 2) * 16; + +#ifdef CONFIG_MIKROE_FLASH_CONFIG_PART + /* Test if this is the config partition */ + + if (CONFIG_MIKROE_FLASH_CONFIG_PART_NUMBER == partno) + { + /* Register the partition as the config device */ + + mtdconfig_register(mtd_part); + } + else +#endif + { + /* Now initialize a SMART Flash block device and bind it + * to the MTD device. + */ + + #if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS) + snprintf(partname, sizeof(partname), "p%d", partno); + smart_initialize(CONFIG_MIKROE_FLASH_MINOR, mtd_part, + partname); +#endif + } + + /* Update the pointer to point to the next size in the list */ + + while ((*ptr >= '0') && (*ptr <= '9')) + { + ptr++; + } + + if (*ptr == ',') + { + ptr++; + } + + /* Increment the part number */ + + partno++; + } + } +#else /* CONFIG_MIKROE_FLASH_PART */ + + /* Configure the device with no partition support */ + + smart_initialize(CONFIG_MIKROE_FLASH_MINOR, mtd, NULL); + +#endif /* CONFIG_MIKROE_FLASH_PART */ + } + + /* Create a RAM MTD device if configured */ + +#if defined(CONFIG_RAMMTD) && defined(CONFIG_MIKROE_RAMMTD) + { + uint8_t *start = + kmm_malloc(CONFIG_MIKROE_RAMMTD_SIZE * 1024); + mtd = rammtd_initialize(start, CONFIG_MIKROE_RAMMTD_SIZE * 1024); + mtd->ioctl(mtd, MTDIOC_BULKERASE, 0); + + /* Now initialize a SMART Flash block device and bind it to the + * MTD device + */ + +#if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS) + smart_initialize(CONFIG_MIKROE_RAMMTD_MINOR, mtd, NULL); +#endif + } + +#endif /* CONFIG_RAMMTD && CONFIG_MIKROE_RAMMTD */ + +#endif /* CONFIG_MTD */ +#endif /* CONFIG_STM32_SPI3 */ + + /* Create the SPI FLASH MTD instance */ + + /* The M25Pxx is not a good media to implement a file system.. + * its block sizes are too large + */ + + /* Mount the SDIO-based MMC/SD block driver */ + +#ifdef NSH_HAVEMMCSD + /* Bind the spi interface to the MMC/SD driver */ + + syslog(LOG_INFO, "Bind SDIO to the MMC/SD driver, minor=%d\n", + CONFIG_NSH_MMCSDMINOR); + + ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, + CONFIG_NSH_MMCSDSLOTNO, spi); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: Failed to bind SPI to the MMC/SD driver:" + " %d\n", ret); + } + else + { + syslog(LOG_INFO, "Successfully bound SPI to the MMC/SD driver\n"); + } +#endif + +#ifdef HAVE_USBHOST + /* Initialize USB host operation. stm32_usbhost_initialize() starts a + * thread will monitor for USB connection and disconnection events. + */ + + ret = stm32_usbhost_initialize(); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); + return; + } +#endif + +#ifdef HAVE_USBMONITOR + /* Start the USB Monitor */ + + ret = usbmonitor_start(); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); + } +#endif + +#ifdef CONFIG_INPUT + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_PWM + /* Initialize PWM and register the PWM device. */ + + ret = stm32_pwm_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret); + } +#endif + +#if defined(CONFIG_LCD_MIO283QT2) || defined(CONFIG_LCD_MIO283QT9A) + /* Configure the TFT LCD module */ + + syslog(LOG_INFO, "Initializing TFT LCD module\n"); + + ret = board_lcd_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize TFT LCD module\n"); + } +#endif + +#ifdef CONFIG_SENSORS_QENCODER + /* Initialize and register the qencoder driver */ + + ret = board_qencoder_initialize(0, CONFIG_MIKROE_QETIMER); + if (ret != OK) + { + syslog(LOG_ERR, + "ERROR: Failed to register the qencoder: %d\n", + ret); + return; + } +#endif + +#ifdef CONFIG_AUDIO + /* Configure the Audio sub-system if enabled and bind it to SPI 3 */ + + up_vs1053initialize(spi); +#endif +} +#endif diff --git a/boards/arm/stm32/nucleo-f103rb/src/CMakeLists.txt b/boards/arm/stm32/nucleo-f103rb/src/CMakeLists.txt index 38aa9f27b32..513418e9419 100644 --- a/boards/arm/stm32/nucleo-f103rb/src/CMakeLists.txt +++ b/boards/arm/stm32/nucleo-f103rb/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(NOT CONFIG_STM32_FOC) if(CONFIG_ADC) list(APPEND SRCS stm32_adc.c) diff --git a/boards/arm/stm32/nucleo-f103rb/src/Make.defs b/boards/arm/stm32/nucleo-f103rb/src/Make.defs index db43563066f..fa7a6e98720 100644 --- a/boards/arm/stm32/nucleo-f103rb/src/Make.defs +++ b/boards/arm/stm32/nucleo-f103rb/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifneq ($(CONFIG_STM32_FOC),y) ifeq ($(CONFIG_ADC),y) CSRCS += stm32_adc.c diff --git a/boards/arm/stm32/nucleo-f103rb/src/nucleo-f103rb.h b/boards/arm/stm32/nucleo-f103rb/src/nucleo-f103rb.h index 5a5e4bc8368..d4cb2b2383a 100644 --- a/boards/arm/stm32/nucleo-f103rb/src/nucleo-f103rb.h +++ b/boards/arm/stm32/nucleo-f103rb/src/nucleo-f103rb.h @@ -89,12 +89,7 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * * Otherwise, bad news: Never called diff --git a/boards/arm/stm32/nucleo-f103rb/src/stm32_appinit.c b/boards/arm/stm32/nucleo-f103rb/src/stm32_appinit.c deleted file mode 100644 index 546cc9704a7..00000000000 --- a/boards/arm/stm32/nucleo-f103rb/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/nucleo-f103rb/src/stm32_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 - -#include -#include - -#include "nucleo-f103rb.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/nucleo-f103rb/src/stm32_foc_ihm07m1.c b/boards/arm/stm32/nucleo-f103rb/src/stm32_foc_ihm07m1.c index 6c850c7e62f..d584691bd53 100644 --- a/boards/arm/stm32/nucleo-f103rb/src/stm32_foc_ihm07m1.c +++ b/boards/arm/stm32/nucleo-f103rb/src/stm32_foc_ihm07m1.c @@ -174,8 +174,6 @@ static struct stm32_foc_adc_s g_adc_cfg = * Description: * Initialize FOC driver. * - * This function should be call by board_app_initialize(). - * * Returned Value: * 0 on success, a negated errno value on failure * diff --git a/boards/arm/stm32/nucleo-f207zg/src/CMakeLists.txt b/boards/arm/stm32/nucleo-f207zg/src/CMakeLists.txt index 06b6a2f3d53..5ca78ff3da4 100644 --- a/boards/arm/stm32/nucleo-f207zg/src/CMakeLists.txt +++ b/boards/arm/stm32/nucleo-f207zg/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_STM32_OTGFS) list(APPEND SRCS stm32_usb.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_ADC) list(APPEND SRCS stm32_adc.c) endif() diff --git a/boards/arm/stm32/nucleo-f207zg/src/Make.defs b/boards/arm/stm32/nucleo-f207zg/src/Make.defs index f0324ad40bd..3962a5368fd 100644 --- a/boards/arm/stm32/nucleo-f207zg/src/Make.defs +++ b/boards/arm/stm32/nucleo-f207zg/src/Make.defs @@ -38,10 +38,6 @@ ifeq ($(CONFIG_STM32_OTGFS),y) CSRCS += stm32_usb.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += stm32_adc.c endif diff --git a/boards/arm/stm32/nucleo-f207zg/src/stm32_appinitialize.c b/boards/arm/stm32/nucleo-f207zg/src/stm32_appinitialize.c deleted file mode 100644 index 6eb5d0915bf..00000000000 --- a/boards/arm/stm32/nucleo-f207zg/src/stm32_appinitialize.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/nucleo-f207zg/src/stm32_appinitialize.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 - -#include -#include - -#include "nucleo-f207zg.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/nucleo-f207zg/src/stm32_boot.c b/boards/arm/stm32/nucleo-f207zg/src/stm32_boot.c index f15f770d8ab..3f7ae0c33c1 100644 --- a/boards/arm/stm32/nucleo-f207zg/src/stm32_boot.c +++ b/boards/arm/stm32/nucleo-f207zg/src/stm32_boot.c @@ -82,12 +82,6 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { -#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) - /* Perform board bring-up here instead of from the - * board_app_initialize(). - */ - stm32_bringup(); -#endif } #endif diff --git a/boards/arm/stm32/nucleo-f207zg/src/stm32_bringup.c b/boards/arm/stm32/nucleo-f207zg/src/stm32_bringup.c index f0d98f187e9..149f1cc0930 100644 --- a/boards/arm/stm32/nucleo-f207zg/src/stm32_bringup.c +++ b/boards/arm/stm32/nucleo-f207zg/src/stm32_bringup.c @@ -49,10 +49,6 @@ * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void) diff --git a/boards/arm/stm32/nucleo-f302r8/src/CMakeLists.txt b/boards/arm/stm32/nucleo-f302r8/src/CMakeLists.txt index b57f7b41cd0..e5e905b763f 100644 --- a/boards/arm/stm32/nucleo-f302r8/src/CMakeLists.txt +++ b/boards/arm/stm32/nucleo-f302r8/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_PWM) list(APPEND SRCS stm32_pwm.c) endif() diff --git a/boards/arm/stm32/nucleo-f302r8/src/Make.defs b/boards/arm/stm32/nucleo-f302r8/src/Make.defs index 1af494745a8..7c9ce0e0b1f 100644 --- a/boards/arm/stm32/nucleo-f302r8/src/Make.defs +++ b/boards/arm/stm32/nucleo-f302r8/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_PWM),y) CSRCS += stm32_pwm.c endif diff --git a/boards/arm/stm32/nucleo-f302r8/src/nucleo-f302r8.h b/boards/arm/stm32/nucleo-f302r8/src/nucleo-f302r8.h index 2348c4ed197..6c3c83d04a0 100644 --- a/boards/arm/stm32/nucleo-f302r8/src/nucleo-f302r8.h +++ b/boards/arm/stm32/nucleo-f302r8/src/nucleo-f302r8.h @@ -104,12 +104,7 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * * Otherwise, bad news: Never called diff --git a/boards/arm/stm32/nucleo-f302r8/src/stm32_appinit.c b/boards/arm/stm32/nucleo-f302r8/src/stm32_appinit.c deleted file mode 100644 index 93fb0ebd633..00000000000 --- a/boards/arm/stm32/nucleo-f302r8/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/nucleo-f302r8/src/stm32_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 - -#include -#include - -#include "nucleo-f302r8.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/nucleo-f302r8/src/stm32_foc_ihm07m1.c b/boards/arm/stm32/nucleo-f302r8/src/stm32_foc_ihm07m1.c index e89f0333a58..60471ed2ae3 100644 --- a/boards/arm/stm32/nucleo-f302r8/src/stm32_foc_ihm07m1.c +++ b/boards/arm/stm32/nucleo-f302r8/src/stm32_foc_ihm07m1.c @@ -172,8 +172,6 @@ static struct stm32_foc_adc_s g_adc_cfg = * Description: * Initialize FOC driver. * - * This function should be call by board_app_initialize(). - * * Returned Value: * 0 on success, a negated errno value on failure * diff --git a/boards/arm/stm32/nucleo-f303re/src/CMakeLists.txt b/boards/arm/stm32/nucleo-f303re/src/CMakeLists.txt index d52e454b8ce..bcc8d69e66c 100644 --- a/boards/arm/stm32/nucleo-f303re/src/CMakeLists.txt +++ b/boards/arm/stm32/nucleo-f303re/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_ADC) list(APPEND SRCS stm32_adc.c) endif() diff --git a/boards/arm/stm32/nucleo-f303re/src/Make.defs b/boards/arm/stm32/nucleo-f303re/src/Make.defs index 73afdd9775b..08749d74cd0 100644 --- a/boards/arm/stm32/nucleo-f303re/src/Make.defs +++ b/boards/arm/stm32/nucleo-f303re/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += stm32_adc.c endif diff --git a/boards/arm/stm32/nucleo-f303re/src/stm32_appinitialize.c b/boards/arm/stm32/nucleo-f303re/src/stm32_appinitialize.c deleted file mode 100644 index b1eac2bbc2f..00000000000 --- a/boards/arm/stm32/nucleo-f303re/src/stm32_appinitialize.c +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/nucleo-f303re/src/stm32_appinitialize.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 - -#include -#include - -#include -#include - -#include "nucleo-f303re.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#undef HAVE_LEDS -#undef HAVE_DAC - -#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) -# define HAVE_LEDS 1 -#endif - -#if defined(CONFIG_DAC) -# define HAVE_DAC 1 -#endif - -/**************************************************************************** - * 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) -{ - int ret; - -#ifdef HAVE_LEDS - /* Register the LED driver */ - - ret = userled_lower_initialize(LED_DRIVER_PATH); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); - return ret; - } -#endif - -#ifdef CONFIG_PWM - /* Initialize PWM and register the PWM device. */ - - ret = stm32_pwm_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret); - } -#endif - - /* Contrairement à l'ADC, il n'y a pas de BOARDIOC_DAC_SETUP spécifique. - * Il faut le faire ici - */ - -#ifdef HAVE_DAC - ret = board_dac_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: board_dac_setup() failed: %d\n", ret); - return ret; - } -#endif - -#ifdef CONFIG_ADC - /* Initialize ADC and register the ADC driver. */ - - ret = stm32_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_STM32_CAN_CHARDRIVER - /* Initialize CAN and register the CAN driver. */ - - ret = stm32_can_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_can_setup failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/stm32/nucleo-f303re/src/stm32_boot.c b/boards/arm/stm32/nucleo-f303re/src/stm32_boot.c index 8bd52fcfb37..6231f8b5f59 100644 --- a/boards/arm/stm32/nucleo-f303re/src/stm32_boot.c +++ b/boards/arm/stm32/nucleo-f303re/src/stm32_boot.c @@ -26,8 +26,12 @@ #include +#include +#include + #include #include +#include #include "nucleo-f303re.h" @@ -35,6 +39,17 @@ * Pre-processor Definitions ****************************************************************************/ +#undef HAVE_LEDS +#undef HAVE_DAC + +#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) +# define HAVE_LEDS 1 +#endif + +#if defined(CONFIG_DAC) +# define HAVE_DAC 1 +#endif + /**************************************************************************** * Private Function Prototypes ****************************************************************************/ @@ -77,3 +92,80 @@ void stm32_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_intitialize() 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) +{ + int ret; + +#ifdef HAVE_LEDS + /* Register the LED driver */ + + ret = userled_lower_initialize(LED_DRIVER_PATH); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); + return ret; + } +#endif + +#ifdef CONFIG_PWM + /* Initialize PWM and register the PWM device. */ + + ret = stm32_pwm_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret); + } +#endif + + /* Contrairement à l'ADC, il n'y a pas de BOARDIOC_DAC_SETUP spécifique. + * Il faut le faire ici + */ + +#ifdef HAVE_DAC + ret = board_dac_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: board_dac_setup() failed: %d\n", ret); + return; + } +#endif + +#ifdef CONFIG_ADC + /* Initialize ADC and register the ADC driver. */ + + ret = stm32_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_STM32_CAN_CHARDRIVER + /* Initialize CAN and register the CAN driver. */ + + ret = stm32_can_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_can_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); +} +#endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/stm32/nucleo-f303ze/src/CMakeLists.txt b/boards/arm/stm32/nucleo-f303ze/src/CMakeLists.txt index 623d086de4f..5c6e0c74cb3 100644 --- a/boards/arm/stm32/nucleo-f303ze/src/CMakeLists.txt +++ b/boards/arm/stm32/nucleo-f303ze/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_ADC) list(APPEND SRCS stm32_adc.c) endif() diff --git a/boards/arm/stm32/nucleo-f303ze/src/Make.defs b/boards/arm/stm32/nucleo-f303ze/src/Make.defs index 983e35383fe..099d67193b3 100644 --- a/boards/arm/stm32/nucleo-f303ze/src/Make.defs +++ b/boards/arm/stm32/nucleo-f303ze/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += stm32_adc.c endif diff --git a/boards/arm/stm32/nucleo-f303ze/src/stm32_appinitialize.c b/boards/arm/stm32/nucleo-f303ze/src/stm32_appinitialize.c deleted file mode 100644 index b09706aff05..00000000000 --- a/boards/arm/stm32/nucleo-f303ze/src/stm32_appinitialize.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/nucleo-f303ze/src/stm32_appinitialize.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 - -#include -#include - -#include "nucleo-f303ze.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/nucleo-f303ze/src/stm32_boot.c b/boards/arm/stm32/nucleo-f303ze/src/stm32_boot.c index bb71110be88..f2c54d36d4e 100644 --- a/boards/arm/stm32/nucleo-f303ze/src/stm32_boot.c +++ b/boards/arm/stm32/nucleo-f303ze/src/stm32_boot.c @@ -76,12 +76,6 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { -#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) - /* Perform board bring-up here instead of from the - * board_app_initialize(). - */ - stm32_bringup(); -#endif } #endif diff --git a/boards/arm/stm32/nucleo-f303ze/src/stm32_bringup.c b/boards/arm/stm32/nucleo-f303ze/src/stm32_bringup.c index 0afd939a921..697969eec66 100644 --- a/boards/arm/stm32/nucleo-f303ze/src/stm32_bringup.c +++ b/boards/arm/stm32/nucleo-f303ze/src/stm32_bringup.c @@ -49,10 +49,6 @@ * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void) diff --git a/boards/arm/stm32/nucleo-f334r8/src/CMakeLists.txt b/boards/arm/stm32/nucleo-f334r8/src/CMakeLists.txt index 49780b06c08..30f5bccef47 100644 --- a/boards/arm/stm32/nucleo-f334r8/src/CMakeLists.txt +++ b/boards/arm/stm32/nucleo-f334r8/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_ARCH_LEDS) list(APPEND SRCS stm32_autoleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ADC) list(APPEND SRCS stm32_adc.c) endif() diff --git a/boards/arm/stm32/nucleo-f334r8/src/Make.defs b/boards/arm/stm32/nucleo-f334r8/src/Make.defs index c0d906bd7ad..97dbc7a0f51 100644 --- a/boards/arm/stm32/nucleo-f334r8/src/Make.defs +++ b/boards/arm/stm32/nucleo-f334r8/src/Make.defs @@ -28,10 +28,6 @@ ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += stm32_autoleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += stm32_adc.c endif diff --git a/boards/arm/stm32/nucleo-f334r8/src/stm32_appinit.c b/boards/arm/stm32/nucleo-f334r8/src/stm32_appinit.c deleted file mode 100644 index 80fc69e84c5..00000000000 --- a/boards/arm/stm32/nucleo-f334r8/src/stm32_appinit.c +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/nucleo-f334r8/src/stm32_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 - -#include -#include - -#include -#include - -#include "nucleo-f334r8.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#undef HAVE_LEDS -#undef HAVE_DAC - -#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) -# define HAVE_LEDS 1 -#endif - -#if defined(CONFIG_DAC) -# define HAVE_DAC1 1 -# define HAVE_DAC2 1 -#endif - -/**************************************************************************** - * 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) -{ - int ret; - -#ifdef HAVE_LEDS - /* Register the LED driver */ - - ret = userled_lower_initialize(LED_DRIVER_PATH); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); - return ret; - } -#endif - -#ifdef CONFIG_ADC - /* Initialize ADC and register the ADC driver. */ - - ret = stm32_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_DAC - /* Initialize DAC and register the DAC driver. */ - - ret = stm32_dac_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_dac_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_COMP - /* Initialize COMP and register the COMP driver. */ - - ret = stm32_comp_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_comp_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_OPAMP - /* Initialize OPAMP and register the OPAMP driver. */ - - ret = stm32_opamp_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_opamp_setup failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/stm32/nucleo-f334r8/src/stm32_boot.c b/boards/arm/stm32/nucleo-f334r8/src/stm32_boot.c index a2962485bb5..6387f93c8a3 100644 --- a/boards/arm/stm32/nucleo-f334r8/src/stm32_boot.c +++ b/boards/arm/stm32/nucleo-f334r8/src/stm32_boot.c @@ -26,8 +26,12 @@ #include +#include +#include + #include #include +#include #include "nucleo-f334r8.h" @@ -35,6 +39,18 @@ * Pre-processor Definitions ****************************************************************************/ +#undef HAVE_LEDS +#undef HAVE_DAC + +#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) +# define HAVE_LEDS 1 +#endif + +#if defined(CONFIG_DAC) +# define HAVE_DAC1 1 +# define HAVE_DAC2 1 +#endif + /**************************************************************************** * Private Function Prototypes ****************************************************************************/ @@ -70,3 +86,77 @@ void stm32_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) +{ + int ret; + +#ifdef HAVE_LEDS + /* Register the LED driver */ + + ret = userled_lower_initialize(LED_DRIVER_PATH); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); + return; + } +#endif + +#ifdef CONFIG_ADC + /* Initialize ADC and register the ADC driver. */ + + ret = stm32_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_DAC + /* Initialize DAC and register the DAC driver. */ + + ret = stm32_dac_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_dac_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_COMP + /* Initialize COMP and register the COMP driver. */ + + ret = stm32_comp_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_comp_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_OPAMP + /* Initialize OPAMP and register the OPAMP driver. */ + + ret = stm32_opamp_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_opamp_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); +} +#endif diff --git a/boards/arm/stm32/nucleo-f401re/src/CMakeLists.txt b/boards/arm/stm32/nucleo-f401re/src/CMakeLists.txt index 804ea88612d..d1e694f4405 100644 --- a/boards/arm/stm32/nucleo-f401re/src/CMakeLists.txt +++ b/boards/arm/stm32/nucleo-f401re/src/CMakeLists.txt @@ -49,10 +49,6 @@ if(CONFIG_CAN_MCP2515) list(APPEND SRCS stm32_mcp2515.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld") diff --git a/boards/arm/stm32/nucleo-f401re/src/Make.defs b/boards/arm/stm32/nucleo-f401re/src/Make.defs index 372f00f2483..45725b5052e 100644 --- a/boards/arm/stm32/nucleo-f401re/src/Make.defs +++ b/boards/arm/stm32/nucleo-f401re/src/Make.defs @@ -51,10 +51,6 @@ ifeq ($(CONFIG_CAN_MCP2515),y) CSRCS += stm32_mcp2515.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/arm/stm32/nucleo-f401re/src/nucleo-f401re.h b/boards/arm/stm32/nucleo-f401re/src/nucleo-f401re.h index 976fca4a406..09a0d7af69a 100644 --- a/boards/arm/stm32/nucleo-f401re/src/nucleo-f401re.h +++ b/boards/arm/stm32/nucleo-f401re/src/nucleo-f401re.h @@ -238,12 +238,7 @@ extern struct sdio_dev_s *g_sdio; * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * * Otherwise, bad news: Never called diff --git a/boards/arm/stm32/nucleo-f401re/src/stm32_appinit.c b/boards/arm/stm32/nucleo-f401re/src/stm32_appinit.c deleted file mode 100644 index b1562d2d4af..00000000000 --- a/boards/arm/stm32/nucleo-f401re/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/nucleo-f401re/src/stm32_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 - -#include -#include - -#include "nucleo-f401re.h" - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - return OK; -#else - /* Perform board initialization here */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/nucleo-f401re/src/stm32_boot.c b/boards/arm/stm32/nucleo-f401re/src/stm32_boot.c index 73ed43ea85b..66eb41c6066 100644 --- a/boards/arm/stm32/nucleo-f401re/src/stm32_boot.c +++ b/boards/arm/stm32/nucleo-f401re/src/stm32_boot.c @@ -96,10 +96,6 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform board initialization here instead of from the - * board_app_initialize(). - */ - stm32_bringup(); } #endif diff --git a/boards/arm/stm32/nucleo-f410rb/src/CMakeLists.txt b/boards/arm/stm32/nucleo-f410rb/src/CMakeLists.txt index fb6e6231e4a..df15551bccb 100644 --- a/boards/arm/stm32/nucleo-f410rb/src/CMakeLists.txt +++ b/boards/arm/stm32/nucleo-f410rb/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_ADC) list(APPEND SRCS stm32_adc.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/f410rb.ld") diff --git a/boards/arm/stm32/nucleo-f410rb/src/Make.defs b/boards/arm/stm32/nucleo-f410rb/src/Make.defs index db1644aec42..abd7559d831 100644 --- a/boards/arm/stm32/nucleo-f410rb/src/Make.defs +++ b/boards/arm/stm32/nucleo-f410rb/src/Make.defs @@ -38,10 +38,6 @@ ifeq ($(CONFIG_ADC),y) CSRCS += stm32_adc.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/arm/stm32/nucleo-f410rb/src/stm32_appinit.c b/boards/arm/stm32/nucleo-f410rb/src/stm32_appinit.c deleted file mode 100644 index e38385f205c..00000000000 --- a/boards/arm/stm32/nucleo-f410rb/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/nucleo-f410rb/src/stm32_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 - -#include -#include - -#include "nucleo-f410rb.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/nucleo-f410rb/src/stm32_boot.c b/boards/arm/stm32/nucleo-f410rb/src/stm32_boot.c index b4c6108b728..d85baaa2d49 100644 --- a/boards/arm/stm32/nucleo-f410rb/src/stm32_boot.c +++ b/boards/arm/stm32/nucleo-f410rb/src/stm32_boot.c @@ -90,10 +90,6 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { -#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) - /* Perform board-specific initialization */ - stm32_bringup(); -#endif } #endif diff --git a/boards/arm/stm32/nucleo-f411re/src/CMakeLists.txt b/boards/arm/stm32/nucleo-f411re/src/CMakeLists.txt index 112eee3d55e..9339106e5de 100644 --- a/boards/arm/stm32/nucleo-f411re/src/CMakeLists.txt +++ b/boards/arm/stm32/nucleo-f411re/src/CMakeLists.txt @@ -49,10 +49,6 @@ if(CONFIG_CAN_MCP2515) list(APPEND SRCS stm32_mcp2515.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld") diff --git a/boards/arm/stm32/nucleo-f411re/src/Make.defs b/boards/arm/stm32/nucleo-f411re/src/Make.defs index 20c1fcb2be2..0bab56576f5 100644 --- a/boards/arm/stm32/nucleo-f411re/src/Make.defs +++ b/boards/arm/stm32/nucleo-f411re/src/Make.defs @@ -51,10 +51,6 @@ ifeq ($(CONFIG_CAN_MCP2515),y) CSRCS += stm32_mcp2515.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/arm/stm32/nucleo-f411re/src/nucleo-f411re.h b/boards/arm/stm32/nucleo-f411re/src/nucleo-f411re.h index 88f6fdce853..036d7b73c37 100644 --- a/boards/arm/stm32/nucleo-f411re/src/nucleo-f411re.h +++ b/boards/arm/stm32/nucleo-f411re/src/nucleo-f411re.h @@ -238,12 +238,7 @@ extern struct sdio_dev_s *g_sdio; * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * * Otherwise, bad news: Never called diff --git a/boards/arm/stm32/nucleo-f411re/src/stm32_appinit.c b/boards/arm/stm32/nucleo-f411re/src/stm32_appinit.c deleted file mode 100644 index c2b6d362bed..00000000000 --- a/boards/arm/stm32/nucleo-f411re/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/nucleo-f411re/src/stm32_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 - -#include -#include - -#include "nucleo-f411re.h" - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - return OK; -#else - /* Perform board initialization here */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/nucleo-f411re/src/stm32_boot.c b/boards/arm/stm32/nucleo-f411re/src/stm32_boot.c index 595f0d2043c..88b543398ba 100644 --- a/boards/arm/stm32/nucleo-f411re/src/stm32_boot.c +++ b/boards/arm/stm32/nucleo-f411re/src/stm32_boot.c @@ -96,10 +96,6 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform board initialization here instead of from the - * board_app_initialize(). - */ - stm32_bringup(); } #endif diff --git a/boards/arm/stm32/nucleo-f412zg/src/CMakeLists.txt b/boards/arm/stm32/nucleo-f412zg/src/CMakeLists.txt index 9ffcb4bb390..b3cae915b25 100644 --- a/boards/arm/stm32/nucleo-f412zg/src/CMakeLists.txt +++ b/boards/arm/stm32/nucleo-f412zg/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_ARCH_LEDS) list(APPEND SRCS stm32_autoleds.c) endif() -if(CONFIG_NSH_LIBRARY) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_STM32_OTGFS) list(APPEND SRCS stm32_usb.c) endif() diff --git a/boards/arm/stm32/nucleo-f412zg/src/Make.defs b/boards/arm/stm32/nucleo-f412zg/src/Make.defs index dd20e668bb4..d437533fd24 100644 --- a/boards/arm/stm32/nucleo-f412zg/src/Make.defs +++ b/boards/arm/stm32/nucleo-f412zg/src/Make.defs @@ -29,10 +29,6 @@ ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += stm32_autoleds.c endif -ifeq ($(CONFIG_NSH_LIBRARY),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_STM32_OTGFS),y) CSRCS += stm32_usb.c endif diff --git a/boards/arm/stm32/nucleo-f412zg/src/stm32_appinit.c b/boards/arm/stm32/nucleo-f412zg/src/stm32_appinit.c deleted file mode 100644 index 40c40fb45a7..00000000000 --- a/boards/arm/stm32/nucleo-f412zg/src/stm32_appinit.c +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/nucleo-f412zg/src/stm32_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 - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include "nucleo-f412zg.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 cold 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-specific initialization */ - - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32/nucleo-f429zi/src/CMakeLists.txt b/boards/arm/stm32/nucleo-f429zi/src/CMakeLists.txt index 4e16a74e01a..cfcef00556c 100644 --- a/boards/arm/stm32/nucleo-f429zi/src/CMakeLists.txt +++ b/boards/arm/stm32/nucleo-f429zi/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_DEV_GPIO) list(APPEND SRCS stm32_gpio.c) endif() diff --git a/boards/arm/stm32/nucleo-f429zi/src/Make.defs b/boards/arm/stm32/nucleo-f429zi/src/Make.defs index 72c22ff63d2..2824447d2d6 100644 --- a/boards/arm/stm32/nucleo-f429zi/src/Make.defs +++ b/boards/arm/stm32/nucleo-f429zi/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += stm32_gpio.c endif diff --git a/boards/arm/stm32/nucleo-f429zi/src/stm32_appinitialize.c b/boards/arm/stm32/nucleo-f429zi/src/stm32_appinitialize.c deleted file mode 100644 index 3928e4469ce..00000000000 --- a/boards/arm/stm32/nucleo-f429zi/src/stm32_appinitialize.c +++ /dev/null @@ -1,226 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/nucleo-f429zi/src/stm32_appinitialize.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 - -#include -#include -#include - -#include "nucleo-144.h" -#include -#include -#ifdef CONFIG_STM32_ROMFS -#include "stm32_romfs.h" -#endif - -#ifdef CONFIG_SENSORS_AMG88XX -#include "stm32_amg88xx.h" -#endif - -#if defined(CONFIG_I2C) && defined(CONFIG_SYSTEM_I2CTOOL) -# include "stm32_i2c.h" -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: stm32_i2c_register - * - * Description: - * Register one I2C drivers for the I2C tool. - * - ****************************************************************************/ - -#if defined(CONFIG_I2C) && defined(CONFIG_SYSTEM_I2CTOOL) -static void stm32_i2c_register(int bus) -{ - struct i2c_master_s *i2c; - int ret; - - i2c = stm32_i2cbus_initialize(bus); - if (i2c == NULL) - { - syslog(LOG_ERR, "ERROR: Failed to get I2C%d interface\n", bus); - } - else - { - ret = i2c_register(i2c, bus); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to register I2C%d driver: %d\n", - bus, ret); - stm32_i2cbus_uninitialize(i2c); - } - } -} -#endif - -/**************************************************************************** - * 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) -{ - int ret; - -#ifdef CONFIG_FS_PROCFS - /* Mount the procfs file system */ - - ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", - STM32_PROCFS_MOUNTPOINT, ret); - } -#endif - -#ifdef CONFIG_STM32_ROMFS - /* Mount the romfs partition */ - - ret = stm32_romfs_initialize(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to mount romfs at %s: %d\n", - CONFIG_STM32_ROMFS_MOUNTPOINT, ret); - } -#endif - -#ifdef CONFIG_DEV_GPIO - /* Register the GPIO driver */ - - ret = stm32_gpio_initialize(); - if (ret < 0) - { - syslog(LOG_ERR, "Failed to initialize GPIO Driver: %d\n", ret); - return ret; - } -#endif - -#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) - /* Register the LED driver */ - - ret = userled_lower_initialize(LED_DRIVER_PATH); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_ADC - /* Initialize ADC and register the ADC driver. */ - - ret = stm32_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_STM32_BBSRAM - /* Initialize battery-backed RAM */ - - stm32_bbsram_int(); -#endif - -#if defined(CONFIG_FAT_DMAMEMORY) - if (stm32_dma_alloc_init() < 0) - { - syslog(LOG_ERR, "DMA alloc FAILED"); - } -#endif - -#if defined(CONFIG_NUCLEO_SPI_TEST) - /* Create SPI interfaces */ - - ret = stm32_spidev_bus_test(); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SPI interfaces: %d\n", - ret); - return ret; - } -#endif - -#if defined(CONFIG_MMCSD) - /* Initialize the SDIO block driver */ - - ret = stm32_sdio_initialize(); - if (ret != OK) - { - ferr("ERROR: Failed to initialize MMC/SD driver: %d\n", ret); - return ret; - } -#endif - -#if defined(CONFIG_PWM) - /* Initialize PWM and register the PWM device */ - - ret = stm32_pwm_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret); - } -#endif - -#if defined(CONFIG_I2C) && defined(CONFIG_SYSTEM_I2CTOOL) - stm32_i2c_register(1); -#endif - -#ifdef CONFIG_SENSORS_AMG88XX - board_amg88xx_initialize(1); -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/stm32/nucleo-f429zi/src/stm32_boot.c b/boards/arm/stm32/nucleo-f429zi/src/stm32_boot.c index 81996d6e206..f6131a8308b 100644 --- a/boards/arm/stm32/nucleo-f429zi/src/stm32_boot.c +++ b/boards/arm/stm32/nucleo-f429zi/src/stm32_boot.c @@ -28,12 +28,65 @@ #include +#include +#include + #include +#include +#include #include #include "arm_internal.h" #include "nucleo-144.h" +#ifdef CONFIG_STM32_ROMFS +#include "stm32_romfs.h" +#endif + +#ifdef CONFIG_SENSORS_AMG88XX +#include "stm32_amg88xx.h" +#endif + +#if defined(CONFIG_I2C) && defined(CONFIG_SYSTEM_I2CTOOL) +# include "stm32_i2c.h" +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: stm32_i2c_register + * + * Description: + * Register one I2C drivers for the I2C tool. + * + ****************************************************************************/ + +#if defined(CONFIG_I2C) && defined(CONFIG_SYSTEM_I2CTOOL) +static void stm32_i2c_register(int bus) +{ + struct i2c_master_s *i2c; + int ret; + + i2c = stm32_i2cbus_initialize(bus); + if (i2c == NULL) + { + syslog(LOG_ERR, "ERROR: Failed to get I2C%d interface\n", bus); + } + else + { + ret = i2c_register(i2c, bus); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to register I2C%d driver: %d\n", + bus, ret); + stm32_i2cbus_uninitialize(i2c); + } + } +} +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -85,13 +138,115 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { -#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) - /* Perform NSH initialization here instead of from the NSH. This - * alternative NSH initialization is necessary when NSH is ran in - * user-space but the initialization function must run in kernel space. - */ + int ret; - board_app_initialize(0); +#ifdef CONFIG_FS_PROCFS + /* Mount the procfs file system */ + + ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", + STM32_PROCFS_MOUNTPOINT, ret); + } #endif + +#ifdef CONFIG_STM32_ROMFS + /* Mount the romfs partition */ + + ret = stm32_romfs_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to mount romfs at %s: %d\n", + CONFIG_STM32_ROMFS_MOUNTPOINT, ret); + } +#endif + +#ifdef CONFIG_DEV_GPIO + /* Register the GPIO driver */ + + ret = stm32_gpio_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "Failed to initialize GPIO Driver: %d\n", ret); + return; + } +#endif + +#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) + /* Register the LED driver */ + + ret = userled_lower_initialize(LED_DRIVER_PATH); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_ADC + /* Initialize ADC and register the ADC driver. */ + + ret = stm32_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_STM32_BBSRAM + /* Initialize battery-backed RAM */ + + stm32_bbsram_int(); +#endif + +#if defined(CONFIG_FAT_DMAMEMORY) + if (stm32_dma_alloc_init() < 0) + { + syslog(LOG_ERR, "DMA alloc FAILED"); + } +#endif + +#if defined(CONFIG_NUCLEO_SPI_TEST) + /* Create SPI interfaces */ + + ret = stm32_spidev_bus_test(); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SPI interfaces: %d\n", + ret); + return; + } +#endif + +#if defined(CONFIG_MMCSD) + /* Initialize the SDIO block driver */ + + ret = stm32_sdio_initialize(); + if (ret != OK) + { + ferr("ERROR: Failed to initialize MMC/SD driver: %d\n", ret); + return; + } +#endif + +#if defined(CONFIG_PWM) + /* Initialize PWM and register the PWM device */ + + ret = stm32_pwm_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret); + } +#endif + +#if defined(CONFIG_I2C) && defined(CONFIG_SYSTEM_I2CTOOL) + stm32_i2c_register(1); +#endif + +#ifdef CONFIG_SENSORS_AMG88XX + board_amg88xx_initialize(1); +#endif + + UNUSED(ret); } #endif diff --git a/boards/arm/stm32/nucleo-f446re/src/CMakeLists.txt b/boards/arm/stm32/nucleo-f446re/src/CMakeLists.txt index 3b4ebe0a2e4..f9d569a51e9 100644 --- a/boards/arm/stm32/nucleo-f446re/src/CMakeLists.txt +++ b/boards/arm/stm32/nucleo-f446re/src/CMakeLists.txt @@ -66,10 +66,6 @@ if(CONFIG_DAC) list(APPEND SRCS stm32_dac.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_BOARD_STM32_IHM08M1) list(APPEND SRCS stm32_foc_ihm08m1.c) endif() diff --git a/boards/arm/stm32/nucleo-f446re/src/Make.defs b/boards/arm/stm32/nucleo-f446re/src/Make.defs index 34e905cd183..968930b9767 100644 --- a/boards/arm/stm32/nucleo-f446re/src/Make.defs +++ b/boards/arm/stm32/nucleo-f446re/src/Make.defs @@ -68,10 +68,6 @@ ifeq ($(CONFIG_DAC),y) CSRCS += stm32_dac.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_BOARD_STM32_IHM08M1),y) CSRCS += stm32_foc_ihm08m1.c endif diff --git a/boards/arm/stm32/nucleo-f446re/src/nucleo-f446re.h b/boards/arm/stm32/nucleo-f446re/src/nucleo-f446re.h index 00d8318d399..9510bade876 100644 --- a/boards/arm/stm32/nucleo-f446re/src/nucleo-f446re.h +++ b/boards/arm/stm32/nucleo-f446re/src/nucleo-f446re.h @@ -270,12 +270,7 @@ extern struct sdio_dev_s *g_sdio; * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * * Otherwise, bad news: Never called diff --git a/boards/arm/stm32/nucleo-f446re/src/stm32_appinit.c b/boards/arm/stm32/nucleo-f446re/src/stm32_appinit.c deleted file mode 100644 index 0c7bd5d1cbb..00000000000 --- a/boards/arm/stm32/nucleo-f446re/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/nucleo-f446re/src/stm32_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 - -#include -#include - -#include "nucleo-f446re.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/nucleo-f446re/src/stm32_foc_ihm08m1.c b/boards/arm/stm32/nucleo-f446re/src/stm32_foc_ihm08m1.c index 9b71f0a5364..b8d48436117 100644 --- a/boards/arm/stm32/nucleo-f446re/src/stm32_foc_ihm08m1.c +++ b/boards/arm/stm32/nucleo-f446re/src/stm32_foc_ihm08m1.c @@ -177,8 +177,6 @@ static struct stm32_foc_adc_s g_adc_cfg = * Description: * Initialize FOC driver. * - * This function should be call by board_app_initialize(). - * * Returned Value: * 0 on success, a negated errno value on failure * diff --git a/boards/arm/stm32/nucleo-g431kb/src/CMakeLists.txt b/boards/arm/stm32/nucleo-g431kb/src/CMakeLists.txt index 78450b1fcb9..e45962dfe20 100644 --- a/boards/arm/stm32/nucleo-g431kb/src/CMakeLists.txt +++ b/boards/arm/stm32/nucleo-g431kb/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_PWM) list(APPEND SRCS stm32_pwm.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_STM32_COMP) list(APPEND SRCS stm32_comp.c) endif() diff --git a/boards/arm/stm32/nucleo-g431kb/src/Make.defs b/boards/arm/stm32/nucleo-g431kb/src/Make.defs index a366373e9a0..7aa1045c6a8 100644 --- a/boards/arm/stm32/nucleo-g431kb/src/Make.defs +++ b/boards/arm/stm32/nucleo-g431kb/src/Make.defs @@ -35,10 +35,6 @@ ifeq ($(CONFIG_PWM),y) CSRCS += stm32_pwm.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_STM32_COMP),y) CSRCS += stm32_comp.c endif diff --git a/boards/arm/stm32/nucleo-g431kb/src/nucleo-g431kb.h b/boards/arm/stm32/nucleo-g431kb/src/nucleo-g431kb.h index f4ba5640df2..147f4c3479d 100644 --- a/boards/arm/stm32/nucleo-g431kb/src/nucleo-g431kb.h +++ b/boards/arm/stm32/nucleo-g431kb/src/nucleo-g431kb.h @@ -78,16 +78,9 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * - * Otherwise, bad news: Never called - * ****************************************************************************/ int stm32_bringup(void); diff --git a/boards/arm/stm32/nucleo-g431kb/src/stm32_appinit.c b/boards/arm/stm32/nucleo-g431kb/src/stm32_appinit.c deleted file mode 100644 index 613b989581c..00000000000 --- a/boards/arm/stm32/nucleo-g431kb/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/nucleo-g431kb/src/stm32_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 - -#include -#include - -#include "nucleo-g431kb.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/nucleo-g431rb/src/CMakeLists.txt b/boards/arm/stm32/nucleo-g431rb/src/CMakeLists.txt index 67ad9875838..f25dfbffa49 100644 --- a/boards/arm/stm32/nucleo-g431rb/src/CMakeLists.txt +++ b/boards/arm/stm32/nucleo-g431rb/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(NOT CONFIG_STM32_FOC) if(CONFIG_PWM) list(APPEND SRCS stm32_pwm.c) diff --git a/boards/arm/stm32/nucleo-g431rb/src/Make.defs b/boards/arm/stm32/nucleo-g431rb/src/Make.defs index 47de6b5d748..14403c22700 100644 --- a/boards/arm/stm32/nucleo-g431rb/src/Make.defs +++ b/boards/arm/stm32/nucleo-g431rb/src/Make.defs @@ -35,10 +35,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifneq ($(CONFIG_STM32_FOC),y) ifeq ($(CONFIG_PWM),y) CSRCS += stm32_pwm.c diff --git a/boards/arm/stm32/nucleo-g431rb/src/nucleo-g431rb.h b/boards/arm/stm32/nucleo-g431rb/src/nucleo-g431rb.h index 6676cf32939..a00571f7c2e 100644 --- a/boards/arm/stm32/nucleo-g431rb/src/nucleo-g431rb.h +++ b/boards/arm/stm32/nucleo-g431rb/src/nucleo-g431rb.h @@ -105,12 +105,7 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * * Otherwise, bad news: Never called diff --git a/boards/arm/stm32/nucleo-g431rb/src/stm32_appinit.c b/boards/arm/stm32/nucleo-g431rb/src/stm32_appinit.c deleted file mode 100644 index 30bd426d71c..00000000000 --- a/boards/arm/stm32/nucleo-g431rb/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/nucleo-g431rb/src/stm32_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 - -#include -#include - -#include "nucleo-g431rb.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/nucleo-g431rb/src/stm32_foc_ihm16m1.c b/boards/arm/stm32/nucleo-g431rb/src/stm32_foc_ihm16m1.c index 290c97f82ad..73316003dd0 100644 --- a/boards/arm/stm32/nucleo-g431rb/src/stm32_foc_ihm16m1.c +++ b/boards/arm/stm32/nucleo-g431rb/src/stm32_foc_ihm16m1.c @@ -172,8 +172,6 @@ static struct stm32_foc_adc_s g_adc_cfg = * Description: * Initialize FOC driver. * - * This function should be call by board_app_initialize(). - * * Returned Value: * 0 on success, a negated errno value on failure * diff --git a/boards/arm/stm32/nucleo-g474re/src/CMakeLists.txt b/boards/arm/stm32/nucleo-g474re/src/CMakeLists.txt index 7d019ead780..53f5643fc8b 100644 --- a/boards/arm/stm32/nucleo-g474re/src/CMakeLists.txt +++ b/boards/arm/stm32/nucleo-g474re/src/CMakeLists.txt @@ -28,10 +28,6 @@ else() list(APPEND SRCS stm32_userleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_USBDEV) list(APPEND SRCS stm32_usbdev.c) endif() diff --git a/boards/arm/stm32/nucleo-g474re/src/Make.defs b/boards/arm/stm32/nucleo-g474re/src/Make.defs index 50c7a830603..b27f9af3514 100644 --- a/boards/arm/stm32/nucleo-g474re/src/Make.defs +++ b/boards/arm/stm32/nucleo-g474re/src/Make.defs @@ -31,10 +31,6 @@ else CSRCS += stm32_userleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_USBDEV),y) CSRCS += stm32_usbdev.c endif diff --git a/boards/arm/stm32/nucleo-g474re/src/stm32_appinit.c b/boards/arm/stm32/nucleo-g474re/src/stm32_appinit.c deleted file mode 100644 index 6f67fe4291f..00000000000 --- a/boards/arm/stm32/nucleo-g474re/src/stm32_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/nucleo-g474re/src/stm32_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 - -#include - -#include "nucleo-g474re.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/nucleo-g474re/src/stm32_boot.c b/boards/arm/stm32/nucleo-g474re/src/stm32_boot.c index 4df30c00150..8f134c1cd9e 100644 --- a/boards/arm/stm32/nucleo-g474re/src/stm32_boot.c +++ b/boards/arm/stm32/nucleo-g474re/src/stm32_boot.c @@ -88,13 +88,6 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - arm_lowputs("board_late_initialize()\r\n"); -#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) - /* Perform board bring-up here instead of from the - * board_app_initialize(). - */ - stm32_bringup(); -#endif } #endif diff --git a/boards/arm/stm32/nucleo-l152re/src/CMakeLists.txt b/boards/arm/stm32/nucleo-l152re/src/CMakeLists.txt index 99f3dc5ed3b..c8bbc27e2fe 100644 --- a/boards/arm/stm32/nucleo-l152re/src/CMakeLists.txt +++ b/boards/arm/stm32/nucleo-l152re/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_LCD_ILI9341) list(APPEND SRCS stm32_ili93418b.c) endif() diff --git a/boards/arm/stm32/nucleo-l152re/src/Make.defs b/boards/arm/stm32/nucleo-l152re/src/Make.defs index f1660ef6c6b..3eafd51d2e9 100644 --- a/boards/arm/stm32/nucleo-l152re/src/Make.defs +++ b/boards/arm/stm32/nucleo-l152re/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_LCD_ILI9341),y) CSRCS += stm32_ili93418b.c endif diff --git a/boards/arm/stm32/nucleo-l152re/src/stm32_appinitialize.c b/boards/arm/stm32/nucleo-l152re/src/stm32_appinitialize.c deleted file mode 100644 index a50a55fa764..00000000000 --- a/boards/arm/stm32/nucleo-l152re/src/stm32_appinitialize.c +++ /dev/null @@ -1,175 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/nucleo-l152re/src/stm32_appinitialize.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 - -#include -#include -#include - -#include -#include -#include - -#include "stm32_i2c.h" - -#include "nucleo-l152re.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#undef HAVE_LEDS -#undef HAVE_DAC - -#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) -# define HAVE_LEDS 1 -#endif - -#if defined(CONFIG_DAC) -# define HAVE_DAC 1 -#endif - -/**************************************************************************** - * 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) -{ - int ret; -#ifdef CONFIG_STM32_I2C1 - struct i2c_master_s *i2c1; -#endif -#ifdef CONFIG_STM32_I2C2 - struct i2c_master_s *i2c2; -#endif - -#ifdef CONFIG_STM32_I2C1 - /* Get the I2C lower half instance */ - - i2c1 = stm32_i2cbus_initialize(1); - if (i2c1 == NULL) - { - i2cerr("ERROR: Initialize I2C1: %d\n", ret); - } - else - { - /* Register the I2C character driver */ - - ret = i2c_register(i2c1, 1); - if (ret < 0) - { - i2cerr("ERROR: Failed to register I2C1 device: %d\n", ret); - } - } -#endif - -#ifdef CONFIG_STM32_I2C2 - /* Get the I2C lower half instance */ - - i2c2 = stm32_i2cbus_initialize(2); - if (i2c2 == NULL) - { - i2cerr("ERROR: Initialize I2C2: %d\n", ret); - } - else - { - /* Register the I2C character driver */ - - ret = i2c_register(i2c2, 2); - if (ret < 0) - { - i2cerr("ERROR: Failed to register I2C2 device: %d\n", ret); - } - } -#endif - -#ifdef CONFIG_STM32_SPI - stm32_spiinitialize(); -#endif - -#ifdef HAVE_LEDS - /* Register the LED driver */ - - ret = userled_lower_initialize(LED_DRIVER_PATH); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); - return ret; - } -#endif - -#ifdef CONFIG_FS_PROCFS - /* Mount the procfs file system */ - - ret = nx_mount(0, STM32_PROCFS_MOUNTPOINT, "procfs", 0, 0); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", - STM32_PROCFS_MOUNTPOINT, ret); - } -#endif - -#ifdef CONFIG_MMCSD_SPI - - /* Initialize the MMC/SD SPI driver (SPI1 is used) */ - - ret = stm32_spisd_initialize(1, CONFIG_NSH_MMCSDMINOR); - if (ret < 0) - { - syslog(LOG_ERR, "Failed to initialize SD slot %d: %d\n", - CONFIG_NSH_MMCSDMINOR, ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/stm32/nucleo-l152re/src/stm32_boot.c b/boards/arm/stm32/nucleo-l152re/src/stm32_boot.c index 7d575cf857a..f9b3cd58433 100644 --- a/boards/arm/stm32/nucleo-l152re/src/stm32_boot.c +++ b/boards/arm/stm32/nucleo-l152re/src/stm32_boot.c @@ -26,15 +26,34 @@ #include +#include +#include +#include + #include +#include +#include #include +#include "stm32_i2c.h" + #include "nucleo-l152re.h" /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +#undef HAVE_LEDS +#undef HAVE_DAC + +#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) +# define HAVE_LEDS 1 +#endif + +#if defined(CONFIG_DAC) +# define HAVE_DAC 1 +#endif + /**************************************************************************** * Private Function Prototypes ****************************************************************************/ @@ -87,8 +106,92 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform board-specific initialization */ + int ret; +#ifdef CONFIG_STM32_I2C1 + struct i2c_master_s *i2c1; +#endif +#ifdef CONFIG_STM32_I2C2 + struct i2c_master_s *i2c2; +#endif - board_app_initialize(0); +#ifdef CONFIG_STM32_I2C1 + /* Get the I2C lower half instance */ + + i2c1 = stm32_i2cbus_initialize(1); + if (i2c1 == NULL) + { + i2cerr("ERROR: Initialize I2C1: %d\n", ret); + } + else + { + /* Register the I2C character driver */ + + ret = i2c_register(i2c1, 1); + if (ret < 0) + { + i2cerr("ERROR: Failed to register I2C1 device: %d\n", ret); + } + } +#endif + +#ifdef CONFIG_STM32_I2C2 + /* Get the I2C lower half instance */ + + i2c2 = stm32_i2cbus_initialize(2); + if (i2c2 == NULL) + { + i2cerr("ERROR: Initialize I2C2: %d\n", ret); + } + else + { + /* Register the I2C character driver */ + + ret = i2c_register(i2c2, 2); + if (ret < 0) + { + i2cerr("ERROR: Failed to register I2C2 device: %d\n", ret); + } + } +#endif + +#ifdef CONFIG_STM32_SPI + stm32_spiinitialize(); +#endif + +#ifdef HAVE_LEDS + /* Register the LED driver */ + + ret = userled_lower_initialize(LED_DRIVER_PATH); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); + return; + } +#endif + +#ifdef CONFIG_FS_PROCFS + /* Mount the procfs file system */ + + ret = nx_mount(0, STM32_PROCFS_MOUNTPOINT, "procfs", 0, 0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", + STM32_PROCFS_MOUNTPOINT, ret); + } +#endif + +#ifdef CONFIG_MMCSD_SPI + + /* Initialize the MMC/SD SPI driver (SPI1 is used) */ + + ret = stm32_spisd_initialize(1, CONFIG_NSH_MMCSDMINOR); + if (ret < 0) + { + syslog(LOG_ERR, "Failed to initialize SD slot %d: %d\n", + CONFIG_NSH_MMCSDMINOR, ret); + } +#endif + + UNUSED(ret); } #endif diff --git a/boards/arm/stm32/odrive36/src/CMakeLists.txt b/boards/arm/stm32/odrive36/src/CMakeLists.txt index 1f15c408a03..fb8dbb343df 100644 --- a/boards/arm/stm32/odrive36/src/CMakeLists.txt +++ b/boards/arm/stm32/odrive36/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_STM32_SPI) list(APPEND SRCS stm32_spi.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_STM32_FOC) list(APPEND SRCS stm32_foc.c) endif() diff --git a/boards/arm/stm32/odrive36/src/Make.defs b/boards/arm/stm32/odrive36/src/Make.defs index c9263a688bf..4074cab81c5 100644 --- a/boards/arm/stm32/odrive36/src/Make.defs +++ b/boards/arm/stm32/odrive36/src/Make.defs @@ -28,10 +28,6 @@ ifeq ($(CONFIG_STM32_SPI),y) CSRCS += stm32_spi.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_STM32_FOC),y) CSRCS += stm32_foc.c endif diff --git a/boards/arm/stm32/odrive36/src/odrive.h b/boards/arm/stm32/odrive36/src/odrive.h index 6a51ee7e7d7..c8de89d3b2a 100644 --- a/boards/arm/stm32/odrive36/src/odrive.h +++ b/boards/arm/stm32/odrive36/src/odrive.h @@ -81,12 +81,7 @@ * Description: * Perform architecture specific initialization * - * CONFIG_LIB_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * * Otherwise, bad news: Never called diff --git a/boards/arm/stm32/odrive36/src/stm32_appinit.c b/boards/arm/stm32/odrive36/src/stm32_appinit.c deleted file mode 100644 index 2fb263fe271..00000000000 --- a/boards/arm/stm32/odrive36/src/stm32_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/odrive36/src/stm32_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 - -#include - -#include "odrive.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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/odrive36/src/stm32_foc.c b/boards/arm/stm32/odrive36/src/stm32_foc.c index a5cfa3f4e1e..7107a31b61a 100644 --- a/boards/arm/stm32/odrive36/src/stm32_foc.c +++ b/boards/arm/stm32/odrive36/src/stm32_foc.c @@ -859,8 +859,6 @@ errout: * Description: * Setup FOC devices * - * This function should be call by board_app_initialize(). - * * Returned Value: * 0 on success, a negated errno value on failure * diff --git a/boards/arm/stm32/olimex-stm32-e407/src/CMakeLists.txt b/boards/arm/stm32/olimex-stm32-e407/src/CMakeLists.txt index ab064f703b1..152d38216dd 100644 --- a/boards/arm/stm32/olimex-stm32-e407/src/CMakeLists.txt +++ b/boards/arm/stm32/olimex-stm32-e407/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ARCH_IDLE_CUSTOM) list(APPEND SRCS stm32_idle.c) endif() diff --git a/boards/arm/stm32/olimex-stm32-e407/src/Make.defs b/boards/arm/stm32/olimex-stm32-e407/src/Make.defs index 33cd11558a9..e5b1f17edc3 100644 --- a/boards/arm/stm32/olimex-stm32-e407/src/Make.defs +++ b/boards/arm/stm32/olimex-stm32-e407/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ARCH_IDLE_CUSTOM),y) CSRCS += stm32_idle.c endif diff --git a/boards/arm/stm32/olimex-stm32-e407/src/stm32_appinit.c b/boards/arm/stm32/olimex-stm32-e407/src/stm32_appinit.c deleted file mode 100644 index b3b0b333a02..00000000000 --- a/boards/arm/stm32/olimex-stm32-e407/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/olimex-stm32-e407/src/stm32_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 - -#include -#include - -#include "olimex-stm32-e407.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/olimex-stm32-h405/src/CMakeLists.txt b/boards/arm/stm32/olimex-stm32-h405/src/CMakeLists.txt index e54f21890ba..0fb338eadb5 100644 --- a/boards/arm/stm32/olimex-stm32-h405/src/CMakeLists.txt +++ b/boards/arm/stm32/olimex-stm32-h405/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_STM32_OTGFS) list(APPEND SRCS stm32_usb.c) endif() -if(CONFIG_NSH_LIBRARY) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ADC) list(APPEND SRCS stm32_adc.c) endif() diff --git a/boards/arm/stm32/olimex-stm32-h405/src/Make.defs b/boards/arm/stm32/olimex-stm32-h405/src/Make.defs index 148d40274c8..82df67a1c2d 100644 --- a/boards/arm/stm32/olimex-stm32-h405/src/Make.defs +++ b/boards/arm/stm32/olimex-stm32-h405/src/Make.defs @@ -38,10 +38,6 @@ ifeq ($(CONFIG_STM32_OTGFS),y) CSRCS += stm32_usb.c endif -ifeq ($(CONFIG_NSH_LIBRARY),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += stm32_adc.c endif diff --git a/boards/arm/stm32/olimex-stm32-h405/src/stm32_appinit.c b/boards/arm/stm32/olimex-stm32-h405/src/stm32_appinit.c deleted file mode 100644 index 4afae2ca7a0..00000000000 --- a/boards/arm/stm32/olimex-stm32-h405/src/stm32_appinit.c +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/olimex-stm32-h405/src/stm32_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 - -#include -#include -#include -#include - -#include - -#ifdef CONFIG_USBMONITOR -# include -#endif - -#ifdef CONFIG_STM32_OTGFS -# include "stm32_usbhost.h" -#endif - -#include "stm32.h" -#include "olimex-stm32-h405.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#if !defined(CONFIG_STM32_CAN1) && !defined(CONFIG_STM32_CAN2) -# undef CONFIG_CAN -#endif - -/**************************************************************************** - * 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. - * - * CONFIG_BOARDCTL=y : - * Called from the NSH library - * - * CONFIG_BOARD_LATE_INITIALIZE=y, CONFIG_NSH_LIBRARY=y, && - * CONFIG_BOARDCTL=n : - * Called from board_late_initialize(). - * - * 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) -{ - int ret; - -#ifdef CONFIG_ADC - /* Initialize ADC and register the ADC driver. */ - - ret = stm32_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_STM32_CAN_CHARDRIVER - /* Initialize CAN and register the CAN driver. */ - - ret = stm32_can_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_can_setup failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/stm32/olimex-stm32-h405/src/stm32_boot.c b/boards/arm/stm32/olimex-stm32-h405/src/stm32_boot.c index f371c9ce7ea..f7b9a5410e3 100644 --- a/boards/arm/stm32/olimex-stm32-h405/src/stm32_boot.c +++ b/boards/arm/stm32/olimex-stm32-h405/src/stm32_boot.c @@ -28,12 +28,34 @@ #include +#include +#include +#include +#include + #include #include #include +#ifdef CONFIG_USBMONITOR +# include +#endif + +#ifdef CONFIG_STM32_OTGFS +# include "stm32_usbhost.h" +#endif + +#include "stm32.h" #include "olimex-stm32-h405.h" +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#if !defined(CONFIG_STM32_CAN1) && !defined(CONFIG_STM32_CAN2) +# undef CONFIG_CAN +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -93,13 +115,28 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform NSH initialization here instead of from the NSH. This - * alternative NSH initialization is necessary when NSH is ran in - * user-space but the initialization function must run in kernel space. - */ + int ret; -#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) - board_app_initialize(0); +#ifdef CONFIG_ADC + /* Initialize ADC and register the ADC driver. */ + + ret = stm32_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); + } #endif + +#ifdef CONFIG_STM32_CAN_CHARDRIVER + /* Initialize CAN and register the CAN driver. */ + + ret = stm32_can_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_can_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); } #endif diff --git a/boards/arm/stm32/olimex-stm32-h407/src/CMakeLists.txt b/boards/arm/stm32/olimex-stm32-h407/src/CMakeLists.txt index e0745bb04c4..4f687f840f7 100644 --- a/boards/arm/stm32/olimex-stm32-h407/src/CMakeLists.txt +++ b/boards/arm/stm32/olimex-stm32-h407/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ARCH_IDLE_CUSTOM) list(APPEND SRCS stm32_idle.c) endif() diff --git a/boards/arm/stm32/olimex-stm32-h407/src/Make.defs b/boards/arm/stm32/olimex-stm32-h407/src/Make.defs index 2b074cdc9f5..9e3959c58c9 100644 --- a/boards/arm/stm32/olimex-stm32-h407/src/Make.defs +++ b/boards/arm/stm32/olimex-stm32-h407/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ARCH_IDLE_CUSTOM),y) CSRCS += stm32_idle.c endif diff --git a/boards/arm/stm32/olimex-stm32-h407/src/olimex-stm32-h407.h b/boards/arm/stm32/olimex-stm32-h407/src/olimex-stm32-h407.h index 298fba692e8..5fe28b34fab 100644 --- a/boards/arm/stm32/olimex-stm32-h407/src/olimex-stm32-h407.h +++ b/boards/arm/stm32/olimex-stm32-h407/src/olimex-stm32-h407.h @@ -199,12 +199,7 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherse, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * * Otherwise, bad news: Never called diff --git a/boards/arm/stm32/olimex-stm32-h407/src/stm32_appinit.c b/boards/arm/stm32/olimex-stm32-h407/src/stm32_appinit.c deleted file mode 100644 index 4d96d6ca771..00000000000 --- a/boards/arm/stm32/olimex-stm32-h407/src/stm32_appinit.c +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/olimex-stm32-h407/src/stm32_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 - -#include -#include -#include -#include - -#include - -#ifdef CONFIG_USBMONITOR -# include -#endif - -#ifdef CONFIG_STM32_OTGFS -# include "stm32_usbhost.h" -#endif - -#include "stm32.h" -#include "olimex-stm32-h407.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. - * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherse, assumed to be called from some other application. - * - * 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 stm32_bringup(); -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/stm32/olimex-stm32-h407/src/stm32_boot.c b/boards/arm/stm32/olimex-stm32-h407/src/stm32_boot.c index d8305aaa19e..a2f2c02ed66 100644 --- a/boards/arm/stm32/olimex-stm32-h407/src/stm32_boot.c +++ b/boards/arm/stm32/olimex-stm32-h407/src/stm32_boot.c @@ -95,15 +95,6 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { -#ifndef CONFIG_BOARDCTL - /* Perform NSH initialization here instead of from the - * board_app_initialize. - * If CONFIG_BOARDCTL=y we assume that come application will perform - * the initialization by calling board_app_initialize indirectly through - * boardctl(). - */ - stm32_bringup(); -#endif } #endif diff --git a/boards/arm/stm32/olimex-stm32-h407/src/stm32_bringup.c b/boards/arm/stm32/olimex-stm32-h407/src/stm32_bringup.c index 6aaa41f9e61..7a4e99655bd 100644 --- a/boards/arm/stm32/olimex-stm32-h407/src/stm32_bringup.c +++ b/boards/arm/stm32/olimex-stm32-h407/src/stm32_bringup.c @@ -65,12 +65,7 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherse, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * * Otherwise, bad news: Never called diff --git a/boards/arm/stm32/olimex-stm32-p107/src/CMakeLists.txt b/boards/arm/stm32/olimex-stm32-p107/src/CMakeLists.txt index 67a505c6f6f..0e5286c799d 100644 --- a/boards/arm/stm32/olimex-stm32-p107/src/CMakeLists.txt +++ b/boards/arm/stm32/olimex-stm32-p107/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS stm32_boot.c stm32_spi.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_STM32_CAN_CHARDRIVER) list(APPEND SRCS stm32_can.c) endif() diff --git a/boards/arm/stm32/olimex-stm32-p107/src/Make.defs b/boards/arm/stm32/olimex-stm32-p107/src/Make.defs index e51a52fd296..d7aa1806f73 100644 --- a/boards/arm/stm32/olimex-stm32-p107/src/Make.defs +++ b/boards/arm/stm32/olimex-stm32-p107/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = stm32_boot.c stm32_spi.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_STM32_CAN_CHARDRIVER),y) CSRCS += stm32_can.c endif diff --git a/boards/arm/stm32/olimex-stm32-p107/src/stm32_appinit.c b/boards/arm/stm32/olimex-stm32-p107/src/stm32_appinit.c deleted file mode 100644 index ccb2afa522c..00000000000 --- a/boards/arm/stm32/olimex-stm32-p107/src/stm32_appinit.c +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/olimex-stm32-p107/src/stm32_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 - -#include -#include -#include - -#include - -#include "stm32.h" -#include "olimex-stm32-p107.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. - * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherse, assumed to be called from some other application. - * - * 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) -{ - int ret; - -#ifdef CONFIG_STM32_CAN_CHARDRIVER - /* Initialize CAN and register the CAN driver. */ - - ret = stm32_can_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_can_setup failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/stm32/olimex-stm32-p107/src/stm32_boot.c b/boards/arm/stm32/olimex-stm32-p107/src/stm32_boot.c index 38212606f23..729ccbe7e16 100644 --- a/boards/arm/stm32/olimex-stm32-p107/src/stm32_boot.c +++ b/boards/arm/stm32/olimex-stm32-p107/src/stm32_boot.c @@ -28,6 +28,11 @@ #include #include +#include +#include +#include + +#include "stm32.h" #include "arm_internal.h" #include "olimex-stm32-p107.h" @@ -59,3 +64,36 @@ void stm32_boardinitialize(void) } #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) +{ + int ret; + +#ifdef CONFIG_STM32_CAN_CHARDRIVER + /* Initialize CAN and register the CAN driver. */ + + ret = stm32_can_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_can_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); +} +#endif diff --git a/boards/arm/stm32/olimex-stm32-p207/src/CMakeLists.txt b/boards/arm/stm32/olimex-stm32-p207/src/CMakeLists.txt index a0d740836ee..98fcae67692 100644 --- a/boards/arm/stm32/olimex-stm32-p207/src/CMakeLists.txt +++ b/boards/arm/stm32/olimex-stm32-p207/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_STM32_OTGFS) list(APPEND SRCS stm32_usb.c) endif() -if(CONFIG_NSH_LIBRARY) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ADC) list(APPEND SRCS stm32_adc.c) endif() diff --git a/boards/arm/stm32/olimex-stm32-p207/src/Make.defs b/boards/arm/stm32/olimex-stm32-p207/src/Make.defs index dc34765b890..42ceed74368 100644 --- a/boards/arm/stm32/olimex-stm32-p207/src/Make.defs +++ b/boards/arm/stm32/olimex-stm32-p207/src/Make.defs @@ -38,10 +38,6 @@ ifeq ($(CONFIG_STM32_OTGFS),y) CSRCS += stm32_usb.c endif -ifeq ($(CONFIG_NSH_LIBRARY),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += stm32_adc.c endif diff --git a/boards/arm/stm32/olimex-stm32-p207/src/stm32_appinit.c b/boards/arm/stm32/olimex-stm32-p207/src/stm32_appinit.c deleted file mode 100644 index 8e7a97925ad..00000000000 --- a/boards/arm/stm32/olimex-stm32-p207/src/stm32_appinit.c +++ /dev/null @@ -1,180 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/olimex-stm32-p207/src/stm32_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 - -#include -#include -#include -#include - -#include - -#ifdef CONFIG_USBMONITOR -# include -#endif - -#ifdef CONFIG_STM32_OTGFS -# include "stm32_usbhost.h" -#endif - -#include "stm32.h" -#include "olimex-stm32-p207.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#define HAVE_USBDEV 1 -#define HAVE_USBHOST 1 -#define HAVE_USBMONITOR 1 - -/* Can't support USB host or device features if USB OTG FS is not enabled */ - -#ifndef CONFIG_STM32_OTGFS -# undef HAVE_USBDEV -# undef HAVE_USBHOST -#endif - -/* Can't support USB device if USB device is not enabled */ - -#ifndef CONFIG_USBDEV -# undef HAVE_USBDEV -#endif - -/* Can't support USB host is USB host is not enabled */ - -#ifndef CONFIG_STM32_USBHOST -# undef CONFIG_USBHOST -# undef HAVE_USBHOST -#endif - -/* Check if we should enable the USB monitor before starting NSH */ - -#ifndef CONFIG_USBMONITOR -# undef HAVE_USBMONITOR -#endif - -#ifndef HAVE_USBDEV -# undef CONFIG_USBDEV_TRACE -#endif - -#ifndef HAVE_USBHOST -# undef CONFIG_USBHOST_TRACE -#endif - -#if !defined(CONFIG_USBDEV_TRACE) && !defined(CONFIG_USBHOST_TRACE) -# undef HAVE_USBMONITOR -#endif - -/**************************************************************************** - * 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. - * - * CONFIG_BOARDCTL=y : - * Called from the NSH library - * - * CONFIG_BOARD_LATE_INITIALIZE=y, CONFIG_NSH_LIBRARY=y, && - * CONFIG_BOARDCTL=n : - * Called from board_late_initialize(). - * - * 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) -{ - int ret; - -#ifdef CONFIG_STM32_CAN_CHARDRIVER - /* Initialize CAN and register the CAN driver. */ - - ret = stm32_can_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_can_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_ADC - /* Initialize ADC and register the ADC driver. */ - - ret = stm32_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); - } -#endif - -#ifdef HAVE_USBHOST - /* Initialize USB host operation. stm32_usbhost_initialize() starts a - * thread will monitor for USB connection and disconnection events. - */ - - ret = stm32_usbhost_initialize(); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); - return ret; - } -#endif - -#ifdef HAVE_USBMONITOR - /* Start the USB Monitor */ - - ret = usbmonitor_start(); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/stm32/olimex-stm32-p207/src/stm32_boot.c b/boards/arm/stm32/olimex-stm32-p207/src/stm32_boot.c index f87f57b0dcb..3ce6df06ea4 100644 --- a/boards/arm/stm32/olimex-stm32-p207/src/stm32_boot.c +++ b/boards/arm/stm32/olimex-stm32-p207/src/stm32_boot.c @@ -28,12 +28,74 @@ #include +#include +#include +#include +#include + #include #include #include +#ifdef CONFIG_USBMONITOR +# include +#endif + +#ifdef CONFIG_STM32_OTGFS +# include "stm32_usbhost.h" +#endif + +#include "stm32.h" #include "olimex-stm32-p207.h" +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +#define HAVE_USBDEV 1 +#define HAVE_USBHOST 1 +#define HAVE_USBMONITOR 1 + +/* Can't support USB host or device features if USB OTG FS is not enabled */ + +#ifndef CONFIG_STM32_OTGFS +# undef HAVE_USBDEV +# undef HAVE_USBHOST +#endif + +/* Can't support USB device if USB device is not enabled */ + +#ifndef CONFIG_USBDEV +# undef HAVE_USBDEV +#endif + +/* Can't support USB host is USB host is not enabled */ + +#ifndef CONFIG_STM32_USBHOST +# undef CONFIG_USBHOST +# undef HAVE_USBHOST +#endif + +/* Check if we should enable the USB monitor before starting NSH */ + +#ifndef CONFIG_USBMONITOR +# undef HAVE_USBMONITOR +#endif + +#ifndef HAVE_USBDEV +# undef CONFIG_USBDEV_TRACE +#endif + +#ifndef HAVE_USBHOST +# undef CONFIG_USBHOST_TRACE +#endif + +#if !defined(CONFIG_USBDEV_TRACE) && !defined(CONFIG_USBHOST_TRACE) +# undef HAVE_USBMONITOR +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -93,13 +155,51 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform NSH initialization here instead of from the NSH. This - * alternative NSH initialization is necessary when NSH is ran in - * user-space but the initialization function must run in kernel space. + int ret; + +#ifdef CONFIG_STM32_CAN_CHARDRIVER + /* Initialize CAN and register the CAN driver. */ + + ret = stm32_can_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_can_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_ADC + /* Initialize ADC and register the ADC driver. */ + + ret = stm32_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); + } +#endif + +#ifdef HAVE_USBHOST + /* Initialize USB host operation. stm32_usbhost_initialize() starts a + * thread will monitor for USB connection and disconnection events. */ -#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) - board_app_initialize(0); + ret = stm32_usbhost_initialize(); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); + return; + } #endif + +#ifdef HAVE_USBMONITOR + /* Start the USB Monitor */ + + ret = usbmonitor_start(); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); + } +#endif + + UNUSED(ret); } #endif diff --git a/boards/arm/stm32/olimex-stm32-p407/src/CMakeLists.txt b/boards/arm/stm32/olimex-stm32-p407/src/CMakeLists.txt index 06810c07c52..f10df30fa1f 100644 --- a/boards/arm/stm32/olimex-stm32-p407/src/CMakeLists.txt +++ b/boards/arm/stm32/olimex-stm32-p407/src/CMakeLists.txt @@ -40,10 +40,6 @@ if(CONFIG_STM32_OTGFS) list(APPEND SRCS stm32_usb.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ADC) list(APPEND SRCS stm32_adc.c) endif() diff --git a/boards/arm/stm32/olimex-stm32-p407/src/Make.defs b/boards/arm/stm32/olimex-stm32-p407/src/Make.defs index 29b75144b32..8d0d261b5fb 100644 --- a/boards/arm/stm32/olimex-stm32-p407/src/Make.defs +++ b/boards/arm/stm32/olimex-stm32-p407/src/Make.defs @@ -42,10 +42,6 @@ ifeq ($(CONFIG_STM32_OTGFS),y) CSRCS += stm32_usb.c endif -ifeq ($(CONFIG_BOARDCTL),y) - CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += stm32_adc.c endif diff --git a/boards/arm/stm32/olimex-stm32-p407/src/stm32_appinit.c b/boards/arm/stm32/olimex-stm32-p407/src/stm32_appinit.c deleted file mode 100644 index 78e34047c4b..00000000000 --- a/boards/arm/stm32/olimex-stm32-p407/src/stm32_appinit.c +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/olimex-stm32-p407/src/stm32_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 - -#include -#include - -#include - -#include "olimex-stm32-p407.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. - * - * CONFIG_BOARDCTL=y : - * Called from the NSH library - * - * CONFIG_BOARD_LATE_INITIALIZE=y, CONFIG_NSH_LIBRARY=y, && - * CONFIG_BOARDCTL=n : - * Called from board_late_initialize(). - * - * 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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/stm32/olimexino-stm32/src/CMakeLists.txt b/boards/arm/stm32/olimexino-stm32/src/CMakeLists.txt index 6abf53777ff..9457b7258b7 100644 --- a/boards/arm/stm32/olimexino-stm32/src/CMakeLists.txt +++ b/boards/arm/stm32/olimexino-stm32/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_STM32_CAN_CHARDRIVER) list(APPEND SRCS stm32_can.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_USBMSC) list(APPEND SRCS stm32_usbmsc.c) endif() diff --git a/boards/arm/stm32/olimexino-stm32/src/Make.defs b/boards/arm/stm32/olimexino-stm32/src/Make.defs index 0b1f25a07a2..65205d71528 100644 --- a/boards/arm/stm32/olimexino-stm32/src/Make.defs +++ b/boards/arm/stm32/olimexino-stm32/src/Make.defs @@ -28,10 +28,6 @@ ifeq ($(CONFIG_STM32_CAN_CHARDRIVER),y) CSRCS += stm32_can.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_USBMSC),y) CSRCS += stm32_usbmsc.c endif diff --git a/boards/arm/stm32/olimexino-stm32/src/stm32_appinit.c b/boards/arm/stm32/olimexino-stm32/src/stm32_appinit.c deleted file mode 100644 index deeee12bd88..00000000000 --- a/boards/arm/stm32/olimexino-stm32/src/stm32_appinit.c +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/olimexino-stm32/src/stm32_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 - -#include -#include -#include -#include - -#include -#include -#include - -#ifdef CONFIG_USBMONITOR -# include -#endif - -#ifdef CONFIG_USBDEV -# include "stm32_usbdev.h" -#endif - -#include "stm32.h" -#include "olimexino-stm32.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) -{ - int ret = OK; - -#ifdef CONFIG_USBMSC -#if !defined(CONFIG_NSH_BUILTIN_APPS) && !defined(CONFIG_SYSTEM_USBMSC) - ret = board_usbmsc_initialize(0); -#endif -#endif - -#if !defined(CONFIG_NSH_BUILTIN_APPS) && defined(CONFIG_USBDEV_COMPOSITE) - ret = board_composite_initialize(0); -#endif - -#ifdef CONFIG_STM32_CAN_CHARDRIVER - /* Initialize CAN and register the CAN driver. */ - - ret = stm32_can_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_can_setup failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return ret; -} diff --git a/boards/arm/stm32/olimexino-stm32/src/stm32_boot.c b/boards/arm/stm32/olimexino-stm32/src/stm32_boot.c index b61d3c7cf11..b4d93ced9dc 100644 --- a/boards/arm/stm32/olimexino-stm32/src/stm32_boot.c +++ b/boards/arm/stm32/olimexino-stm32/src/stm32_boot.c @@ -25,10 +25,28 @@ ****************************************************************************/ #include -#include -#include +#include + +#include +#include +#include +#include + +#include #include +#include +#include + +#ifdef CONFIG_USBMONITOR +# include +#endif + +#ifdef CONFIG_USBDEV +# include "stm32_usbdev.h" +#endif + +#include "stm32.h" #include "olimexino-stm32.h" /**************************************************************************** @@ -117,14 +135,29 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { -#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) - /* Perform NSH initialization here instead of from the NSH. This - * alternative NSH initialization is necessary when NSH is ran in user- - * space but the initialization function must run in kernel space. - */ + int ret = OK; - board_app_initialize(0); +#ifdef CONFIG_USBMSC +#if !defined(CONFIG_NSH_BUILTIN_APPS) && !defined(CONFIG_SYSTEM_USBMSC) + ret = board_usbmsc_initialize(0); #endif +#endif + +#if !defined(CONFIG_NSH_BUILTIN_APPS) && defined(CONFIG_USBDEV_COMPOSITE) + ret = board_composite_initialize(0); +#endif + +#ifdef CONFIG_STM32_CAN_CHARDRIVER + /* Initialize CAN and register the CAN driver. */ + + ret = stm32_can_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_can_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); #if defined(CONFIG_USBDEV) stm32_usb_set_pwr_callback(vbus_handler); diff --git a/boards/arm/stm32/olimexino-stm32/src/stm32_composite.c b/boards/arm/stm32/olimexino-stm32/src/stm32_composite.c index bf95a10cfe4..dbc418009f5 100644 --- a/boards/arm/stm32/olimexino-stm32/src/stm32_composite.c +++ b/boards/arm/stm32/olimexino-stm32/src/stm32_composite.c @@ -364,8 +364,7 @@ static void *board_composite1_connect(int port) int board_composite_initialize(int port) { /* If system/composite is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/stm32/olimexino-stm32/src/stm32_usbmsc.c b/boards/arm/stm32/olimexino-stm32/src/stm32_usbmsc.c index f6ae6e7da2e..8af999fdb60 100644 --- a/boards/arm/stm32/olimexino-stm32/src/stm32_usbmsc.c +++ b/boards/arm/stm32/olimexino-stm32/src/stm32_usbmsc.c @@ -79,8 +79,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/stm32/omnibusf4/src/CMakeLists.txt b/boards/arm/stm32/omnibusf4/src/CMakeLists.txt index d250cab6e5c..9be173575b5 100644 --- a/boards/arm/stm32/omnibusf4/src/CMakeLists.txt +++ b/boards/arm/stm32/omnibusf4/src/CMakeLists.txt @@ -42,14 +42,12 @@ if(CONFIG_PWM) list(APPEND SRCS stm32_pwm.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) - if(CONFIG_BOARDCTL_RESET) - list(APPEND SRCS stm32_reset.c) - endif() - if(CONFIG_BOARDCTL_IOCTL) - list(APPEND SRCS stm32_ioctl.c) - endif() +if(CONFIG_BOARDCTL_RESET) + list(APPEND SRCS stm32_reset.c) +endif() + +if(CONFIG_BOARDCTL_IOCTL) + list(APPEND SRCS stm32_ioctl.c) endif() if(CONFIG_ARCH_CUSTOM_PMINIT) diff --git a/boards/arm/stm32/omnibusf4/src/Make.defs b/boards/arm/stm32/omnibusf4/src/Make.defs index 5b33eee4333..6fa1d9b08b8 100644 --- a/boards/arm/stm32/omnibusf4/src/Make.defs +++ b/boards/arm/stm32/omnibusf4/src/Make.defs @@ -44,15 +44,12 @@ ifeq ($(CONFIG_PWM),y) CSRCS += stm32_pwm.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c ifeq ($(CONFIG_BOARDCTL_RESET),y) CSRCS += stm32_reset.c endif ifeq ($(CONFIG_BOARDCTL_IOCTL),y) CSRCS += stm32_ioctl.c endif -endif ifeq ($(CONFIG_ARCH_CUSTOM_PMINIT),y) CSRCS += stm32_pm.c diff --git a/boards/arm/stm32/omnibusf4/src/stm32_appinit.c b/boards/arm/stm32/omnibusf4/src/stm32_appinit.c deleted file mode 100644 index 50d68f6b51b..00000000000 --- a/boards/arm/stm32/omnibusf4/src/stm32_appinit.c +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/omnibusf4/src/stm32_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 - -#include -#include - -#include "omnibusf4.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_INITIALIZE - - /* Board initialization already performed by board_initialize() */ - - return OK; -#else - - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/omnibusf4/src/stm32_boot.c b/boards/arm/stm32/omnibusf4/src/stm32_boot.c index 1168a703d44..651df187d81 100644 --- a/boards/arm/stm32/omnibusf4/src/stm32_boot.c +++ b/boards/arm/stm32/omnibusf4/src/stm32_boot.c @@ -104,20 +104,21 @@ void stm32_boardinitialize(void) } /**************************************************************************** - * Name: board_initialize + * Name: board_late_initialize * * Description: - * If CONFIG_BOARD_INITIALIZE is selected, then an additional + * 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_initialize(). board_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. + * 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_INITIALIZE -void board_initialize(void) +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) { /* Perform board-specific initialization */ diff --git a/boards/arm/stm32/omnibusf4/src/stm32_usbmsc.c b/boards/arm/stm32/omnibusf4/src/stm32_usbmsc.c index 49239282a0f..b3c093ab6a1 100644 --- a/boards/arm/stm32/omnibusf4/src/stm32_usbmsc.c +++ b/boards/arm/stm32/omnibusf4/src/stm32_usbmsc.c @@ -59,9 +59,8 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() (see - * stm32_appinit.c). In this case, there is nothing further to be done - * here. + * already have been initialized. + * In this case, there is nothing further to be done here. */ #ifndef CONFIG_NSH_BUILTIN_APPS diff --git a/boards/arm/stm32/photon/src/CMakeLists.txt b/boards/arm/stm32/photon/src/CMakeLists.txt index 7fabce6ade4..e6e55c00a00 100644 --- a/boards/arm/stm32/photon/src/CMakeLists.txt +++ b/boards/arm/stm32/photon/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_PHOTON_DFU_BOOTLOADER) list(APPEND SRCS dfu_signature.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_INPUT_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() diff --git a/boards/arm/stm32/photon/src/Make.defs b/boards/arm/stm32/photon/src/Make.defs index 2741307f5a7..6edf5dce2d9 100644 --- a/boards/arm/stm32/photon/src/Make.defs +++ b/boards/arm/stm32/photon/src/Make.defs @@ -28,10 +28,6 @@ ifeq ($(CONFIG_PHOTON_DFU_BOOTLOADER),y) CSRCS += dfu_signature.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_INPUT_BUTTONS),y) CSRCS += stm32_buttons.c endif diff --git a/boards/arm/stm32/photon/src/photon.h b/boards/arm/stm32/photon/src/photon.h index 3631c042622..299fe0294ec 100644 --- a/boards/arm/stm32/photon/src/photon.h +++ b/boards/arm/stm32/photon/src/photon.h @@ -80,16 +80,12 @@ * Name: stm32_bringup * * Description: - * Called either by board_initialize() if CONFIG_BOARD_LATE_INITIALIZE or - * by board_app_initialize if CONFIG_BOARDCTL is selected. This - * function initializes and configures all on-board features appropriate - * for the selected configuration. + * This function initializes and configures all on-board features + * appropriate for the selected configuration. * ****************************************************************************/ -#if defined(CONFIG_BOARDCTL) || defined(CONFIG_BOARD_LATE_INITIALIZE) int stm32_bringup(void); -#endif /**************************************************************************** * Name: stm32_spidev_initialize diff --git a/boards/arm/stm32/photon/src/stm32_appinit.c b/boards/arm/stm32/photon/src/stm32_appinit.c deleted file mode 100644 index dfc5b90f392..00000000000 --- a/boards/arm/stm32/photon/src/stm32_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/photon/src/stm32_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 - -#include - -#include - -#include "photon.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return stm32_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/stm32/photon/src/stm32_bringup.c b/boards/arm/stm32/photon/src/stm32_bringup.c index 23673484fc7..5096dad8d0b 100644 --- a/boards/arm/stm32/photon/src/stm32_bringup.c +++ b/boards/arm/stm32/photon/src/stm32_bringup.c @@ -51,8 +51,6 @@ * Name: stm32_bringup * * Description: - * Called either by board_initialize() if CONFIG_BOARD_LATE_INITIALIZE or - * by board_app_initialize if CONFIG_BOARDCTL is selected. * This function initializes and configures all on-board features * appropriate for the selected configuration. * diff --git a/boards/arm/stm32/shenzhou/src/CMakeLists.txt b/boards/arm/stm32/shenzhou/src/CMakeLists.txt index 8a62068f636..fe1037ab0f8 100644 --- a/boards/arm/stm32/shenzhou/src/CMakeLists.txt +++ b/boards/arm/stm32/shenzhou/src/CMakeLists.txt @@ -40,10 +40,6 @@ if(CONFIG_STM32_OTGFS) list(APPEND SRCS stm32_usb.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_MTD_W25) list(APPEND SRCS stm32_w25.c) endif() diff --git a/boards/arm/stm32/shenzhou/src/Make.defs b/boards/arm/stm32/shenzhou/src/Make.defs index ff4d00f0f8e..86db238f76e 100644 --- a/boards/arm/stm32/shenzhou/src/Make.defs +++ b/boards/arm/stm32/shenzhou/src/Make.defs @@ -42,10 +42,6 @@ ifeq ($(CONFIG_STM32_OTGFS),y) CSRCS += stm32_usb.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_MTD_W25),y) CSRCS += stm32_w25.c endif diff --git a/boards/arm/stm32/shenzhou/src/stm32_appinit.c b/boards/arm/stm32/shenzhou/src/stm32_appinit.c deleted file mode 100644 index dc4c6b656bf..00000000000 --- a/boards/arm/stm32/shenzhou/src/stm32_appinit.c +++ /dev/null @@ -1,229 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/shenzhou/src/stm32_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 - -#include -#include -#include -#include - -#include - -#include "stm32.h" -#include "shenzhou.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -/* Assume that we support everything until convinced otherwise */ - -#define HAVE_MMCSD 1 -#define HAVE_USBDEV 1 -#define HAVE_USBHOST 1 -#define HAVE_W25 1 - -/* Configuration ************************************************************/ - -/* SPI1 connects to the SD CARD (and to the SPI FLASH) */ - -#define STM32_MMCSDSPIPORTNO 1 /* SPI1 */ -#define STM32_MMCSDSLOTNO 0 /* Only one slot */ - -#ifndef CONFIG_STM32_SPI1 -# undef HAVE_MMCSD -#endif - -/* Can't support MMC/SD features if mountpoints are disabled */ - -#ifdef CONFIG_DISABLE_MOUNTPOINT -# undef HAVE_MMCSD -#endif - -/* Default MMC/SD minor number */ - -#ifdef HAVE_MMCSD -# ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -# endif - -/* Default MMC/SD SLOT number */ - -# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != STM32_MMCSDSLOTNO -# error "Only one MMC/SD slot: Slot 0" -# endif - -/* Verify configured SPI port number */ - -# if defined(CONFIG_NSH_MMCSDSPIPORTNO) && CONFIG_NSH_MMCSDSPIPORTNO != STM32_MMCSDSPIPORTNO -# error "Only one MMC/SD port: SPI1" -# endif -#endif - -/* Can't support the W25 device if it SPI1 or W25 support is not enabled */ - -#if !defined(CONFIG_STM32_SPI1) || !defined(CONFIG_MTD_W25) -# undef HAVE_W25 -#endif - -/* Can't support W25 features if mountpoints are disabled */ - -#ifdef CONFIG_DISABLE_MOUNTPOINT -# undef HAVE_W25 -#endif - -/* Default W25 minor number */ - -#if defined(HAVE_W25) && !defined(CONFIG_NSH_W25MINOR) -# define CONFIG_NSH_W25MINOR 0 -#endif - -/* Can't support USB host or device features if USB OTG FS is not enabled */ - -#ifndef CONFIG_STM32_OTGFS -# undef HAVE_USBDEV -# undef HAVE_USBHOST -#endif - -/* Can't support USB device is USB device is not enabled */ - -#ifndef CONFIG_USBDEV -# undef HAVE_USBDEV -#endif - -/* Can't support USB host is USB host is not enabled */ - -#ifndef CONFIG_USBHOST -# undef HAVE_USBHOST -#endif - -/**************************************************************************** - * 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) -{ - int ret; - -#ifdef HAVE_W25 - /* Initialize and register the W25 FLASH file system. */ - - ret = stm32_w25initialize(CONFIG_NSH_W25MINOR); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to initialize W25 minor %d: %d\n", - CONFIG_NSH_W25MINOR, ret); - return ret; - } -#endif - -#ifdef HAVE_MMCSD - /* Initialize the SPI-based MMC/SD slot */ - - ret = stm32_sdinitialize(CONFIG_NSH_MMCSDMINOR); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot %d: %d\n", - STM32_MMCSDSLOTNO, ret); - return ret; - } -#endif - -#ifdef HAVE_USBHOST - /* Initialize USB host operation. - * stm32_usbhost_initialize() starts a thread will monitor - * for USB connection and disconnection events. - */ - - ret = stm32_usbhost_initialize(); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); - return ret; - } -#endif - -#ifdef CONFIG_INPUT_ADS7843E - /* Initialize the touchscreen */ - - ret = stm32_tsc_setup(0); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_ADC - /* Initialize ADC and register the ADC driver. */ - - ret = stm32_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_STM32_CAN_CHARDRIVER - /* Initialize CAN and register the CAN driver. */ - - ret = stm32_can_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_can_setup failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/stm32/shenzhou/src/stm32_boot.c b/boards/arm/stm32/shenzhou/src/stm32_boot.c index 7d4e70f42e6..b4aa743dcb0 100644 --- a/boards/arm/stm32/shenzhou/src/stm32_boot.c +++ b/boards/arm/stm32/shenzhou/src/stm32_boot.c @@ -28,16 +28,105 @@ #include +#include +#include +#include +#include + #include #include #include "arm_internal.h" +#include "stm32.h" #include "shenzhou.h" /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +/* Assume that we support everything until convinced otherwise */ + +#define HAVE_MMCSD 1 +#define HAVE_USBDEV 1 +#define HAVE_USBHOST 1 +#define HAVE_W25 1 + +/* Configuration ************************************************************/ + +/* SPI1 connects to the SD CARD (and to the SPI FLASH) */ + +#define STM32_MMCSDSPIPORTNO 1 /* SPI1 */ +#define STM32_MMCSDSLOTNO 0 /* Only one slot */ + +#ifndef CONFIG_STM32_SPI1 +# undef HAVE_MMCSD +#endif + +/* Can't support MMC/SD features if mountpoints are disabled */ + +#ifdef CONFIG_DISABLE_MOUNTPOINT +# undef HAVE_MMCSD +#endif + +/* Default MMC/SD minor number */ + +#ifdef HAVE_MMCSD +# ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +# endif + +/* Default MMC/SD SLOT number */ + +# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != STM32_MMCSDSLOTNO +# error "Only one MMC/SD slot: Slot 0" +# endif + +/* Verify configured SPI port number */ + +# if defined(CONFIG_NSH_MMCSDSPIPORTNO) && CONFIG_NSH_MMCSDSPIPORTNO != STM32_MMCSDSPIPORTNO +# error "Only one MMC/SD port: SPI1" +# endif +#endif + +/* Can't support the W25 device if it SPI1 or W25 support is not enabled */ + +#if !defined(CONFIG_STM32_SPI1) || !defined(CONFIG_MTD_W25) +# undef HAVE_W25 +#endif + +/* Can't support W25 features if mountpoints are disabled */ + +#ifdef CONFIG_DISABLE_MOUNTPOINT +# undef HAVE_W25 +#endif + +/* Default W25 minor number */ + +#if defined(HAVE_W25) && !defined(CONFIG_NSH_W25MINOR) +# define CONFIG_NSH_W25MINOR 0 +#endif + +/* Can't support USB host or device features if USB OTG FS is not enabled */ + +#ifndef CONFIG_STM32_OTGFS +# undef HAVE_USBDEV +# undef HAVE_USBHOST +#endif + +/* Can't support USB device is USB device is not enabled */ + +#ifndef CONFIG_USBDEV +# undef HAVE_USBDEV +#endif + +/* Can't support USB host is USB host is not enabled */ + +#ifndef CONFIG_USBHOST +# undef HAVE_USBHOST +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -88,3 +177,94 @@ void stm32_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) +{ + int ret; + +#ifdef HAVE_W25 + /* Initialize and register the W25 FLASH file system. */ + + ret = stm32_w25initialize(CONFIG_NSH_W25MINOR); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize W25 minor %d: %d\n", + CONFIG_NSH_W25MINOR, ret); + return; + } +#endif + +#ifdef HAVE_MMCSD + /* Initialize the SPI-based MMC/SD slot */ + + ret = stm32_sdinitialize(CONFIG_NSH_MMCSDMINOR); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot %d: %d\n", + STM32_MMCSDSLOTNO, ret); + return; + } +#endif + +#ifdef HAVE_USBHOST + /* Initialize USB host operation. + * stm32_usbhost_initialize() starts a thread will monitor + * for USB connection and disconnection events. + */ + + ret = stm32_usbhost_initialize(); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); + return; + } +#endif + +#ifdef CONFIG_INPUT_ADS7843E + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_ADC + /* Initialize ADC and register the ADC driver. */ + + ret = stm32_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_STM32_CAN_CHARDRIVER + /* Initialize CAN and register the CAN driver. */ + + ret = stm32_can_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_can_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); +} +#endif diff --git a/boards/arm/stm32/shenzhou/src/stm32_usbmsc.c b/boards/arm/stm32/shenzhou/src/stm32_usbmsc.c index aff6d4f9671..4e9f496f132 100644 --- a/boards/arm/stm32/shenzhou/src/stm32_usbmsc.c +++ b/boards/arm/stm32/shenzhou/src/stm32_usbmsc.c @@ -60,8 +60,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() (see - * stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/stm32/stm3210e-eval/src/CMakeLists.txt b/boards/arm/stm32/stm3210e-eval/src/CMakeLists.txt index 98cbdb0b90d..b870c533c1c 100644 --- a/boards/arm/stm32/stm3210e-eval/src/CMakeLists.txt +++ b/boards/arm/stm32/stm3210e-eval/src/CMakeLists.txt @@ -29,10 +29,6 @@ if(CONFIG_STM32_FSMC) list(APPEND SRCS stm32_selectlcd.c stm32_deselectlcd.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ADC) list(APPEND SRCS stm32_adc.c) endif() diff --git a/boards/arm/stm32/stm3210e-eval/src/Make.defs b/boards/arm/stm32/stm3210e-eval/src/Make.defs index d618974f4b6..9815a6acb2d 100644 --- a/boards/arm/stm32/stm3210e-eval/src/Make.defs +++ b/boards/arm/stm32/stm3210e-eval/src/Make.defs @@ -30,10 +30,6 @@ CSRCS += stm32_deselectnor.c stm32_selectsram.c stm32_deselectsram.c CSRCS += stm32_selectlcd.c stm32_deselectlcd.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += stm32_adc.c endif diff --git a/boards/arm/stm32/stm3210e-eval/src/stm32_appinit.c b/boards/arm/stm32/stm3210e-eval/src/stm32_appinit.c deleted file mode 100644 index f998fd77948..00000000000 --- a/boards/arm/stm32/stm3210e-eval/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/stm3210e-eval/src/stm32_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 - -#include -#include - -#include "stm3210e-eval.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/stm3210e-eval/src/stm32_composite.c b/boards/arm/stm32/stm3210e-eval/src/stm32_composite.c index 036a66a9e31..b955808ef1b 100644 --- a/boards/arm/stm32/stm3210e-eval/src/stm32_composite.c +++ b/boards/arm/stm32/stm3210e-eval/src/stm32_composite.c @@ -359,8 +359,7 @@ static void *board_composite1_connect(int port) int board_composite_initialize(int port) { /* If system/composite is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() (see - * stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. * * NOTE: CONFIG_NSH_BUILTIN_APPS is not a fool-proof indication that NSH diff --git a/boards/arm/stm32/stm3210e-eval/src/stm32_usbmsc.c b/boards/arm/stm32/stm3210e-eval/src/stm32_usbmsc.c index 9b29146c8da..05bd61798b5 100644 --- a/boards/arm/stm32/stm3210e-eval/src/stm32_usbmsc.c +++ b/boards/arm/stm32/stm3210e-eval/src/stm32_usbmsc.c @@ -93,8 +93,7 @@ int stm32_bringup(void); int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/stm32/stm3220g-eval/src/CMakeLists.txt b/boards/arm/stm32/stm3220g-eval/src/CMakeLists.txt index 2dd02863f91..7f0321dd1b8 100644 --- a/boards/arm/stm32/stm3220g-eval/src/CMakeLists.txt +++ b/boards/arm/stm32/stm3220g-eval/src/CMakeLists.txt @@ -60,10 +60,6 @@ if(CONFIG_STM32_CAN_CHARDRIVER) list(APPEND SRCS stm32_can.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_INPUT_STMPE811) list(APPEND SRCS stm32_stmpe811.c) endif() diff --git a/boards/arm/stm32/stm3220g-eval/src/Make.defs b/boards/arm/stm32/stm3220g-eval/src/Make.defs index e214325560f..e77785ac6fa 100644 --- a/boards/arm/stm32/stm3220g-eval/src/Make.defs +++ b/boards/arm/stm32/stm3220g-eval/src/Make.defs @@ -54,10 +54,6 @@ ifeq ($(CONFIG_STM32_CAN_CHARDRIVER),y) CSRCS += stm32_can.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_INPUT_STMPE811),y) CSRCS += stm32_stmpe811.c endif diff --git a/boards/arm/stm32/stm3220g-eval/src/stm32_appinit.c b/boards/arm/stm32/stm3220g-eval/src/stm32_appinit.c deleted file mode 100644 index 670e4d7c308..00000000000 --- a/boards/arm/stm32/stm3220g-eval/src/stm32_appinit.c +++ /dev/null @@ -1,326 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/stm3220g-eval/src/stm32_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 - -#include -#include -#include -#include - -#include -#include - -#ifdef CONFIG_STM32_SPI1 -# include -# include -#endif - -#ifdef CONFIG_STM32_SDIO -# include -# include -#endif - -#ifdef CONFIG_STM32_OTGFS -# include "stm32_usbhost.h" -#endif - -#include "stm32.h" -#include "stm32_i2c.h" -#include "stm3220g-eval.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -/* For now, don't build in any SPI1 support -- NSH is not using it */ - -#undef CONFIG_STM32_SPI1 - -/* MMCSD PORT and SLOT number probably depend on the board configuration */ - -#define HAVE_USBDEV 1 -#define HAVE_MMCSD 1 -#define HAVE_USBHOST 1 - -#if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 -# error "Only one MMC/SD slot" -# undef CONFIG_NSH_MMCSDSLOTNO -#endif - -#ifndef CONFIG_NSH_MMCSDSLOTNO -# define CONFIG_NSH_MMCSDSLOTNO 0 -#endif - -/* Can't support MMC/SD features if mountpoints are disabled or if SDIO - * support is not enabled. - */ - -#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_STM32_SDIO) -# undef HAVE_MMCSD -#endif - -#ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -#endif - -/* Can't support USB host or device features if USB OTG FS is not enabled */ - -#ifndef CONFIG_STM32_OTGFS -# undef HAVE_USBDEV -# undef HAVE_USBHOST -#endif - -/* Can't support USB device is USB device is not enabled */ - -#ifndef CONFIG_USBDEV -# undef HAVE_USBDEV -#endif - -/* Can't support USB host is USB host is not enabled */ - -#ifndef CONFIG_USBHOST -# undef HAVE_USBHOST -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: stm32_i2c_register - * - * Description: - * Register one I2C drivers for the I2C tool. - * - ****************************************************************************/ - -#ifdef HAVE_I2CTOOL -static void stm32_i2c_register(int bus) -{ - struct i2c_master_s *i2c; - int ret; - - i2c = stm32_i2cbus_initialize(bus); - if (i2c == NULL) - { - _err("ERROR: Failed to get I2C%d interface\n", bus); - } - else - { - ret = i2c_register(i2c, bus); - if (ret < 0) - { - _err("ERROR: Failed to register I2C%d driver: %d\n", bus, ret); - stm32_i2cbus_uninitialize(i2c); - } - } -} -#endif - -/**************************************************************************** - * Name: stm32_i2ctool - * - * Description: - * Register I2C drivers for the I2C tool. - * - ****************************************************************************/ - -#ifdef HAVE_I2CTOOL -static void stm32_i2ctool(void) -{ -#ifdef CONFIG_STM32_I2C1 - stm32_i2c_register(1); -#endif -#ifdef CONFIG_STM32_I2C2 - stm32_i2c_register(2); -#endif -#ifdef CONFIG_STM32_I2C3 - stm32_i2c_register(3); -#endif -} -#else -# define stm32_i2ctool() -#endif - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_STM32_SPI1 - struct spi_dev_s *spi; - struct mtd_dev_s *mtd; -#endif -#ifdef HAVE_MMCSD - struct sdio_dev_s *sdio; -#endif - int ret; - - /* Register I2C drivers on behalf of the I2C tool */ - - stm32_i2ctool(); - - /* Configure SPI-based devices */ - -#ifdef CONFIG_STM32_SPI1 - /* Get the SPI port */ - - spi = stm32_spibus_initialize(1); - if (!spi) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SPI port 0\n"); - return -ENODEV; - } - - /* Now bind the SPI interface to the M25P64/128 SPI FLASH driver */ - - mtd = m25p_initialize(spi); - if (!mtd) - { - syslog(LOG_ERR, - "ERROR: Failed to bind SPI port 0 to the SPI FLASH driver\n"); - return -ENODEV; - } - -#warning "Now what are we going to do with this SPI FLASH driver?" -#endif - - /* Mount the SDIO-based MMC/SD block driver */ - -#ifdef HAVE_MMCSD - /* First, get an instance of the SDIO interface */ - - sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); - if (!sdio) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); - return -ENODEV; - } - - /* Now bind the SDIO interface to the MMC/SD driver */ - - ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio); - if (ret != OK) - { - syslog(LOG_ERR, - "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); - return ret; - } - - /* Then let's guess and say that there is a card in the slot. I need to - * check to see if the STM3220G-EVAL board supports a GPIO to detect if - * there is a card in the slot. - */ - - sdio_mediachange(sdio, true); -#endif - - /* Initialize USB host operation. stm32_usbhost_initialize() starts a - * thread will monitor for USB connection and disconnection events. - */ - -#ifdef HAVE_USBHOST - ret = stm32_usbhost_initialize(); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); - return ret; - } -#endif - -#ifdef CONFIG_INPUT_STMPE811 - /* Initialize the touchscreen */ - - ret = stm32_tsc_setup(0); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_PWM - /* Initialize PWM and register the PWM device. */ - - ret = stm32_pwm_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_ADC - /* Initialize ADC and register the ADC driver. */ - - ret = stm32_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_STM32_CAN_CHARDRIVER - /* Initialize CAN and register the CAN driver. */ - - ret = stm32_can_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_can_setup failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/stm32/stm3220g-eval/src/stm32_boot.c b/boards/arm/stm32/stm3220g-eval/src/stm32_boot.c index 96b9e34b351..a3693105506 100644 --- a/boards/arm/stm32/stm3220g-eval/src/stm32_boot.c +++ b/boards/arm/stm32/stm3220g-eval/src/stm32_boot.c @@ -28,20 +28,149 @@ #include +#include +#include +#include + #include +#include #include +#ifdef CONFIG_STM32_SPI1 +# include +# include +#endif + +#ifdef CONFIG_STM32_SDIO +# include +# include +#endif + +#ifdef CONFIG_STM32_OTGFS +# include "stm32_usbhost.h" +#endif + #include "arm_internal.h" +#include "stm32.h" +#include "stm32_i2c.h" #include "stm3220g-eval.h" /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +/* For now, don't build in any SPI1 support -- NSH is not using it */ + +#undef CONFIG_STM32_SPI1 + +/* MMCSD PORT and SLOT number probably depend on the board configuration */ + +#define HAVE_USBDEV 1 +#define HAVE_MMCSD 1 +#define HAVE_USBHOST 1 + +#if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0 +# error "Only one MMC/SD slot" +# undef CONFIG_NSH_MMCSDSLOTNO +#endif + +#ifndef CONFIG_NSH_MMCSDSLOTNO +# define CONFIG_NSH_MMCSDSLOTNO 0 +#endif + +/* Can't support MMC/SD features if mountpoints are disabled or if SDIO + * support is not enabled. + */ + +#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_STM32_SDIO) +# undef HAVE_MMCSD +#endif + +#ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +#endif + +/* Can't support USB host or device features if USB OTG FS is not enabled */ + +#ifndef CONFIG_STM32_OTGFS +# undef HAVE_USBDEV +# undef HAVE_USBHOST +#endif + +/* Can't support USB device is USB device is not enabled */ + +#ifndef CONFIG_USBDEV +# undef HAVE_USBDEV +#endif + +/* Can't support USB host is USB host is not enabled */ + +#ifndef CONFIG_USBHOST +# undef HAVE_USBHOST +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: stm32_i2c_register + * + * Description: + * Register one I2C drivers for the I2C tool. + * + ****************************************************************************/ + +#ifdef HAVE_I2CTOOL +static void stm32_i2c_register(int bus) +{ + struct i2c_master_s *i2c; + int ret; + + i2c = stm32_i2cbus_initialize(bus); + if (i2c == NULL) + { + _err("ERROR: Failed to get I2C%d interface\n", bus); + } + else + { + ret = i2c_register(i2c, bus); + if (ret < 0) + { + _err("ERROR: Failed to register I2C%d driver: %d\n", bus, ret); + stm32_i2cbus_uninitialize(i2c); + } + } +} +#endif + +/**************************************************************************** + * Name: stm32_i2ctool + * + * Description: + * Register I2C drivers for the I2C tool. + * + ****************************************************************************/ + +#ifdef HAVE_I2CTOOL +static void stm32_i2ctool(void) +{ +#ifdef CONFIG_STM32_I2C1 + stm32_i2c_register(1); +#endif +#ifdef CONFIG_STM32_I2C2 + stm32_i2c_register(2); +#endif +#ifdef CONFIG_STM32_I2C3 + stm32_i2c_register(3); +#endif +} +#else +# define stm32_i2ctool() +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -95,3 +224,145 @@ void stm32_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) +{ +#ifdef CONFIG_STM32_SPI1 + struct spi_dev_s *spi; + struct mtd_dev_s *mtd; +#endif +#ifdef HAVE_MMCSD + struct sdio_dev_s *sdio; +#endif + int ret; + + /* Register I2C drivers on behalf of the I2C tool */ + + stm32_i2ctool(); + + /* Configure SPI-based devices */ + +#ifdef CONFIG_STM32_SPI1 + /* Get the SPI port */ + + spi = stm32_spibus_initialize(1); + if (!spi) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port 0\n"); + return; + } + + /* Now bind the SPI interface to the M25P64/128 SPI FLASH driver */ + + mtd = m25p_initialize(spi); + if (!mtd) + { + syslog(LOG_ERR, + "ERROR: Failed to bind SPI port 0 to the SPI FLASH driver\n"); + return; + } + +#warning "Now what are we going to do with this SPI FLASH driver?" +#endif + + /* Mount the SDIO-based MMC/SD block driver */ + +#ifdef HAVE_MMCSD + /* First, get an instance of the SDIO interface */ + + sdio = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); + if (!sdio) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n", + CONFIG_NSH_MMCSDSLOTNO); + return; + } + + /* Now bind the SDIO interface to the MMC/SD driver */ + + ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio); + if (ret != OK) + { + syslog(LOG_ERR, + "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); + return; + } + + /* Then let's guess and say that there is a card in the slot. I need to + * check to see if the STM3220G-EVAL board supports a GPIO to detect if + * there is a card in the slot. + */ + + sdio_mediachange(sdio, true); +#endif + + /* Initialize USB host operation. stm32_usbhost_initialize() starts a + * thread will monitor for USB connection and disconnection events. + */ + +#ifdef HAVE_USBHOST + ret = stm32_usbhost_initialize(); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); + return; + } +#endif + +#ifdef CONFIG_INPUT_STMPE811 + /* Initialize the touchscreen */ + + ret = stm32_tsc_setup(0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_PWM + /* Initialize PWM and register the PWM device. */ + + ret = stm32_pwm_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_ADC + /* Initialize ADC and register the ADC driver. */ + + ret = stm32_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_STM32_CAN_CHARDRIVER + /* Initialize CAN and register the CAN driver. */ + + ret = stm32_can_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_can_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); +} +#endif diff --git a/boards/arm/stm32/stm3240g-eval/src/CMakeLists.txt b/boards/arm/stm32/stm3240g-eval/src/CMakeLists.txt index 30e92467489..c8c5aa4f724 100644 --- a/boards/arm/stm32/stm3240g-eval/src/CMakeLists.txt +++ b/boards/arm/stm32/stm3240g-eval/src/CMakeLists.txt @@ -53,10 +53,6 @@ if(CONFIG_STM32_CAN_CHARDRIVER) list(APPEND SRCS stm32_can.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_INPUT_STMPE811) list(APPEND SRCS stm32_stmpe811.c) endif() diff --git a/boards/arm/stm32/stm3240g-eval/src/Make.defs b/boards/arm/stm32/stm3240g-eval/src/Make.defs index 04b7b4c85a9..04d1ecfdd0b 100644 --- a/boards/arm/stm32/stm3240g-eval/src/Make.defs +++ b/boards/arm/stm32/stm3240g-eval/src/Make.defs @@ -55,10 +55,6 @@ ifeq ($(CONFIG_STM32_CAN_CHARDRIVER),y) CSRCS += stm32_can.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_INPUT_STMPE811),y) CSRCS += stm32_stmpe811.c endif diff --git a/boards/arm/stm32/stm3240g-eval/src/stm32_appinit.c b/boards/arm/stm32/stm3240g-eval/src/stm32_appinit.c deleted file mode 100644 index 69d0329d495..00000000000 --- a/boards/arm/stm32/stm3240g-eval/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/stm3240g-eval/src/stm32_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 - -#include -#include - -#include "stm3240g-eval.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/stm32_tiny/src/CMakeLists.txt b/boards/arm/stm32/stm32_tiny/src/CMakeLists.txt index 0412d4f845d..c73b5cfb5bd 100644 --- a/boards/arm/stm32/stm32_tiny/src/CMakeLists.txt +++ b/boards/arm/stm32/stm32_tiny/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_PWM) list(APPEND SRCS stm32_pwm.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/ld.script") diff --git a/boards/arm/stm32/stm32_tiny/src/Make.defs b/boards/arm/stm32/stm32_tiny/src/Make.defs index 11d3bf20626..a8268fc3401 100644 --- a/boards/arm/stm32/stm32_tiny/src/Make.defs +++ b/boards/arm/stm32/stm32_tiny/src/Make.defs @@ -28,10 +28,6 @@ ifeq ($(CONFIG_PWM),y) CSRCS += stm32_pwm.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/arm/stm32/stm32_tiny/src/stm32_appinit.c b/boards/arm/stm32/stm32_tiny/src/stm32_appinit.c deleted file mode 100644 index 7af85c071d9..00000000000 --- a/boards/arm/stm32/stm32_tiny/src/stm32_appinit.c +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/stm32_tiny/src/stm32_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 - -#include -#include -#include -#include - -#include - -#include "stm32.h" -#include "stm32_tiny.h" - -#ifdef CONFIG_WL_NRF24L01 -#include "stm32_nrf24l01.h" -#endif - -/**************************************************************************** - * 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) -{ - int ret = OK; - -#ifdef CONFIG_PWM - /* Initialize PWM and register the PWM device. */ - - ret = stm32_pwm_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret); - } -#endif - -#if defined(CONFIG_WL_NRF24L01) - /* Initialize the NRF24L01 wireless module */ - - ret = board_nrf24l01_initialize(2); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: board_nrf24l01_initialize failed: %d\n", ret); - } -#endif - - return ret; -} diff --git a/boards/arm/stm32/stm32_tiny/src/stm32_boot.c b/boards/arm/stm32/stm32_tiny/src/stm32_boot.c index 92719c9f07a..978fee88af4 100644 --- a/boards/arm/stm32/stm32_tiny/src/stm32_boot.c +++ b/boards/arm/stm32/stm32_tiny/src/stm32_boot.c @@ -34,6 +34,10 @@ #include "arm_internal.h" #include "stm32_tiny.h" +#ifdef CONFIG_WL_NRF24L01 +#include "stm32_nrf24l01.h" +#endif + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -82,3 +86,44 @@ void stm32_boardinitialize(void) stm32_usbinitialize(); #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) +{ + int ret = OK; + +#ifdef CONFIG_PWM + /* Initialize PWM and register the PWM device. */ + + ret = stm32_pwm_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret); + } +#endif + +#if defined(CONFIG_WL_NRF24L01) + /* Initialize the NRF24L01 wireless module */ + + ret = board_nrf24l01_initialize(2); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: board_nrf24l01_initialize failed: %d\n", ret); + } +#endif +} +#endif diff --git a/boards/arm/stm32/stm32butterfly2/src/stm32_boot.c b/boards/arm/stm32/stm32butterfly2/src/stm32_boot.c index b49ed184d95..de6bf256cf4 100644 --- a/boards/arm/stm32/stm32butterfly2/src/stm32_boot.c +++ b/boards/arm/stm32/stm32butterfly2/src/stm32_boot.c @@ -49,16 +49,21 @@ void stm32_boardinitialize(void) } /**************************************************************************** - * Name: board_app_initialize + * Name: board_late_initialize * * Description: - * Initializes upper half drivers with board specific settings + * 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. * - * Returned Value: - * 0 on success or errno value of failed init function. ****************************************************************************/ -int board_app_initialize(uintptr_t arg) +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) { int ret = 0; @@ -67,7 +72,7 @@ int board_app_initialize(uintptr_t arg) if (ret < 0) { syslog(LOG_ERR, "Failed to initialize SD slot: %d\n", ret); - return ret; + return; } #endif @@ -76,7 +81,7 @@ int board_app_initialize(uintptr_t arg) if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to initialize USB host: %d\n", ret); - return ret; + return; } #endif @@ -91,5 +96,5 @@ int board_app_initialize(uintptr_t arg) #endif UNUSED(ret); - return ret; } +#endif diff --git a/boards/arm/stm32/stm32f103-minimum/src/CMakeLists.txt b/boards/arm/stm32/stm32f103-minimum/src/CMakeLists.txt index 9ebb7d39cff..06607962aed 100644 --- a/boards/arm/stm32/stm32f103-minimum/src/CMakeLists.txt +++ b/boards/arm/stm32/stm32f103-minimum/src/CMakeLists.txt @@ -22,11 +22,8 @@ set(SRCS stm32_boot.c stm32_bringup.c stm32_spi.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) - if(CONFIG_BOARDCTL_RESET) - list(APPEND SRCS stm32_reset.c) - endif() +if(CONFIG_BOARDCTL_RESET) + list(APPEND SRCS stm32_reset.c) endif() if(CONFIG_ARCH_BUTTONS) diff --git a/boards/arm/stm32/stm32f103-minimum/src/Make.defs b/boards/arm/stm32/stm32f103-minimum/src/Make.defs index 93bdf6190e8..a0fc84fc4ee 100644 --- a/boards/arm/stm32/stm32f103-minimum/src/Make.defs +++ b/boards/arm/stm32/stm32f103-minimum/src/Make.defs @@ -24,12 +24,9 @@ include $(TOPDIR)/Make.defs CSRCS = stm32_boot.c stm32_bringup.c stm32_spi.c -ifeq ($(CONFIG_BOARDCTL),y) - CSRCS += stm32_appinit.c ifeq ($(CONFIG_BOARDCTL_RESET),y) CSRCS += stm32_reset.c endif -endif ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c diff --git a/boards/arm/stm32/stm32f103-minimum/src/stm32_appinit.c b/boards/arm/stm32/stm32f103-minimum/src/stm32_appinit.c deleted file mode 100644 index 1fb0ee62a05..00000000000 --- a/boards/arm/stm32/stm32f103-minimum/src/stm32_appinit.c +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/stm32f103-minimum/src/stm32_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 - -#include -#include -#include -#include - -#include -#include - -#include "stm32.h" -#include "stm32f103_minimum.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) -{ - /* Perform board initialization here */ - - return stm32_bringup(); -} diff --git a/boards/arm/stm32/stm32f103-minimum/src/stm32_boot.c b/boards/arm/stm32/stm32f103-minimum/src/stm32_boot.c index 9ebb5686cee..0f4f0c9e0a5 100644 --- a/boards/arm/stm32/stm32f103-minimum/src/stm32_boot.c +++ b/boards/arm/stm32/stm32f103-minimum/src/stm32_boot.c @@ -96,12 +96,6 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { -#ifndef CONFIG_BOARDCTL - /* Perform board initialization here instead of from the - * board_app_initialize(). - */ - stm32_bringup(); -#endif } #endif diff --git a/boards/arm/stm32/stm32f103-minimum/src/stm32_usbmsc.c b/boards/arm/stm32/stm32f103-minimum/src/stm32_usbmsc.c index f3c07b23cc8..3ab090b7c65 100644 --- a/boards/arm/stm32/stm32f103-minimum/src/stm32_usbmsc.c +++ b/boards/arm/stm32/stm32f103-minimum/src/stm32_usbmsc.c @@ -59,8 +59,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/stm32/stm32f103-minimum/src/stm32f103_minimum.h b/boards/arm/stm32/stm32f103-minimum/src/stm32f103_minimum.h index eda8b3debf6..a3cac399ded 100644 --- a/boards/arm/stm32/stm32f103-minimum/src/stm32f103_minimum.h +++ b/boards/arm/stm32/stm32f103-minimum/src/stm32f103_minimum.h @@ -213,12 +213,7 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * * Otherwise, bad news: Never called diff --git a/boards/arm/stm32/stm32f334-disco/src/CMakeLists.txt b/boards/arm/stm32/stm32f334-disco/src/CMakeLists.txt index cae93a234b1..b3e02b012c8 100644 --- a/boards/arm/stm32/stm32f334-disco/src/CMakeLists.txt +++ b/boards/arm/stm32/stm32f334-disco/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_ARCH_LEDS) list(APPEND SRCS stm32_autoleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_STM32_CAN_CHARDRIVER) list(APPEND SRCS stm32_can.c) endif() diff --git a/boards/arm/stm32/stm32f334-disco/src/Make.defs b/boards/arm/stm32/stm32f334-disco/src/Make.defs index 5f94592797a..df8d1b44b37 100644 --- a/boards/arm/stm32/stm32f334-disco/src/Make.defs +++ b/boards/arm/stm32/stm32f334-disco/src/Make.defs @@ -28,10 +28,6 @@ ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += stm32_autoleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_STM32_CAN_CHARDRIVER),y) CSRCS += stm32_can.c endif diff --git a/boards/arm/stm32/stm32f334-disco/src/stm32_appinit.c b/boards/arm/stm32/stm32f334-disco/src/stm32_appinit.c deleted file mode 100644 index e83d296873b..00000000000 --- a/boards/arm/stm32/stm32f334-disco/src/stm32_appinit.c +++ /dev/null @@ -1,171 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/stm32f334-disco/src/stm32_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 - -#include -#include - -#include -#include - -#include "stm32f334-disco.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#undef HAVE_LEDS -#undef HAVE_DAC - -#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) -# define HAVE_LEDS 1 -#endif - -#if defined(CONFIG_DAC) -# define HAVE_DAC1 1 -# define HAVE_DAC2 1 -#endif - -/**************************************************************************** - * 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) -{ - int ret; - -#if !defined(CONFIG_DRIVERS_POWERLED) && !defined(CONFIG_DRIVERS_SMPS) -#ifdef HAVE_LEDS - /* Register the LED driver */ - - ret = userled_lower_initialize(LED_DRIVER_PATH); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); - return ret; - } -#endif - -#ifdef CONFIG_ADC - /* Initialize ADC and register the ADC driver. */ - - ret = stm32_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_DAC - /* Initialize DAC and register the DAC driver. */ - - ret = stm32_dac_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_dac_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_COMP - /* Initialize COMP and register the COMP driver. */ - - ret = stm32_comp_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_comp_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_OPAMP - /* Initialize OPAMP and register the OPAMP driver. */ - - ret = stm32_opamp_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_opamp_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_STM32_HRTIM - /* Initialize HRTIM and register the HRTIM driver. */ - - ret = stm32_hrtim_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_hrtim_setup failed: %d\n", ret); - } -#endif -#endif - -#ifdef CONFIG_DRIVERS_POWERLED - /* Initialize powerled and register the powerled driver */ - - ret = stm32_powerled_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_powerled_setup failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_DRIVERS_SMPS - /* Initialize smps and register the smps driver */ - - ret = stm32_smps_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_smps_setup failed: %d\n", ret); - } -#endif - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/stm32/stm32f334-disco/src/stm32_boot.c b/boards/arm/stm32/stm32f334-disco/src/stm32_boot.c index 3a7dd440843..5aacb0f9f11 100644 --- a/boards/arm/stm32/stm32f334-disco/src/stm32_boot.c +++ b/boards/arm/stm32/stm32f334-disco/src/stm32_boot.c @@ -26,7 +26,11 @@ #include +#include +#include + #include +#include #include #include "stm32f334-disco.h" @@ -35,6 +39,18 @@ * Pre-processor Definitions ****************************************************************************/ +#undef HAVE_LEDS +#undef HAVE_DAC + +#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) +# define HAVE_LEDS 1 +#endif + +#if defined(CONFIG_DAC) +# define HAVE_DAC1 1 +# define HAVE_DAC2 1 +#endif + /**************************************************************************** * Private Function Prototypes ****************************************************************************/ @@ -70,3 +86,109 @@ void stm32_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) +{ + int ret; + +#if !defined(CONFIG_DRIVERS_POWERLED) && !defined(CONFIG_DRIVERS_SMPS) +#ifdef HAVE_LEDS + /* Register the LED driver */ + + ret = userled_lower_initialize(LED_DRIVER_PATH); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); + return; + } +#endif + +#ifdef CONFIG_ADC + /* Initialize ADC and register the ADC driver. */ + + ret = stm32_adc_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_DAC + /* Initialize DAC and register the DAC driver. */ + + ret = stm32_dac_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_dac_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_COMP + /* Initialize COMP and register the COMP driver. */ + + ret = stm32_comp_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_comp_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_OPAMP + /* Initialize OPAMP and register the OPAMP driver. */ + + ret = stm32_opamp_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_opamp_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_STM32_HRTIM + /* Initialize HRTIM and register the HRTIM driver. */ + + ret = stm32_hrtim_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_hrtim_setup failed: %d\n", ret); + } +#endif +#endif + +#ifdef CONFIG_DRIVERS_POWERLED + /* Initialize powerled and register the powerled driver */ + + ret = stm32_powerled_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_powerled_setup failed: %d\n", ret); + } +#endif + +#ifdef CONFIG_DRIVERS_SMPS + /* Initialize smps and register the smps driver */ + + ret = stm32_smps_setup(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32_smps_setup failed: %d\n", ret); + } +#endif + + UNUSED(ret); +} +#endif diff --git a/boards/arm/stm32/stm32f334-disco/src/stm32_powerled.c b/boards/arm/stm32/stm32f334-disco/src/stm32_powerled.c index 8ecb93ffb22..0f7890bd25f 100644 --- a/boards/arm/stm32/stm32f334-disco/src/stm32_powerled.c +++ b/boards/arm/stm32/stm32f334-disco/src/stm32_powerled.c @@ -555,8 +555,6 @@ static int powerled_ioctl(struct powerled_dev_s *dev, int cmd, * Description: * Initialize POWERLED driver. * - * This function should be call by board_app_initialize(). - * * Returned Value: * 0 on success, a negated errno value on failure * diff --git a/boards/arm/stm32/stm32f334-disco/src/stm32_smps.c b/boards/arm/stm32/stm32f334-disco/src/stm32_smps.c index 9273b5dac08..9dc01746e99 100644 --- a/boards/arm/stm32/stm32f334-disco/src/stm32_smps.c +++ b/boards/arm/stm32/stm32f334-disco/src/stm32_smps.c @@ -1045,8 +1045,6 @@ static void adc12_handler(void) * Description: * Initialize SMPS driver. * - * This function should be call by board_app_initialize(). - * * Returned Value: * 0 on success, a negated errno value on failure * diff --git a/boards/arm/stm32/stm32f3discovery/src/CMakeLists.txt b/boards/arm/stm32/stm32f3discovery/src/CMakeLists.txt index dcf6bb01291..a5f1196b826 100644 --- a/boards/arm/stm32/stm32f3discovery/src/CMakeLists.txt +++ b/boards/arm/stm32/stm32f3discovery/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS stm32_boot.c stm32_bringup.c stm32_spi.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS stm32_autoleds.c) else() diff --git a/boards/arm/stm32/stm32f3discovery/src/Make.defs b/boards/arm/stm32/stm32f3discovery/src/Make.defs index e411c586337..5ab0f6b49b4 100644 --- a/boards/arm/stm32/stm32f3discovery/src/Make.defs +++ b/boards/arm/stm32/stm32f3discovery/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = stm32_boot.c stm32_bringup.c stm32_spi.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += stm32_autoleds.c else diff --git a/boards/arm/stm32/stm32f3discovery/src/stm32_appinit.c b/boards/arm/stm32/stm32f3discovery/src/stm32_appinit.c deleted file mode 100644 index ee1e6af5ed4..00000000000 --- a/boards/arm/stm32/stm32f3discovery/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/stm32f3discovery/src/stm32_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 - -#include -#include - -#include "stm32f3discovery.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/stm32f401rc-rs485/src/CMakeLists.txt b/boards/arm/stm32/stm32f401rc-rs485/src/CMakeLists.txt index 3bf72325e43..bf67263f692 100644 --- a/boards/arm/stm32/stm32f401rc-rs485/src/CMakeLists.txt +++ b/boards/arm/stm32/stm32f401rc-rs485/src/CMakeLists.txt @@ -30,11 +30,8 @@ if(CONFIG_USERLED) list(APPEND SRCS stm32_userleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) - if(CONFIG_BOARDCTL_RESET) - list(APPEND SRCS stm32_reset.c) - endif() +if(CONFIG_BOARDCTL_RESET) + list(APPEND SRCS stm32_reset.c) endif() if(CONFIG_ARCH_BUTTONS) diff --git a/boards/arm/stm32/stm32f401rc-rs485/src/Make.defs b/boards/arm/stm32/stm32f401rc-rs485/src/Make.defs index 95425aaa474..122740343ad 100644 --- a/boards/arm/stm32/stm32f401rc-rs485/src/Make.defs +++ b/boards/arm/stm32/stm32f401rc-rs485/src/Make.defs @@ -41,12 +41,9 @@ ifeq ($(CONFIG_USERLED),y) CSRCS += stm32_userleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c ifeq ($(CONFIG_BOARDCTL_RESET),y) CSRCS += stm32_reset.c endif -endif ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c @@ -54,7 +51,7 @@ endif ifeq ($(CONFIG_ADC),y) CSRCS += stm32_adc.c -endif +endif ifeq ($(CONFIG_STM32_SDIO),y) CSRCS += stm32_sdio.c diff --git a/boards/arm/stm32/stm32f401rc-rs485/src/stm32_appinit.c b/boards/arm/stm32/stm32f401rc-rs485/src/stm32_appinit.c deleted file mode 100644 index 1090f389bff..00000000000 --- a/boards/arm/stm32/stm32f401rc-rs485/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/stm32f401rc-rs485/src/stm32_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 - -#include -#include - -#include "stm32f401rc-rs485.h" - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - return OK; -#else - /* Perform board initialization here */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/stm32f401rc-rs485/src/stm32_boot.c b/boards/arm/stm32/stm32f401rc-rs485/src/stm32_boot.c index 432164d76c2..e4a5038168b 100644 --- a/boards/arm/stm32/stm32f401rc-rs485/src/stm32_boot.c +++ b/boards/arm/stm32/stm32f401rc-rs485/src/stm32_boot.c @@ -88,10 +88,6 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform board initialization here instead of from the - * board_app_initialize(). - */ - stm32_bringup(); } #endif diff --git a/boards/arm/stm32/stm32f401rc-rs485/src/stm32_usbmsc.c b/boards/arm/stm32/stm32f401rc-rs485/src/stm32_usbmsc.c index cebac2378d5..d5d633d8996 100644 --- a/boards/arm/stm32/stm32f401rc-rs485/src/stm32_usbmsc.c +++ b/boards/arm/stm32/stm32f401rc-rs485/src/stm32_usbmsc.c @@ -59,8 +59,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/stm32/stm32f401rc-rs485/src/stm32f401rc-rs485.h b/boards/arm/stm32/stm32f401rc-rs485/src/stm32f401rc-rs485.h index 46c2b900ec3..b8fbec7e25a 100644 --- a/boards/arm/stm32/stm32f401rc-rs485/src/stm32f401rc-rs485.h +++ b/boards/arm/stm32/stm32f401rc-rs485/src/stm32f401rc-rs485.h @@ -194,12 +194,7 @@ extern struct sdio_dev_s *g_sdio; * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * * Otherwise, bad news: Never called diff --git a/boards/arm/stm32/stm32f411-minimum/src/CMakeLists.txt b/boards/arm/stm32/stm32f411-minimum/src/CMakeLists.txt index 09c582407c2..67ae6a038bb 100644 --- a/boards/arm/stm32/stm32f411-minimum/src/CMakeLists.txt +++ b/boards/arm/stm32/stm32f411-minimum/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS stm32_boot.c stm32_bringup.c) -if(CONFIG_NSH_LIBRARY) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS stm32_autoleds.c) endif() diff --git a/boards/arm/stm32/stm32f411-minimum/src/Make.defs b/boards/arm/stm32/stm32f411-minimum/src/Make.defs index d8cde2b77e9..a221a572f16 100644 --- a/boards/arm/stm32/stm32f411-minimum/src/Make.defs +++ b/boards/arm/stm32/stm32f411-minimum/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = stm32_boot.c stm32_bringup.c -ifeq ($(CONFIG_NSH_LIBRARY),y) - CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += stm32_autoleds.c endif diff --git a/boards/arm/stm32/stm32f411-minimum/src/stm32_appinit.c b/boards/arm/stm32/stm32f411-minimum/src/stm32_appinit.c deleted file mode 100644 index eb04e9a0c91..00000000000 --- a/boards/arm/stm32/stm32f411-minimum/src/stm32_appinit.c +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/stm32f411-minimum/src/stm32_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 - -#include -#include -#include - -#include -#include - -#include -#include - -#include - -#include "stm32f411-minimum.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-specific initialization */ - - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32/stm32f411-minimum/src/stm32_usbmsc.c b/boards/arm/stm32/stm32f411-minimum/src/stm32_usbmsc.c index 2da1cf2f75f..19084231667 100644 --- a/boards/arm/stm32/stm32f411-minimum/src/stm32_usbmsc.c +++ b/boards/arm/stm32/stm32f411-minimum/src/stm32_usbmsc.c @@ -59,8 +59,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/stm32/stm32f411e-disco/src/CMakeLists.txt b/boards/arm/stm32/stm32f411e-disco/src/CMakeLists.txt index d140063b28f..9f3433d0cc8 100644 --- a/boards/arm/stm32/stm32f411e-disco/src/CMakeLists.txt +++ b/boards/arm/stm32/stm32f411e-disco/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS stm32_boot.c stm32_bringup.c) -if(CONFIG_NSH_LIBRARY) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_STM32_OTGFS) list(APPEND SRCS stm32_usb.c) endif() diff --git a/boards/arm/stm32/stm32f411e-disco/src/Make.defs b/boards/arm/stm32/stm32f411e-disco/src/Make.defs index d848bee82f8..cff6ead802f 100644 --- a/boards/arm/stm32/stm32f411e-disco/src/Make.defs +++ b/boards/arm/stm32/stm32f411e-disco/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = stm32_boot.c stm32_bringup.c -ifeq ($(CONFIG_NSH_LIBRARY),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif diff --git a/boards/arm/stm32/stm32f411e-disco/src/stm32_appinit.c b/boards/arm/stm32/stm32f411e-disco/src/stm32_appinit.c deleted file mode 100644 index c4ae8f7ad2f..00000000000 --- a/boards/arm/stm32/stm32f411e-disco/src/stm32_appinit.c +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/stm32f411e-disco/src/stm32_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 - -#include -#include -#include - -#include -#include - -#include -#include - -#include - -#include "stm32f411e-disco.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-specific initialization */ - - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32/stm32f429i-disco/src/CMakeLists.txt b/boards/arm/stm32/stm32f429i-disco/src/CMakeLists.txt index 5bee3e74ff4..fa9314f019b 100644 --- a/boards/arm/stm32/stm32f429i-disco/src/CMakeLists.txt +++ b/boards/arm/stm32/stm32f429i-disco/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ARCH_IDLE_CUSTOM) list(APPEND SRCS stm32_idle.c) endif() diff --git a/boards/arm/stm32/stm32f429i-disco/src/Make.defs b/boards/arm/stm32/stm32f429i-disco/src/Make.defs index bf6450fd8b3..5b7dd1fcbd2 100644 --- a/boards/arm/stm32/stm32f429i-disco/src/Make.defs +++ b/boards/arm/stm32/stm32f429i-disco/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ARCH_IDLE_CUSTOM),y) CSRCS += stm32_idle.c endif diff --git a/boards/arm/stm32/stm32f429i-disco/src/stm32_appinit.c b/boards/arm/stm32/stm32f429i-disco/src/stm32_appinit.c deleted file mode 100644 index 34da37bf689..00000000000 --- a/boards/arm/stm32/stm32f429i-disco/src/stm32_appinit.c +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/stm32f429i-disco/src/stm32_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 - -#include - -#include - -#include "stm32f429i-disco.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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/stm32/stm32f4discovery/configs/mpr121_keypad/defconfig b/boards/arm/stm32/stm32f4discovery/configs/mpr121_keypad/defconfig index 8090b5152f0..c6b607db287 100644 --- a/boards/arm/stm32/stm32f4discovery/configs/mpr121_keypad/defconfig +++ b/boards/arm/stm32/stm32f4discovery/configs/mpr121_keypad/defconfig @@ -17,7 +17,6 @@ CONFIG_ARCH_CHIP="stm32" CONFIG_ARCH_CHIP_STM32=y CONFIG_ARCH_CHIP_STM32F407VG=y CONFIG_ARCH_STACKDUMP=y -CONFIG_BOARD_LATE_INITIALIZE=y CONFIG_BOARD_LOOPSPERMSEC=16717 CONFIG_BUILTIN=y CONFIG_DEBUG_FEATURES=y diff --git a/boards/arm/stm32/stm32f4discovery/configs/st7567/defconfig b/boards/arm/stm32/stm32f4discovery/configs/st7567/defconfig index aa0080aa318..88af267d2b6 100644 --- a/boards/arm/stm32/stm32f4discovery/configs/st7567/defconfig +++ b/boards/arm/stm32/stm32f4discovery/configs/st7567/defconfig @@ -16,7 +16,6 @@ CONFIG_ARCH_CHIP="stm32" CONFIG_ARCH_CHIP_STM32=y CONFIG_ARCH_CHIP_STM32F407VG=y CONFIG_ARCH_STACKDUMP=y -CONFIG_BOARD_LATE_INITIALIZE=y CONFIG_BOARD_LOOPSPERMSEC=16717 CONFIG_BUILTIN=y CONFIG_DRIVERS_VIDEO=y diff --git a/boards/arm/stm32/stm32f4discovery/src/CMakeLists.txt b/boards/arm/stm32/stm32f4discovery/src/CMakeLists.txt index 2784309d2c1..e56c3f35a7d 100644 --- a/boards/arm/stm32/stm32f4discovery/src/CMakeLists.txt +++ b/boards/arm/stm32/stm32f4discovery/src/CMakeLists.txt @@ -92,11 +92,8 @@ if(CONFIG_PWM) list(APPEND SRCS stm32_pwm.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) - if(CONFIG_BOARDCTL_RESET) - list(APPEND SRCS stm32_reset.c) - endif() +if(CONFIG_BOARDCTL_RESET) + list(APPEND SRCS stm32_reset.c) endif() if(CONFIG_ARCH_CUSTOM_PMINIT) diff --git a/boards/arm/stm32/stm32f4discovery/src/Make.defs b/boards/arm/stm32/stm32f4discovery/src/Make.defs index e8060c2ca42..d4a14a5c9f1 100644 --- a/boards/arm/stm32/stm32f4discovery/src/Make.defs +++ b/boards/arm/stm32/stm32f4discovery/src/Make.defs @@ -98,12 +98,9 @@ ifeq ($(CONFIG_CAPTURE),y) CSRCS += stm32_capture.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c ifeq ($(CONFIG_BOARDCTL_RESET),y) CSRCS += stm32_reset.c endif -endif ifeq ($(CONFIG_ARCH_CUSTOM_PMINIT),y) CSRCS += stm32_pm.c diff --git a/boards/arm/stm32/stm32f4discovery/src/stm32_appinit.c b/boards/arm/stm32/stm32f4discovery/src/stm32_appinit.c deleted file mode 100644 index 06034540d4a..00000000000 --- a/boards/arm/stm32/stm32f4discovery/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/stm32f4discovery/src/stm32_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 - -#include -#include - -#include "stm32f4discovery.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/stm32f4discovery/src/stm32_usbmsc.c b/boards/arm/stm32/stm32f4discovery/src/stm32_usbmsc.c index 5437f1a47c2..d4afdc4e95e 100644 --- a/boards/arm/stm32/stm32f4discovery/src/stm32_usbmsc.c +++ b/boards/arm/stm32/stm32f4discovery/src/stm32_usbmsc.c @@ -59,8 +59,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/stm32/stm32ldiscovery/src/CMakeLists.txt b/boards/arm/stm32/stm32ldiscovery/src/CMakeLists.txt index 4fcff170931..feae2b53ca1 100644 --- a/boards/arm/stm32/stm32ldiscovery/src/CMakeLists.txt +++ b/boards/arm/stm32/stm32ldiscovery/src/CMakeLists.txt @@ -40,10 +40,6 @@ if(CONFIG_PWM) list(APPEND SRCS stm32_pwm.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_ARCH_CHIP_STM32L152RB) diff --git a/boards/arm/stm32/stm32ldiscovery/src/Make.defs b/boards/arm/stm32/stm32ldiscovery/src/Make.defs index c9fd4a64a3c..0a07db0a932 100644 --- a/boards/arm/stm32/stm32ldiscovery/src/Make.defs +++ b/boards/arm/stm32/stm32ldiscovery/src/Make.defs @@ -42,10 +42,6 @@ ifeq ($(CONFIG_PWM),y) CSRCS += stm32_pwm.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/arm/stm32/stm32ldiscovery/src/stm32_appinit.c b/boards/arm/stm32/stm32ldiscovery/src/stm32_appinit.c deleted file mode 100644 index ad8cd3649cf..00000000000 --- a/boards/arm/stm32/stm32ldiscovery/src/stm32_appinit.c +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/stm32ldiscovery/src/stm32_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 - -#include -#include - -#include "stm32ldiscovery.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 here */ - - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32/stm32ldiscovery/src/stm32_boot.c b/boards/arm/stm32/stm32ldiscovery/src/stm32_boot.c index 90c611a616b..701fdbd303c 100644 --- a/boards/arm/stm32/stm32ldiscovery/src/stm32_boot.c +++ b/boards/arm/stm32/stm32ldiscovery/src/stm32_boot.c @@ -86,10 +86,6 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform board initialization here instead of from the - * board_app_initialize(). - */ - stm32_bringup(); } #endif diff --git a/boards/arm/stm32/stm32ldiscovery/src/stm32ldiscovery.h b/boards/arm/stm32/stm32ldiscovery/src/stm32ldiscovery.h index 378a2e3805a..a3ef72b7265 100644 --- a/boards/arm/stm32/stm32ldiscovery/src/stm32ldiscovery.h +++ b/boards/arm/stm32/stm32ldiscovery/src/stm32ldiscovery.h @@ -237,12 +237,7 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * * Otherwise, bad news: Never called diff --git a/boards/arm/stm32/stm32vldiscovery/src/CMakeLists.txt b/boards/arm/stm32/stm32vldiscovery/src/CMakeLists.txt index 630393344be..ee0a0879fca 100644 --- a/boards/arm/stm32/stm32vldiscovery/src/CMakeLists.txt +++ b/boards/arm/stm32/stm32vldiscovery/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS stm32_boot.c stm32_bringup.c stm32_leds.c stm32_buttons.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT diff --git a/boards/arm/stm32/stm32vldiscovery/src/Make.defs b/boards/arm/stm32/stm32vldiscovery/src/Make.defs index 84e41f01c96..9eef1f9e16d 100644 --- a/boards/arm/stm32/stm32vldiscovery/src/Make.defs +++ b/boards/arm/stm32/stm32vldiscovery/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = stm32_boot.c stm32_bringup.c stm32_leds.c stm32_buttons.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/arm/stm32/stm32vldiscovery/src/stm32_appinit.c b/boards/arm/stm32/stm32vldiscovery/src/stm32_appinit.c deleted file mode 100644 index 7d55230ed07..00000000000 --- a/boards/arm/stm32/stm32vldiscovery/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/stm32vldiscovery/src/stm32_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 - -#include -#include - -#include "stm32vldiscovery.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/viewtool-stm32f107/src/CMakeLists.txt b/boards/arm/stm32/viewtool-stm32f107/src/CMakeLists.txt index 73b70821463..c994fa4536c 100644 --- a/boards/arm/stm32/viewtool-stm32f107/src/CMakeLists.txt +++ b/boards/arm/stm32/viewtool-stm32f107/src/CMakeLists.txt @@ -46,10 +46,6 @@ if(CONFIG_LCD_SSD1289) list(APPEND SRCS stm32_ssd1289.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_USBMSC) list(APPEND SRCS stm32_usbmsc.c) endif() diff --git a/boards/arm/stm32/viewtool-stm32f107/src/Make.defs b/boards/arm/stm32/viewtool-stm32f107/src/Make.defs index 341a7a8d870..260a9270b30 100644 --- a/boards/arm/stm32/viewtool-stm32f107/src/Make.defs +++ b/boards/arm/stm32/viewtool-stm32f107/src/Make.defs @@ -48,10 +48,6 @@ ifeq ($(CONFIG_LCD_SSD1289),y) # F103 CSRCS += stm32_ssd1289.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_USBMSC),y) CSRCS += stm32_usbmsc.c endif diff --git a/boards/arm/stm32/viewtool-stm32f107/src/stm32_appinit.c b/boards/arm/stm32/viewtool-stm32f107/src/stm32_appinit.c deleted file mode 100644 index 11137732078..00000000000 --- a/boards/arm/stm32/viewtool-stm32f107/src/stm32_appinit.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32/viewtool-stm32f107/src/stm32_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 - -#include -#include - -#include "viewtool_stm32f107.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32/viewtool-stm32f107/src/stm32_usbmsc.c b/boards/arm/stm32/viewtool-stm32f107/src/stm32_usbmsc.c index 81167f07a26..015af8a323d 100644 --- a/boards/arm/stm32/viewtool-stm32f107/src/stm32_usbmsc.c +++ b/boards/arm/stm32/viewtool-stm32f107/src/stm32_usbmsc.c @@ -61,8 +61,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/CMakeLists.txt b/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/CMakeLists.txt index d1907db6233..133c3298bce 100644 --- a/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/CMakeLists.txt +++ b/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_STM32F0L0G0_SPI) list(APPEND SRCS stm32_spi.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_LPWAN_SX127X) list(APPEND SRCS stm32_sx127x.c) endif() diff --git a/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/Make.defs b/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/Make.defs index 3471923bbeb..c1646dd2d1c 100644 --- a/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/Make.defs +++ b/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/Make.defs @@ -38,10 +38,6 @@ ifeq ($(CONFIG_STM32F0L0G0_SPI),y) CSRCS += stm32_spi.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_LPWAN_SX127X),y) CSRCS += stm32_sx127x.c endif diff --git a/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/stm32_appinit.c b/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/stm32_appinit.c deleted file mode 100644 index 08b01b9cfc6..00000000000 --- a/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/stm32_appinit.c +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/stm32_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 - -#include -#include - -#include -#include - -#include "b-l072z-lrwan1.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/stm32_boot.c b/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/stm32_boot.c index b79a7a810d3..3df42fb83cb 100644 --- a/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/stm32_boot.c +++ b/boards/arm/stm32f0l0g0/b-l072z-lrwan1/src/stm32_boot.c @@ -96,6 +96,6 @@ void board_late_initialize(void) { /* Perform board-specific initialization */ - nrf52_bringup(); + stm32_bringup(); } #endif diff --git a/boards/arm/stm32f0l0g0/nucleo-c071rb/configs/adcscope/defconfig b/boards/arm/stm32f0l0g0/nucleo-c071rb/configs/adcscope/defconfig index 003ae422ea1..54dc06b209b 100644 --- a/boards/arm/stm32f0l0g0/nucleo-c071rb/configs/adcscope/defconfig +++ b/boards/arm/stm32f0l0g0/nucleo-c071rb/configs/adcscope/defconfig @@ -22,7 +22,6 @@ CONFIG_ARCH_IRQBUTTONS=y CONFIG_ARCH_STACKDUMP=y CONFIG_BOARDCTL=y CONFIG_BOARDCTL_MKRD=y -CONFIG_BOARD_LATE_INITIALIZE=y CONFIG_BOARD_LOOPSPERMSEC=3997 CONFIG_BUILTIN=y CONFIG_DEBUG_ASSERTIONS=y diff --git a/boards/arm/stm32f0l0g0/nucleo-c071rb/src/CMakeLists.txt b/boards/arm/stm32f0l0g0/nucleo-c071rb/src/CMakeLists.txt index 03e5b9efe0a..2d327d8c106 100644 --- a/boards/arm/stm32f0l0g0/nucleo-c071rb/src/CMakeLists.txt +++ b/boards/arm/stm32f0l0g0/nucleo-c071rb/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ADC) list(APPEND SRCS stm32_adc.c) endif() diff --git a/boards/arm/stm32f0l0g0/nucleo-c071rb/src/Make.defs b/boards/arm/stm32f0l0g0/nucleo-c071rb/src/Make.defs index 7b4bb3362e5..a89ade51216 100644 --- a/boards/arm/stm32f0l0g0/nucleo-c071rb/src/Make.defs +++ b/boards/arm/stm32f0l0g0/nucleo-c071rb/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += stm32_adc.c endif diff --git a/boards/arm/stm32f0l0g0/nucleo-c071rb/src/stm32_appinit.c b/boards/arm/stm32f0l0g0/nucleo-c071rb/src/stm32_appinit.c deleted file mode 100644 index 0c47cb1ad21..00000000000 --- a/boards/arm/stm32f0l0g0/nucleo-c071rb/src/stm32_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f0l0g0/nucleo-c071rb/src/stm32_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 - -#include - -#include - -#include "nucleo-c071rb.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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32f0l0g0/nucleo-c071rb/src/stm32_boot.c b/boards/arm/stm32f0l0g0/nucleo-c071rb/src/stm32_boot.c index 173717fab65..b12a1c64a71 100644 --- a/boards/arm/stm32f0l0g0/nucleo-c071rb/src/stm32_boot.c +++ b/boards/arm/stm32f0l0g0/nucleo-c071rb/src/stm32_boot.c @@ -78,10 +78,6 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform board bring-up here instead of from the - * board_app_initialize(). - */ - stm32_bringup(); } #endif diff --git a/boards/arm/stm32f0l0g0/nucleo-c092rc/src/CMakeLists.txt b/boards/arm/stm32f0l0g0/nucleo-c092rc/src/CMakeLists.txt index 63782e9618a..163b6d6bb7c 100644 --- a/boards/arm/stm32f0l0g0/nucleo-c092rc/src/CMakeLists.txt +++ b/boards/arm/stm32f0l0g0/nucleo-c092rc/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ADC) list(APPEND SRCS stm32_adc.c) endif() diff --git a/boards/arm/stm32f0l0g0/nucleo-c092rc/src/Make.defs b/boards/arm/stm32f0l0g0/nucleo-c092rc/src/Make.defs index 8c4bb580a14..aa1ef146219 100644 --- a/boards/arm/stm32f0l0g0/nucleo-c092rc/src/Make.defs +++ b/boards/arm/stm32f0l0g0/nucleo-c092rc/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += stm32_adc.c endif diff --git a/boards/arm/stm32f0l0g0/nucleo-c092rc/src/stm32_appinit.c b/boards/arm/stm32f0l0g0/nucleo-c092rc/src/stm32_appinit.c deleted file mode 100644 index ebeba085b0f..00000000000 --- a/boards/arm/stm32f0l0g0/nucleo-c092rc/src/stm32_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f0l0g0/nucleo-c092rc/src/stm32_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 - -#include - -#include - -#include "nucleo-c092rc.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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32f0l0g0/nucleo-c092rc/src/stm32_boot.c b/boards/arm/stm32f0l0g0/nucleo-c092rc/src/stm32_boot.c index 2cc4354d6b0..ceb6af10047 100644 --- a/boards/arm/stm32f0l0g0/nucleo-c092rc/src/stm32_boot.c +++ b/boards/arm/stm32f0l0g0/nucleo-c092rc/src/stm32_boot.c @@ -78,10 +78,6 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform board bring-up here instead of from the - * board_app_initialize(). - */ - stm32_bringup(); } #endif diff --git a/boards/arm/stm32f0l0g0/nucleo-f072rb/src/CMakeLists.txt b/boards/arm/stm32f0l0g0/nucleo-f072rb/src/CMakeLists.txt index 0147d82ff10..16d4ed14c12 100644 --- a/boards/arm/stm32f0l0g0/nucleo-f072rb/src/CMakeLists.txt +++ b/boards/arm/stm32f0l0g0/nucleo-f072rb/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld") diff --git a/boards/arm/stm32f0l0g0/nucleo-f072rb/src/Make.defs b/boards/arm/stm32f0l0g0/nucleo-f072rb/src/Make.defs index 3d26c7d4de8..27aae3fb3b1 100644 --- a/boards/arm/stm32f0l0g0/nucleo-f072rb/src/Make.defs +++ b/boards/arm/stm32f0l0g0/nucleo-f072rb/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/arm/stm32f0l0g0/nucleo-f072rb/src/stm32_appinit.c b/boards/arm/stm32f0l0g0/nucleo-f072rb/src/stm32_appinit.c deleted file mode 100644 index 78edbf9a6b5..00000000000 --- a/boards/arm/stm32f0l0g0/nucleo-f072rb/src/stm32_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f0l0g0/nucleo-f072rb/src/stm32_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 - -#include - -#include - -#include "nucleo-f072rb.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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32f0l0g0/nucleo-f091rc/src/CMakeLists.txt b/boards/arm/stm32f0l0g0/nucleo-f091rc/src/CMakeLists.txt index e2bac8bc110..bfafa31ee78 100644 --- a/boards/arm/stm32f0l0g0/nucleo-f091rc/src/CMakeLists.txt +++ b/boards/arm/stm32f0l0g0/nucleo-f091rc/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_STM32F0L0G0_SPI) list(APPEND SRCS stm32_spi.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_LPWAN_SX127X) list(APPEND SRCS stm32_sx127x.c) endif() diff --git a/boards/arm/stm32f0l0g0/nucleo-f091rc/src/Make.defs b/boards/arm/stm32f0l0g0/nucleo-f091rc/src/Make.defs index 878be9be5ab..b455d3605ef 100644 --- a/boards/arm/stm32f0l0g0/nucleo-f091rc/src/Make.defs +++ b/boards/arm/stm32f0l0g0/nucleo-f091rc/src/Make.defs @@ -38,10 +38,6 @@ ifeq ($(CONFIG_STM32F0L0G0_SPI),y) CSRCS += stm32_spi.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_LPWAN_SX127X),y) CSRCS += stm32_sx127x.c endif diff --git a/boards/arm/stm32f0l0g0/nucleo-f091rc/src/stm32_appinit.c b/boards/arm/stm32f0l0g0/nucleo-f091rc/src/stm32_appinit.c deleted file mode 100644 index 0c0c4bd5e3f..00000000000 --- a/boards/arm/stm32f0l0g0/nucleo-f091rc/src/stm32_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f0l0g0/nucleo-f091rc/src/stm32_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 - -#include - -#include - -#include "nucleo-f091rc.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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32f0l0g0/nucleo-g070rb/src/CMakeLists.txt b/boards/arm/stm32f0l0g0/nucleo-g070rb/src/CMakeLists.txt index c0ce3a9391d..08d07dd22c1 100644 --- a/boards/arm/stm32f0l0g0/nucleo-g070rb/src/CMakeLists.txt +++ b/boards/arm/stm32f0l0g0/nucleo-g070rb/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_DEV_GPIO) list(APPEND SRCS stm32_gpio.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_PWM) list(APPEND SRCS stm32_pwm.c) endif() diff --git a/boards/arm/stm32f0l0g0/nucleo-g070rb/src/Make.defs b/boards/arm/stm32f0l0g0/nucleo-g070rb/src/Make.defs index cec0ba4489d..3fcfafcf17f 100644 --- a/boards/arm/stm32f0l0g0/nucleo-g070rb/src/Make.defs +++ b/boards/arm/stm32f0l0g0/nucleo-g070rb/src/Make.defs @@ -38,10 +38,6 @@ ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += stm32_gpio.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_PWM),y) CSRCS += stm32_pwm.c endif diff --git a/boards/arm/stm32f0l0g0/nucleo-g070rb/src/stm32_appinit.c b/boards/arm/stm32f0l0g0/nucleo-g070rb/src/stm32_appinit.c deleted file mode 100644 index abcf90dc0c6..00000000000 --- a/boards/arm/stm32f0l0g0/nucleo-g070rb/src/stm32_appinit.c +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f0l0g0/nucleo-g070rb/src/stm32_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 - -#include -#include - -#include -#include - -#include "nucleo-g070rb.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32f0l0g0/nucleo-g070rb/src/stm32_boot.c b/boards/arm/stm32f0l0g0/nucleo-g070rb/src/stm32_boot.c index bb3ff68695c..7783acec8ab 100644 --- a/boards/arm/stm32f0l0g0/nucleo-g070rb/src/stm32_boot.c +++ b/boards/arm/stm32f0l0g0/nucleo-g070rb/src/stm32_boot.c @@ -78,10 +78,6 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform board bring-up here instead of from the - * board_app_initialize(). - */ - stm32_bringup(); } #endif diff --git a/boards/arm/stm32f0l0g0/nucleo-g070rb/src/stm32_bringup.c b/boards/arm/stm32f0l0g0/nucleo-g070rb/src/stm32_bringup.c index 95b7f55b6a7..4d21f1918ae 100644 --- a/boards/arm/stm32f0l0g0/nucleo-g070rb/src/stm32_bringup.c +++ b/boards/arm/stm32f0l0g0/nucleo-g070rb/src/stm32_bringup.c @@ -123,10 +123,6 @@ static void stm32_i2ctool(void) * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y - * && CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void) diff --git a/boards/arm/stm32f0l0g0/nucleo-g071rb/src/CMakeLists.txt b/boards/arm/stm32f0l0g0/nucleo-g071rb/src/CMakeLists.txt index 9f59398f374..b0e6eae77fb 100644 --- a/boards/arm/stm32f0l0g0/nucleo-g071rb/src/CMakeLists.txt +++ b/boards/arm/stm32f0l0g0/nucleo-g071rb/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/ld.script") diff --git a/boards/arm/stm32f0l0g0/nucleo-g071rb/src/Make.defs b/boards/arm/stm32f0l0g0/nucleo-g071rb/src/Make.defs index 6819c489881..75e78e8bc72 100644 --- a/boards/arm/stm32f0l0g0/nucleo-g071rb/src/Make.defs +++ b/boards/arm/stm32f0l0g0/nucleo-g071rb/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/arm/stm32f0l0g0/nucleo-g071rb/src/stm32_appinit.c b/boards/arm/stm32f0l0g0/nucleo-g071rb/src/stm32_appinit.c deleted file mode 100644 index 5a1eea5def6..00000000000 --- a/boards/arm/stm32f0l0g0/nucleo-g071rb/src/stm32_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f0l0g0/nucleo-g071rb/src/stm32_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 - -#include -#include - -#include -#include - -#include "nucleo-g071rb.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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32f0l0g0/nucleo-g0b1re/src/CMakeLists.txt b/boards/arm/stm32f0l0g0/nucleo-g0b1re/src/CMakeLists.txt index 17b4bbcbc49..f6843c176e1 100644 --- a/boards/arm/stm32f0l0g0/nucleo-g0b1re/src/CMakeLists.txt +++ b/boards/arm/stm32f0l0g0/nucleo-g0b1re/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/ld.script") diff --git a/boards/arm/stm32f0l0g0/nucleo-g0b1re/src/Make.defs b/boards/arm/stm32f0l0g0/nucleo-g0b1re/src/Make.defs index 79545c290c2..b3019b82f54 100644 --- a/boards/arm/stm32f0l0g0/nucleo-g0b1re/src/Make.defs +++ b/boards/arm/stm32f0l0g0/nucleo-g0b1re/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += stm32_adc.c endif diff --git a/boards/arm/stm32f0l0g0/nucleo-g0b1re/src/stm32_appinit.c b/boards/arm/stm32f0l0g0/nucleo-g0b1re/src/stm32_appinit.c deleted file mode 100644 index 6f8bc76d695..00000000000 --- a/boards/arm/stm32f0l0g0/nucleo-g0b1re/src/stm32_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f0l0g0/nucleo-g0b1re/src/stm32_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 - -#include -#include - -#include -#include - -#include "nucleo-g0b1re.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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32f0l0g0/nucleo-l073rz/src/CMakeLists.txt b/boards/arm/stm32f0l0g0/nucleo-l073rz/src/CMakeLists.txt index 9099f537571..c14a6c35881 100644 --- a/boards/arm/stm32f0l0g0/nucleo-l073rz/src/CMakeLists.txt +++ b/boards/arm/stm32f0l0g0/nucleo-l073rz/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_STM32F0L0G0_SPI) list(APPEND SRCS stm32_spi.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_WL_NRF24L01) list(APPEND SRCS stm32_nrf24l01.c) endif() diff --git a/boards/arm/stm32f0l0g0/nucleo-l073rz/src/Make.defs b/boards/arm/stm32f0l0g0/nucleo-l073rz/src/Make.defs index 805bf1223c3..bd4f63065bd 100644 --- a/boards/arm/stm32f0l0g0/nucleo-l073rz/src/Make.defs +++ b/boards/arm/stm32f0l0g0/nucleo-l073rz/src/Make.defs @@ -38,10 +38,6 @@ ifeq ($(CONFIG_STM32F0L0G0_SPI),y) CSRCS += stm32_spi.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_WL_NRF24L01),y) CSRCS += stm32_nrf24l01.c endif diff --git a/boards/arm/stm32f0l0g0/nucleo-l073rz/src/stm32_appinit.c b/boards/arm/stm32f0l0g0/nucleo-l073rz/src/stm32_appinit.c deleted file mode 100644 index a7810109309..00000000000 --- a/boards/arm/stm32f0l0g0/nucleo-l073rz/src/stm32_appinit.c +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f0l0g0/nucleo-l073rz/src/stm32_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 - -#include -#include - -#include -#include - -#include "nucleo-l073rz.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32f0l0g0/stm32f051-discovery/src/CMakeLists.txt b/boards/arm/stm32f0l0g0/stm32f051-discovery/src/CMakeLists.txt index e38b6f9f172..185c0672fed 100644 --- a/boards/arm/stm32f0l0g0/stm32f051-discovery/src/CMakeLists.txt +++ b/boards/arm/stm32f0l0g0/stm32f051-discovery/src/CMakeLists.txt @@ -44,10 +44,6 @@ if(CONFIG_SENSORS_QENCODER) list(APPEND SRCS stm32_qencoder.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld") diff --git a/boards/arm/stm32f0l0g0/stm32f051-discovery/src/Make.defs b/boards/arm/stm32f0l0g0/stm32f051-discovery/src/Make.defs index 96b350843f7..520a4c8e891 100644 --- a/boards/arm/stm32f0l0g0/stm32f051-discovery/src/Make.defs +++ b/boards/arm/stm32f0l0g0/stm32f051-discovery/src/Make.defs @@ -46,10 +46,6 @@ ifeq ($(CONFIG_SENSORS_QENCODER),y) CSRCS += stm32_qencoder.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/arm/stm32f0l0g0/stm32f051-discovery/src/stm32_appinit.c b/boards/arm/stm32f0l0g0/stm32f051-discovery/src/stm32_appinit.c deleted file mode 100644 index 2c02e4c6a05..00000000000 --- a/boards/arm/stm32f0l0g0/stm32f051-discovery/src/stm32_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f0l0g0/stm32f051-discovery/src/stm32_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 - -#include - -#include - -#include "stm32f051-discovery.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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32f0l0g0/stm32f072-discovery/src/CMakeLists.txt b/boards/arm/stm32f0l0g0/stm32f072-discovery/src/CMakeLists.txt index 4e1e1b9fe7a..0475024980b 100644 --- a/boards/arm/stm32f0l0g0/stm32f072-discovery/src/CMakeLists.txt +++ b/boards/arm/stm32f0l0g0/stm32f072-discovery/src/CMakeLists.txt @@ -44,10 +44,6 @@ if(CONFIG_SENSORS_QENCODER) list(APPEND SRCS stm32_qencoder.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld") diff --git a/boards/arm/stm32f0l0g0/stm32f072-discovery/src/Make.defs b/boards/arm/stm32f0l0g0/stm32f072-discovery/src/Make.defs index 586a1755db7..2963ffd2ae2 100644 --- a/boards/arm/stm32f0l0g0/stm32f072-discovery/src/Make.defs +++ b/boards/arm/stm32f0l0g0/stm32f072-discovery/src/Make.defs @@ -46,10 +46,6 @@ ifeq ($(CONFIG_SENSORS_QENCODER),y) CSRCS += stm32_qencoder.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/arm/stm32f0l0g0/stm32f072-discovery/src/stm32_appinit.c b/boards/arm/stm32f0l0g0/stm32f072-discovery/src/stm32_appinit.c deleted file mode 100644 index ae8da4cc6d0..00000000000 --- a/boards/arm/stm32f0l0g0/stm32f072-discovery/src/stm32_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f0l0g0/stm32f072-discovery/src/stm32_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 - -#include - -#include - -#include "stm32f072-discovery.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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32f0l0g0/stm32g071b-disco/src/CMakeLists.txt b/boards/arm/stm32f0l0g0/stm32g071b-disco/src/CMakeLists.txt index 296de8b597b..88d162b1679 100644 --- a/boards/arm/stm32f0l0g0/stm32g071b-disco/src/CMakeLists.txt +++ b/boards/arm/stm32f0l0g0/stm32g071b-disco/src/CMakeLists.txt @@ -27,10 +27,6 @@ if(CONFIG_USERLED) list(APPEND SRCS stm32_userleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_SPI) list(APPEND SRCS stm32_spi.c) endif() diff --git a/boards/arm/stm32f0l0g0/stm32g071b-disco/src/Make.defs b/boards/arm/stm32f0l0g0/stm32g071b-disco/src/Make.defs index 65651fe2b67..1f012b2515c 100644 --- a/boards/arm/stm32f0l0g0/stm32g071b-disco/src/Make.defs +++ b/boards/arm/stm32f0l0g0/stm32g071b-disco/src/Make.defs @@ -29,10 +29,6 @@ ifeq ($(CONFIG_USERLED),y) CSRCS += stm32_userleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_SPI),y) CSRCS += stm32_spi.c endif diff --git a/boards/arm/stm32f0l0g0/stm32g071b-disco/src/stm32_appinit.c b/boards/arm/stm32f0l0g0/stm32g071b-disco/src/stm32_appinit.c deleted file mode 100644 index 7469dfc2d56..00000000000 --- a/boards/arm/stm32f0l0g0/stm32g071b-disco/src/stm32_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f0l0g0/stm32g071b-disco/src/stm32_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 - -#include - -#include "stm32g071b-disco.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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32f0l0g0/stm32l0538-disco/src/CMakeLists.txt b/boards/arm/stm32f0l0g0/stm32l0538-disco/src/CMakeLists.txt index 08d6dc7bcb5..2d3a59a01db 100644 --- a/boards/arm/stm32f0l0g0/stm32l0538-disco/src/CMakeLists.txt +++ b/boards/arm/stm32f0l0g0/stm32l0538-disco/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/ld.script") diff --git a/boards/arm/stm32f0l0g0/stm32l0538-disco/src/Make.defs b/boards/arm/stm32f0l0g0/stm32l0538-disco/src/Make.defs index df59ca7a7d6..502d059a105 100644 --- a/boards/arm/stm32f0l0g0/stm32l0538-disco/src/Make.defs +++ b/boards/arm/stm32f0l0g0/stm32l0538-disco/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/arm/stm32f0l0g0/stm32l0538-disco/src/stm32_appinit.c b/boards/arm/stm32f0l0g0/stm32l0538-disco/src/stm32_appinit.c deleted file mode 100644 index 6b9820f21d5..00000000000 --- a/boards/arm/stm32f0l0g0/stm32l0538-disco/src/stm32_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f0l0g0/stm32l0538-disco/src/stm32_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 - -#include - -#include "stm32l0538-disco.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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32f7/nucleo-f722ze/src/CMakeLists.txt b/boards/arm/stm32f7/nucleo-f722ze/src/CMakeLists.txt index 8cb11323474..f8b17eb732e 100644 --- a/boards/arm/stm32f7/nucleo-f722ze/src/CMakeLists.txt +++ b/boards/arm/stm32f7/nucleo-f722ze/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_DEV_GPIO) list(APPEND SRCS stm32_gpio.c) endif() diff --git a/boards/arm/stm32f7/nucleo-f722ze/src/Make.defs b/boards/arm/stm32f7/nucleo-f722ze/src/Make.defs index abc77c03203..084c954afc3 100644 --- a/boards/arm/stm32f7/nucleo-f722ze/src/Make.defs +++ b/boards/arm/stm32f7/nucleo-f722ze/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += stm32_gpio.c endif diff --git a/boards/arm/stm32f7/nucleo-f722ze/src/nucleo-f722ze.h b/boards/arm/stm32f7/nucleo-f722ze/src/nucleo-f722ze.h index af3cb8e902d..1db1e63552c 100644 --- a/boards/arm/stm32f7/nucleo-f722ze/src/nucleo-f722ze.h +++ b/boards/arm/stm32f7/nucleo-f722ze/src/nucleo-f722ze.h @@ -204,16 +204,9 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * - * Otherwise, bad news: Never called - * ****************************************************************************/ int stm32_bringup(void); diff --git a/boards/arm/stm32f7/nucleo-f722ze/src/stm32_appinitialize.c b/boards/arm/stm32f7/nucleo-f722ze/src/stm32_appinitialize.c deleted file mode 100644 index 6c82fbcecb4..00000000000 --- a/boards/arm/stm32f7/nucleo-f722ze/src/stm32_appinitialize.c +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f7/nucleo-f722ze/src/stm32_appinitialize.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 -#include - -#include "nucleo-f722ze.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board-specific initialization */ - - return stm32_bringup(); -#else - return OK; -#endif -} - -#endif - diff --git a/boards/arm/stm32f7/nucleo-f746zg/src/CMakeLists.txt b/boards/arm/stm32f7/nucleo-f746zg/src/CMakeLists.txt index 68d09c3d171..73a308ecf1c 100644 --- a/boards/arm/stm32f7/nucleo-f746zg/src/CMakeLists.txt +++ b/boards/arm/stm32f7/nucleo-f746zg/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_DEV_GPIO) list(APPEND SRCS stm32_gpio.c) endif() diff --git a/boards/arm/stm32f7/nucleo-f746zg/src/Make.defs b/boards/arm/stm32f7/nucleo-f746zg/src/Make.defs index 49783595c96..92eaf789e58 100644 --- a/boards/arm/stm32f7/nucleo-f746zg/src/Make.defs +++ b/boards/arm/stm32f7/nucleo-f746zg/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += stm32_gpio.c endif diff --git a/boards/arm/stm32f7/nucleo-f746zg/src/nucleo-f746zg.h b/boards/arm/stm32f7/nucleo-f746zg/src/nucleo-f746zg.h index 753ec9a2c32..a71f98a2c34 100644 --- a/boards/arm/stm32f7/nucleo-f746zg/src/nucleo-f746zg.h +++ b/boards/arm/stm32f7/nucleo-f746zg/src/nucleo-f746zg.h @@ -204,16 +204,9 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * - * Otherwise, bad news: Never called - * ****************************************************************************/ int stm32_bringup(void); diff --git a/boards/arm/stm32f7/nucleo-f746zg/src/stm32_appinitialize.c b/boards/arm/stm32f7/nucleo-f746zg/src/stm32_appinitialize.c deleted file mode 100644 index a158fe21c92..00000000000 --- a/boards/arm/stm32f7/nucleo-f746zg/src/stm32_appinitialize.c +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f7/nucleo-f746zg/src/stm32_appinitialize.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 -#include - -#include "nucleo-f746zg.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board-specific initialization */ - - return stm32_bringup(); -#else - return OK; -#endif -} - -#endif - diff --git a/boards/arm/stm32f7/nucleo-f767zi/src/CMakeLists.txt b/boards/arm/stm32f7/nucleo-f767zi/src/CMakeLists.txt index 8cdbe6dc369..28d7f560bef 100644 --- a/boards/arm/stm32f7/nucleo-f767zi/src/CMakeLists.txt +++ b/boards/arm/stm32f7/nucleo-f767zi/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_DEV_GPIO) list(APPEND SRCS stm32_gpio.c) endif() diff --git a/boards/arm/stm32f7/nucleo-f767zi/src/Make.defs b/boards/arm/stm32f7/nucleo-f767zi/src/Make.defs index 54554d97808..b4c24d64fec 100644 --- a/boards/arm/stm32f7/nucleo-f767zi/src/Make.defs +++ b/boards/arm/stm32f7/nucleo-f767zi/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += stm32_gpio.c endif diff --git a/boards/arm/stm32f7/nucleo-f767zi/src/nucleo-f767zi.h b/boards/arm/stm32f7/nucleo-f767zi/src/nucleo-f767zi.h index bc925a104df..60c9ab458c9 100644 --- a/boards/arm/stm32f7/nucleo-f767zi/src/nucleo-f767zi.h +++ b/boards/arm/stm32f7/nucleo-f767zi/src/nucleo-f767zi.h @@ -230,15 +230,7 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: - * Called from board_late_initialize(). - * - * Otherwise, bad news: Never called + * Called from board_late_initialize(). * ****************************************************************************/ diff --git a/boards/arm/stm32f7/nucleo-f767zi/src/stm32_appinitialize.c b/boards/arm/stm32f7/nucleo-f767zi/src/stm32_appinitialize.c deleted file mode 100644 index 2b7ac8b355d..00000000000 --- a/boards/arm/stm32f7/nucleo-f767zi/src/stm32_appinitialize.c +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f7/nucleo-f767zi/src/stm32_appinitialize.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 -#include - -#include "nucleo-f767zi.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board-specific initialization */ - - return stm32_bringup(); -#else - return OK; -#endif -} - -#endif - diff --git a/boards/arm/stm32f7/steval-eth001v1/src/CMakeLists.txt b/boards/arm/stm32f7/steval-eth001v1/src/CMakeLists.txt index 612fb63d83a..f9467f69994 100644 --- a/boards/arm/stm32f7/steval-eth001v1/src/CMakeLists.txt +++ b/boards/arm/stm32f7/steval-eth001v1/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS stm32_boot.c stm32_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_STM32F7_FOC) list(APPEND SRCS stm32_foc.c) endif() diff --git a/boards/arm/stm32f7/steval-eth001v1/src/Make.defs b/boards/arm/stm32f7/steval-eth001v1/src/Make.defs index 8e265b63d92..ace68763fc4 100644 --- a/boards/arm/stm32f7/steval-eth001v1/src/Make.defs +++ b/boards/arm/stm32f7/steval-eth001v1/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = stm32_boot.c stm32_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_STM32F7_FOC),y) CSRCS += stm32_foc.c endif diff --git a/boards/arm/stm32f7/steval-eth001v1/src/stm32_appinit.c b/boards/arm/stm32f7/steval-eth001v1/src/stm32_appinit.c deleted file mode 100644 index 397c99adb2c..00000000000 --- a/boards/arm/stm32f7/steval-eth001v1/src/stm32_appinit.c +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f7/steval-eth001v1/src/stm32_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 -#include - -#include "steval-eth001v1.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board-specific initialization */ - - return stm32_bringup(); -#else - return OK; -#endif -} - -#endif diff --git a/boards/arm/stm32f7/steval-eth001v1/src/stm32_foc.c b/boards/arm/stm32f7/steval-eth001v1/src/stm32_foc.c index 5579b4a9453..9a27e7bc948 100644 --- a/boards/arm/stm32f7/steval-eth001v1/src/stm32_foc.c +++ b/boards/arm/stm32f7/steval-eth001v1/src/stm32_foc.c @@ -436,8 +436,6 @@ static void board_foc_trace(struct foc_dev_s *dev, int type, bool state) * Description: * Initialize FOC driver. * - * This function should be call by board_app_initialize(). - * * Returned Value: * 0 on success, a negated errno value on failure * diff --git a/boards/arm/stm32f7/stm32f746-ws/src/CMakeLists.txt b/boards/arm/stm32f7/stm32f746-ws/src/CMakeLists.txt index 8fcf733f7ea..19d76fca1f5 100644 --- a/boards/arm/stm32f7/stm32f746-ws/src/CMakeLists.txt +++ b/boards/arm/stm32f7/stm32f746-ws/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS stm32_boot.c stm32_spi.c stm32_dma_alloc.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_STM32F7_OTGFS) list(APPEND SRCS stm32_usb.c) endif() diff --git a/boards/arm/stm32f7/stm32f746-ws/src/Make.defs b/boards/arm/stm32f7/stm32f746-ws/src/Make.defs index df9d49346bb..80e52803544 100644 --- a/boards/arm/stm32f7/stm32f746-ws/src/Make.defs +++ b/boards/arm/stm32f7/stm32f746-ws/src/Make.defs @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = stm32_boot.c stm32_spi.c stm32_dma_alloc.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_STM32F7_OTGFS),y) CSRCS += stm32_usb.c endif diff --git a/boards/arm/stm32f7/stm32f746-ws/src/stm32_appinitialize.c b/boards/arm/stm32f7/stm32f746-ws/src/stm32_appinitialize.c deleted file mode 100644 index 0c5b2d40f17..00000000000 --- a/boards/arm/stm32f7/stm32f746-ws/src/stm32_appinitialize.c +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f7/stm32f746-ws/src/stm32_appinitialize.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 -#include - -#include -#include -#include - -#include "stm32f746-ws.h" -#include "stm32_i2c.h" - -static void stm32_i2c_register(int bus) -{ - struct i2c_master_s *i2c; - int ret; - - i2c = stm32_i2cbus_initialize(bus); - if (i2c == NULL) - { - serr("ERROR: Failed to get I2C%d interface\n", bus); - } - else - { - ret = i2c_register(i2c, bus); - if (ret < 0) - { - serr("ERROR: Failed to register I2C%d driver: %d\n", bus, ret); - stm32_i2cbus_uninitialize(i2c); - } - } -} - -static void stm32_i2ctool(void) -{ - stm32_i2c_register(1); -} - -/**************************************************************************** - * 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. - * - ****************************************************************************/ - -int board_app_initialize(void) -{ - /* Register I2C drivers on behalf of the I2C tool */ - - stm32_i2ctool(); - -#if defined(CONFIG_FAT_DMAMEMORY) - if (stm32_dma_alloc_init() < 0) - { - syslog(LOG_ERR, "DMA alloc FAILED"); - } -#endif - -#ifdef CONFIG_STM32F7_SDMMC1 - /* Initialize the SDIO block driver */ - - int ret = OK; - - ret = stm32_sdio_initialize(); - if (ret != OK) - { - ferr("ERROR: Failed to initialize MMC/SD driver: %d\n", ret); - return ret; - } -#endif - - return OK; -} diff --git a/boards/arm/stm32f7/stm32f746-ws/src/stm32_boot.c b/boards/arm/stm32f7/stm32f746-ws/src/stm32_boot.c index 15f81b00795..eb4801aefb4 100644 --- a/boards/arm/stm32f7/stm32f746-ws/src/stm32_boot.c +++ b/boards/arm/stm32f7/stm32f746-ws/src/stm32_boot.c @@ -28,11 +28,46 @@ #include +#include + #include #include +#include +#include #include "arm_internal.h" #include "stm32f746-ws.h" +#include "stm32_i2c.h" + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static void stm32_i2c_register(int bus) +{ + struct i2c_master_s *i2c; + int ret; + + i2c = stm32_i2cbus_initialize(bus); + if (i2c == NULL) + { + serr("ERROR: Failed to get I2C%d interface\n", bus); + } + else + { + ret = i2c_register(i2c, bus); + if (ret < 0) + { + serr("ERROR: Failed to register I2C%d driver: %d\n", bus, ret); + stm32_i2cbus_uninitialize(i2c); + } + } +} + +static void stm32_i2ctool(void) +{ + stm32_i2c_register(1); +} /**************************************************************************** * Public Functions @@ -81,13 +116,28 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { -#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) - /* Perform NSH initialization here instead of from the NSH. This - * alternative NSH initialization is necessary when NSH is ran in - * user-space but the initialization function must run in kernel space. - */ + /* Register I2C drivers on behalf of the I2C tool */ - board_app_initialize(); + stm32_i2ctool(); + +#if defined(CONFIG_FAT_DMAMEMORY) + if (stm32_dma_alloc_init() < 0) + { + syslog(LOG_ERR, "DMA alloc FAILED"); + } +#endif + +#ifdef CONFIG_STM32F7_SDMMC1 + /* Initialize the SDIO block driver */ + + int ret = OK; + + ret = stm32_sdio_initialize(); + if (ret != OK) + { + ferr("ERROR: Failed to initialize MMC/SD driver: %d\n", ret); + return; + } #endif } #endif diff --git a/boards/arm/stm32f7/stm32f746g-disco/src/CMakeLists.txt b/boards/arm/stm32f7/stm32f746g-disco/src/CMakeLists.txt index a20d4e5c0db..fa3921f051c 100644 --- a/boards/arm/stm32f7/stm32f746g-disco/src/CMakeLists.txt +++ b/boards/arm/stm32f7/stm32f746g-disco/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_ADC) list(APPEND SRCS stm32_adc.c) endif() diff --git a/boards/arm/stm32f7/stm32f746g-disco/src/Make.defs b/boards/arm/stm32f7/stm32f746g-disco/src/Make.defs index 3ebba261bab..ddc33cdca5b 100644 --- a/boards/arm/stm32f7/stm32f746g-disco/src/Make.defs +++ b/boards/arm/stm32f7/stm32f746g-disco/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += stm32_adc.c endif diff --git a/boards/arm/stm32f7/stm32f746g-disco/src/stm32_appinitialize.c b/boards/arm/stm32f7/stm32f746g-disco/src/stm32_appinitialize.c deleted file mode 100644 index ad1e945f474..00000000000 --- a/boards/arm/stm32f7/stm32f746g-disco/src/stm32_appinitialize.c +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f7/stm32f746g-disco/src/stm32_appinitialize.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 -#include - -#include "stm32f746g-disco.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board-specific initialization */ - - return stm32_bringup(); -#else - return OK; -#endif -} - -#endif diff --git a/boards/arm/stm32f7/stm32f769i-disco/src/CMakeLists.txt b/boards/arm/stm32f7/stm32f769i-disco/src/CMakeLists.txt index dc99018b08d..b41627ab518 100644 --- a/boards/arm/stm32f7/stm32f769i-disco/src/CMakeLists.txt +++ b/boards/arm/stm32f7/stm32f769i-disco/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_PWM) list(APPEND SRCS stm32_pwm.c) endif() diff --git a/boards/arm/stm32f7/stm32f769i-disco/src/Make.defs b/boards/arm/stm32f7/stm32f769i-disco/src/Make.defs index c9981eacbac..82a79440d22 100644 --- a/boards/arm/stm32f7/stm32f769i-disco/src/Make.defs +++ b/boards/arm/stm32f7/stm32f769i-disco/src/Make.defs @@ -34,10 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_PWM),y) CSRCS += stm32_pwm.c endif diff --git a/boards/arm/stm32f7/stm32f769i-disco/src/stm32_appinitialize.c b/boards/arm/stm32f7/stm32f769i-disco/src/stm32_appinitialize.c deleted file mode 100644 index 4ea5e7ec1bc..00000000000 --- a/boards/arm/stm32f7/stm32f769i-disco/src/stm32_appinitialize.c +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f7/stm32f769i-disco/src/stm32_appinitialize.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 -#include - -#include "stm32f769i-disco.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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32f7/stm32f777zit6-meadow/src/CMakeLists.txt b/boards/arm/stm32f7/stm32f777zit6-meadow/src/CMakeLists.txt index 17559db0c4d..a22e8a9afed 100644 --- a/boards/arm/stm32f7/stm32f777zit6-meadow/src/CMakeLists.txt +++ b/boards/arm/stm32f7/stm32f777zit6-meadow/src/CMakeLists.txt @@ -32,11 +32,8 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) - if(CONFIG_BOARDCTL_IOCTL) - list(APPEND SRCS stm32_ioctl.c) - endif() +if(CONFIG_BOARDCTL_IOCTL) + list(APPEND SRCS stm32_ioctl.c) endif() if(CONFIG_PWM) diff --git a/boards/arm/stm32f7/stm32f777zit6-meadow/src/Make.defs b/boards/arm/stm32f7/stm32f777zit6-meadow/src/Make.defs index f206e99f381..8d6ef41b3a6 100644 --- a/boards/arm/stm32f7/stm32f777zit6-meadow/src/Make.defs +++ b/boards/arm/stm32f7/stm32f777zit6-meadow/src/Make.defs @@ -35,12 +35,9 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c ifeq ($(CONFIG_BOARDCTL_IOCTL),y) CSRCS += stm32_ioctl.c endif -endif ifeq ($(CONFIG_PWM),y) CSRCS += stm32_pwm.c diff --git a/boards/arm/stm32f7/stm32f777zit6-meadow/src/stm32_appinitialize.c b/boards/arm/stm32f7/stm32f777zit6-meadow/src/stm32_appinitialize.c deleted file mode 100644 index 16a97f62980..00000000000 --- a/boards/arm/stm32f7/stm32f777zit6-meadow/src/stm32_appinitialize.c +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32f7/stm32f777zit6-meadow/src/stm32_appinitialize.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 -#include - -#include "stm32f777zit6-meadow.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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32f7/stm32f777zit6-meadow/src/stm32_boot.c b/boards/arm/stm32f7/stm32f777zit6-meadow/src/stm32_boot.c index 18f055b3c35..fbf4f961fc5 100644 --- a/boards/arm/stm32f7/stm32f777zit6-meadow/src/stm32_boot.c +++ b/boards/arm/stm32f7/stm32f777zit6-meadow/src/stm32_boot.c @@ -179,15 +179,7 @@ void board_late_initialize(void) } #endif -#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) - /* Perform NSH initialization here instead of from the NSH. This - * alternative NSH initialization is necessary when NSH is ran in - * user-space but the initialization function must run in kernel space. - */ - board_app_initialize(); -#else stm32_bringup(); -#endif } #endif diff --git a/boards/arm/stm32h5/nucleo-h563zi/src/CMakeLists.txt b/boards/arm/stm32h5/nucleo-h563zi/src/CMakeLists.txt index 4999c854abb..7dca629677e 100644 --- a/boards/arm/stm32h5/nucleo-h563zi/src/CMakeLists.txt +++ b/boards/arm/stm32h5/nucleo-h563zi/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ADC) list(APPEND SRCS stm32_adc.c) endif() diff --git a/boards/arm/stm32h5/nucleo-h563zi/src/Makefile b/boards/arm/stm32h5/nucleo-h563zi/src/Makefile index e3c0288e28e..015b4463999 100644 --- a/boards/arm/stm32h5/nucleo-h563zi/src/Makefile +++ b/boards/arm/stm32h5/nucleo-h563zi/src/Makefile @@ -35,10 +35,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ADC),y) CSRCS += stm32_adc.c endif diff --git a/boards/arm/stm32h5/nucleo-h563zi/src/stm32_appinit.c b/boards/arm/stm32h5/nucleo-h563zi/src/stm32_appinit.c deleted file mode 100644 index ff4984f29b2..00000000000 --- a/boards/arm/stm32h5/nucleo-h563zi/src/stm32_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32h5/nucleo-h563zi/src/stm32_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 - -#include - -#include "nucleo-h563zi.h" - -#include - -/**************************************************************************** - * 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 cold 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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32h7/linum-stm32h753bi/src/CMakeLists.txt b/boards/arm/stm32h7/linum-stm32h753bi/src/CMakeLists.txt index 4062f4dfe66..d0d7904d73a 100644 --- a/boards/arm/stm32h7/linum-stm32h753bi/src/CMakeLists.txt +++ b/boards/arm/stm32h7/linum-stm32h753bi/src/CMakeLists.txt @@ -30,10 +30,6 @@ if(CONFIG_USERLED) list(APPEND SRCS stm32_userled.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_STM32H7_OTGFS) list(APPEND SRCS stm32_usb.c) endif() diff --git a/boards/arm/stm32h7/linum-stm32h753bi/src/Makefile b/boards/arm/stm32h7/linum-stm32h753bi/src/Makefile index e8adde244ed..c2ae5df6f58 100644 --- a/boards/arm/stm32h7/linum-stm32h753bi/src/Makefile +++ b/boards/arm/stm32h7/linum-stm32h753bi/src/Makefile @@ -68,10 +68,6 @@ ifeq ($(CONFIG_CL_MFRC522),y) CSRCS += stm32_mfrc522.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_STM32H7_LTDC),y) CSRCS += stm32_lcd.c endif diff --git a/boards/arm/stm32h7/linum-stm32h753bi/src/linum-stm32h753bi.h b/boards/arm/stm32h7/linum-stm32h753bi/src/linum-stm32h753bi.h index 885910ba385..a4cc20958f1 100644 --- a/boards/arm/stm32h7/linum-stm32h753bi/src/linum-stm32h753bi.h +++ b/boards/arm/stm32h7/linum-stm32h753bi/src/linum-stm32h753bi.h @@ -148,10 +148,6 @@ * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void); diff --git a/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_appinitialize.c b/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_appinitialize.c deleted file mode 100644 index 30bfc1edac4..00000000000 --- a/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_appinitialize.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32h7/linum-stm32h753bi/src/stm32_appinitialize.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 - -#include -#include - -#include "linum-stm32h753bi.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_bringup.c b/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_bringup.c index ebe03e69b2b..bab56899d14 100644 --- a/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_bringup.c +++ b/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_bringup.c @@ -154,10 +154,6 @@ static void stm32_i2ctool(void) * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void) diff --git a/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_usbmsc.c b/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_usbmsc.c index 84d4dd1c800..88981e3df72 100644 --- a/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_usbmsc.c +++ b/boards/arm/stm32h7/linum-stm32h753bi/src/stm32_usbmsc.c @@ -48,8 +48,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/stm32h7/nucleo-h723zg/configs/oa_tc6/defconfig b/boards/arm/stm32h7/nucleo-h723zg/configs/oa_tc6/defconfig index 47a86a8ffbc..314c36575b7 100644 --- a/boards/arm/stm32h7/nucleo-h723zg/configs/oa_tc6/defconfig +++ b/boards/arm/stm32h7/nucleo-h723zg/configs/oa_tc6/defconfig @@ -19,7 +19,6 @@ CONFIG_ARMV7M_DCACHE=y CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y CONFIG_ARMV7M_DTCM=y CONFIG_ARMV7M_ICACHE=y -CONFIG_BOARD_LATE_INITIALIZE=y CONFIG_BOARD_LOOPSPERMSEC=43103 CONFIG_BUILTIN=y CONFIG_DEBUG_FEATURES=y diff --git a/boards/arm/stm32h7/nucleo-h723zg/src/CMakeLists.txt b/boards/arm/stm32h7/nucleo-h723zg/src/CMakeLists.txt index 979311adc7b..f27901f9491 100644 --- a/boards/arm/stm32h7/nucleo-h723zg/src/CMakeLists.txt +++ b/boards/arm/stm32h7/nucleo-h723zg/src/CMakeLists.txt @@ -48,10 +48,6 @@ if(CONFIG_BOARDCTL_UNIQUEID) list(APPEND SRCS stm32_uid.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_DEV_GPIO) list(APPEND SRCS stm32_gpio.c) endif() diff --git a/boards/arm/stm32h7/nucleo-h723zg/src/Makefile b/boards/arm/stm32h7/nucleo-h723zg/src/Makefile index 111f96be693..dedc375fb9c 100644 --- a/boards/arm/stm32h7/nucleo-h723zg/src/Makefile +++ b/boards/arm/stm32h7/nucleo-h723zg/src/Makefile @@ -50,10 +50,6 @@ ifeq ($(CONFIG_BOARDCTL_UNIQUEID),y) CSRCS += stm32_uid.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += stm32_gpio.c endif diff --git a/boards/arm/stm32h7/nucleo-h723zg/src/stm32_appinitialize.c b/boards/arm/stm32h7/nucleo-h723zg/src/stm32_appinitialize.c deleted file mode 100644 index c988b0079f4..00000000000 --- a/boards/arm/stm32h7/nucleo-h723zg/src/stm32_appinitialize.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32h7/nucleo-h723zg/src/stm32_appinitialize.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 - -#include -#include - -#include "nucleo-h723zg.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32h7/nucleo-h723zg/src/stm32_usbmsc.c b/boards/arm/stm32h7/nucleo-h723zg/src/stm32_usbmsc.c index 8ad08805e1b..4e6f4f3874f 100644 --- a/boards/arm/stm32h7/nucleo-h723zg/src/stm32_usbmsc.c +++ b/boards/arm/stm32h7/nucleo-h723zg/src/stm32_usbmsc.c @@ -48,8 +48,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized in board_late_initialize() * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/stm32h7/nucleo-h743zi/src/CMakeLists.txt b/boards/arm/stm32h7/nucleo-h743zi/src/CMakeLists.txt index 280ab93a551..d4e92b8f5ed 100644 --- a/boards/arm/stm32h7/nucleo-h743zi/src/CMakeLists.txt +++ b/boards/arm/stm32h7/nucleo-h743zi/src/CMakeLists.txt @@ -72,10 +72,6 @@ if(CONFIG_LCD_SSD1306) list(APPEND SRCS stm32_ssd1306.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_STM32H7_PROGMEM) list(APPEND SRCS stm32_progmem.c) endif() diff --git a/boards/arm/stm32h7/nucleo-h743zi/src/Makefile b/boards/arm/stm32h7/nucleo-h743zi/src/Makefile index 14d0b78569a..985900a61a9 100644 --- a/boards/arm/stm32h7/nucleo-h743zi/src/Makefile +++ b/boards/arm/stm32h7/nucleo-h743zi/src/Makefile @@ -74,10 +74,6 @@ ifeq ($(CONFIG_LCD_SSD1306),y) CSRCS += stm32_ssd1306.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_STM32H7_PROGMEM),y) CSRCS += stm32_progmem.c endif diff --git a/boards/arm/stm32h7/nucleo-h743zi/src/nucleo-h743zi.h b/boards/arm/stm32h7/nucleo-h743zi/src/nucleo-h743zi.h index b9d01569980..4bcfe00d50b 100644 --- a/boards/arm/stm32h7/nucleo-h743zi/src/nucleo-h743zi.h +++ b/boards/arm/stm32h7/nucleo-h743zi/src/nucleo-h743zi.h @@ -238,10 +238,6 @@ * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void); diff --git a/boards/arm/stm32h7/nucleo-h743zi/src/stm32_appinitialize.c b/boards/arm/stm32h7/nucleo-h743zi/src/stm32_appinitialize.c deleted file mode 100644 index 26d21104d6e..00000000000 --- a/boards/arm/stm32h7/nucleo-h743zi/src/stm32_appinitialize.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32h7/nucleo-h743zi/src/stm32_appinitialize.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 - -#include -#include - -#include "nucleo-h743zi.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32h7/nucleo-h743zi/src/stm32_bringup.c b/boards/arm/stm32h7/nucleo-h743zi/src/stm32_bringup.c index 3ec9cfe076b..a8999a87a40 100644 --- a/boards/arm/stm32h7/nucleo-h743zi/src/stm32_bringup.c +++ b/boards/arm/stm32h7/nucleo-h743zi/src/stm32_bringup.c @@ -244,10 +244,6 @@ static void stm32_i2ctool(void) * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void) diff --git a/boards/arm/stm32h7/nucleo-h743zi/src/stm32_usbmsc.c b/boards/arm/stm32h7/nucleo-h743zi/src/stm32_usbmsc.c index 80e041a9654..edf9bd2e77a 100644 --- a/boards/arm/stm32h7/nucleo-h743zi/src/stm32_usbmsc.c +++ b/boards/arm/stm32h7/nucleo-h743zi/src/stm32_usbmsc.c @@ -48,8 +48,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/stm32h7/nucleo-h743zi2/src/CMakeLists.txt b/boards/arm/stm32h7/nucleo-h743zi2/src/CMakeLists.txt index c8ef998d0f2..ce26e66e8cc 100644 --- a/boards/arm/stm32h7/nucleo-h743zi2/src/CMakeLists.txt +++ b/boards/arm/stm32h7/nucleo-h743zi2/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_STM32H7_OTGFS) list(APPEND SRCS stm32_usb.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_DEV_GPIO) list(APPEND SRCS stm32_gpio.c) endif() diff --git a/boards/arm/stm32h7/nucleo-h743zi2/src/Makefile b/boards/arm/stm32h7/nucleo-h743zi2/src/Makefile index 92e776d490e..9991b451550 100644 --- a/boards/arm/stm32h7/nucleo-h743zi2/src/Makefile +++ b/boards/arm/stm32h7/nucleo-h743zi2/src/Makefile @@ -42,10 +42,6 @@ ifeq ($(CONFIG_STM32H7_OTGFS),y) CSRCS += stm32_usb.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += stm32_gpio.c endif diff --git a/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_appinitialize.c b/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_appinitialize.c deleted file mode 100644 index dd2ccdd8e25..00000000000 --- a/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_appinitialize.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32h7/nucleo-h743zi2/src/stm32_appinitialize.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 -#include -#include - -#include "nucleo-h743zi2.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_bringup.c b/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_bringup.c index e461b646093..aa17bd7856f 100644 --- a/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_bringup.c +++ b/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_bringup.c @@ -70,10 +70,6 @@ * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void) diff --git a/boards/arm/stm32h7/nucleo-h745zi/src/CMakeLists.txt b/boards/arm/stm32h7/nucleo-h745zi/src/CMakeLists.txt index a20c432323a..4d1e7e4d7c2 100644 --- a/boards/arm/stm32h7/nucleo-h745zi/src/CMakeLists.txt +++ b/boards/arm/stm32h7/nucleo-h745zi/src/CMakeLists.txt @@ -28,10 +28,6 @@ else() list(APPEND SRCS stm32_userleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_ARCH_CHIP_STM32H7_CORTEXM7) diff --git a/boards/arm/stm32h7/nucleo-h745zi/src/Makefile b/boards/arm/stm32h7/nucleo-h745zi/src/Makefile index e3b0718b1db..df3be92d509 100644 --- a/boards/arm/stm32h7/nucleo-h745zi/src/Makefile +++ b/boards/arm/stm32h7/nucleo-h745zi/src/Makefile @@ -38,10 +38,6 @@ ifeq ($(CONFIG_STM32H7_OTGFS),y) CSRCS += stm32_usb.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += stm32_gpio.c endif diff --git a/boards/arm/stm32h7/nucleo-h745zi/src/nucleo-h745zi.h b/boards/arm/stm32h7/nucleo-h745zi/src/nucleo-h745zi.h index 28e800b3e3d..b3b16bee6f6 100644 --- a/boards/arm/stm32h7/nucleo-h745zi/src/nucleo-h745zi.h +++ b/boards/arm/stm32h7/nucleo-h745zi/src/nucleo-h745zi.h @@ -245,10 +245,6 @@ * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void); diff --git a/boards/arm/stm32h7/nucleo-h745zi/src/stm32_appinitialize.c b/boards/arm/stm32h7/nucleo-h745zi/src/stm32_appinitialize.c deleted file mode 100644 index 1d1b8c135d8..00000000000 --- a/boards/arm/stm32h7/nucleo-h745zi/src/stm32_appinitialize.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32h7/nucleo-h745zi/src/stm32_appinitialize.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 - -#include -#include - -#include "nucleo-h745zi.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32h7/nucleo-h745zi/src/stm32_bringup.c b/boards/arm/stm32h7/nucleo-h745zi/src/stm32_bringup.c index 9b195df0501..a8e26a5b591 100644 --- a/boards/arm/stm32h7/nucleo-h745zi/src/stm32_bringup.c +++ b/boards/arm/stm32h7/nucleo-h745zi/src/stm32_bringup.c @@ -85,10 +85,6 @@ void rpmsg_serialinit(void) * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void) @@ -229,7 +225,7 @@ int stm32_bringup(void) { syslog(LOG_ERR, "ERROR: stm32_pwm_setup() failed: %d\n", ret); } -#endif +#endif return OK; } diff --git a/boards/arm/stm32h7/openh743i/src/CMakeLists.txt b/boards/arm/stm32h7/openh743i/src/CMakeLists.txt index 67c6af47217..d6e3a6040cb 100644 --- a/boards/arm/stm32h7/openh743i/src/CMakeLists.txt +++ b/boards/arm/stm32h7/openh743i/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS stm32_boot.c stm32_bringup.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_STM32H7_SDMMC) list(APPEND SRCS stm32_sdmmc.c) endif() diff --git a/boards/arm/stm32h7/openh743i/src/Makefile b/boards/arm/stm32h7/openh743i/src/Makefile index 05eaa57aaa4..eda04e7c3af 100644 --- a/boards/arm/stm32h7/openh743i/src/Makefile +++ b/boards/arm/stm32h7/openh743i/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = stm32_boot.c stm32_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_STM32H7_SDMMC),y) CSRCS += stm32_sdmmc.c endif diff --git a/boards/arm/stm32h7/openh743i/src/stm32_appinitialize.c b/boards/arm/stm32h7/openh743i/src/stm32_appinitialize.c deleted file mode 100644 index 098df3e0b00..00000000000 --- a/boards/arm/stm32h7/openh743i/src/stm32_appinitialize.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32h7/openh743i/src/stm32_appinitialize.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 - -#include -#include - -#include "openh743i.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32h7/openh743i/src/stm32_boot.c b/boards/arm/stm32h7/openh743i/src/stm32_boot.c index 48aa8414257..df105a23b30 100644 --- a/boards/arm/stm32h7/openh743i/src/stm32_boot.c +++ b/boards/arm/stm32h7/openh743i/src/stm32_boot.c @@ -76,12 +76,6 @@ void stm32_boardinitialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { -#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) - /* Perform board bring-up here instead of from the - * board_app_initialize(). - */ - stm32_bringup(); -#endif } #endif diff --git a/boards/arm/stm32h7/openh743i/src/stm32_bringup.c b/boards/arm/stm32h7/openh743i/src/stm32_bringup.c index f9a620015aa..8d0abb21da5 100644 --- a/boards/arm/stm32h7/openh743i/src/stm32_bringup.c +++ b/boards/arm/stm32h7/openh743i/src/stm32_bringup.c @@ -62,8 +62,6 @@ * Called from board_late_initialize(). * * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library * ****************************************************************************/ diff --git a/boards/arm/stm32h7/openh743i/src/stm32_usbmsc.c b/boards/arm/stm32h7/openh743i/src/stm32_usbmsc.c index 3cf9f662480..cfa34a7b214 100644 --- a/boards/arm/stm32h7/openh743i/src/stm32_usbmsc.c +++ b/boards/arm/stm32h7/openh743i/src/stm32_usbmsc.c @@ -59,8 +59,7 @@ int board_usbmsc_initialize(int port) { /* If system/usbmsc is built as an NSH command, then SD slot should - * already have been initialized in board_app_initialize() - * (see stm32_appinit.c). + * already have been initialized. * In this case, there is nothing further to be done here. */ diff --git a/boards/arm/stm32h7/portenta-h7/src/CMakeLists.txt b/boards/arm/stm32h7/portenta-h7/src/CMakeLists.txt index eab66ddce96..50b89cc1eb8 100644 --- a/boards/arm/stm32h7/portenta-h7/src/CMakeLists.txt +++ b/boards/arm/stm32h7/portenta-h7/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_ARCH_LEDS) list(APPEND SRCS stm32_autoleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(CONFIG_ARCH_CHIP_STM32H7_CORTEXM7) diff --git a/boards/arm/stm32h7/portenta-h7/src/Makefile b/boards/arm/stm32h7/portenta-h7/src/Makefile index a1bb5920c3a..adca38bed3e 100644 --- a/boards/arm/stm32h7/portenta-h7/src/Makefile +++ b/boards/arm/stm32h7/portenta-h7/src/Makefile @@ -28,8 +28,4 @@ ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += stm32_autoleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/stm32h7/portenta-h7/src/portenta-h7.h b/boards/arm/stm32h7/portenta-h7/src/portenta-h7.h index f6d9cda70ae..15726918817 100644 --- a/boards/arm/stm32h7/portenta-h7/src/portenta-h7.h +++ b/boards/arm/stm32h7/portenta-h7/src/portenta-h7.h @@ -81,10 +81,6 @@ * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void); diff --git a/boards/arm/stm32h7/portenta-h7/src/stm32_appinitialize.c b/boards/arm/stm32h7/portenta-h7/src/stm32_appinitialize.c deleted file mode 100644 index 05fc9961493..00000000000 --- a/boards/arm/stm32h7/portenta-h7/src/stm32_appinitialize.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32h7/portenta-h7/src/stm32_appinitialize.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 - -#include -#include - -#include "portenta-h7.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32h7/portenta-h7/src/stm32_bringup.c b/boards/arm/stm32h7/portenta-h7/src/stm32_bringup.c index a2aefc772e2..a61fab1bb64 100644 --- a/boards/arm/stm32h7/portenta-h7/src/stm32_bringup.c +++ b/boards/arm/stm32h7/portenta-h7/src/stm32_bringup.c @@ -113,10 +113,6 @@ static void stm32_i2ctool(void) * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void) diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/CMakeLists.txt b/boards/arm/stm32h7/stm32h745i-disco/src/CMakeLists.txt index 0c77b55a62c..424170bc1a1 100644 --- a/boards/arm/stm32h7/stm32h745i-disco/src/CMakeLists.txt +++ b/boards/arm/stm32h7/stm32h745i-disco/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_STM32H7_OTGFS) list(APPEND SRCS stm32_usb.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_TESTING_OSTEST) list(APPEND SRCS stm32_ostest.c) endif() diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/Makefile b/boards/arm/stm32h7/stm32h745i-disco/src/Makefile index 253e470ef46..59db9b7cd6a 100644 --- a/boards/arm/stm32h7/stm32h745i-disco/src/Makefile +++ b/boards/arm/stm32h7/stm32h745i-disco/src/Makefile @@ -34,10 +34,6 @@ ifeq ($(CONFIG_STM32H7_OTGFS),y) CSRCS += stm32_usb.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_TESTING_OSTEST),y) CSRCS += stm32_ostest.c endif diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/stm32_appinitialize.c b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_appinitialize.c deleted file mode 100644 index d09861fbea9..00000000000 --- a/boards/arm/stm32h7/stm32h745i-disco/src/stm32_appinitialize.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32h7/stm32h745i-disco/src/stm32_appinitialize.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 - -#include -#include - -#include "stm32h745i_disco.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/stm32_bringup.c b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_bringup.c index 7b73a4e0b87..5af6ac7f31f 100644 --- a/boards/arm/stm32h7/stm32h745i-disco/src/stm32_bringup.c +++ b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_bringup.c @@ -115,10 +115,6 @@ void rpmsg_serialinit(void) * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void) diff --git a/boards/arm/stm32h7/stm32h747i-disco/src/CMakeLists.txt b/boards/arm/stm32h7/stm32h747i-disco/src/CMakeLists.txt index 2e7b06e34eb..1547dd92632 100644 --- a/boards/arm/stm32h7/stm32h747i-disco/src/CMakeLists.txt +++ b/boards/arm/stm32h7/stm32h747i-disco/src/CMakeLists.txt @@ -48,10 +48,6 @@ if(CONFIG_BOARDCTL_UNIQUEID) list(APPEND SRCS stm32_uid.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_STM32H7_SDMMC) list(APPEND SRCS stm32_sdmmc.c) endif() diff --git a/boards/arm/stm32h7/stm32h747i-disco/src/Makefile b/boards/arm/stm32h7/stm32h747i-disco/src/Makefile index d3428220c8b..788e0f0d91f 100644 --- a/boards/arm/stm32h7/stm32h747i-disco/src/Makefile +++ b/boards/arm/stm32h7/stm32h747i-disco/src/Makefile @@ -50,10 +50,6 @@ ifeq ($(CONFIG_BOARDCTL_UNIQUEID),y) CSRCS += stm32_uid.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_STM32H7_SDMMC),y) CSRCS += stm32_sdmmc.c endif diff --git a/boards/arm/stm32h7/stm32h747i-disco/src/stm32_appinitialize.c b/boards/arm/stm32h7/stm32h747i-disco/src/stm32_appinitialize.c deleted file mode 100644 index 19e9911490d..00000000000 --- a/boards/arm/stm32h7/stm32h747i-disco/src/stm32_appinitialize.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32h7/stm32h747i-disco/src/stm32_appinitialize.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 - -#include -#include - -#include "stm32h747i-disco.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32h7/stm32h747i-disco/src/stm32_bringup.c b/boards/arm/stm32h7/stm32h747i-disco/src/stm32_bringup.c index 8c52d89d0cf..84e93d0e997 100644 --- a/boards/arm/stm32h7/stm32h747i-disco/src/stm32_bringup.c +++ b/boards/arm/stm32h7/stm32h747i-disco/src/stm32_bringup.c @@ -118,10 +118,6 @@ static void stm32_i2ctool(void) * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void) diff --git a/boards/arm/stm32h7/stm32h747i-disco/src/stm32h747i-disco.h b/boards/arm/stm32h7/stm32h747i-disco/src/stm32h747i-disco.h index eb6159ec7d0..c53bb6f8a76 100644 --- a/boards/arm/stm32h7/stm32h747i-disco/src/stm32h747i-disco.h +++ b/boards/arm/stm32h7/stm32h747i-disco/src/stm32h747i-disco.h @@ -117,10 +117,6 @@ * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void); diff --git a/boards/arm/stm32h7/stm32h750b-dk/src/CMakeLists.txt b/boards/arm/stm32h7/stm32h750b-dk/src/CMakeLists.txt index fde7f720d27..d89067b817f 100644 --- a/boards/arm/stm32h7/stm32h750b-dk/src/CMakeLists.txt +++ b/boards/arm/stm32h7/stm32h750b-dk/src/CMakeLists.txt @@ -30,10 +30,6 @@ if(CONFIG_STM32H7_OTGFS) list(APPEND SRCS stm32_usb.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - if(CONFIG_TESTING_OSTEST) list(APPEND SRCS stm32_ostest.c) endif() diff --git a/boards/arm/stm32h7/stm32h750b-dk/src/Makefile b/boards/arm/stm32h7/stm32h750b-dk/src/Makefile index a0a30c67a82..7dec83d2100 100644 --- a/boards/arm/stm32h7/stm32h750b-dk/src/Makefile +++ b/boards/arm/stm32h7/stm32h750b-dk/src/Makefile @@ -32,10 +32,6 @@ ifeq ($(CONFIG_STM32H7_OTGFS),y) CSRCS += stm32_usb.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - ifeq ($(CONFIG_TESTING_OSTEST),y) CSRCS += stm32_ostest.c endif @@ -52,4 +48,4 @@ ifeq ($(CONFIG_STM32H7_LTDC),y) CSRCS += stm32_lcd.c endif -include $(TOPDIR)/boards/Board.mk \ No newline at end of file +include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/stm32h7/stm32h750b-dk/src/stm32_appinitialize.c b/boards/arm/stm32h7/stm32h750b-dk/src/stm32_appinitialize.c deleted file mode 100644 index 856fbded418..00000000000 --- a/boards/arm/stm32h7/stm32h750b-dk/src/stm32_appinitialize.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32h7/stm32h750b-dk/src/stm32_appinitialize.c - * - * 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 - -#include -#include - -#include "stm32h750b-dk.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32h7/stm32h750b-dk/src/stm32_bringup.c b/boards/arm/stm32h7/stm32h750b-dk/src/stm32_bringup.c index cb37f043e36..a7200dffe19 100644 --- a/boards/arm/stm32h7/stm32h750b-dk/src/stm32_bringup.c +++ b/boards/arm/stm32h7/stm32h750b-dk/src/stm32_bringup.c @@ -113,10 +113,6 @@ void rpmsg_serialinit(void) * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void) diff --git a/boards/arm/stm32h7/weact-stm32h743/src/CMakeLists.txt b/boards/arm/stm32h7/weact-stm32h743/src/CMakeLists.txt index ee8fb5bff0b..af3c82ac515 100644 --- a/boards/arm/stm32h7/weact-stm32h743/src/CMakeLists.txt +++ b/boards/arm/stm32h7/weact-stm32h743/src/CMakeLists.txt @@ -42,10 +42,6 @@ if(CONFIG_FAT_DMAMEMORY) list(APPEND SRCS stm32_dma_alloc.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) -endif() - target_sources(board PRIVATE ${SRCS}) if(NOT CONFIG_BUILD_FLAT) diff --git a/boards/arm/stm32h7/weact-stm32h743/src/Makefile b/boards/arm/stm32h7/weact-stm32h743/src/Makefile index 252922dff7a..3d686ef415e 100644 --- a/boards/arm/stm32h7/weact-stm32h743/src/Makefile +++ b/boards/arm/stm32h7/weact-stm32h743/src/Makefile @@ -44,8 +44,4 @@ ifeq ($(CONFIG_FAT_DMAMEMORY),y) CSRCS += stm32_dma_alloc.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/stm32h7/weact-stm32h743/src/stm32_appinitialize.c b/boards/arm/stm32h7/weact-stm32h743/src/stm32_appinitialize.c deleted file mode 100644 index f0d46088606..00000000000 --- a/boards/arm/stm32h7/weact-stm32h743/src/stm32_appinitialize.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32h7/weact-stm32h743/src/stm32_appinitialize.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 - -#include -#include - -#include "weact-stm32h743.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32h7/weact-stm32h743/src/stm32_bringup.c b/boards/arm/stm32h7/weact-stm32h743/src/stm32_bringup.c index e9335b3406f..a69d806e8bf 100644 --- a/boards/arm/stm32h7/weact-stm32h743/src/stm32_bringup.c +++ b/boards/arm/stm32h7/weact-stm32h743/src/stm32_bringup.c @@ -59,10 +59,6 @@ * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void) diff --git a/boards/arm/stm32h7/weact-stm32h743/src/weact-stm32h743.h b/boards/arm/stm32h7/weact-stm32h743/src/weact-stm32h743.h index 0d39b8f52bb..34f91044d7e 100644 --- a/boards/arm/stm32h7/weact-stm32h743/src/weact-stm32h743.h +++ b/boards/arm/stm32h7/weact-stm32h743/src/weact-stm32h743.h @@ -168,10 +168,6 @@ void weak_function stm32_spidev_initialize(void); * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void); diff --git a/boards/arm/stm32h7/weact-stm32h750/src/CMakeLists.txt b/boards/arm/stm32h7/weact-stm32h750/src/CMakeLists.txt index 01b06b6e7cb..6c5220cccc2 100644 --- a/boards/arm/stm32h7/weact-stm32h750/src/CMakeLists.txt +++ b/boards/arm/stm32h7/weact-stm32h750/src/CMakeLists.txt @@ -50,11 +50,8 @@ if(CONFIG_FAT_DMAMEMORY) list(APPEND SRCS stm32_dma_alloc.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) - if(CONFIG_BOARDCTL_IOCTL) - list(APPEND SRCS stm32_ioctl.c) - endif() +if(CONFIG_BOARDCTL_IOCTL) + list(APPEND SRCS stm32_ioctl.c) endif() target_sources(board PRIVATE ${SRCS}) diff --git a/boards/arm/stm32h7/weact-stm32h750/src/Makefile b/boards/arm/stm32h7/weact-stm32h750/src/Makefile index c186c90a781..80033455ab3 100644 --- a/boards/arm/stm32h7/weact-stm32h750/src/Makefile +++ b/boards/arm/stm32h7/weact-stm32h750/src/Makefile @@ -44,8 +44,4 @@ ifeq ($(CONFIG_FAT_DMAMEMORY),y) CSRCS += stm32_dma_alloc.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/stm32h7/weact-stm32h750/src/stm32_appinitialize.c b/boards/arm/stm32h7/weact-stm32h750/src/stm32_appinitialize.c deleted file mode 100644 index abab7c528e4..00000000000 --- a/boards/arm/stm32h7/weact-stm32h750/src/stm32_appinitialize.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32h7/weact-stm32h750/src/stm32_appinitialize.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 - -#include -#include - -#include "weact-stm32h750.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} diff --git a/boards/arm/stm32h7/weact-stm32h750/src/stm32_bringup.c b/boards/arm/stm32h7/weact-stm32h750/src/stm32_bringup.c index a3235d8a6b4..a2fe0030fe4 100644 --- a/boards/arm/stm32h7/weact-stm32h750/src/stm32_bringup.c +++ b/boards/arm/stm32h7/weact-stm32h750/src/stm32_bringup.c @@ -59,10 +59,6 @@ * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void) diff --git a/boards/arm/stm32h7/weact-stm32h750/src/weact-stm32h750.h b/boards/arm/stm32h7/weact-stm32h750/src/weact-stm32h750.h index d32a4d69213..ecf03db7907 100644 --- a/boards/arm/stm32h7/weact-stm32h750/src/weact-stm32h750.h +++ b/boards/arm/stm32h7/weact-stm32h750/src/weact-stm32h750.h @@ -168,10 +168,6 @@ void weak_function stm32_spidev_initialize(void); * CONFIG_BOARD_LATE_INITIALIZE=y : * Called from board_late_initialize(). * - * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y && - * CONFIG_NSH_ARCHINIT: - * Called from the NSH library - * ****************************************************************************/ int stm32_bringup(void); diff --git a/boards/arm/stm32l4/b-l475e-iot01a/src/CMakeLists.txt b/boards/arm/stm32l4/b-l475e-iot01a/src/CMakeLists.txt index ac7a4dfa8ab..7d6ffd6d703 100644 --- a/boards/arm/stm32l4/b-l475e-iot01a/src/CMakeLists.txt +++ b/boards/arm/stm32l4/b-l475e-iot01a/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS stm32_boot.c stm32_bringup.c stm32_spi.c stm32_timer.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ARCH_LEDS) list(APPEND SRCS stm32_autoleds.c) else() diff --git a/boards/arm/stm32l4/b-l475e-iot01a/src/Makefile b/boards/arm/stm32l4/b-l475e-iot01a/src/Makefile index d7c64d18693..4b6dba43ad1 100644 --- a/boards/arm/stm32l4/b-l475e-iot01a/src/Makefile +++ b/boards/arm/stm32l4/b-l475e-iot01a/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = stm32_boot.c stm32_bringup.c stm32_spi.c stm32_timer.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += stm32_autoleds.c else diff --git a/boards/arm/stm32l4/b-l475e-iot01a/src/b-l475e-iot01a.h b/boards/arm/stm32l4/b-l475e-iot01a/src/b-l475e-iot01a.h index 4f359aab3fc..831f891cc5a 100644 --- a/boards/arm/stm32l4/b-l475e-iot01a/src/b-l475e-iot01a.h +++ b/boards/arm/stm32l4/b-l475e-iot01a/src/b-l475e-iot01a.h @@ -136,10 +136,8 @@ * Name: stm32l4_bringup * * Description: - * Called either by board_initialize() if CONFIG_BOARD_LATE_INITIALIZE or - * by board_app_initialize if CONFIG_BOARDCTL is selected. This - * function initializes and configures all on-board features appropriate - * for the selected configuration. + * This function initializes and configures all on-board features + * appropriate for the selected configuration. * ****************************************************************************/ diff --git a/boards/arm/stm32l4/b-l475e-iot01a/src/stm32_appinit.c b/boards/arm/stm32l4/b-l475e-iot01a/src/stm32_appinit.c deleted file mode 100644 index b54e5be1b5a..00000000000 --- a/boards/arm/stm32l4/b-l475e-iot01a/src/stm32_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32l4/b-l475e-iot01a/src/stm32_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 - -#include - -#include - -#include "b-l475e-iot01a.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return stm32l4_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/stm32l4/b-l475e-iot01a/src/stm32_bringup.c b/boards/arm/stm32l4/b-l475e-iot01a/src/stm32_bringup.c index 8d635addb14..cdbb58f24fb 100644 --- a/boards/arm/stm32l4/b-l475e-iot01a/src/stm32_bringup.c +++ b/boards/arm/stm32l4/b-l475e-iot01a/src/stm32_bringup.c @@ -52,10 +52,8 @@ * Name: stm32l4_bringup * * Description: - * Called either by board_initialize() if CONFIG_BOARD_LATE_INITIALIZE or - * by board_app_initialize if CONFIG_BOARDCTL is selected. This - * function initializes and configures all on-board features appropriate - * for the selected configuration. + * This function initializes and configures all on-board features + * appropriate for the selected configuration. * ****************************************************************************/ diff --git a/boards/arm/stm32l4/nucleo-l432kc/src/CMakeLists.txt b/boards/arm/stm32l4/nucleo-l432kc/src/CMakeLists.txt index 988c57acf4d..4a419a02045 100644 --- a/boards/arm/stm32l4/nucleo-l432kc/src/CMakeLists.txt +++ b/boards/arm/stm32l4/nucleo-l432kc/src/CMakeLists.txt @@ -76,11 +76,8 @@ if(CONFIG_TIMER) list(APPEND SRCS stm32_timer.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) - if(CONFIG_BOARDCTL_IOCTL) - list(APPEND SRCS stm32_ioctl.c) - endif() +if(CONFIG_BOARDCTL_IOCTL) + list(APPEND SRCS stm32_ioctl.c) endif() if(CONFIG_BOARDCTL_UNIQUEID) diff --git a/boards/arm/stm32l4/nucleo-l432kc/src/Makefile b/boards/arm/stm32l4/nucleo-l432kc/src/Makefile index 0571726b045..10e16a6729f 100644 --- a/boards/arm/stm32l4/nucleo-l432kc/src/Makefile +++ b/boards/arm/stm32l4/nucleo-l432kc/src/Makefile @@ -78,12 +78,9 @@ ifeq ($(CONFIG_TIMER),y) CSRCS += stm32_timer.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c ifeq ($(CONFIG_BOARDCTL_IOCTL),y) CSRCS += stm32_ioctl.c endif -endif ifeq ($(CONFIG_BOARDCTL_UNIQUEID),y) CSRCS += stm32_uid.c diff --git a/boards/arm/stm32l4/nucleo-l432kc/src/stm32_appinit.c b/boards/arm/stm32l4/nucleo-l432kc/src/stm32_appinit.c deleted file mode 100644 index 45b16776e16..00000000000 --- a/boards/arm/stm32l4/nucleo-l432kc/src/stm32_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32l4/nucleo-l432kc/src/stm32_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 - -#include -#include - -#include "nucleo-l432kc.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32l4/nucleo-l432kc/src/stm32_boot.c b/boards/arm/stm32l4/nucleo-l432kc/src/stm32_boot.c index f383979ed2d..1241ab202ff 100644 --- a/boards/arm/stm32l4/nucleo-l432kc/src/stm32_boot.c +++ b/boards/arm/stm32l4/nucleo-l432kc/src/stm32_boot.c @@ -103,6 +103,6 @@ void stm32l4_board_initialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - board_app_initialize(0); + stm32_bringup(); } #endif diff --git a/boards/arm/stm32l4/nucleo-l432kc/src/stm32_bringup.c b/boards/arm/stm32l4/nucleo-l432kc/src/stm32_bringup.c index d3836b439d5..0898bcad054 100644 --- a/boards/arm/stm32l4/nucleo-l432kc/src/stm32_bringup.c +++ b/boards/arm/stm32l4/nucleo-l432kc/src/stm32_bringup.c @@ -196,8 +196,7 @@ int stm32_bringup(void) #ifdef CONFIG_SPI_DRIVER stm32l4_spiregister(); - /* driver registering must be processed in appinit. - * If called it during board_init, + /* If called it during board_init, * registering failed due to heap doesn't be initialized yet. */ #endif diff --git a/boards/arm/stm32l4/nucleo-l452re/src/CMakeLists.txt b/boards/arm/stm32l4/nucleo-l452re/src/CMakeLists.txt index 8e9e677d887..5695d928b1c 100644 --- a/boards/arm/stm32l4/nucleo-l452re/src/CMakeLists.txt +++ b/boards/arm/stm32l4/nucleo-l452re/src/CMakeLists.txt @@ -40,10 +40,6 @@ if(CONFIG_DAC) list(APPEND SRCS stm32_dac.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT diff --git a/boards/arm/stm32l4/nucleo-l452re/src/Makefile b/boards/arm/stm32l4/nucleo-l452re/src/Makefile index 12025a96760..4c04979e48a 100644 --- a/boards/arm/stm32l4/nucleo-l452re/src/Makefile +++ b/boards/arm/stm32l4/nucleo-l452re/src/Makefile @@ -42,8 +42,4 @@ ifeq ($(CONFIG_DAC),y) CSRCS += stm32_dac.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/stm32l4/nucleo-l452re/src/stm32_appinit.c b/boards/arm/stm32l4/nucleo-l452re/src/stm32_appinit.c deleted file mode 100644 index 5c154629c6d..00000000000 --- a/boards/arm/stm32l4/nucleo-l452re/src/stm32_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32l4/nucleo-l452re/src/stm32_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 - -#include - -#include "nucleo-l452re.h" - -#include - -/**************************************************************************** - * 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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32l4/nucleo-l476rg/src/CMakeLists.txt b/boards/arm/stm32l4/nucleo-l476rg/src/CMakeLists.txt index 3435d865075..caeda607c1d 100644 --- a/boards/arm/stm32l4/nucleo-l476rg/src/CMakeLists.txt +++ b/boards/arm/stm32l4/nucleo-l476rg/src/CMakeLists.txt @@ -99,11 +99,8 @@ if(CONFIG_TIMER) list(APPEND SRCS stm32_timer.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) - if(CONFIG_BOARDCTL_IOCTL) - list(APPEND SRCS stm32_ioctl.c) - endif() +if(CONFIG_BOARDCTL_IOCTL) + list(APPEND SRCS stm32_ioctl.c) endif() if(CONFIG_BOARDCTL_UNIQUEID) diff --git a/boards/arm/stm32l4/nucleo-l476rg/src/Makefile b/boards/arm/stm32l4/nucleo-l476rg/src/Makefile index 92d0a381bdd..d51f9740937 100644 --- a/boards/arm/stm32l4/nucleo-l476rg/src/Makefile +++ b/boards/arm/stm32l4/nucleo-l476rg/src/Makefile @@ -103,12 +103,9 @@ ifeq ($(CONFIG_TIMER),y) CSRCS += stm32_timer.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c ifeq ($(CONFIG_BOARDCTL_IOCTL),y) CSRCS += stm32_ioctl.c endif -endif ifeq ($(CONFIG_BOARDCTL_UNIQUEID),y) CSRCS += stm32_uid.c diff --git a/boards/arm/stm32l4/nucleo-l476rg/src/stm32_appinit.c b/boards/arm/stm32l4/nucleo-l476rg/src/stm32_appinit.c deleted file mode 100644 index c0dcea5d134..00000000000 --- a/boards/arm/stm32l4/nucleo-l476rg/src/stm32_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32l4/nucleo-l476rg/src/stm32_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 - -#include -#include - -#include "nucleo-l476rg.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32l4/nucleo-l476rg/src/stm32_boot.c b/boards/arm/stm32l4/nucleo-l476rg/src/stm32_boot.c index cf4f8731922..4800e811aa0 100644 --- a/boards/arm/stm32l4/nucleo-l476rg/src/stm32_boot.c +++ b/boards/arm/stm32l4/nucleo-l476rg/src/stm32_boot.c @@ -95,6 +95,6 @@ void stm32l4_board_initialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - board_app_initialize(0); + stm32_bringup(); } #endif diff --git a/boards/arm/stm32l4/nucleo-l496zg/src/CMakeLists.txt b/boards/arm/stm32l4/nucleo-l496zg/src/CMakeLists.txt index 32ff2a428fc..3e922a252e9 100644 --- a/boards/arm/stm32l4/nucleo-l496zg/src/CMakeLists.txt +++ b/boards/arm/stm32l4/nucleo-l496zg/src/CMakeLists.txt @@ -32,11 +32,8 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinitialize.c) - if(CONFIG_BOARDCTL_IOCTL) - list(APPEND SRCS stm32_ioctl.c) - endif() +if(CONFIG_BOARDCTL_IOCTL) + list(APPEND SRCS stm32_ioctl.c) endif() if(CONFIG_SPI) diff --git a/boards/arm/stm32l4/nucleo-l496zg/src/Makefile b/boards/arm/stm32l4/nucleo-l496zg/src/Makefile index b14856b894e..5170327a061 100644 --- a/boards/arm/stm32l4/nucleo-l496zg/src/Makefile +++ b/boards/arm/stm32l4/nucleo-l496zg/src/Makefile @@ -34,12 +34,9 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinitialize.c ifeq ($(CONFIG_BOARDCTL_IOCTL),y) CSRCS += stm32_ioctl.c endif -endif ifeq ($(CONFIG_SPI),y) CSRCS += stm32_spi.c diff --git a/boards/arm/stm32l4/nucleo-l496zg/src/stm32_appinit.c b/boards/arm/stm32l4/nucleo-l496zg/src/stm32_appinit.c deleted file mode 100644 index a0d80f933c1..00000000000 --- a/boards/arm/stm32l4/nucleo-l496zg/src/stm32_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32l4/nucleo-l496zg/src/stm32_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 - -#include -#include - -#include "nucleo-l496zg.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32l4/nucleo-l496zg/src/stm32_appinitialize.c b/boards/arm/stm32l4/nucleo-l496zg/src/stm32_appinitialize.c deleted file mode 100644 index 2ec91484233..00000000000 --- a/boards/arm/stm32l4/nucleo-l496zg/src/stm32_appinitialize.c +++ /dev/null @@ -1,208 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32l4/nucleo-l496zg/src/stm32_appinitialize.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 - -#include -#include -#include - -#include "nucleo-144.h" -#include -#include - -#include "stm32l4_i2c.h" - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -#if defined(CONFIG_STM32L4_I2C1) -struct i2c_master_s *i2c1; -#endif -#if defined(CONFIG_STM32L4_I2C2) -struct i2c_master_s *i2c2; -#endif -#if defined(CONFIG_STM32L4_I2C3) -struct i2c_master_s *i2c3; -#endif -#if defined(CONFIG_STM32L4_I2C4) -struct i2c_master_s *i2c4; -#endif - -/**************************************************************************** - * 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) -{ - int ret; - -#ifdef CONFIG_FS_PROCFS - /* Mount the procfs file system */ - - ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", - STM32_PROCFS_MOUNTPOINT, ret); - } -#endif - -#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER) - /* Register the LED driver */ - - ret = userled_lower_initialize(LED_DRIVER_PATH); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); - } -#endif - -#ifdef CONFIG_ADC - /* Initialize ADC and register the ADC driver. */ - - ret = stm32_adc_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_adc_setup failed: %d\n", ret); - } - -#ifdef CONFIG_STM32L4_DFSDM - /* Initialize DFSDM and register its filters as additional ADC devices. */ - - ret = stm32_dfsdm_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_dfsdm_setup failed: %d\n", ret); - } - -#endif -#endif /* CONFIG_ADC */ - -#ifdef CONFIG_DAC - /* Initialize DAC and register the DAC driver. */ - - ret = stm32_dac_setup(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_dac_setup failed: %d\n", ret); - } -#endif - -#if defined(CONFIG_FAT_DMAMEMORY) - if (stm32_dma_alloc_init() < 0) - { - syslog(LOG_ERR, "DMA alloc FAILED"); - } -#endif - -#if defined(CONFIG_NUCLEO_SPI_TEST) - /* Create SPI interfaces */ - - ret = stm32_spidev_bus_test(); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SPI interfaces: %d\n", - ret); - return ret; - } -#endif - -#if defined(CONFIG_MMCSD) - /* Configure SDIO */ - - /* Initialize the SDIO block driver */ - - ret = stm32l4_sdio_initialize(); - if (ret != OK) - { - ferr("ERROR: Failed to initialize MMC/SD driver: %d\n", ret); - return ret; - } -#endif - -#if defined(CONFIG_I2C) - /* Configure I2C */ - - /* REVISIT: this is ugly! */ - -#if defined(CONFIG_STM32L4_I2C1) - i2c1 = stm32l4_i2cbus_initialize(1); -#endif -#if defined(CONFIG_STM32L4_I2C2) - i2c2 = stm32l4_i2cbus_initialize(2); -#endif -#if defined(CONFIG_STM32L4_I2C3) - i2c3 = stm32l4_i2cbus_initialize(3); -#endif -#if defined(CONFIG_STM32L4_I2C4) - i2c4 = stm32l4_i2cbus_initialize(4); -#endif -#ifdef CONFIG_I2C_DRIVER -#if defined(CONFIG_STM32L4_I2C1) - i2c_register(i2c1, 1); -#endif -#if defined(CONFIG_STM32L4_I2C2) - i2c_register(i2c2, 2); -#endif -#if defined(CONFIG_STM32L4_I2C3) - i2c_register(i2c3, 3); -#endif -#if defined(CONFIG_STM32L4_I2C4) - i2c_register(i2c4, 4); -#endif -#endif -#endif /* CONFIG_I2C */ - - UNUSED(ret); - return OK; -} diff --git a/boards/arm/stm32l4/nucleo-l496zg/src/stm32_boot.c b/boards/arm/stm32l4/nucleo-l496zg/src/stm32_boot.c index 6a6e88a0cc3..a195c97e019 100644 --- a/boards/arm/stm32l4/nucleo-l496zg/src/stm32_boot.c +++ b/boards/arm/stm32l4/nucleo-l496zg/src/stm32_boot.c @@ -28,12 +28,19 @@ #include +#include +#include + #include #include #include "arm_internal.h" #include "nucleo-144.h" +/**************************************************************************** + * Private Data + ****************************************************************************/ + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -85,13 +92,6 @@ void stm32l4_board_initialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { -#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL) - /* Perform NSH initialization here instead of from the NSH. This - * alternative NSH initialization is necessary when NSH is ran in - * user-space but the initialization function must run in kernel space. - */ - - board_app_initialize(0); -#endif + stm32_bringup(); } #endif diff --git a/boards/arm/stm32l4/steval-stlcs01v1/src/CMakeLists.txt b/boards/arm/stm32l4/steval-stlcs01v1/src/CMakeLists.txt index 5724bb7d50f..88aa47097ce 100644 --- a/boards/arm/stm32l4/steval-stlcs01v1/src/CMakeLists.txt +++ b/boards/arm/stm32l4/steval-stlcs01v1/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_ARCH_LEDS) list(APPEND SRCS stm32_autoleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_STM32L4_OTGFS) list(APPEND SRCS stm32_usb.c) endif() diff --git a/boards/arm/stm32l4/steval-stlcs01v1/src/Makefile b/boards/arm/stm32l4/steval-stlcs01v1/src/Makefile index 5a8566fe401..e46d406cb3e 100644 --- a/boards/arm/stm32l4/steval-stlcs01v1/src/Makefile +++ b/boards/arm/stm32l4/steval-stlcs01v1/src/Makefile @@ -28,10 +28,6 @@ ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += stm32_autoleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_STM32L4_OTGFS),y) CSRCS += stm32_usb.c endif diff --git a/boards/arm/stm32l4/steval-stlcs01v1/src/steval-stlcs01v1.h b/boards/arm/stm32l4/steval-stlcs01v1/src/steval-stlcs01v1.h index b09a22bcfd9..b206a8d27d8 100644 --- a/boards/arm/stm32l4/steval-stlcs01v1/src/steval-stlcs01v1.h +++ b/boards/arm/stm32l4/steval-stlcs01v1/src/steval-stlcs01v1.h @@ -77,16 +77,9 @@ * Description: * Perform architecture specific initialization * - * CONFIG_BOARDCTL=y: - * If CONFIG_NSH_ARCHINITIALIZE=y: - * Called from the NSH library (or other application) - * Otherwise, assumed to be called from some other application. - * - * Otherwise CONFIG_BOARD_LATE_INITIALIZE=y: + * CONFIG_BOARD_LATE_INITIALIZE=y: * Called from board_late_initialize(). * - * Otherwise, bad news: Never called - * ****************************************************************************/ int stm32l4_bringup(void); diff --git a/boards/arm/stm32l4/steval-stlcs01v1/src/stm32_appinit.c b/boards/arm/stm32l4/steval-stlcs01v1/src/stm32_appinit.c deleted file mode 100644 index 2c0d16eac49..00000000000 --- a/boards/arm/stm32l4/steval-stlcs01v1/src/stm32_appinit.c +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32l4/steval-stlcs01v1/src/stm32_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 - -#include - -#include - -#include "steval-stlcs01v1.h" - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32l4_bringup(); -#endif -} diff --git a/boards/arm/stm32l4/stm32l476-mdk/src/CMakeLists.txt b/boards/arm/stm32l4/stm32l476-mdk/src/CMakeLists.txt index 9deebb0f0b6..f47dc052ac4 100644 --- a/boards/arm/stm32l4/stm32l476-mdk/src/CMakeLists.txt +++ b/boards/arm/stm32l4/stm32l476-mdk/src/CMakeLists.txt @@ -20,7 +20,7 @@ # # ############################################################################## -set(SRCS stm32_boot.c stm32_bringup.c stm32_spi.c stm32_userleds.c) +set(SRCS stm32_boot.c stm32_spi.c stm32_userleds.c) if(CONFIG_ARCH_BOARD_STM32L4_CUSTOM_CLOCKCONFIG) list(APPEND SRCS stm32_clockconfig.c) @@ -34,10 +34,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT diff --git a/boards/arm/stm32l4/stm32l476-mdk/src/Makefile b/boards/arm/stm32l4/stm32l476-mdk/src/Makefile index f0fa7f07753..0aba6ed8c09 100644 --- a/boards/arm/stm32l4/stm32l476-mdk/src/Makefile +++ b/boards/arm/stm32l4/stm32l476-mdk/src/Makefile @@ -22,7 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = stm32_boot.c stm32_bringup.c stm32_spi.c stm32_userleds.c +CSRCS = stm32_boot.c stm32_spi.c stm32_userleds.c ifeq ($(CONFIG_ARCH_BOARD_STM32L4_CUSTOM_CLOCKCONFIG),y) CSRCS += stm32_clockconfig.c @@ -36,8 +36,4 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/stm32l4/stm32l476-mdk/src/stm32_appinit.c b/boards/arm/stm32l4/stm32l476-mdk/src/stm32_appinit.c deleted file mode 100644 index ab612dc79da..00000000000 --- a/boards/arm/stm32l4/stm32l476-mdk/src/stm32_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32l4/stm32l476-mdk/src/stm32_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 - -#include - -#include "stm32l476-mdk.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) -{ -#ifdef CONFIG_BOARD_LATE_INITIALIZE - /* Board initialization already performed by board_late_initialize() */ - - return OK; -#else - /* Perform board-specific initialization */ - - return stm32_bringup(); -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/stm32l4/stm32l476-mdk/src/stm32_boot.c b/boards/arm/stm32l4/stm32l476-mdk/src/stm32_boot.c index 0bde3e3c79b..ab4b6b3ddc4 100644 --- a/boards/arm/stm32l4/stm32l476-mdk/src/stm32_boot.c +++ b/boards/arm/stm32l4/stm32l476-mdk/src/stm32_boot.c @@ -28,15 +28,39 @@ #include +#include +#include +#include +#include +#include +#include + #include #include -#include - #include +#include +#include +#include #include "arm_internal.h" +#include "stm32l4.h" +#include "stm32l4_uid.h" #include "stm32l476-mdk.h" +/* Conditional logic in stm32l476-mdk.h will determine if certain features + * are supported. Tests for these features need to be made after including + * stm32l476-mdk.h. + */ + +#ifdef HAVE_RTC_DRIVER +# include +# include "stm32l4_rtc.h" +#endif + +#ifdef HAVE_USERLED_DRIVER +# include +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -87,8 +111,77 @@ void stm32l4_board_initialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - /* Perform board-specific initialization */ +#ifdef HAVE_RTC_DRIVER + struct rtc_lowerhalf_s *rtclower; +#endif + int ret; - stm32_bringup(); +#ifdef HAVE_PROC + /* mount the proc filesystem */ + + syslog(LOG_INFO, "Mounting procfs to /proc\n"); + + ret = nx_mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); + return; + } +#endif + +#ifdef HAVE_RTC_DRIVER + /* Instantiate the STM32 lower-half RTC driver */ + + rtclower = stm32l4_rtc_lowerhalf(); + if (!rtclower) + { + syslog(LOG_ERR, + "ERROR: Failed to instantiate the RTC lower-half driver\n"); + return; + } + else + { + /* Bind the lower half driver and register the combined RTC driver + * as /dev/rtc0 + */ + + ret = rtc_initialize(0, rtclower); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to bind/register the RTC driver: %d\n", + ret); + return; + } + } +#endif + +#ifdef HAVE_USERLED_DRIVER + /* Register the LED driver */ + + ret = userled_lower_initialize("/dev/userleds"); + if (ret != OK) + { + syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", + ret); + return; + } +#endif + + UNUSED(ret); +} +#endif + +#if defined(CONFIG_BOARDCTL_UNIQUEID) +int board_uniqueid(uint8_t *uniqueid) +{ + if (uniqueid == NULL) + { + return -EINVAL; + } + + stm32l4_get_uniqueid(uniqueid); + return OK; } #endif diff --git a/boards/arm/stm32l4/stm32l476-mdk/src/stm32_bringup.c b/boards/arm/stm32l4/stm32l476-mdk/src/stm32_bringup.c deleted file mode 100644 index 87f3ee3a429..00000000000 --- a/boards/arm/stm32l4/stm32l476-mdk/src/stm32_bringup.c +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32l4/stm32l476-mdk/src/stm32_bringup.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 - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include "stm32l4.h" -#include "stm32l4_uid.h" -#include "stm32l476-mdk.h" - -/* Conditional logic in stm32l476-mdk.h will determine if certain features - * are supported. Tests for these features need to be made after including - * stm32l476-mdk.h. - */ - -#ifdef HAVE_RTC_DRIVER -# include -# include "stm32l4_rtc.h" -#endif - -#ifdef HAVE_USERLED_DRIVER -# include -#endif - -/**************************************************************************** - * 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. - * - ****************************************************************************/ - -#ifdef CONFIG_BOARDCTL -int board_app_initialize(uintptr_t arg) -{ -#ifdef HAVE_RTC_DRIVER - struct rtc_lowerhalf_s *rtclower; -#endif - int ret; - -#ifdef HAVE_PROC - /* mount the proc filesystem */ - - syslog(LOG_INFO, "Mounting procfs to /proc\n"); - - ret = nx_mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); - if (ret < 0) - { - syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d\n", ret); - return ret; - } -#endif - -#ifdef HAVE_RTC_DRIVER - /* Instantiate the STM32 lower-half RTC driver */ - - rtclower = stm32l4_rtc_lowerhalf(); - if (!rtclower) - { - syslog(LOG_ERR, - "ERROR: Failed to instantiate the RTC lower-half driver\n"); - return -ENOMEM; - } - else - { - /* Bind the lower half driver and register the combined RTC driver - * as /dev/rtc0 - */ - - ret = rtc_initialize(0, rtclower); - if (ret < 0) - { - syslog(LOG_ERR, - "ERROR: Failed to bind/register the RTC driver: %d\n", - ret); - return ret; - } - } -#endif - -#ifdef HAVE_USERLED_DRIVER - /* Register the LED driver */ - - ret = userled_lower_initialize("/dev/userleds"); - if (ret != OK) - { - syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", - ret); - return ret; - } -#endif - - UNUSED(ret); - return OK; -} -#endif /* CONFIG_BOARDCTL */ - -#if defined(CONFIG_BOARDCTL_UNIQUEID) -int board_uniqueid(uint8_t *uniqueid) -{ - if (uniqueid == NULL) - { - return -EINVAL; - } - - stm32l4_get_uniqueid(uniqueid); - return OK; -} -#endif diff --git a/boards/arm/stm32l4/stm32l476vg-disco/src/Makefile b/boards/arm/stm32l4/stm32l476vg-disco/src/Makefile index 821da245d6b..a2438eee63b 100644 --- a/boards/arm/stm32l4/stm32l476vg-disco/src/Makefile +++ b/boards/arm/stm32l4/stm32l476vg-disco/src/Makefile @@ -46,12 +46,9 @@ ifeq ($(CONFIG_ADC),y) #CSRCS += stm32_adc.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c ifeq ($(CONFIG_BOARDCTL_IOCTL),y) CSRCS += stm32_ioctl.c endif -endif ifeq ($(CONFIG_ETC_ROMFS),y) CSRCS += etc_romfs.c diff --git a/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c b/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c deleted file mode 100644 index dd49a7b0877..00000000000 --- a/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32l4/stm32l476vg-disco/src/stm32_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 - -#include -#include - -#include "stm32l476vg-disco.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_boot.c b/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_boot.c index 01382d49d8a..74a290c5550 100644 --- a/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_boot.c +++ b/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_boot.c @@ -98,6 +98,6 @@ void stm32l4_board_initialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - board_app_initialize(0); + stm32_bringup(); } #endif diff --git a/boards/arm/stm32l4/stm32l4r9ai-disco/src/Makefile b/boards/arm/stm32l4/stm32l4r9ai-disco/src/Makefile index 735e3935709..47936292ad5 100644 --- a/boards/arm/stm32l4/stm32l4r9ai-disco/src/Makefile +++ b/boards/arm/stm32l4/stm32l4r9ai-disco/src/Makefile @@ -59,12 +59,9 @@ ifeq ($(CONFIG_STM32L4_OTGFS),y) CSRCS += stm32_usb.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c ifeq ($(CONFIG_BOARDCTL_IOCTL),y) CSRCS += stm32_ioctl.c endif -endif ifeq ($(CONFIG_ETC_ROMFS),y) CSRCS += etc_romfs.c diff --git a/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_appinit.c b/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_appinit.c deleted file mode 100644 index 131464b3ec8..00000000000 --- a/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_appinit.c +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_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 - -#include -#include - -#include "stm32l4r9ai-disco.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * 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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_boot.c b/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_boot.c index c91802b82ec..ccc12956c6a 100644 --- a/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_boot.c +++ b/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_boot.c @@ -98,6 +98,6 @@ void stm32l4_board_initialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - board_app_initialize(0); + stm32_bringup(); } #endif diff --git a/boards/arm/stm32l5/nucleo-l552ze/src/CMakeLists.txt b/boards/arm/stm32l5/nucleo-l552ze/src/CMakeLists.txt index 70b4b2eee1e..0146945c9d5 100644 --- a/boards/arm/stm32l5/nucleo-l552ze/src/CMakeLists.txt +++ b/boards/arm/stm32l5/nucleo-l552ze/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld") diff --git a/boards/arm/stm32l5/nucleo-l552ze/src/Makefile b/boards/arm/stm32l5/nucleo-l552ze/src/Makefile index 848f9648e94..28cdefc9f46 100644 --- a/boards/arm/stm32l5/nucleo-l552ze/src/Makefile +++ b/boards/arm/stm32l5/nucleo-l552ze/src/Makefile @@ -35,8 +35,4 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/stm32l5/nucleo-l552ze/src/stm32_appinit.c b/boards/arm/stm32l5/nucleo-l552ze/src/stm32_appinit.c deleted file mode 100644 index 8cfdb9045c6..00000000000 --- a/boards/arm/stm32l5/nucleo-l552ze/src/stm32_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32l5/nucleo-l552ze/src/stm32_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 - -#include - -#include "nucleo-l552ze.h" - -#include - -/**************************************************************************** - * 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 cold 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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32l5/stm32l562e-dk/src/CMakeLists.txt b/boards/arm/stm32l5/stm32l562e-dk/src/CMakeLists.txt index 759a5286c01..bf7a04d8d53 100644 --- a/boards/arm/stm32l5/stm32l562e-dk/src/CMakeLists.txt +++ b/boards/arm/stm32l5/stm32l562e-dk/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/tfm-ns.ld") diff --git a/boards/arm/stm32l5/stm32l562e-dk/src/Makefile b/boards/arm/stm32l5/stm32l562e-dk/src/Makefile index 2e03d200b68..aa38e15db50 100644 --- a/boards/arm/stm32l5/stm32l562e-dk/src/Makefile +++ b/boards/arm/stm32l5/stm32l562e-dk/src/Makefile @@ -35,8 +35,4 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += stm32_buttons.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/stm32l5/stm32l562e-dk/src/stm32_appinit.c b/boards/arm/stm32l5/stm32l562e-dk/src/stm32_appinit.c deleted file mode 100644 index 307964bd676..00000000000 --- a/boards/arm/stm32l5/stm32l562e-dk/src/stm32_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32l5/stm32l562e-dk/src/stm32_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 - -#include - -#include "stm32l562e-dk.h" - -#include - -/**************************************************************************** - * 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 cold 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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32u5/b-u585i-iot02a/src/CMakeLists.txt b/boards/arm/stm32u5/b-u585i-iot02a/src/CMakeLists.txt index c0c733e9acf..a845f39aefe 100644 --- a/boards/arm/stm32u5/b-u585i-iot02a/src/CMakeLists.txt +++ b/boards/arm/stm32u5/b-u585i-iot02a/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS stm32_boot.c stm32_bringup.c stm32_spi.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ARCH_BOARD_STM32U5_CUSTOM_CLOCKCONFIG) list(APPEND SRCS stm32_clockconfig.c) endif() diff --git a/boards/arm/stm32u5/b-u585i-iot02a/src/Makefile b/boards/arm/stm32u5/b-u585i-iot02a/src/Makefile index 48bc90571ea..0a32978916a 100644 --- a/boards/arm/stm32u5/b-u585i-iot02a/src/Makefile +++ b/boards/arm/stm32u5/b-u585i-iot02a/src/Makefile @@ -25,10 +25,6 @@ ASRCS = CSRCS = stm32_boot.c stm32_bringup.c stm32_spi.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ARCH_BOARD_STM32U5_CUSTOM_CLOCKCONFIG),y) CSRCS += stm32_clockconfig.c endif diff --git a/boards/arm/stm32u5/b-u585i-iot02a/src/stm32_appinit.c b/boards/arm/stm32u5/b-u585i-iot02a/src/stm32_appinit.c deleted file mode 100644 index c0594f96f08..00000000000 --- a/boards/arm/stm32u5/b-u585i-iot02a/src/stm32_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32u5/b-u585i-iot02a/src/stm32_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 - -#include - -#include "b-u585i-iot02a.h" - -#include - -/**************************************************************************** - * 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 cold 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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32u5/nucleo-u5a5zj-q/src/CMakeLists.txt b/boards/arm/stm32u5/nucleo-u5a5zj-q/src/CMakeLists.txt index 18a86294aea..fa6b58b12dc 100644 --- a/boards/arm/stm32u5/nucleo-u5a5zj-q/src/CMakeLists.txt +++ b/boards/arm/stm32u5/nucleo-u5a5zj-q/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS stm32_boot.c stm32_bringup.c stm32_spi.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ARCH_BOARD_STM32U5_CUSTOM_CLOCKCONFIG) list(APPEND SRCS stm32_clockconfig.c) endif() diff --git a/boards/arm/stm32u5/nucleo-u5a5zj-q/src/Makefile b/boards/arm/stm32u5/nucleo-u5a5zj-q/src/Makefile index 71f3c21059b..1fa94c46e61 100644 --- a/boards/arm/stm32u5/nucleo-u5a5zj-q/src/Makefile +++ b/boards/arm/stm32u5/nucleo-u5a5zj-q/src/Makefile @@ -25,10 +25,6 @@ ASRCS = CSRCS = stm32_boot.c stm32_bringup.c stm32_spi.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_ARCH_BOARD_STM32U5_CUSTOM_CLOCKCONFIG),y) CSRCS += stm32_clockconfig.c endif diff --git a/boards/arm/stm32u5/nucleo-u5a5zj-q/src/stm32_appinit.c b/boards/arm/stm32u5/nucleo-u5a5zj-q/src/stm32_appinit.c deleted file mode 100644 index fd03281dc01..00000000000 --- a/boards/arm/stm32u5/nucleo-u5a5zj-q/src/stm32_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32u5/nucleo-u5a5zj-q/src/stm32_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 - -#include - -#include "nucleo-u5a5zj-q.h" - -#include - -/**************************************************************************** - * 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 cold 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) -{ - /* Did we already initialize via board_late_initialize()? */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return stm32_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/stm32wb/flipperzero/src/CMakeLists.txt b/boards/arm/stm32wb/flipperzero/src/CMakeLists.txt index b38341f1522..80c36fc77e1 100644 --- a/boards/arm/stm32wb/flipperzero/src/CMakeLists.txt +++ b/boards/arm/stm32wb/flipperzero/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS stm32_boot.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_SPI) list(APPEND SRCS stm32_spi.c) endif() diff --git a/boards/arm/stm32wb/flipperzero/src/Makefile b/boards/arm/stm32wb/flipperzero/src/Makefile index 13b789b1ad3..716d6b29001 100644 --- a/boards/arm/stm32wb/flipperzero/src/Makefile +++ b/boards/arm/stm32wb/flipperzero/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = stm32_boot.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - ifeq ($(CONFIG_SPI),y) CSRCS += stm32_spi.c endif diff --git a/boards/arm/stm32wb/flipperzero/src/stm32_appinit.c b/boards/arm/stm32wb/flipperzero/src/stm32_appinit.c deleted file mode 100644 index d708fe1318a..00000000000 --- a/boards/arm/stm32wb/flipperzero/src/stm32_appinit.c +++ /dev/null @@ -1,196 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32wb/flipperzero/src/stm32_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 - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "stm32wb_tim.h" - -#ifdef CONFIG_RTC_DRIVER -# include -# include "stm32wb_rtc.h" -#endif - -#ifdef CONFIG_STM32WB_BLE -# include "stm32wb_blehci.h" -#endif - -#include "flipperzero.h" - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: arm_netinitialize - * - * Description: - * Dummy function expected to start-up logic. - * - ****************************************************************************/ - -#if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT) -void arm_netinitialize(void) -{ -} -#endif - -/**************************************************************************** - * 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. - * - ****************************************************************************/ - -#ifdef CONFIG_BOARDCTL -int board_app_initialize(uintptr_t arg) -{ -#ifdef CONFIG_RTC_DRIVER - struct rtc_lowerhalf_s *rtclower; -#endif - int ret = OK; - -#ifdef HAVE_PROC - /* Mount the proc filesystem */ - - syslog(LOG_INFO, "Mounting procfs to /proc\n"); - - ret = nx_mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); - if (ret < 0) - { - syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); - return ret; - } -#endif - -#ifdef CONFIG_RTC_DRIVER - /* Instantiate the STM32WB lower-half RTC driver */ - - rtclower = stm32wb_rtc_lowerhalf(); - if (!rtclower) - { - serr("ERROR: Failed to instantiate the RTC lower-half driver\n"); - return -ENOMEM; - } - else - { - /* Bind the lower half driver and register the combined RTC driver - * as /dev/rtc0 - */ - - ret = rtc_initialize(0, rtclower); - if (ret < 0) - { - serr("ERROR: Failed to bind/register the RTC driver: %d\n", ret); - return ret; - } - } -#endif - -#ifdef CONFIG_TIMER - /* Initialize and register the timer driver */ - - ret = stm32wb_timer_initialize("/dev/timer0", 1); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to register the timer driver: %d\n", - ret); - return ret; - } -#endif - -#ifdef CONFIG_LCD - ret = board_lcd_initialize(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to initialize LCD.\n"); - } -#endif - -#ifdef CONFIG_STM32WB_BLE - /* Initialize and register BLE HCI driver */ - - stm32wb_blehci_initialize(); -#endif - - return ret; -} -#endif /* CONFIG_BOARDCTL */ - -#ifdef CONFIG_BOARDCTL_IOCTL -int board_ioctl(unsigned int cmd, uintptr_t arg) -{ - return -ENOTTY; -} -#endif - -#if defined(CONFIG_BOARDCTL_UNIQUEID) -int board_uniqueid(uint8_t *uniqueid) -{ - if (uniqueid == NULL) - { - return -EINVAL; - } - - stm32wb_get_uniqueid(uniqueid); - return OK; -} -#endif diff --git a/boards/arm/stm32wb/flipperzero/src/stm32_boot.c b/boards/arm/stm32wb/flipperzero/src/stm32_boot.c index e62f34df795..b83f7f7bab3 100644 --- a/boards/arm/stm32wb/flipperzero/src/stm32_boot.c +++ b/boards/arm/stm32wb/flipperzero/src/stm32_boot.c @@ -28,11 +28,29 @@ #include +#include +#include +#include +#include +#include + #include #include +#include #include +#include "stm32wb_tim.h" + +#ifdef CONFIG_RTC_DRIVER +# include +# include "stm32wb_rtc.h" +#endif + +#ifdef CONFIG_STM32WB_BLE +# include "stm32wb_blehci.h" +#endif + #include "flipperzero.h" /**************************************************************************** @@ -70,6 +88,20 @@ void stm32wb_board_initialize(void) #endif } +/**************************************************************************** + * Name: arm_netinitialize + * + * Description: + * Dummy function expected to start-up logic. + * + ****************************************************************************/ + +#if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT) +void arm_netinitialize(void) +{ +} +#endif + /**************************************************************************** * Name: board_late_initialize * @@ -87,6 +119,94 @@ void stm32wb_board_initialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - board_app_initialize(0); +#ifdef CONFIG_RTC_DRIVER + struct rtc_lowerhalf_s *rtclower; +#endif + int ret = OK; + +#ifdef HAVE_PROC + /* Mount the proc filesystem */ + + syslog(LOG_INFO, "Mounting procfs to /proc\n"); + + ret = nx_mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", + ret, errno); + return; + } +#endif + +#ifdef CONFIG_RTC_DRIVER + /* Instantiate the STM32WB lower-half RTC driver */ + + rtclower = stm32wb_rtc_lowerhalf(); + if (!rtclower) + { + serr("ERROR: Failed to instantiate the RTC lower-half driver\n"); + return; + } + else + { + /* Bind the lower half driver and register the combined RTC driver + * as /dev/rtc0 + */ + + ret = rtc_initialize(0, rtclower); + if (ret < 0) + { + serr("ERROR: Failed to bind/register the RTC driver: %d\n", ret); + return; + } + } +#endif + +#ifdef CONFIG_TIMER + /* Initialize and register the timer driver */ + + ret = stm32wb_timer_initialize("/dev/timer0", 1); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to register the timer driver: %d\n", + ret); + return; + } +#endif + +#ifdef CONFIG_LCD + ret = board_lcd_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize LCD.\n"); + } +#endif + +#ifdef CONFIG_STM32WB_BLE + /* Initialize and register BLE HCI driver */ + + stm32wb_blehci_initialize(); +#endif +} +#endif + +#ifdef CONFIG_BOARDCTL_IOCTL +int board_ioctl(unsigned int cmd, uintptr_t arg) +{ + return -ENOTTY; +} +#endif + +#if defined(CONFIG_BOARDCTL_UNIQUEID) +int board_uniqueid(uint8_t *uniqueid) +{ + if (uniqueid == NULL) + { + return -EINVAL; + } + + stm32wb_get_uniqueid(uniqueid); + return OK; } #endif diff --git a/boards/arm/stm32wb/nucleo-wb55rg/src/CMakeLists.txt b/boards/arm/stm32wb/nucleo-wb55rg/src/CMakeLists.txt index 8c5df0a5587..ccedd77381b 100644 --- a/boards/arm/stm32wb/nucleo-wb55rg/src/CMakeLists.txt +++ b/boards/arm/stm32wb/nucleo-wb55rg/src/CMakeLists.txt @@ -28,10 +28,6 @@ else() list(APPEND SRCS stm32_userleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/wb55rg.ld") diff --git a/boards/arm/stm32wb/nucleo-wb55rg/src/Makefile b/boards/arm/stm32wb/nucleo-wb55rg/src/Makefile index 02f0299a9bc..11d004aa68c 100644 --- a/boards/arm/stm32wb/nucleo-wb55rg/src/Makefile +++ b/boards/arm/stm32wb/nucleo-wb55rg/src/Makefile @@ -30,8 +30,4 @@ else CSRCS += stm32_userleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += stm32_appinit.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/stm32wb/nucleo-wb55rg/src/stm32_appinit.c b/boards/arm/stm32wb/nucleo-wb55rg/src/stm32_appinit.c deleted file mode 100644 index 7da65ac26c8..00000000000 --- a/boards/arm/stm32wb/nucleo-wb55rg/src/stm32_appinit.c +++ /dev/null @@ -1,188 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32wb/nucleo-wb55rg/src/stm32_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 - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "stm32wb_tim.h" - -#ifdef CONFIG_RTC_DRIVER -# include -# include "stm32wb_rtc.h" -#endif - -#ifdef CONFIG_STM32WB_BLE -# include "stm32wb_blehci.h" -#endif - -#include "nucleo-wb55rg.h" - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: arm_netinitialize - * - * Description: - * Dummy function expected to start-up logic. - * - ****************************************************************************/ - -#if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT) -void arm_netinitialize(void) -{ -} -#endif - -/**************************************************************************** - * 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. - * - ****************************************************************************/ - -#ifdef CONFIG_BOARDCTL -int board_app_initialize(uintptr_t arg) -{ -#ifdef CONFIG_RTC_DRIVER - struct rtc_lowerhalf_s *rtclower; -#endif - int ret = OK; - -#ifdef HAVE_PROC - /* Mount the proc filesystem */ - - syslog(LOG_INFO, "Mounting procfs to /proc\n"); - - ret = nx_mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); - if (ret < 0) - { - syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); - return ret; - } -#endif - -#ifdef CONFIG_RTC_DRIVER - /* Instantiate the STM32WB lower-half RTC driver */ - - rtclower = stm32wb_rtc_lowerhalf(); - if (!rtclower) - { - serr("ERROR: Failed to instantiate the RTC lower-half driver\n"); - return -ENOMEM; - } - else - { - /* Bind the lower half driver and register the combined RTC driver - * as /dev/rtc0 - */ - - ret = rtc_initialize(0, rtclower); - if (ret < 0) - { - serr("ERROR: Failed to bind/register the RTC driver: %d\n", ret); - return ret; - } - } -#endif - -#ifdef CONFIG_TIMER - /* Initialize and register the timer driver */ - - ret = stm32wb_timer_initialize("/dev/timer0", 1); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to register the timer driver: %d\n", - ret); - return ret; - } -#endif - -#ifdef CONFIG_STM32WB_BLE - /* Initialize and register BLE HCI driver */ - - stm32wb_blehci_initialize(); -#endif - - return ret; -} -#endif /* CONFIG_BOARDCTL */ - -#ifdef CONFIG_BOARDCTL_IOCTL -int board_ioctl(unsigned int cmd, uintptr_t arg) -{ - return -ENOTTY; -} -#endif - -#if defined(CONFIG_BOARDCTL_UNIQUEID) -int board_uniqueid(uint8_t *uniqueid) -{ - if (uniqueid == NULL) - { - return -EINVAL; - } - - stm32wb_get_uniqueid(uniqueid); - return OK; -} -#endif diff --git a/boards/arm/stm32wb/nucleo-wb55rg/src/stm32_boot.c b/boards/arm/stm32wb/nucleo-wb55rg/src/stm32_boot.c index 5340371958e..9b1b0c5a05f 100644 --- a/boards/arm/stm32wb/nucleo-wb55rg/src/stm32_boot.c +++ b/boards/arm/stm32wb/nucleo-wb55rg/src/stm32_boot.c @@ -28,11 +28,30 @@ #include +#include +#include +#include +#include +#include + #include #include +#include #include +#include "stm32wb_tim.h" + +#ifdef CONFIG_RTC_DRIVER +# include +# include "stm32wb_rtc.h" +#endif + +#ifdef CONFIG_STM32WB_BLE +# include "stm32wb_blehci.h" +#endif + + #include "nucleo-wb55rg.h" /**************************************************************************** @@ -59,6 +78,20 @@ void stm32wb_board_initialize(void) #endif } +/**************************************************************************** + * Name: arm_netinitialize + * + * Description: + * Dummy function expected to start-up logic. + * + ****************************************************************************/ + +#if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT) +void arm_netinitialize(void) +{ +} +#endif + /**************************************************************************** * Name: board_late_initialize * @@ -76,6 +109,87 @@ void stm32wb_board_initialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { - board_app_initialize(0); +#ifdef CONFIG_RTC_DRIVER + struct rtc_lowerhalf_s *rtclower; +#endif + int ret = OK; + +#ifdef HAVE_PROC + /* Mount the proc filesystem */ + + syslog(LOG_INFO, "Mounting procfs to /proc\n"); + + ret = nx_mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", + ret, errno); + return; + } +#endif + +#ifdef CONFIG_RTC_DRIVER + /* Instantiate the STM32WB lower-half RTC driver */ + + rtclower = stm32wb_rtc_lowerhalf(); + if (!rtclower) + { + serr("ERROR: Failed to instantiate the RTC lower-half driver\n"); + return; + } + else + { + /* Bind the lower half driver and register the combined RTC driver + * as /dev/rtc0 + */ + + ret = rtc_initialize(0, rtclower); + if (ret < 0) + { + serr("ERROR: Failed to bind/register the RTC driver: %d\n", ret); + return; + } + } +#endif + +#ifdef CONFIG_TIMER + /* Initialize and register the timer driver */ + + ret = stm32wb_timer_initialize("/dev/timer0", 1); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to register the timer driver: %d\n", + ret); + return; + } +#endif + +#ifdef CONFIG_STM32WB_BLE + /* Initialize and register BLE HCI driver */ + + stm32wb_blehci_initialize(); +#endif + UNUSED(ret); +} +#endif + +#ifdef CONFIG_BOARDCTL_IOCTL +int board_ioctl(unsigned int cmd, uintptr_t arg) +{ + return -ENOTTY; +} +#endif + +#if defined(CONFIG_BOARDCTL_UNIQUEID) +int board_uniqueid(uint8_t *uniqueid) +{ + if (uniqueid == NULL) + { + return -EINVAL; + } + + stm32wb_get_uniqueid(uniqueid); + return OK; } #endif diff --git a/boards/arm/stm32wl5/nucleo-wl55jc/src/CMakeLists.txt b/boards/arm/stm32wl5/nucleo-wl55jc/src/CMakeLists.txt index f8ca9fe234d..fb81ed29429 100644 --- a/boards/arm/stm32wl5/nucleo-wl55jc/src/CMakeLists.txt +++ b/boards/arm/stm32wl5/nucleo-wl55jc/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS stm32_boot.c stm32_leds.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS stm32_appinit.c) -endif() - if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS stm32_buttons.c) endif() diff --git a/boards/arm/stm32wl5/nucleo-wl55jc/src/Makefile b/boards/arm/stm32wl5/nucleo-wl55jc/src/Makefile index 630173bd984..1c280874bc5 100644 --- a/boards/arm/stm32wl5/nucleo-wl55jc/src/Makefile +++ b/boards/arm/stm32wl5/nucleo-wl55jc/src/Makefile @@ -24,7 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = stm32_boot.c stm32_leds.c -CSRCS-$(CONFIG_BOARDCTL) += stm32_appinit.c CSRCS-$(CONFIG_ARCH_BUTTONS) += stm32_buttons.c CSRCS-$(CONFIG_ARCH_BOARD_FLASH_MOUNT) += stm32_flash.c CSRCS-$(CONFIG_SPI_DRIVER) += stm32_spi.c diff --git a/boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_appinit.c b/boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_appinit.c deleted file mode 100644 index d8fee19197a..00000000000 --- a/boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_appinit.c +++ /dev/null @@ -1,175 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_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 - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include "nucleo-wl55jc.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Define proc mountpoint in case procfs is used but nsh is not */ - -#ifndef CONFIG_NSH_PROC_MOUNTPOINT -#define CONFIG_NSH_PROC_MOUNTPOINT "/proc" -#endif - -/**************************************************************************** - * 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) -{ - int ret = OK; - (void)arg; - -#ifdef HAVE_PROC - /* Mount the proc filesystem */ - - syslog(LOG_INFO, "Mounting procfs to /proc\n"); - - ret = nx_mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to mount the PROC filesystem: %d\n", - ret); - return ret; - } -#endif - -#if defined(CONFIG_USERLED_LOWER) - /* Register the LED driver */ - - ret = userled_lower_initialize("/dev/userleds"); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); - } -#endif - -#if defined(CONFIG_INPUT_BUTTONS_LOWER) - /* Register the Button driver */ - - ret = btn_lower_initialize("/dev/buttons"); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret); - } -#endif - -#if defined(CONFIG_ARCH_BOARD_FLASH_MOUNT) - /* Register partition table for on-board FLASH memory */ - - ret = stm32wl5_flash_init(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32wl5_flash_init() failed: %d\n", ret); - } -#endif - -#if defined(CONFIG_ARCH_BOARD_IPCC) - /* Register IPCC driver */ - - ret = ipcc_init(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: ipcc_init() failed\n"); - } -#endif - -#if defined(CONFIG_ARCH_BOARD_ENABLE_CPU2) - /* Start second CPU */ - - stm32wl5_pwr_boot_c2(); -#endif - - return ret; -} - -#ifdef CONFIG_BOARDCTL_IOCTL -int board_ioctl(unsigned int cmd, uintptr_t arg) -{ - return -ENOTTY; -} -#endif - -#if defined(CONFIG_BOARDCTL_UNIQUEID) -int board_uniqueid(uint8_t *uniqueid) -{ - if (uniqueid == 0) - { - return -EINVAL; - } - - stm32wl5_get_uniqueid(uniqueid); - return OK; -} -#endif diff --git a/boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_boot.c b/boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_boot.c index 67f4631cbb8..b823f818470 100644 --- a/boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_boot.c +++ b/boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_boot.c @@ -28,9 +28,18 @@ #include +#include +#include +#include +#include +#include + #include #include #include +#include +#include +#include #include @@ -38,6 +47,10 @@ #include #endif +#include +#include +#include + #include "arm_internal.h" #include "nucleo-wl55jc.h" @@ -45,6 +58,12 @@ * Pre-processor Definitions ****************************************************************************/ +/* Define proc mountpoint in case procfs is used but nsh is not */ + +#ifndef CONFIG_NSH_PROC_MOUNTPOINT +#define CONFIG_NSH_PROC_MOUNTPOINT "/proc" +#endif + /**************************************************************************** * Private Data ****************************************************************************/ @@ -87,9 +106,7 @@ void stm32wl5_board_initialize(void) #ifdef CONFIG_BOARD_LATE_INITIALIZE void board_late_initialize(void) { -#if defined(CONFIG_VIDEO_FB) int ret; -#endif #if defined(CONFIG_STM32WL5_SPI1) || defined(CONFIG_STM32WL5_SPI2S2) stm32wl5_spidev_initialize(); @@ -107,6 +124,86 @@ void board_late_initialize(void) } #endif - board_app_initialize(0); +#ifdef HAVE_PROC + /* Mount the proc filesystem */ + + syslog(LOG_INFO, "Mounting procfs to /proc\n"); + + ret = nx_mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to mount the PROC filesystem: %d\n", + ret); + return; + } +#endif + +#if defined(CONFIG_USERLED_LOWER) + /* Register the LED driver */ + + ret = userled_lower_initialize("/dev/userleds"); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret); + } +#endif + +#if defined(CONFIG_INPUT_BUTTONS_LOWER) + /* Register the Button driver */ + + ret = btn_lower_initialize("/dev/buttons"); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret); + } +#endif + +#if defined(CONFIG_ARCH_BOARD_FLASH_MOUNT) + /* Register partition table for on-board FLASH memory */ + + ret = stm32wl5_flash_init(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: stm32wl5_flash_init() failed: %d\n", ret); + } +#endif + +#if defined(CONFIG_ARCH_BOARD_IPCC) + /* Register IPCC driver */ + + ret = ipcc_init(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: ipcc_init() failed\n"); + } +#endif + +#if defined(CONFIG_ARCH_BOARD_ENABLE_CPU2) + /* Start second CPU */ + + stm32wl5_pwr_boot_c2(); +#endif + + UNUSED(ret); +} +#endif + +#ifdef CONFIG_BOARDCTL_IOCTL +int board_ioctl(unsigned int cmd, uintptr_t arg) +{ + return -ENOTTY; +} +#endif + +#if defined(CONFIG_BOARDCTL_UNIQUEID) +int board_uniqueid(uint8_t *uniqueid) +{ + if (uniqueid == 0) + { + return -EINVAL; + } + + stm32wl5_get_uniqueid(uniqueid); + return OK; } #endif diff --git a/boards/arm/str71x/olimex-strp711/src/Makefile b/boards/arm/str71x/olimex-strp711/src/Makefile index d0fa559d33e..4c175061a04 100644 --- a/boards/arm/str71x/olimex-strp711/src/Makefile +++ b/boards/arm/str71x/olimex-strp711/src/Makefile @@ -22,10 +22,8 @@ include $(TOPDIR)/Make.defs -CSRCS = str71_spi.c str71_leds.c str71_buttons.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += str71_appinit.c -endif +CSRCS = str71_spi.c str71_leds.c str71_buttons.c str71_boardinit.c + ifeq ($(CONFIG_ENC28J60),y) CSRCS += str71_enc28j60.c endif diff --git a/boards/arm/str71x/olimex-strp711/src/str71_appinit.c b/boards/arm/str71x/olimex-strp711/src/str71_boardinit.c similarity index 75% rename from boards/arm/str71x/olimex-strp711/src/str71_appinit.c rename to boards/arm/str71x/olimex-strp711/src/str71_boardinit.c index d295a78d455..843054983c9 100644 --- a/boards/arm/str71x/olimex-strp711/src/str71_appinit.c +++ b/boards/arm/str71x/olimex-strp711/src/str71_boardinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/str71x/olimex-strp711/src/str71_appinit.c + * boards/arm/str71x/olimex-strp711/src/str71_boardinit.c * * SPDX-License-Identifier: Apache-2.0 * @@ -76,31 +76,20 @@ ****************************************************************************/ /**************************************************************************** - * Name: board_app_initialize + * Name: board_late_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. + * 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. * ****************************************************************************/ -int board_app_initialize(uintptr_t arg) +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) { #ifdef NSH_HAVEMMCSD struct spi_dev_s *spi; @@ -116,7 +105,7 @@ int board_app_initialize(uintptr_t arg) { syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n", CONFIG_NSH_MMCSDSPIPORTNO); - return -ENODEV; + return; } syslog(LOG_INFO, "Successfully initialized SPI port %d\n", @@ -135,12 +124,11 @@ int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); - return ret; + return; } syslog(LOG_INFO, "Successfully bound SPI port %d to MMC/SD slot %d\n", CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); #endif - - return OK; } +#endif diff --git a/boards/arm/tiva/dk-tm4c129x/src/Makefile b/boards/arm/tiva/dk-tm4c129x/src/Makefile index 840f8f204f6..e3ccd6ab6ac 100644 --- a/boards/arm/tiva/dk-tm4c129x/src/Makefile +++ b/boards/arm/tiva/dk-tm4c129x/src/Makefile @@ -42,10 +42,6 @@ ifeq ($(CONFIG_DK_TM4C129X_TIMER),y) CSRCS += tm4c_timer.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += tm4c_appinit.c -endif - ifeq ($(CONFIG_LM75_I2C),y) ifeq ($(CONFIG_TIVA_I2C6),y) CSRCS += tm4c_tmp100.c diff --git a/boards/arm/tiva/dk-tm4c129x/src/tm4c_appinit.c b/boards/arm/tiva/dk-tm4c129x/src/tm4c_appinit.c deleted file mode 100644 index e80606eff1b..00000000000 --- a/boards/arm/tiva/dk-tm4c129x/src/tm4c_appinit.c +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** - * boards/arm/tiva/dk-tm4c129x/src/tm4c_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 - -#include - -#include "dk-tm4c129x.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ - /* If CONFIG_BOARD_LATE_INITIALIZE is selected then board initialization - * was already performed in board_late_initialize. - */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return tm4c_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/tiva/eagle100/src/Makefile b/boards/arm/tiva/eagle100/src/Makefile index 7a77e880a94..9a11d7c2213 100644 --- a/boards/arm/tiva/eagle100/src/Makefile +++ b/boards/arm/tiva/eagle100/src/Makefile @@ -23,8 +23,5 @@ include $(TOPDIR)/Make.defs CSRCS = lm_boot.c lm_leds.c lm_ethernet.c lm_ssi.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lm_appinit.c -endif include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/tiva/eagle100/src/lm_appinit.c b/boards/arm/tiva/eagle100/src/lm_appinit.c deleted file mode 100644 index 7bb80e782fc..00000000000 --- a/boards/arm/tiva/eagle100/src/lm_appinit.c +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** - * boards/arm/tiva/eagle100/src/lm_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 - -#include -#include -#include - -#include -#include -#include - -#include "tiva_ssi.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -/* PORT and SLOT number probably depend on the board configuration */ - -# undef CONFIG_NSH_MMCSDSPIPORTNO -# define CONFIG_NSH_MMCSDSPIPORTNO 0 -# undef CONFIG_NSH_MMCSDSLOTNO -# define CONFIG_NSH_MMCSDSLOTNO 0 - -/* Can't support USB features if USB is not enabled */ - -#ifndef CONFIG_USBDEV -# undef NSH_HAVEUSBDEV -#endif - -/* Can't support MMC/SD features if mountpoints are disabled */ - -#if defined(CONFIG_DISABLE_MOUNTPOINT) -# undef NSH_HAVEMMCSD -#endif - -#ifndef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ - struct spi_dev_s *spi; -#if defined (CONFIG_MMCSD) && defined (CONFIG_MMCSD_SPI) - int ret; -#endif - - /* Get the SPI port */ - - syslog(LOG_INFO, "Initializing SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); - - spi = tiva_ssibus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); - if (!spi) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); - return -ENODEV; - } - - syslog(LOG_INFO, "Successfully initialized SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); - -#if defined (CONFIG_MMCSD) && defined (CONFIG_MMCSD_SPI) - /* Bind the SPI port to the slot */ - - syslog(LOG_INFO, "Binding SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); - - ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, - CONFIG_NSH_MMCSDSLOTNO, spi); - if (ret < 0) - { - syslog(LOG_ERR, - "ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); - return ret; - } - - syslog(LOG_INFO, "Successfully bound SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); -#endif - - return OK; -} diff --git a/boards/arm/tiva/eagle100/src/lm_boot.c b/boards/arm/tiva/eagle100/src/lm_boot.c index df20d814624..cd0d936c13f 100644 --- a/boards/arm/tiva/eagle100/src/lm_boot.c +++ b/boards/arm/tiva/eagle100/src/lm_boot.c @@ -28,9 +28,16 @@ #include -#include -#include +#include +#include +#include +#include +#include +#include +#include + +#include "tiva_ssi.h" #include "arm_internal.h" #include "eagle100.h" @@ -38,6 +45,31 @@ * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +/* PORT and SLOT number probably depend on the board configuration */ + +# undef CONFIG_NSH_MMCSDSPIPORTNO +# define CONFIG_NSH_MMCSDSPIPORTNO 0 +# undef CONFIG_NSH_MMCSDSLOTNO +# define CONFIG_NSH_MMCSDSLOTNO 0 + +/* Can't support USB features if USB is not enabled */ + +#ifndef CONFIG_USBDEV +# undef NSH_HAVEUSBDEV +#endif + +/* Can't support MMC/SD features if mountpoints are disabled */ + +#if defined(CONFIG_DISABLE_MOUNTPOINT) +# undef NSH_HAVEMMCSD +#endif + +#ifndef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -80,3 +112,63 @@ void tiva_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_intitialize() 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) +{ + struct spi_dev_s *spi; +#if defined (CONFIG_MMCSD) && defined (CONFIG_MMCSD_SPI) + int ret; +#endif + + /* Get the SPI port */ + + syslog(LOG_INFO, "Initializing SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); + + spi = tiva_ssibus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); + if (!spi) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); + return; + } + + syslog(LOG_INFO, "Successfully initialized SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); + +#if defined (CONFIG_MMCSD) && defined (CONFIG_MMCSD_SPI) + /* Bind the SPI port to the slot */ + + syslog(LOG_INFO, "Binding SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); + + ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, + CONFIG_NSH_MMCSDSLOTNO, spi); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); + return; + } + + syslog(LOG_INFO, "Successfully bound SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); +#endif + +} +#endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/tiva/ekk-lm3s9b96/src/CMakeLists.txt b/boards/arm/tiva/ekk-lm3s9b96/src/CMakeLists.txt index 1caf62876e1..599cdb9c951 100644 --- a/boards/arm/tiva/ekk-lm3s9b96/src/CMakeLists.txt +++ b/boards/arm/tiva/ekk-lm3s9b96/src/CMakeLists.txt @@ -21,9 +21,6 @@ # ############################################################################## set(SRCS lm_boot.c lm_leds.c lm_ethernet.c lm_ssi.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS lm_appinit.c) -endif() target_sources(board PRIVATE ${SRCS}) diff --git a/boards/arm/tiva/ekk-lm3s9b96/src/Makefile b/boards/arm/tiva/ekk-lm3s9b96/src/Makefile index 4ab93fe1d24..852abd4a868 100644 --- a/boards/arm/tiva/ekk-lm3s9b96/src/Makefile +++ b/boards/arm/tiva/ekk-lm3s9b96/src/Makefile @@ -23,8 +23,5 @@ include $(TOPDIR)/Make.defs CSRCS = lm_boot.c lm_leds.c lm_ethernet.c lm_ssi.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lm_appinit.c -endif include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/tiva/ekk-lm3s9b96/src/lm_boot.c b/boards/arm/tiva/ekk-lm3s9b96/src/lm_boot.c index 5fb97071f48..28ed2674d03 100644 --- a/boards/arm/tiva/ekk-lm3s9b96/src/lm_boot.c +++ b/boards/arm/tiva/ekk-lm3s9b96/src/lm_boot.c @@ -78,3 +78,23 @@ void tiva_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 diff --git a/boards/arm/tiva/launchxl-cc1310/src/Makefile b/boards/arm/tiva/launchxl-cc1310/src/Makefile index 43d68da65b4..088a34a87da 100644 --- a/boards/arm/tiva/launchxl-cc1310/src/Makefile +++ b/boards/arm/tiva/launchxl-cc1310/src/Makefile @@ -22,13 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = cc1310_boot.c cc1310_pinconfig.c - -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += cc1310_appinit.c cc1310_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += cc1310_bringup.c -endif +CSRCS = cc1310_boot.c cc1310_pinconfig.c cc1310_bringup.c ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += cc1310_autoleds.c diff --git a/boards/arm/tiva/launchxl-cc1310/src/cc1310_appinit.c b/boards/arm/tiva/launchxl-cc1310/src/cc1310_appinit.c deleted file mode 100644 index 36ba9fed0ac..00000000000 --- a/boards/arm/tiva/launchxl-cc1310/src/cc1310_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/tiva/launchxl-cc1310/src/cc1310_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 - -#include - -#include - -#include "launchxl-cc1310.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return cc1310_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/tiva/launchxl-cc1312r1/src/CMakeLists.txt b/boards/arm/tiva/launchxl-cc1312r1/src/CMakeLists.txt index db620f4f5c8..8a27e4dbdf9 100644 --- a/boards/arm/tiva/launchxl-cc1312r1/src/CMakeLists.txt +++ b/boards/arm/tiva/launchxl-cc1312r1/src/CMakeLists.txt @@ -20,13 +20,7 @@ # # ############################################################################## -set(SRCS cc1312_boot.c cc1312_pinconfig.c) - -if(CONFIG_BOARDCTL) - list(APPEND SRCS cc1312_appinit.c cc1312_bringup.c) -elseif(CONFIG_BOARD_LATE_INITIALIZE) - list(APPEND SRCS cc1312_bringup.c) -endif() +set(SRCS cc1312_boot.c cc1312_pinconfig.c cc1312_bringup.c) if(CONFIG_ARCH_LEDS) list(APPEND SRCS cc1312_autoleds.c) diff --git a/boards/arm/tiva/launchxl-cc1312r1/src/Makefile b/boards/arm/tiva/launchxl-cc1312r1/src/Makefile index ff9920c64ca..a3656450a58 100644 --- a/boards/arm/tiva/launchxl-cc1312r1/src/Makefile +++ b/boards/arm/tiva/launchxl-cc1312r1/src/Makefile @@ -22,13 +22,7 @@ include $(TOPDIR)/Make.defs -CSRCS = cc1312_boot.c cc1312_pinconfig.c - -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += cc1312_appinit.c cc1312_bringup.c -else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) -CSRCS += cc1312_bringup.c -endif +CSRCS = cc1312_boot.c cc1312_pinconfig.c cc1312_bringup.c ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += cc1312_autoleds.c diff --git a/boards/arm/tiva/launchxl-cc1312r1/src/cc1312_appinit.c b/boards/arm/tiva/launchxl-cc1312r1/src/cc1312_appinit.c deleted file mode 100644 index 4beb1fac78f..00000000000 --- a/boards/arm/tiva/launchxl-cc1312r1/src/cc1312_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/tiva/launchxl-cc1312r1/src/cc1312_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 - -#include - -#include - -#include "launchxl-cc1312r1.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) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform board initialization */ - - return cc1312_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/tiva/lm3s6432-s2e/src/Makefile b/boards/arm/tiva/lm3s6432-s2e/src/Makefile index 35fa6b3ce41..29230464b74 100644 --- a/boards/arm/tiva/lm3s6432-s2e/src/Makefile +++ b/boards/arm/tiva/lm3s6432-s2e/src/Makefile @@ -23,8 +23,5 @@ include $(TOPDIR)/Make.defs CSRCS = lm_boot.c lm_leds.c lm_ethernet.c lm_ssi.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lm_appinit.c -endif include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/tiva/lm3s6432-s2e/src/lm_appinit.c b/boards/arm/tiva/lm3s6432-s2e/src/lm_appinit.c deleted file mode 100644 index bd12ec3a642..00000000000 --- a/boards/arm/tiva/lm3s6432-s2e/src/lm_appinit.c +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** - * boards/arm/tiva/lm3s6432-s2e/src/lm_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 - -#include -#include -#include - -#include -#include -#include - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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; -} diff --git a/boards/arm/tiva/lm3s6432-s2e/src/lm_boot.c b/boards/arm/tiva/lm3s6432-s2e/src/lm_boot.c index 497a27e5d8c..2eb9b0b3fec 100644 --- a/boards/arm/tiva/lm3s6432-s2e/src/lm_boot.c +++ b/boards/arm/tiva/lm3s6432-s2e/src/lm_boot.c @@ -91,3 +91,23 @@ void tiva_boardinitialize(void) tiva_configgpio(XCVR_ON_GPIO); tiva_configgpio(XCVR_OFF_GPIO); } + +/**************************************************************************** + * 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/arm/tiva/lm3s6965-ek/src/CMakeLists.txt b/boards/arm/tiva/lm3s6965-ek/src/CMakeLists.txt index ed90349c799..bf265b59c5b 100644 --- a/boards/arm/tiva/lm3s6965-ek/src/CMakeLists.txt +++ b/boards/arm/tiva/lm3s6965-ek/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS lm_boot.c lm_leds.c lm_ethernet.c lm_ssi.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS lm_appinit.c) -endif() - if(CONFIG_NX_LCDDRIVER) list(APPEND SRCS lm_oled.c) endif() diff --git a/boards/arm/tiva/lm3s6965-ek/src/Makefile b/boards/arm/tiva/lm3s6965-ek/src/Makefile index 4aa7f7dca8c..6a64b5cdfab 100644 --- a/boards/arm/tiva/lm3s6965-ek/src/Makefile +++ b/boards/arm/tiva/lm3s6965-ek/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = lm_boot.c lm_leds.c lm_ethernet.c lm_ssi.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lm_appinit.c -endif - ifeq ($(CONFIG_NX_LCDDRIVER),y) CSRCS += lm_oled.c endif diff --git a/boards/arm/tiva/lm3s6965-ek/src/lm_appinit.c b/boards/arm/tiva/lm3s6965-ek/src/lm_appinit.c deleted file mode 100644 index 9508324080a..00000000000 --- a/boards/arm/tiva/lm3s6965-ek/src/lm_appinit.c +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** - * boards/arm/tiva/lm3s6965-ek/src/lm_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 - -#include "lm3s6965-ek.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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 - return lm_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/tiva/lm3s8962-ek/src/CMakeLists.txt b/boards/arm/tiva/lm3s8962-ek/src/CMakeLists.txt index 6390263df10..cffecb245e1 100644 --- a/boards/arm/tiva/lm3s8962-ek/src/CMakeLists.txt +++ b/boards/arm/tiva/lm3s8962-ek/src/CMakeLists.txt @@ -22,10 +22,6 @@ set(SRCS lm_boot.c lm_leds.c lm_ethernet.c lm_ssi.c) -if(CONFIG_BOARDCTL) - list(APPEND SRCS lm_appinit.c) -endif() - if(CONFIG_NX_LCDDRIVER) list(APPEND SRCS lm_oled.c) endif() diff --git a/boards/arm/tiva/lm3s8962-ek/src/Makefile b/boards/arm/tiva/lm3s8962-ek/src/Makefile index f1bfb5484bf..ab3f0300a36 100644 --- a/boards/arm/tiva/lm3s8962-ek/src/Makefile +++ b/boards/arm/tiva/lm3s8962-ek/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = lm_boot.c lm_leds.c lm_ethernet.c lm_ssi.c -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lm_appinit.c -endif - ifeq ($(CONFIG_NX_LCDDRIVER),y) CSRCS += lm_oled.c endif diff --git a/boards/arm/tiva/lm3s8962-ek/src/lm_appinit.c b/boards/arm/tiva/lm3s8962-ek/src/lm_appinit.c deleted file mode 100644 index 7dc087799b4..00000000000 --- a/boards/arm/tiva/lm3s8962-ek/src/lm_appinit.c +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** - * boards/arm/tiva/lm3s8962-ek/src/lm_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 - -#include -#include -#include - -#include -#include -#include - -#include "tiva_ssi.h" -#include "lm3s8962-ek.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#undef NSH_HAVEUSBDEV -#define NSH_HAVEMMCSD 1 - -/* PORT and SLOT number depend on the board configuration */ - -# undef CONFIG_NSH_MMCSDSPIPORTNO -# define CONFIG_NSH_MMCSDSPIPORTNO 0 -# undef CONFIG_NSH_MMCSDSLOTNO -# define CONFIG_NSH_MMCSDSLOTNO 0 -# undef CONFIG_NSH_MMCSDMINOR -# define CONFIG_NSH_MMCSDMINOR 0 - -/* Can't support USB features if USB is not enabled */ - -#ifndef CONFIG_USBDEV -# undef NSH_HAVEUSBDEV -#endif - -/* Can't support MMC/SD features if mountpoints are disabled */ - -#if defined(CONFIG_DISABLE_MOUNTPOINT) -# undef NSH_HAVEMMCSD -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ -#ifdef NSH_HAVEMMCSD - struct spi_dev_s *spi; - int ret; - - /* Get the SPI port */ - - syslog(LOG_INFO, "Initializing SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); - - spi = tiva_ssibus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); - if (!spi) - { - syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); - return -ENODEV; - } - - syslog(LOG_INFO, "Successfully initialized SPI port %d\n", - CONFIG_NSH_MMCSDSPIPORTNO); - - /* Bind the SPI port to the slot */ - - syslog(LOG_INFO, "Binding SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); - - ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, - CONFIG_NSH_MMCSDSLOTNO, spi); - if (ret < 0) - { - syslog(LOG_ERR, - "ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); - return ret; - } - - syslog(LOG_INFO, "Successfully bound SPI port %d to MMC/SD slot %d\n", - CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); -#endif - return OK; -} diff --git a/boards/arm/tiva/lm3s8962-ek/src/lm_boot.c b/boards/arm/tiva/lm3s8962-ek/src/lm_boot.c index e76250d7f21..79da202b0e8 100644 --- a/boards/arm/tiva/lm3s8962-ek/src/lm_boot.c +++ b/boards/arm/tiva/lm3s8962-ek/src/lm_boot.c @@ -28,16 +28,50 @@ #include +#include +#include +#include +#include + #include #include +#include +#include #include "arm_internal.h" +#include "tiva_ssi.h" #include "lm3s8962-ek.h" /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +/* Configuration ************************************************************/ + +#undef NSH_HAVEUSBDEV +#define NSH_HAVEMMCSD 1 + +/* PORT and SLOT number depend on the board configuration */ + +# undef CONFIG_NSH_MMCSDSPIPORTNO +# define CONFIG_NSH_MMCSDSPIPORTNO 0 +# undef CONFIG_NSH_MMCSDSLOTNO +# define CONFIG_NSH_MMCSDSLOTNO 0 +# undef CONFIG_NSH_MMCSDMINOR +# define CONFIG_NSH_MMCSDMINOR 0 + +/* Can't support USB features if USB is not enabled */ + +#ifndef CONFIG_USBDEV +# undef NSH_HAVEUSBDEV +#endif + +/* Can't support MMC/SD features if mountpoints are disabled */ + +#if defined(CONFIG_DISABLE_MOUNTPOINT) +# undef NSH_HAVEMMCSD +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -82,3 +116,60 @@ void tiva_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_intitialize() 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) +{ +#ifdef NSH_HAVEMMCSD + struct spi_dev_s *spi; + int ret; + + /* Get the SPI port */ + + syslog(LOG_INFO, "Initializing SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); + + spi = tiva_ssibus_initialize(CONFIG_NSH_MMCSDSPIPORTNO); + if (!spi) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); + return; + } + + syslog(LOG_INFO, "Successfully initialized SPI port %d\n", + CONFIG_NSH_MMCSDSPIPORTNO); + + /* Bind the SPI port to the slot */ + + syslog(LOG_INFO, "Binding SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); + + ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, + CONFIG_NSH_MMCSDSLOTNO, spi); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret); + return; + } + + syslog(LOG_INFO, "Successfully bound SPI port %d to MMC/SD slot %d\n", + CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO); +#endif +} +#endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/boards/arm/tiva/lm4f120-launchpad/src/CMakeLists.txt b/boards/arm/tiva/lm4f120-launchpad/src/CMakeLists.txt index ec94f630c5a..f3cbbfde28c 100644 --- a/boards/arm/tiva/lm4f120-launchpad/src/CMakeLists.txt +++ b/boards/arm/tiva/lm4f120-launchpad/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_ARCH_LEDS) list(APPEND SRCS lm4f_autoleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS lm4f_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT diff --git a/boards/arm/tiva/lm4f120-launchpad/src/Makefile b/boards/arm/tiva/lm4f120-launchpad/src/Makefile index 44a032d3740..0bd27427277 100644 --- a/boards/arm/tiva/lm4f120-launchpad/src/Makefile +++ b/boards/arm/tiva/lm4f120-launchpad/src/Makefile @@ -28,8 +28,4 @@ ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += lm4f_autoleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += lm4f_appinit.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/tiva/lm4f120-launchpad/src/lm4f_appinit.c b/boards/arm/tiva/lm4f120-launchpad/src/lm4f_appinit.c deleted file mode 100644 index 7829c953693..00000000000 --- a/boards/arm/tiva/lm4f120-launchpad/src/lm4f_appinit.c +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** - * boards/arm/tiva/lm4f120-launchpad/src/lm4f_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 - -#include -#include -#include - -#include -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -/* PORT and SLOT number probably depend on the board configuration */ - -#ifdef CONFIG_ARCH_BOARD_LM4F120_LAUNCHPAD -# undef NSH_HAVEUSBDEV -#else -# error "Unrecognized lm3s board" -# undef NSH_HAVEUSBDEV -#endif - -/* Can't support USB features if USB is not enabled */ - -#ifndef CONFIG_USBDEV -# undef NSH_HAVEUSBDEV -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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; -} diff --git a/boards/arm/tiva/lm4f120-launchpad/src/lm4f_boot.c b/boards/arm/tiva/lm4f120-launchpad/src/lm4f_boot.c index 6f50458dc15..7fdf002fd38 100644 --- a/boards/arm/tiva/lm4f120-launchpad/src/lm4f_boot.c +++ b/boards/arm/tiva/lm4f120-launchpad/src/lm4f_boot.c @@ -81,3 +81,22 @@ void tiva_boardinitialize(void) lm4f_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_intitialize() 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/arm/tiva/tm4c123g-launchpad/src/CMakeLists.txt b/boards/arm/tiva/tm4c123g-launchpad/src/CMakeLists.txt index 72391990e05..e3b5b336d5f 100644 --- a/boards/arm/tiva/tm4c123g-launchpad/src/CMakeLists.txt +++ b/boards/arm/tiva/tm4c123g-launchpad/src/CMakeLists.txt @@ -26,10 +26,6 @@ if(CONFIG_ARCH_LEDS) list(APPEND SRCS tm4c_autoleds.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS tm4c_appinit.c) -endif() - if(CONFIG_TIVA_TIMER) list(APPEND SRCS tm4c_timer.c) endif() diff --git a/boards/arm/tiva/tm4c123g-launchpad/src/Makefile b/boards/arm/tiva/tm4c123g-launchpad/src/Makefile index fbe9688c423..6cadab78946 100644 --- a/boards/arm/tiva/tm4c123g-launchpad/src/Makefile +++ b/boards/arm/tiva/tm4c123g-launchpad/src/Makefile @@ -28,10 +28,6 @@ ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += tm4c_autoleds.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += tm4c_appinit.c -endif - ifeq ($(CONFIG_TIVA_TIMER),y) CSRCS += tm4c_timer.c endif diff --git a/boards/arm/tiva/tm4c123g-launchpad/src/tm4c_appinit.c b/boards/arm/tiva/tm4c123g-launchpad/src/tm4c_appinit.c deleted file mode 100644 index cad9059550c..00000000000 --- a/boards/arm/tiva/tm4c123g-launchpad/src/tm4c_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/tiva/tm4c123g-launchpad/src/tm4c_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 - -#include - -#include "tm4c123g-launchpad.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) -{ - /* If CONFIG_BOARD_LATE_INITIALIZE is selected then board initialization - * was already performed in board_late_initialize. - */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return tm4c_bringup(); -#else - return OK; -#endif -} diff --git a/boards/arm/tiva/tm4c1294-launchpad/src/CMakeLists.txt b/boards/arm/tiva/tm4c1294-launchpad/src/CMakeLists.txt index 6ad85a24977..0a11d8151af 100644 --- a/boards/arm/tiva/tm4c1294-launchpad/src/CMakeLists.txt +++ b/boards/arm/tiva/tm4c1294-launchpad/src/CMakeLists.txt @@ -44,10 +44,6 @@ if(CONFIG_DK_TM4C129X_TIMER) list(APPEND SRCS tm4c_timer.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS tm4c_appinit.c) -endif() - if(CONFIG_TIVA_HCIUART) if(CONFIG_BLUETOOTH_UART) list(APPEND SRCS tm4c_hciuart.c) diff --git a/boards/arm/tiva/tm4c1294-launchpad/src/Makefile b/boards/arm/tiva/tm4c1294-launchpad/src/Makefile index 615fe7d9484..ea90f74df05 100644 --- a/boards/arm/tiva/tm4c1294-launchpad/src/Makefile +++ b/boards/arm/tiva/tm4c1294-launchpad/src/Makefile @@ -46,10 +46,6 @@ ifeq ($(CONFIG_DK_TM4C129X_TIMER),y) CSRCS += tm4c_timer.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += tm4c_appinit.c -endif - ifeq ($(CONFIG_TIVA_HCIUART),y) ifeq ($(CONFIG_BLUETOOTH_UART),y) CSRCS += tm4c_hciuart.c diff --git a/boards/arm/tiva/tm4c1294-launchpad/src/tm4c_appinit.c b/boards/arm/tiva/tm4c1294-launchpad/src/tm4c_appinit.c deleted file mode 100644 index 641790b40e2..00000000000 --- a/boards/arm/tiva/tm4c1294-launchpad/src/tm4c_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/tiva/tm4c1294-launchpad/src/tm4c_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 - -#include - -#include "tm4c1294-launchpad.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) -{ - /* If CONFIG_BOARD_LATE_INITIALIZE is selected then board initialization - * was already performed in board_late_initialize. - */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return tm4c_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/tiva/tm4c129e-launchpad/src/CMakeLists.txt b/boards/arm/tiva/tm4c129e-launchpad/src/CMakeLists.txt index 70c5f2f0b4c..55e71e0bd3a 100644 --- a/boards/arm/tiva/tm4c129e-launchpad/src/CMakeLists.txt +++ b/boards/arm/tiva/tm4c129e-launchpad/src/CMakeLists.txt @@ -40,10 +40,6 @@ if(CONFIG_DK_TM4C129X_TIMER) list(APPEND SRCS tm4c_timer.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS tm4c_appinit.c) -endif() - if(CONFIG_TIVA_HCIUART) if(CONFIG_BLUETOOTH_UART) list(APPEND SRCS tm4c_hciuart.c) diff --git a/boards/arm/tiva/tm4c129e-launchpad/src/Makefile b/boards/arm/tiva/tm4c129e-launchpad/src/Makefile index 88d145ea114..4c044c4f752 100644 --- a/boards/arm/tiva/tm4c129e-launchpad/src/Makefile +++ b/boards/arm/tiva/tm4c129e-launchpad/src/Makefile @@ -42,10 +42,6 @@ ifeq ($(CONFIG_DK_TM4C129X_TIMER),y) CSRCS += tm4c_timer.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += tm4c_appinit.c -endif - ifeq ($(CONFIG_TIVA_HCIUART),y) ifeq ($(CONFIG_BLUETOOTH_UART),y) CSRCS += tm4c_hciuart.c diff --git a/boards/arm/tiva/tm4c129e-launchpad/src/tm4c_appinit.c b/boards/arm/tiva/tm4c129e-launchpad/src/tm4c_appinit.c deleted file mode 100644 index dc063beb5ad..00000000000 --- a/boards/arm/tiva/tm4c129e-launchpad/src/tm4c_appinit.c +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * boards/arm/tiva/tm4c129e-launchpad/src/tm4c_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 - -#include - -#include "tm4c129e-launchpad.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) -{ - /* If CONFIG_BOARD_LATE_INITIALIZE is selected then board initialization - * was already performed in board_late_initialize. - */ - -#ifndef CONFIG_BOARD_LATE_INITIALIZE - return tm4c_bringup(); -#else - return OK; -#endif -} - -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/tlsr82/tlsr8278adk80d/src/Makefile b/boards/arm/tlsr82/tlsr8278adk80d/src/Makefile index 2b59f16ecba..a378eba63c3 100644 --- a/boards/arm/tlsr82/tlsr8278adk80d/src/Makefile +++ b/boards/arm/tlsr82/tlsr8278adk80d/src/Makefile @@ -22,7 +22,6 @@ include $(TOPDIR)/Make.defs -CSRCS = tlsr8278_appinit.c CSRCS += tlsr8278_bringup.c tlsr8278_boot.c CSRCS += tlsr8278_gpio.c diff --git a/boards/arm/tlsr82/tlsr8278adk80d/src/tlsr8278_appinit.c b/boards/arm/tlsr82/tlsr8278adk80d/src/tlsr8278_appinit.c deleted file mode 100644 index b172f9c7ca1..00000000000 --- a/boards/arm/tlsr82/tlsr8278adk80d/src/tlsr8278_appinit.c +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** - * boards/arm/tlsr82/tlsr8278adk80d/src/tlsr8278_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 - -#include -#include - -#include "tlsr8278adk80d.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define TELINK_LIB_VAR_PASTE(v) tl_multi_addr_##v - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -uint16_t TELINK_LIB_VAR_PASTE(L); -uint16_t TELINK_LIB_VAR_PASTE(H); - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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) -{ - UNUSED(arg); - - /* Perform board-specific initialization */ - - return 0; -} - -#ifdef CONFIG_BOARDCTL_IOCTL -int board_ioctl(unsigned int cmd, uintptr_t arg) -{ - switch (cmd) - { - default: - return -EINVAL; - } - - return OK; -} -#endif diff --git a/boards/arm/tlsr82/tlsr8278adk80d/src/tlsr8278_boot.c b/boards/arm/tlsr82/tlsr8278adk80d/src/tlsr8278_boot.c index b007bf1958c..5c1448358bf 100644 --- a/boards/arm/tlsr82/tlsr8278adk80d/src/tlsr8278_boot.c +++ b/boards/arm/tlsr82/tlsr8278adk80d/src/tlsr8278_boot.c @@ -26,8 +26,24 @@ #include +#include +#include + #include "tlsr8278adk80d.h" +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define TELINK_LIB_VAR_PASTE(v) tl_multi_addr_##v + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +uint16_t TELINK_LIB_VAR_PASTE(L); +uint16_t TELINK_LIB_VAR_PASTE(H); + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -40,3 +56,16 @@ void board_late_initialize(void) tlsr8278_bringup(); } #endif + +#ifdef CONFIG_BOARDCTL_IOCTL +int board_ioctl(unsigned int cmd, uintptr_t arg) +{ + switch (cmd) + { + default: + return -EINVAL; + } + + return OK; +} +#endif diff --git a/boards/arm/tms570/launchxl-tms57004/src/CMakeLists.txt b/boards/arm/tms570/launchxl-tms57004/src/CMakeLists.txt index b63ec22d340..41150905be2 100644 --- a/boards/arm/tms570/launchxl-tms57004/src/CMakeLists.txt +++ b/boards/arm/tms570/launchxl-tms57004/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS tms570_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS tms570_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT diff --git a/boards/arm/tms570/launchxl-tms57004/src/Makefile b/boards/arm/tms570/launchxl-tms57004/src/Makefile index fc5827a96bf..a87fd6a7b59 100644 --- a/boards/arm/tms570/launchxl-tms57004/src/Makefile +++ b/boards/arm/tms570/launchxl-tms57004/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = tms570_initialize.c tms570_bringup.c -ifeq ($(CONFIG_BOARDCTL),y) - CSRCS += tms570_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += tms570_autoleds.c else diff --git a/boards/arm/tms570/launchxl-tms57004/src/tms570_appinit.c b/boards/arm/tms570/launchxl-tms57004/src/tms570_appinit.c deleted file mode 100644 index 80e4c22087c..00000000000 --- a/boards/arm/tms570/launchxl-tms57004/src/tms570_appinit.c +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** - * boards/arm/tms570/launchxl-tms57004/src/tms570_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 -#include - -#include "launchxl-tms57004.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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. - * - ****************************************************************************/ - -#ifdef CONFIG_BOARDCTL -int board_app_initialize(uintptr_t arg) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform application level board initialization (if that was not already - * done in board_late_initialize(). - */ - - tms570_bringup(); -#endif - - return 0; -} -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/tms570/tms570ls31x-usb-kit/src/CMakeLists.txt b/boards/arm/tms570/tms570ls31x-usb-kit/src/CMakeLists.txt index cc42883b840..c804a98d81f 100644 --- a/boards/arm/tms570/tms570ls31x-usb-kit/src/CMakeLists.txt +++ b/boards/arm/tms570/tms570ls31x-usb-kit/src/CMakeLists.txt @@ -32,10 +32,6 @@ if(CONFIG_ARCH_BUTTONS) list(APPEND SRCS tms570_buttons.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS tms570_appinit.c) -endif() - if(CONFIG_MMCSD) list(APPEND SRCS tms570_sdmmc.c) endif() diff --git a/boards/arm/tms570/tms570ls31x-usb-kit/src/Makefile b/boards/arm/tms570/tms570ls31x-usb-kit/src/Makefile index 85ae0803ad7..6aef71c5de0 100644 --- a/boards/arm/tms570/tms570ls31x-usb-kit/src/Makefile +++ b/boards/arm/tms570/tms570ls31x-usb-kit/src/Makefile @@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs CSRCS = tms570_initialize.c tms570_bringup.c tms570_spi.c -ifeq ($(CONFIG_BOARDCTL),y) - CSRCS += tms570_appinit.c -endif - ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += tms570_autoleds.c else diff --git a/boards/arm/tms570/tms570ls31x-usb-kit/src/tms570_appinit.c b/boards/arm/tms570/tms570ls31x-usb-kit/src/tms570_appinit.c deleted file mode 100644 index 1bc90355380..00000000000 --- a/boards/arm/tms570/tms570ls31x-usb-kit/src/tms570_appinit.c +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** - * boards/arm/tms570/tms570ls31x-usb-kit/src/tms570_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 -#include - -#include "tms570ls31x_usb_kit.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_app_initialize - * - * Description: - * Perform architecture specific initialization - * - * 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. - * - ****************************************************************************/ - -#ifdef CONFIG_BOARDCTL -int board_app_initialize(uintptr_t arg) -{ -#ifndef CONFIG_BOARD_LATE_INITIALIZE - /* Perform application level board initialization (if that was not already - * done in board_late_initialize(). - */ - - tms570_bringup(); -#endif - - return 0; -} -#endif /* CONFIG_BOARDCTL */ diff --git a/boards/arm/xmc4/xmc4500-relax/src/CMakeLists.txt b/boards/arm/xmc4/xmc4500-relax/src/CMakeLists.txt index a9ab734a5c1..b456f2efec6 100644 --- a/boards/arm/xmc4/xmc4500-relax/src/CMakeLists.txt +++ b/boards/arm/xmc4/xmc4500-relax/src/CMakeLists.txt @@ -40,10 +40,6 @@ if(CONFIG_SENSORS_MAX6675) list(APPEND SRCS xmc4_max6675.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS xmc4_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld") diff --git a/boards/arm/xmc4/xmc4500-relax/src/Makefile b/boards/arm/xmc4/xmc4500-relax/src/Makefile index f90c385b5b5..269a9cfad8e 100644 --- a/boards/arm/xmc4/xmc4500-relax/src/Makefile +++ b/boards/arm/xmc4/xmc4500-relax/src/Makefile @@ -42,8 +42,4 @@ ifeq ($(CONFIG_SENSORS_MAX6675),y) CSRCS += xmc4_max6675.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += xmc4_appinit.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/xmc4/xmc4500-relax/src/xmc4_appinit.c b/boards/arm/xmc4/xmc4500-relax/src/xmc4_appinit.c deleted file mode 100644 index a2291bd254c..00000000000 --- a/boards/arm/xmc4/xmc4500-relax/src/xmc4_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/xmc4/xmc4500-relax/src/xmc4_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 - -#include - -#include - -#include "xmc4500-relax.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 xmc4_bringup(); -#else - return OK; -#endif /* CONFIG_BOARD_LATE_INITIALIZE */ -} diff --git a/boards/arm/xmc4/xmc4700-relax/src/CMakeLists.txt b/boards/arm/xmc4/xmc4700-relax/src/CMakeLists.txt index 49cd9f9d2b4..2e13a561e82 100644 --- a/boards/arm/xmc4/xmc4700-relax/src/CMakeLists.txt +++ b/boards/arm/xmc4/xmc4700-relax/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_XMC4_USCI_SPI) list(APPEND SRCS xmc4_spi.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS xmc4_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld") diff --git a/boards/arm/xmc4/xmc4700-relax/src/Makefile b/boards/arm/xmc4/xmc4700-relax/src/Makefile index 2f987bd31cf..1a2bc0a525f 100644 --- a/boards/arm/xmc4/xmc4700-relax/src/Makefile +++ b/boards/arm/xmc4/xmc4700-relax/src/Makefile @@ -38,8 +38,4 @@ ifeq ($(CONFIG_XMC4_USCI_SPI),y) CSRCS += xmc4_spi.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += xmc4_appinit.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/xmc4/xmc4700-relax/src/xmc4_appinit.c b/boards/arm/xmc4/xmc4700-relax/src/xmc4_appinit.c deleted file mode 100644 index b1e87c9876b..00000000000 --- a/boards/arm/xmc4/xmc4700-relax/src/xmc4_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/xmc4/xmc4700-relax/src/xmc4_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 - -#include - -#include - -#include "xmc4700-relax.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 xmc4_bringup(); -#else - return OK; -#endif /* CONFIG_BOARD_LATE_INITIALIZE */ -} diff --git a/boards/arm/xmc4/xmc4800-relax/src/CMakeLists.txt b/boards/arm/xmc4/xmc4800-relax/src/CMakeLists.txt index 372e441e3cd..9c267e25306 100644 --- a/boards/arm/xmc4/xmc4800-relax/src/CMakeLists.txt +++ b/boards/arm/xmc4/xmc4800-relax/src/CMakeLists.txt @@ -36,10 +36,6 @@ if(CONFIG_XMC4_USCI_SPI) list(APPEND SRCS xmc4_spi.c) endif() -if(CONFIG_BOARDCTL) - list(APPEND SRCS xmc4_appinit.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld") diff --git a/boards/arm/xmc4/xmc4800-relax/src/Makefile b/boards/arm/xmc4/xmc4800-relax/src/Makefile index dd5721f8ff5..e4dc2b0f903 100644 --- a/boards/arm/xmc4/xmc4800-relax/src/Makefile +++ b/boards/arm/xmc4/xmc4800-relax/src/Makefile @@ -38,8 +38,4 @@ ifeq ($(CONFIG_XMC4_USCI_SPI),y) CSRCS += xmc4_spi.c endif -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += xmc4_appinit.c -endif - include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/xmc4/xmc4800-relax/src/xmc4_appinit.c b/boards/arm/xmc4/xmc4800-relax/src/xmc4_appinit.c deleted file mode 100644 index 31fbafcc1a3..00000000000 --- a/boards/arm/xmc4/xmc4800-relax/src/xmc4_appinit.c +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - * boards/arm/xmc4/xmc4800-relax/src/xmc4_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 - -#include - -#include - -#include "xmc4800-relax.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 xmc4_bringup(); -#else - return OK; -#endif /* CONFIG_BOARD_LATE_INITIALIZE */ -}