diff --git a/boards/px4/fmu-v6xrt/src/CMakeLists.txt b/boards/px4/fmu-v6xrt/src/CMakeLists.txt index cd9d6fb6b277..91833ede24c1 100644 --- a/boards/px4/fmu-v6xrt/src/CMakeLists.txt +++ b/boards/px4/fmu-v6xrt/src/CMakeLists.txt @@ -36,7 +36,6 @@ if("${PX4_BOARD_LABEL}" STREQUAL "bootloader") bootloader_main.c init.c usb.c - imxrt_romapi.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c imxrt_clockconfig.c @@ -48,6 +47,7 @@ if("${PX4_BOARD_LABEL}" STREQUAL "bootloader") nuttx_drivers # sdio px4_layer #gpio arch_io_pins # iotimer + arch_board_romapi bootloader ) target_include_directories(drivers_board PRIVATE ${PX4_SOURCE_DIR}/platforms/nuttx/src/bootloader/common) @@ -72,7 +72,6 @@ else() spi.cpp timer_config.cpp usb.c - imxrt_romapi.c imxrt_flexspi_fram.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c @@ -83,6 +82,7 @@ else() target_link_libraries(drivers_board PRIVATE arch_board_hw_info + arch_board_romapi arch_spi drivers__led # drv_led_start nuttx_arch # sdio diff --git a/boards/px4/fmu-v6xrt/src/imxrt_flexspi_nor_flash.c b/boards/px4/fmu-v6xrt/src/imxrt_flexspi_nor_flash.c index eb079e200934..6ae7589d60ef 100644 --- a/boards/px4/fmu-v6xrt/src/imxrt_flexspi_nor_flash.c +++ b/boards/px4/fmu-v6xrt/src/imxrt_flexspi_nor_flash.c @@ -22,7 +22,7 @@ * Included Files ****************************************************************************/ -#include "imxrt_flexspi_nor_flash.h" +#include /**************************************************************************** * Public Data diff --git a/boards/px4/fmu-v6xrt/src/init.c b/boards/px4/fmu-v6xrt/src/init.c index daac8cae427e..4b2edbc658ff 100644 --- a/boards/px4/fmu-v6xrt/src/init.c +++ b/boards/px4/fmu-v6xrt/src/init.c @@ -66,8 +66,7 @@ #include "arm_internal.h" #include "imxrt_flexspi_nor_boot.h" -#include "imxrt_flexspi_nor_flash.h" -#include "imxrt_romapi.h" +#include #include "imxrt_iomuxc.h" #include "imxrt_flexcan.h" #include "imxrt_enet.h" @@ -79,10 +78,12 @@ #include + #include #include #include #include +#include #include #include #include diff --git a/platforms/nuttx/src/bootloader/nxp/imxrt_common/main.c b/platforms/nuttx/src/bootloader/nxp/imxrt_common/main.c index 280bc1ad5b0f..1197427a942c 100644 --- a/platforms/nuttx/src/bootloader/nxp/imxrt_common/main.c +++ b/platforms/nuttx/src/bootloader/nxp/imxrt_common/main.c @@ -7,8 +7,8 @@ #include #include "hw_config.h" -#include "imxrt_flexspi_nor_flash.h" -#include "imxrt_romapi.h" +#include +#include #include #include #include diff --git a/boards/px4/fmu-v6xrt/src/imxrt_flexspi_nor_flash.h b/platforms/nuttx/src/px4/nxp/imxrt/include/px4_arch/imxrt_flexspi_nor_flash.h similarity index 98% rename from boards/px4/fmu-v6xrt/src/imxrt_flexspi_nor_flash.h rename to platforms/nuttx/src/px4/nxp/imxrt/include/px4_arch/imxrt_flexspi_nor_flash.h index 66a425ee9ecc..727744b974aa 100644 --- a/boards/px4/fmu-v6xrt/src/imxrt_flexspi_nor_flash.h +++ b/platforms/nuttx/src/px4/nxp/imxrt/include/px4_arch/imxrt_flexspi_nor_flash.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/px4/fmu-v6xrt/src/imxrt_flexspi_nor_flash.h + * platforms/nuttx/src/px4/nxp/imrt/include/px4_arch/imxrt_flexspi_nor_flash.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -18,8 +18,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_PX4_FMU_V6XRT_SRC_IMXRT_FLEXSPI_NOR_FLASH_H -#define __BOARDS_PX4_FMU_V6XRT_SRC_IMXRT_FLEXSPI_NOR_FLASH_H +#ifndef __PX4_ARCH_IMXRT_FLEXSPI_NOR_FLASH_H +#define __PX4_ARCH_IMXRT_FLEXSPI_NOR_FLASH_H /**************************************************************************** * Included Files @@ -349,4 +349,4 @@ extern const struct flexspi_nor_config_s g_flash_config; extern const struct flexspi_nor_config_s g_flash_fast_config; -#endif /* __BOARDS_PX4_FMU_V6XRT_SRC_IMXRT_FLEXSPI_NOR_FLASH_H */ +#endif /* __PX4_ARCH_IMXRT_FLEXSPI_NOR_FLASH_H */ diff --git a/boards/px4/fmu-v6xrt/src/imxrt_romapi.h b/platforms/nuttx/src/px4/nxp/imxrt/include/px4_arch/imxrt_romapi.h similarity index 98% rename from boards/px4/fmu-v6xrt/src/imxrt_romapi.h rename to platforms/nuttx/src/px4/nxp/imxrt/include/px4_arch/imxrt_romapi.h index de076c68cdae..715e8350d302 100644 --- a/boards/px4/fmu-v6xrt/src/imxrt_romapi.h +++ b/platforms/nuttx/src/px4/nxp/imxrt/include/px4_arch/imxrt_romapi.h @@ -1,14 +1,14 @@ /**************************************************************************** - * boards/px4/fmu-v6xrt/src/imxrt_romapi.c + * platforms/nuttx/src/px4/nxp/imrt/include/px4_arch/imxrt_romapi.c * - * Copyright 2017-2020 NXP + * Copyright 2017-2024 NXP * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * ****************************************************************************/ -#ifndef __BOARDS_PX4_FMU_V6XRT_SRC_IMXRT_ROMAPI_H -#define __BOARDS_PX4_FMU_V6XRT_SRC_IMXRT_ROMAPI_H +#ifndef __PX4_ARCH_IMXRT_ROMAPI_H +#define __PX4_ARCH_IMXRT_ROMAPI_H /**************************************************************************** * @@ -370,4 +370,8 @@ void ROM_FLEXSPI_NorFlash_ClearCache(uint32_t instance); /*@}*/ -#endif /* __BOARDS_PX4_FMU_V6XRT_SRC_IMXRT_ROMAPI_H */ +#ifdef __cplusplus +} +#endif + +#endif /* __PX4_ARCH_IMXRT_ROMAPI_H */ diff --git a/platforms/nuttx/src/px4/nxp/imxrt/romapi/CMakeLists.txt b/platforms/nuttx/src/px4/nxp/imxrt/romapi/CMakeLists.txt new file mode 100644 index 000000000000..d6508bdd61d5 --- /dev/null +++ b/platforms/nuttx/src/px4/nxp/imxrt/romapi/CMakeLists.txt @@ -0,0 +1,36 @@ +############################################################################ +# +# Copyright (c) 2019 PX4 Development Team. All rights reserved. +# +# 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 PX4 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. +# +############################################################################ + +px4_add_library(arch_board_romapi + imxrt_romapi.c +) diff --git a/boards/px4/fmu-v6xrt/src/imxrt_romapi.c b/platforms/nuttx/src/px4/nxp/imxrt/romapi/imxrt_romapi.c similarity index 98% rename from boards/px4/fmu-v6xrt/src/imxrt_romapi.c rename to platforms/nuttx/src/px4/nxp/imxrt/romapi/imxrt_romapi.c index 0f79d88a0e1e..68443e3353ba 100644 --- a/boards/px4/fmu-v6xrt/src/imxrt_romapi.c +++ b/platforms/nuttx/src/px4/nxp/imxrt/romapi/imxrt_romapi.c @@ -1,7 +1,7 @@ /**************************************************************************** - * boards/px4/fmu-v6xrt/src/imxrt_romapi.c + * platforms/nuttx/src/px4/nxp/imrt/romapi/imxrt_romapi.c * - * Copyright 2017-2020 NXP + * Copyright 2017-2024 NXP * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -22,8 +22,8 @@ #include "arm_internal.h" -#include "imxrt_flexspi_nor_flash.h" -#include "imxrt_romapi.h" +#include +#include #include diff --git a/platforms/nuttx/src/px4/nxp/rt117x/CMakeLists.txt b/platforms/nuttx/src/px4/nxp/rt117x/CMakeLists.txt index 8875ab56b776..7a1b5a8bdf9f 100644 --- a/platforms/nuttx/src/px4/nxp/rt117x/CMakeLists.txt +++ b/platforms/nuttx/src/px4/nxp/rt117x/CMakeLists.txt @@ -36,7 +36,7 @@ add_subdirectory(adc) add_subdirectory(../imxrt/board_critmon board_critmon) add_subdirectory(../imxrt/board_hw_info board_hw_info) add_subdirectory(../imxrt/board_reset board_reset) -#add_subdirectory(../imxrt/dshot dshot) +add_subdirectory(../imxrt/romapi romapi) add_subdirectory(../imxrt/hrt hrt) add_subdirectory(../imxrt/led_pwm led_pwm) add_subdirectory(../imxrt/io_pins io_pins) diff --git a/platforms/nuttx/src/px4/nxp/rt117x/include/px4_arch/imxrt_flexspi_nor_flash.h b/platforms/nuttx/src/px4/nxp/rt117x/include/px4_arch/imxrt_flexspi_nor_flash.h new file mode 100644 index 000000000000..3925012e86fd --- /dev/null +++ b/platforms/nuttx/src/px4/nxp/rt117x/include/px4_arch/imxrt_flexspi_nor_flash.h @@ -0,0 +1,36 @@ +/**************************************************************************** + * + * Copyright (c) 2024 PX4 Development Team. All rights reserved. + * + * 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 PX4 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. + * + ****************************************************************************/ +#pragma once + + +#include "../../../imxrt/include/px4_arch/imxrt_flexspi_nor_flash.h" diff --git a/platforms/nuttx/src/px4/nxp/rt117x/include/px4_arch/imxrt_romapi.h b/platforms/nuttx/src/px4/nxp/rt117x/include/px4_arch/imxrt_romapi.h new file mode 100644 index 000000000000..aeab84116295 --- /dev/null +++ b/platforms/nuttx/src/px4/nxp/rt117x/include/px4_arch/imxrt_romapi.h @@ -0,0 +1,36 @@ +/**************************************************************************** + * + * Copyright (c) 2024 PX4 Development Team. All rights reserved. + * + * 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 PX4 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. + * + ****************************************************************************/ +#pragma once + + +#include "../../../imxrt/include/px4_arch/imxrt_romapi.h"