mirror of
https://github.com/apache/nuttx.git
synced 2025-12-11 21:20:26 +08:00
board/risc-v/rp23xx-rv: Added CMake build for Raspberry Pi Pico 2 RISC-V board
- CMake added board Raspberry Pi Pico 2 RISC-V
- Created a file rp23xx_common_pico.h with function
prototype
int rp23xx_dev_gpio_init(void);
to allow cmake + ninja to build without errors.
Signed-off-by: simbit18 <simbit18@gmail.com>
This commit is contained in:
24
boards/risc-v/rp23xx-rv/common/CMakeLists.txt
Normal file
24
boards/risc-v/rp23xx-rv/common/CMakeLists.txt
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# ##############################################################################
|
||||||
|
# boards/risc-v/rp23xx-rv/common/CMakeLists.txt
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# ##############################################################################
|
||||||
|
|
||||||
|
add_subdirectory(src)
|
||||||
|
target_include_directories(board PRIVATE include)
|
||||||
72
boards/risc-v/rp23xx-rv/common/include/rp23xx_common_pico.h
Normal file
72
boards/risc-v/rp23xx-rv/common/include/rp23xx_common_pico.h
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/risc-v/rp23xx-rv/common/include/rp23xx_common_pico.h
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __BOARDS_RISCV_RP23XX_RV_COMMON_INCLUDE_RP23XX_COMMON_PICO_H
|
||||||
|
#define __BOARDS_RISCV_RP23XX_RV_COMMON_INCLUDE_RP23XX_COMMON_PICO_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Inline Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: rp23xx_dev_gpio_init
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEV_GPIO
|
||||||
|
int rp23xx_dev_gpio_init(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __BOARDS_RISCV_RP23XX_RV_COMMON_INCLUDE_RP23XX_COMMON_PICO_H */
|
||||||
116
boards/risc-v/rp23xx-rv/common/src/CMakeLists.txt
Normal file
116
boards/risc-v/rp23xx-rv/common/src/CMakeLists.txt
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
# ##############################################################################
|
||||||
|
# boards/risc-v/rp23xx-rv/common/src/CMakeLists.txt
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# ##############################################################################
|
||||||
|
|
||||||
|
if(CONFIG_ARCH_BOARD_COMMON)
|
||||||
|
set(RP23XXFLAGS -DPICO_RP2040=0 -DPICO_RP2350=1 -DLIB_PICO_BINARY_INFO=0
|
||||||
|
-DPICO_RISCV=1 -DPICO_ARM=0 -DPICO_32BIT=1)
|
||||||
|
|
||||||
|
list(APPEND SRCS rp23xx_common_bringup.c rp23xx_common_initialize.c)
|
||||||
|
|
||||||
|
if(CONFIG_BOARDCTL_RESET)
|
||||||
|
list(APPEND SRCS rp23xx_reset.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_SPI)
|
||||||
|
list(APPEND SRCS rp23xx_spi.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_RP23XX_RV_I2C_DRIVER)
|
||||||
|
list(APPEND SRCS rp23xx_i2cdev.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_RP23XX_RV_PWM)
|
||||||
|
list(APPEND SRCS rp23xx_pwmdev.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_RP23XX_RV_SPI_DRIVER)
|
||||||
|
list(APPEND SRCS rp23xx_spidev.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_RP23XX_RV_I2S)
|
||||||
|
list(APPEND SRCS rp23xx_i2sdev.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_LCD_SSD1306)
|
||||||
|
list(APPEND SRCS rp23xx_ssd1306.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_LCD_ST7789)
|
||||||
|
list(APPEND SRCS rp23xx_st7789.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_LCD_ST7735)
|
||||||
|
list(APPEND SRCS rp23xx_st7735.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_LCD_GC9A01)
|
||||||
|
list(APPEND SRCS rp23xx_gc9a01.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_USBMSC)
|
||||||
|
list(APPEND SRCS rp23xx_usbmsc.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_USBDEV_COMPOSITE)
|
||||||
|
list(APPEND SRCS rp23xx_composite.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_RP23XX_SPISD)
|
||||||
|
list(APPEND SRCS rp23xx_spisd.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_SENSORS_BMP180)
|
||||||
|
list(APPEND SRCS rp23xx_bmp180.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_SENSORS_BMP280)
|
||||||
|
list(APPEND SRCS rp23xx_bmp280.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_SENSORS_INA219)
|
||||||
|
list(APPEND SRCS rp23xx_ina219.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_ENC28J60)
|
||||||
|
list(APPEND SRCS rp23xx_enc28j60.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_LCD_BACKPACK)
|
||||||
|
list(APPEND SRCS rp23xx_lcd_backpack.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_BOARDCTL_UNIQUEID)
|
||||||
|
list(APPEND SRCS rp23xx_uniqueid.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_NET_W5500)
|
||||||
|
list(APPEND SRCS rp23xx_w5500.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_SENSORS_MAX6675)
|
||||||
|
list(APPEND SRCS rp23xx_max6675.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_sources(board PRIVATE ${SRCS})
|
||||||
|
target_compile_options(board PRIVATE ${RP23XXFLAGS})
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include <arch/board/board.h>
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
#include "rp23xx_pico.h"
|
#include "rp23xx_common_pico.h"
|
||||||
#include "rp23xx_common_bringup.h"
|
#include "rp23xx_common_bringup.h"
|
||||||
|
|
||||||
#ifdef CONFIG_RP23XX_RV_PWM
|
#ifdef CONFIG_RP23XX_RV_PWM
|
||||||
|
|||||||
40
boards/risc-v/rp23xx-rv/raspberrypi-pico-2-rv/CMakeLists.txt
Normal file
40
boards/risc-v/rp23xx-rv/raspberrypi-pico-2-rv/CMakeLists.txt
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# ##############################################################################
|
||||||
|
# boards/risc-v/rp23xx-rv/raspberrypi-pico-2-rv/CMakeLists.txt
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# ##############################################################################
|
||||||
|
|
||||||
|
add_subdirectory(src)
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
nuttx_post_build
|
||||||
|
DEPENDS nuttx
|
||||||
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
|
COMMENT "Regenerate nuttx.uf2")
|
||||||
|
|
||||||
|
# The uf2 command to convert ELF/BIN to UF2
|
||||||
|
add_custom_command(
|
||||||
|
TARGET nuttx_post_build
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND picotool ARGS uf2 convert --quiet -t elf nuttx nuttx.uf2
|
||||||
|
COMMAND_EXPAND_LISTS
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E echo "nuttx.uf2" >>
|
||||||
|
${CMAKE_BINARY_DIR}/nuttx.manifest
|
||||||
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
|
COMMENT "Regenerate nuttx.uf2")
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
# ##############################################################################
|
||||||
|
# boards/risc-v/rp23xx-rv/raspberrypi-pico-2-rv/src/CMakeLists.txt
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# ##############################################################################
|
||||||
|
|
||||||
|
set(SRCS rp23xx_boardinitialize.c rp23xx_bringup.c)
|
||||||
|
|
||||||
|
if(CONFIG_DEV_GPIO)
|
||||||
|
list(APPEND SRCS rp23xx_gpio.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_ARCH_LEDS)
|
||||||
|
list(APPEND SRCS rp23xx_autoleds.c)
|
||||||
|
else()
|
||||||
|
list(APPEND SRCS rp23xx_userleds.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
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)
|
||||||
|
set_property(GLOBAL PROPERTY LD_SCRIPT
|
||||||
|
"${NUTTX_BOARD_DIR}/scripts/memmap_default.ld")
|
||||||
|
elseif(CONFIG_BOOT_COPYTORAM)
|
||||||
|
set_property(
|
||||||
|
GLOBAL PROPERTY LD_SCRIPT
|
||||||
|
"${NUTTX_BOARD_DIR}/scripts/memmap_copy_to_ram.ld")
|
||||||
|
else()
|
||||||
|
set_property(GLOBAL PROPERTY LD_SCRIPT
|
||||||
|
"${NUTTX_BOARD_DIR}/scripts/memmap_no_flash.ld")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_ETC_ROMFS)
|
||||||
|
# TODO: etc/init.d/rc.sysinit etc/init.d/rcS
|
||||||
|
endif()
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
int rp23xx_bringup(void);
|
int rp23xx_bringup(void);
|
||||||
|
|
||||||
#ifdef CONFIG_DEV_GPIO
|
#if defined(CONFIG_DEV_GPIO) && !defined(CONFIG_ARCH_BOARD_COMMON)
|
||||||
int rp23xx_dev_gpio_init(void);
|
int rp23xx_dev_gpio_init(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user