From cfbf69f2a7c408903864300bd24cd3939258a6c1 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Sun, 26 Jul 2020 13:55:41 -0400 Subject: [PATCH] boards: rename Hex -> CubePilot - hex_cube-orange_default -> cubepilot_cubeorange_default - hex_cube-yellow_default -> cubepilot_cubeyellow_default --- .ci/Jenkinsfile-compile | 4 +- .github/workflows/compile_nuttx.yml | 4 +- .vscode/cmake-variants.yaml | 12 +- .../cubeorange}/bootloader.cmake | 4 +- .../cubeorange}/default.cmake | 12 +- .../cubeorange}/firmware.prototype | 2 +- .../cubeorange}/init/rc.board_defaults | 4 +- .../cubeorange}/init/rc.board_mavlink | 0 .../cubeorange}/init/rc.board_sensors | 0 .../nuttx-config/bootloader/defconfig | 4 +- .../cubeorange}/nuttx-config/include/board.h | 26 +-- .../nuttx-config/include/board_dma_map.h | 0 .../cubeorange}/nuttx-config/nsh/defconfig | 5 +- .../nuttx-config/scripts/bootloader_script.ld | 0 .../nuttx-config/scripts/script.ld | 1 + .../cubeorange}/src/CMakeLists.txt | 0 .../cubeorange}/src/board_config.h | 2 +- .../cubeorange}/src/bootloader_main.c | 0 .../cubeorange}/src/hw_config.h | 0 .../cubeorange}/src/i2c.cpp | 0 .../cubeorange}/src/init.c | 9 +- .../cubeorange}/src/led.c | 0 .../cubeorange}/src/spi.cpp | 0 .../cubeorange}/src/timer_config.cpp | 0 .../cubeorange}/src/usb.c | 0 .../cubeyellow}/default.cmake | 12 +- .../cubeyellow}/firmware.prototype | 2 +- .../cubeyellow}/init/rc.board_defaults | 2 +- .../cubeyellow}/init/rc.board_mavlink | 0 .../cubeyellow}/init/rc.board_sensors | 0 .../cubeyellow}/nuttx-config/include/board.h | 136 +++------------ .../nuttx-config/include/board_dma_map.h | 0 .../cubeyellow}/nuttx-config/nsh/defconfig | 2 +- .../nuttx-config/scripts/script.ld | 14 +- .../cubeyellow}/src/CMakeLists.txt | 0 .../cubeyellow}/src/board_config.h | 159 ++++-------------- .../cubeyellow}/src/can.c | 0 .../cubeyellow}/src/i2c.cpp | 0 .../cubeyellow}/src/init.c | 90 ++-------- .../cubeyellow}/src/led.c | 27 ++- .../cubeyellow}/src/sdio.c | 18 +- .../cubeyellow}/src/spi.cpp | 16 +- .../cubepilot/cubeyellow/src/timer_config.cpp | 51 ++++++ boards/cubepilot/cubeyellow/src/usb.c | 58 +++++++ boards/{hex => cubepilot}/io-v2/default.cmake | 2 +- .../io-v2/firmware.prototype | 0 .../io-v2/nuttx-config/include/board.h | 0 .../io-v2/nuttx-config/nsh/defconfig | 0 .../io-v2/nuttx-config/scripts/script.ld | 0 .../io-v2/src/CMakeLists.txt | 0 .../io-v2/src/board_config.h | 0 boards/{hex => cubepilot}/io-v2/src/init.c | 0 .../io-v2/src/timer_config.cpp | 0 boards/hex/cube-yellow/nuttx-config/Kconfig | 17 -- boards/hex/cube-yellow/src/timer_config.cpp | 130 -------------- boards/hex/cube-yellow/src/usb.c | 105 ------------ 56 files changed, 284 insertions(+), 646 deletions(-) rename boards/{hex/cube-orange => cubepilot/cubeorange}/bootloader.cmake (73%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/default.cmake (94%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/firmware.prototype (78%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/init/rc.board_defaults (85%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/init/rc.board_mavlink (100%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/init/rc.board_sensors (100%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/nuttx-config/bootloader/defconfig (96%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/nuttx-config/include/board.h (93%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/nuttx-config/include/board_dma_map.h (100%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/nuttx-config/nsh/defconfig (98%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/nuttx-config/scripts/bootloader_script.ld (100%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/nuttx-config/scripts/script.ld (99%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/src/CMakeLists.txt (100%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/src/board_config.h (99%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/src/bootloader_main.c (100%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/src/hw_config.h (100%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/src/i2c.cpp (100%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/src/init.c (97%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/src/led.c (100%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/src/spi.cpp (100%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/src/timer_config.cpp (100%) rename boards/{hex/cube-orange => cubepilot/cubeorange}/src/usb.c (100%) rename boards/{hex/cube-yellow => cubepilot/cubeyellow}/default.cmake (95%) rename boards/{hex/cube-yellow => cubepilot/cubeyellow}/firmware.prototype (78%) rename boards/{hex/cube-yellow => cubepilot/cubeyellow}/init/rc.board_defaults (88%) rename boards/{hex/cube-yellow => cubepilot/cubeyellow}/init/rc.board_mavlink (100%) rename boards/{hex/cube-yellow => cubepilot/cubeyellow}/init/rc.board_sensors (100%) rename boards/{hex/cube-yellow => cubepilot/cubeyellow}/nuttx-config/include/board.h (71%) rename boards/{hex/cube-yellow => cubepilot/cubeyellow}/nuttx-config/include/board_dma_map.h (100%) rename boards/{hex/cube-yellow => cubepilot/cubeyellow}/nuttx-config/nsh/defconfig (99%) rename boards/{hex/cube-yellow => cubepilot/cubeyellow}/nuttx-config/scripts/script.ld (93%) rename boards/{hex/cube-yellow => cubepilot/cubeyellow}/src/CMakeLists.txt (100%) rename boards/{hex/cube-yellow => cubepilot/cubeyellow}/src/board_config.h (59%) rename boards/{hex/cube-yellow => cubepilot/cubeyellow}/src/can.c (100%) rename boards/{hex/cube-yellow => cubepilot/cubeyellow}/src/i2c.cpp (100%) rename boards/{hex/cube-yellow => cubepilot/cubeyellow}/src/init.c (70%) rename boards/{hex/cube-yellow => cubepilot/cubeyellow}/src/led.c (85%) rename boards/{hex/cube-yellow => cubepilot/cubeyellow}/src/sdio.c (94%) rename boards/{hex/cube-yellow => cubepilot/cubeyellow}/src/spi.cpp (85%) create mode 100644 boards/cubepilot/cubeyellow/src/timer_config.cpp create mode 100644 boards/cubepilot/cubeyellow/src/usb.c rename boards/{hex => cubepilot}/io-v2/default.cmake (89%) rename boards/{hex => cubepilot}/io-v2/firmware.prototype (100%) rename boards/{hex => cubepilot}/io-v2/nuttx-config/include/board.h (100%) rename boards/{hex => cubepilot}/io-v2/nuttx-config/nsh/defconfig (100%) rename boards/{hex => cubepilot}/io-v2/nuttx-config/scripts/script.ld (100%) rename boards/{hex => cubepilot}/io-v2/src/CMakeLists.txt (100%) rename boards/{hex => cubepilot}/io-v2/src/board_config.h (100%) rename boards/{hex => cubepilot}/io-v2/src/init.c (100%) rename boards/{hex => cubepilot}/io-v2/src/timer_config.cpp (100%) delete mode 100644 boards/hex/cube-yellow/nuttx-config/Kconfig delete mode 100644 boards/hex/cube-yellow/src/timer_config.cpp delete mode 100644 boards/hex/cube-yellow/src/usb.c diff --git a/.ci/Jenkinsfile-compile b/.ci/Jenkinsfile-compile index 1c7d6e1e08..3a35ee96f7 100644 --- a/.ci/Jenkinsfile-compile +++ b/.ci/Jenkinsfile-compile @@ -33,8 +33,8 @@ pipeline { "av_x-v1_default", "bitcraze_crazyflie_default", "cuav_x7pro_default", - "hex_cube-orange_default", - "hex_cube-yellow_default", + "cubepilot_cubeorange_default", + "cubepilot_cubeyellow_default", "holybro_durandal-v1_default", "holybro_durandal-v1_stackcheck", "holybro_kakutef7", diff --git a/.github/workflows/compile_nuttx.yml b/.github/workflows/compile_nuttx.yml index 35d06c340b..69e78da7a3 100644 --- a/.github/workflows/compile_nuttx.yml +++ b/.github/workflows/compile_nuttx.yml @@ -19,8 +19,8 @@ jobs: av_x-v1_default, bitcraze_crazyflie_default, cuav_x7pro_default, - hex_cube-orange_default, - hex_cube-yellow_default, + cubepilot_cubeorange_default, + cubepilot_cubeyellow_default, holybro_durandal-v1_default, holybro_durandal-v1_stackcheck, holybro_kakutef7_default, diff --git a/.vscode/cmake-variants.yaml b/.vscode/cmake-variants.yaml index 455fc017a8..0523259806 100644 --- a/.vscode/cmake-variants.yaml +++ b/.vscode/cmake-variants.yaml @@ -66,16 +66,16 @@ CONFIG: buildType: MinSizeRel settings: CONFIG: cuav_x7pro_default - hex_cube-orange_default: - short: hex_cube-orange + cubepilot_cubeorange_default: + short: cubepilot_cubeorange buildType: MinSizeRel settings: - CONFIG: hex_cube-orange_default - hex_cube-yellow_default: - short: hex_cube-yellow + CONFIG: cubepilot_orange_default + cubepilot_cubeyellow_default: + short: cubepilot_cubeyellow buildType: MinSizeRel settings: - CONFIG: hex_cube-yellow_default + CONFIG: cubepilot_cubeyellow_default holybro_durandal-v1_default: short: holybro_durandal-v1 buildType: MinSizeRel diff --git a/boards/hex/cube-orange/bootloader.cmake b/boards/cubepilot/cubeorange/bootloader.cmake similarity index 73% rename from boards/hex/cube-orange/bootloader.cmake rename to boards/cubepilot/cubeorange/bootloader.cmake index bf7fe3d338..69782041e2 100644 --- a/boards/hex/cube-orange/bootloader.cmake +++ b/boards/cubepilot/cubeorange/bootloader.cmake @@ -1,8 +1,8 @@ px4_add_board( PLATFORM nuttx - VENDOR hex - MODEL cube-orange + VENDOR cubepilot + MODEL cubeorange LABEL bootloader TOOLCHAIN arm-none-eabi ARCHITECTURE cortex-m7 diff --git a/boards/hex/cube-orange/default.cmake b/boards/cubepilot/cubeorange/default.cmake similarity index 94% rename from boards/hex/cube-orange/default.cmake rename to boards/cubepilot/cubeorange/default.cmake index a2cf1e8c7f..b0dade5ab9 100644 --- a/boards/hex/cube-orange/default.cmake +++ b/boards/cubepilot/cubeorange/default.cmake @@ -1,14 +1,14 @@ px4_add_board( PLATFORM nuttx - VENDOR hex - MODEL cube-orange + VENDOR cubepilot + MODEL cubeorange LABEL default TOOLCHAIN arm-none-eabi ARCHITECTURE cortex-m7 ROMFSROOT px4fmu_common BUILD_BOOTLOADER - IO hex_io-v2_default + IO cubepilot_io-v2_default TESTING UAVCAN_INTERFACES 2 SERIAL_PORTS @@ -29,6 +29,7 @@ px4_add_board( distance_sensor # all available distance sensor drivers dshot gps + #heater #imu # all available imu drivers imu/adis16448 imu/adis16477 @@ -51,6 +52,7 @@ px4_add_board( pwm_out px4io roboclaw + rpm tap_esc telemetry # all available telemetry drivers test_ppm @@ -64,6 +66,7 @@ px4_add_board( commander dataman ekf2 + esc_battery events fw_att_control fw_pos_control_l1 @@ -77,6 +80,7 @@ px4_add_board( mc_hover_thrust_estimator mc_pos_control mc_rate_control + #micrortps_bridge navigator rc_update rover_pos_control @@ -90,6 +94,7 @@ px4_add_board( dmesg dumpfile esc_calib + gpio hardfault_log i2cdetect led_control @@ -112,6 +117,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/hex/cube-orange/firmware.prototype b/boards/cubepilot/cubeorange/firmware.prototype similarity index 78% rename from boards/hex/cube-orange/firmware.prototype rename to boards/cubepilot/cubeorange/firmware.prototype index 35da43cf2f..8132a05a90 100644 --- a/boards/hex/cube-orange/firmware.prototype +++ b/boards/cubepilot/cubeorange/firmware.prototype @@ -1,7 +1,7 @@ { "board_id": 140, "magic": "PX4FWv1", - "description": "Firmware for the Hex Cube Orange board", + "description": "Firmware for the CubePilot CubeOrange board", "image": "", "build_time": 0, "summary": "CubeOrange", diff --git a/boards/hex/cube-orange/init/rc.board_defaults b/boards/cubepilot/cubeorange/init/rc.board_defaults similarity index 85% rename from boards/hex/cube-orange/init/rc.board_defaults rename to boards/cubepilot/cubeorange/init/rc.board_defaults index abe2b393a7..f5d4f8bf57 100644 --- a/boards/hex/cube-orange/init/rc.board_defaults +++ b/boards/cubepilot/cubeorange/init/rc.board_defaults @@ -6,7 +6,7 @@ # # Bootloader upgrade # -set BL_FILE /etc/extras/hex_cube-orange_bootloader.bin +set BL_FILE /etc/extras/cubepilot_cubeorange_bootloader.bin if [ -f $BL_FILE ] then if param compare SYS_BL_UPDATE 1 @@ -36,4 +36,4 @@ then fi set LOGGER_BUF 64 -set IOFW "/etc/extras/hex_io-v2_default.bin" +set IOFW "/etc/extras/cubepilot_io-v2_default.bin" diff --git a/boards/hex/cube-orange/init/rc.board_mavlink b/boards/cubepilot/cubeorange/init/rc.board_mavlink similarity index 100% rename from boards/hex/cube-orange/init/rc.board_mavlink rename to boards/cubepilot/cubeorange/init/rc.board_mavlink diff --git a/boards/hex/cube-orange/init/rc.board_sensors b/boards/cubepilot/cubeorange/init/rc.board_sensors similarity index 100% rename from boards/hex/cube-orange/init/rc.board_sensors rename to boards/cubepilot/cubeorange/init/rc.board_sensors diff --git a/boards/hex/cube-orange/nuttx-config/bootloader/defconfig b/boards/cubepilot/cubeorange/nuttx-config/bootloader/defconfig similarity index 96% rename from boards/hex/cube-orange/nuttx-config/bootloader/defconfig rename to boards/cubepilot/cubeorange/nuttx-config/bootloader/defconfig index e1498cacd9..cd6d509c4f 100644 --- a/boards/hex/cube-orange/nuttx-config/bootloader/defconfig +++ b/boards/cubepilot/cubeorange/nuttx-config/bootloader/defconfig @@ -30,11 +30,11 @@ CONFIG_BOARD_RESET_ON_ASSERT=2 CONFIG_C99_BOOL8=y CONFIG_CDCACM=y CONFIG_CDCACM_PRODUCTID=0x1016 -CONFIG_CDCACM_PRODUCTSTR="PX4 BL Hex Cube Orange" +CONFIG_CDCACM_PRODUCTSTR="PX4 BL CubePilot CubeOrange" CONFIG_CDCACM_RXBUFSIZE=600 CONFIG_CDCACM_TXBUFSIZE=12000 CONFIG_CDCACM_VENDORID=0x2DAE -CONFIG_CDCACM_VENDORSTR="Hex/ProfiCNC" +CONFIG_CDCACM_VENDORSTR="CubePilot" CONFIG_CLOCK_MONOTONIC=y CONFIG_DEBUG_FULLOPT=y CONFIG_DEBUG_SYMBOLS=y diff --git a/boards/hex/cube-orange/nuttx-config/include/board.h b/boards/cubepilot/cubeorange/nuttx-config/include/board.h similarity index 93% rename from boards/hex/cube-orange/nuttx-config/include/board.h rename to boards/cubepilot/cubeorange/nuttx-config/include/board.h index c3e9cc17dd..62a78c863c 100644 --- a/boards/hex/cube-orange/nuttx-config/include/board.h +++ b/boards/cubepilot/cubeorange/nuttx-config/include/board.h @@ -219,6 +219,7 @@ #define STM32_SDMMC_CLKCR_EDGE STM32_SDMMC_CLKCR_NEGEDGE + /* UART/USART */ #define GPIO_USART1_RX GPIO_USART1_RX_2 /* PA10 */ #define GPIO_USART1_TX 0 /* USART1 is RX-only */ @@ -245,27 +246,30 @@ #define GPIO_UART8_RX GPIO_UART8_RX_1 /* PE0 */ #define GPIO_UART8_TX GPIO_UART8_TX_1 /* PE1 */ + /* CAN */ -#define GPIO_CAN1_RX GPIO_CAN1_RX_3 /* PD0 */ -#define GPIO_CAN1_TX GPIO_CAN1_TX_3 /* PD1 */ +#define GPIO_CAN1_RX GPIO_CAN1_RX_3 /* PD0 */ +#define GPIO_CAN1_TX GPIO_CAN1_TX_3 /* PD1 */ #define GPIO_CAN2_RX GPIO_CAN2_RX_1 /* PB12 */ -#define GPIO_CAN2_TX GPIO_CAN2_TX_2 /* PB6 */ +#define GPIO_CAN2_TX GPIO_CAN2_TX_2 /* PB6 */ + /* SPI */ #define ADJ_SLEW_RATE(p) (((p) & ~GPIO_SPEED_MASK) | (GPIO_SPEED_2MHz)) -#define GPIO_SPI1_SCK ADJ_SLEW_RATE(GPIO_SPI1_SCK_1) /* PA5 */ -#define GPIO_SPI1_MISO GPIO_SPI1_MISO_1 /* PA6 */ -#define GPIO_SPI1_MOSI GPIO_SPI1_MOSI_1 /* PA7 */ +#define GPIO_SPI1_SCK ADJ_SLEW_RATE(GPIO_SPI1_SCK_1) /* PA5 */ +#define GPIO_SPI1_MISO GPIO_SPI1_MISO_1 /* PA6 */ +#define GPIO_SPI1_MOSI GPIO_SPI1_MOSI_1 /* PA7 */ #define GPIO_SPI2_SCK ADJ_SLEW_RATE(GPIO_SPI2_SCK_4) /* PB13 */ -#define GPIO_SPI2_MISO GPIO_SPI2_MISO_1 /* PB14 */ -#define GPIO_SPI2_MOSI GPIO_SPI2_MOSI_1 /* PB15 */ +#define GPIO_SPI2_MISO GPIO_SPI2_MISO_1 /* PB14 */ +#define GPIO_SPI2_MOSI GPIO_SPI2_MOSI_1 /* PB15 */ + +#define GPIO_SPI4_SCK ADJ_SLEW_RATE(GPIO_SPI4_SCK_2) /* PE2 */ +#define GPIO_SPI4_MISO GPIO_SPI4_MISO_2 /* PE5 */ +#define GPIO_SPI4_MOSI GPIO_SPI4_MOSI_2 /* PE6 */ -#define GPIO_SPI4_SCK ADJ_SLEW_RATE(GPIO_SPI4_SCK_2) /* PE2 */ -#define GPIO_SPI4_MISO GPIO_SPI4_MISO_2 /* PE5 */ -#define GPIO_SPI4_MOSI GPIO_SPI4_MOSI_2 /* PE6 */ /* I2C */ #define GPIO_I2C1_SCL GPIO_I2C1_SCL_2 /* PB8 */ diff --git a/boards/hex/cube-orange/nuttx-config/include/board_dma_map.h b/boards/cubepilot/cubeorange/nuttx-config/include/board_dma_map.h similarity index 100% rename from boards/hex/cube-orange/nuttx-config/include/board_dma_map.h rename to boards/cubepilot/cubeorange/nuttx-config/include/board_dma_map.h diff --git a/boards/hex/cube-orange/nuttx-config/nsh/defconfig b/boards/cubepilot/cubeorange/nuttx-config/nsh/defconfig similarity index 98% rename from boards/hex/cube-orange/nuttx-config/nsh/defconfig rename to boards/cubepilot/cubeorange/nuttx-config/nsh/defconfig index f318a320f5..1818eadafb 100644 --- a/boards/hex/cube-orange/nuttx-config/nsh/defconfig +++ b/boards/cubepilot/cubeorange/nuttx-config/nsh/defconfig @@ -21,7 +21,6 @@ # CONFIG_NSH_DISABLE_LOOPS is not set # CONFIG_NSH_DISABLE_SEMICOLON is not set # CONFIG_NSH_DISABLE_TIME is not set -# CONFIG_STM32H7_SYSCFG is not set CONFIG_ARCH="arm" CONFIG_ARCH_BOARD_CUSTOM=y CONFIG_ARCH_BOARD_CUSTOM_DIR="../nuttx-config" @@ -50,7 +49,7 @@ CONFIG_CDCACM_PRODUCTSTR="CubeOrange" CONFIG_CDCACM_RXBUFSIZE=600 CONFIG_CDCACM_TXBUFSIZE=12000 CONFIG_CDCACM_VENDORID=0x2DAE -CONFIG_CDCACM_VENDORSTR="Hex/ProfiCNC" +CONFIG_CDCACM_VENDORSTR="CubePilot" CONFIG_CLOCK_MONOTONIC=y CONFIG_DEBUG_FULLOPT=y CONFIG_DEBUG_HARDFAULT_ALERT=y @@ -210,8 +209,8 @@ CONFIG_TTY_SIGINT=y CONFIG_TTY_SIGSTP=y CONFIG_UART7_BAUD=57600 CONFIG_UART7_RXBUFSIZE=600 -CONFIG_UART7_TXBUFSIZE=1500 CONFIG_UART7_SERIAL_CONSOLE=y +CONFIG_UART7_TXBUFSIZE=1500 CONFIG_UART8_BAUD=57600 CONFIG_UART8_RXBUFSIZE=600 CONFIG_UART8_TXBUFSIZE=1500 diff --git a/boards/hex/cube-orange/nuttx-config/scripts/bootloader_script.ld b/boards/cubepilot/cubeorange/nuttx-config/scripts/bootloader_script.ld similarity index 100% rename from boards/hex/cube-orange/nuttx-config/scripts/bootloader_script.ld rename to boards/cubepilot/cubeorange/nuttx-config/scripts/bootloader_script.ld diff --git a/boards/hex/cube-orange/nuttx-config/scripts/script.ld b/boards/cubepilot/cubeorange/nuttx-config/scripts/script.ld similarity index 99% rename from boards/hex/cube-orange/nuttx-config/scripts/script.ld rename to boards/cubepilot/cubeorange/nuttx-config/scripts/script.ld index ef23884ca0..35d756014a 100644 --- a/boards/hex/cube-orange/nuttx-config/scripts/script.ld +++ b/boards/cubepilot/cubeorange/nuttx-config/scripts/script.ld @@ -111,6 +111,7 @@ MEMORY { ITCM_RAM (rwx) : ORIGIN = 0x00000000, LENGTH = 64K FLASH (rx) : ORIGIN = 0x08020000, LENGTH = 1920K + DTCM1_RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K DTCM2_RAM (rwx) : ORIGIN = 0x20010000, LENGTH = 64K AXI_SRAM (rwx) : ORIGIN = 0x24000000, LENGTH = 512K /* D1 domain AXI bus */ diff --git a/boards/hex/cube-orange/src/CMakeLists.txt b/boards/cubepilot/cubeorange/src/CMakeLists.txt similarity index 100% rename from boards/hex/cube-orange/src/CMakeLists.txt rename to boards/cubepilot/cubeorange/src/CMakeLists.txt diff --git a/boards/hex/cube-orange/src/board_config.h b/boards/cubepilot/cubeorange/src/board_config.h similarity index 99% rename from boards/hex/cube-orange/src/board_config.h rename to boards/cubepilot/cubeorange/src/board_config.h index 727c1dcadf..ef1253c372 100644 --- a/boards/hex/cube-orange/src/board_config.h +++ b/boards/cubepilot/cubeorange/src/board_config.h @@ -34,7 +34,7 @@ /** * @file board_config.h * - * Hex Cube Orange internal definitions + * Board internal definitions */ #pragma once diff --git a/boards/hex/cube-orange/src/bootloader_main.c b/boards/cubepilot/cubeorange/src/bootloader_main.c similarity index 100% rename from boards/hex/cube-orange/src/bootloader_main.c rename to boards/cubepilot/cubeorange/src/bootloader_main.c diff --git a/boards/hex/cube-orange/src/hw_config.h b/boards/cubepilot/cubeorange/src/hw_config.h similarity index 100% rename from boards/hex/cube-orange/src/hw_config.h rename to boards/cubepilot/cubeorange/src/hw_config.h diff --git a/boards/hex/cube-orange/src/i2c.cpp b/boards/cubepilot/cubeorange/src/i2c.cpp similarity index 100% rename from boards/hex/cube-orange/src/i2c.cpp rename to boards/cubepilot/cubeorange/src/i2c.cpp diff --git a/boards/hex/cube-orange/src/init.c b/boards/cubepilot/cubeorange/src/init.c similarity index 97% rename from boards/hex/cube-orange/src/init.c rename to boards/cubepilot/cubeorange/src/init.c index 0632a35b7f..67bad1bd81 100644 --- a/boards/hex/cube-orange/src/init.c +++ b/boards/cubepilot/cubeorange/src/init.c @@ -34,7 +34,7 @@ /** * @file init.c * - * FMU-specific early startup code. This file implements the + * board-specific early startup code. This file implements the * board_app_initialize() function that is called early by nsh during startup. * * Code here is run before the rcS script is invoked; it should start required @@ -122,6 +122,7 @@ __EXPORT void stm32_boardinitialize(void) /* configure pins */ const uint32_t gpio[] = PX4_GPIO_INIT_LIST; px4_gpio_init(gpio, arraySize(gpio)); + board_control_spi_sensors_power_configgpio(); /* configure LEDs */ board_autoled_initialize(); @@ -162,12 +163,10 @@ __EXPORT int board_app_initialize(uintptr_t arg) /* initial LED state */ drv_led_start(); - led_off(LED_RED); - led_on(LED_GREEN); // Indicate Power. - led_off(LED_BLUE); + led_off(LED_AMBER); if (board_hardfault_init(2, true) != 0) { - led_on(LED_RED); + led_on(LED_AMBER); } #ifdef CONFIG_MMCSD diff --git a/boards/hex/cube-orange/src/led.c b/boards/cubepilot/cubeorange/src/led.c similarity index 100% rename from boards/hex/cube-orange/src/led.c rename to boards/cubepilot/cubeorange/src/led.c diff --git a/boards/hex/cube-orange/src/spi.cpp b/boards/cubepilot/cubeorange/src/spi.cpp similarity index 100% rename from boards/hex/cube-orange/src/spi.cpp rename to boards/cubepilot/cubeorange/src/spi.cpp diff --git a/boards/hex/cube-orange/src/timer_config.cpp b/boards/cubepilot/cubeorange/src/timer_config.cpp similarity index 100% rename from boards/hex/cube-orange/src/timer_config.cpp rename to boards/cubepilot/cubeorange/src/timer_config.cpp diff --git a/boards/hex/cube-orange/src/usb.c b/boards/cubepilot/cubeorange/src/usb.c similarity index 100% rename from boards/hex/cube-orange/src/usb.c rename to boards/cubepilot/cubeorange/src/usb.c diff --git a/boards/hex/cube-yellow/default.cmake b/boards/cubepilot/cubeyellow/default.cmake similarity index 95% rename from boards/hex/cube-yellow/default.cmake rename to boards/cubepilot/cubeyellow/default.cmake index 0aeea1f3ed..7e5ad4c8d3 100644 --- a/boards/hex/cube-yellow/default.cmake +++ b/boards/cubepilot/cubeyellow/default.cmake @@ -1,15 +1,15 @@ px4_add_board( PLATFORM nuttx - VENDOR hex - MODEL cube-yellow + VENDOR cubepilot + MODEL cubeyellow LABEL default TOOLCHAIN arm-none-eabi ARCHITECTURE cortex-m7 ROMFSROOT px4fmu_common - IO hex_io-v2_default + IO cubepilot_io-v2_default TESTING - UAVCAN_INTERFACES 1 + UAVCAN_INTERFACES 2 SERIAL_PORTS # IO DEBUG:/dev/ttyS0 TEL1:/dev/ttyS1 @@ -50,10 +50,8 @@ px4_add_board( pwm_out_sim pwm_out px4io - rc_input roboclaw rpm - #safety_button tap_esc telemetry # all available telemetry drivers test_ppm @@ -95,6 +93,7 @@ px4_add_board( dmesg dumpfile esc_calib + gpio hardfault_log i2cdetect led_control @@ -117,6 +116,7 @@ px4_add_board( ver work_queue EXAMPLES + fake_magnetometer fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control hello hwtest # Hardware test diff --git a/boards/hex/cube-yellow/firmware.prototype b/boards/cubepilot/cubeyellow/firmware.prototype similarity index 78% rename from boards/hex/cube-yellow/firmware.prototype rename to boards/cubepilot/cubeyellow/firmware.prototype index d3dd03b47b..90adbddd13 100644 --- a/boards/hex/cube-yellow/firmware.prototype +++ b/boards/cubepilot/cubeyellow/firmware.prototype @@ -1,7 +1,7 @@ { "board_id": 120, "magic": "PX4FWv1", - "description": "Firmware for the Hex Cube Yellow board", + "description": "Firmware for the CubePilot CubeYellow board", "image": "", "build_time": 0, "summary": "CubeYellow", diff --git a/boards/hex/cube-yellow/init/rc.board_defaults b/boards/cubepilot/cubeyellow/init/rc.board_defaults similarity index 88% rename from boards/hex/cube-yellow/init/rc.board_defaults rename to boards/cubepilot/cubeyellow/init/rc.board_defaults index edafff2395..cffab7affe 100644 --- a/boards/hex/cube-yellow/init/rc.board_defaults +++ b/boards/cubepilot/cubeyellow/init/rc.board_defaults @@ -19,4 +19,4 @@ then fi set LOGGER_BUF 64 -set IOFW "/etc/extras/hex_io-v2_default.bin" +set IOFW "/etc/extras/cubepilot_io-v2_default.bin" diff --git a/boards/hex/cube-yellow/init/rc.board_mavlink b/boards/cubepilot/cubeyellow/init/rc.board_mavlink similarity index 100% rename from boards/hex/cube-yellow/init/rc.board_mavlink rename to boards/cubepilot/cubeyellow/init/rc.board_mavlink diff --git a/boards/hex/cube-yellow/init/rc.board_sensors b/boards/cubepilot/cubeyellow/init/rc.board_sensors similarity index 100% rename from boards/hex/cube-yellow/init/rc.board_sensors rename to boards/cubepilot/cubeyellow/init/rc.board_sensors diff --git a/boards/hex/cube-yellow/nuttx-config/include/board.h b/boards/cubepilot/cubeyellow/nuttx-config/include/board.h similarity index 71% rename from boards/hex/cube-yellow/nuttx-config/include/board.h rename to boards/cubepilot/cubeyellow/nuttx-config/include/board.h index 3812c4025b..47cc9bd3d0 100644 --- a/boards/hex/cube-yellow/nuttx-config/include/board.h +++ b/boards/cubepilot/cubeyellow/nuttx-config/include/board.h @@ -1,7 +1,8 @@ /************************************************************************************ + * nuttx-config/include/board.h * - * Copyright (C) 2016-2018 Gregory Nutt. All rights reserved. - * Authors: David Sidrane + * Copyright (C) 2020 Gregory Nutt. All rights reserved. + * Authors: David Sidrane * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,12 +32,8 @@ * POSSIBILITY OF SUCH DAMAGE. * ************************************************************************************/ -#ifndef __NUTTX_CONFIG_HEX_CUBE_YELLOW_INCLUDE_BOARD_H -#define __NUTTX_CONFIG_HEX_CUBE_YELLOW_INCLUDE_BOARD_H +#pragma once -/************************************************************************************ - * Included Files - ************************************************************************************/ #include "board_dma_map.h" #include @@ -48,21 +45,16 @@ #include "stm32_rcc.h" #include "stm32_sdmmc.h" -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - /* Clocking *************************************************************************/ -/* The Cube Yellow board provides the following clock sources: +/* The board provides the following clock sources: * - * X301: 24 MHz crystal for HSE + * X1: 24 MHz crystal for HSE * * So we have these clock source available within the STM32 * - * HSI: 16 MHz RC factory-trimmed + * HSI: 16 MHz RC factory-trimmed internal oscillator * HSE: 24 MHz crystal for HSE */ - #define STM32_BOARD_XTAL 24000000ul #define STM32_HSI_FREQUENCY 16000000ul @@ -113,7 +105,6 @@ #define STM32_OTGFS_FREQUENCY (STM32_VCO_FREQUENCY / 9) /* Configure factors for PLLSAI clock */ - #define CONFIG_STM32F7_PLLSAI 1 #define STM32_RCC_PLLSAICFGR_PLLSAIN RCC_PLLSAICFGR_PLLSAIN(192) #define STM32_RCC_PLLSAICFGR_PLLSAIP RCC_PLLSAICFGR_PLLSAIP(8) @@ -121,7 +112,6 @@ #define STM32_RCC_PLLSAICFGR_PLLSAIR RCC_PLLSAICFGR_PLLSAIR(2) /* Configure Dedicated Clock Configuration Register */ - #define STM32_RCC_DCKCFGR1_PLLI2SDIVQ RCC_DCKCFGR1_PLLI2SDIVQ(1) #define STM32_RCC_DCKCFGR1_PLLSAIDIVQ RCC_DCKCFGR1_PLLSAIDIVQ(1) #define STM32_RCC_DCKCFGR1_PLLSAIDIVR RCC_DCKCFGR1_PLLSAIDIVR(0) @@ -131,10 +121,7 @@ #define STM32_RCC_DCKCFGR1_DFSDM1SRC 0 #define STM32_RCC_DCKCFGR1_ADFSDM1SRC 0 - - /* Configure factors for PLLI2S clock */ - #define CONFIG_STM32F7_PLLI2S 1 #define STM32_RCC_PLLI2SCFGR_PLLI2SN RCC_PLLI2SCFGR_PLLI2SN(192) #define STM32_RCC_PLLI2SCFGR_PLLI2SP RCC_PLLI2SCFGR_PLLI2SP(2) @@ -142,7 +129,6 @@ #define STM32_RCC_PLLI2SCFGR_PLLI2SR RCC_PLLI2SCFGR_PLLI2SR(2) /* Configure Dedicated Clock Configuration Register 2 */ - #define STM32_RCC_DCKCFGR2_USART1SRC RCC_DCKCFGR2_USART1SEL_APB #define STM32_RCC_DCKCFGR2_USART2SRC RCC_DCKCFGR2_USART2SEL_APB #define STM32_RCC_DCKCFGR2_UART4SRC RCC_DCKCFGR2_UART4SEL_APB @@ -170,18 +156,15 @@ */ /* AHB clock (HCLK) is SYSCLK (216 MHz) */ - #define STM32_RCC_CFGR_HPRE RCC_CFGR_HPRE_SYSCLK /* HCLK = SYSCLK / 1 */ #define STM32_HCLK_FREQUENCY STM32_SYSCLK_FREQUENCY #define STM32_BOARD_HCLK STM32_HCLK_FREQUENCY /* same as above, to satisfy compiler */ /* APB1 clock (PCLK1) is HCLK/4 (54 MHz) */ - #define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLKd4 /* PCLK1 = HCLK / 4 */ #define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY/4) /* Timers driven from APB1 will be twice PCLK1 */ - #define STM32_APB1_TIM2_CLKIN (2*STM32_PCLK1_FREQUENCY) #define STM32_APB1_TIM3_CLKIN (2*STM32_PCLK1_FREQUENCY) #define STM32_APB1_TIM4_CLKIN (2*STM32_PCLK1_FREQUENCY) @@ -193,12 +176,10 @@ #define STM32_APB1_TIM14_CLKIN (2*STM32_PCLK1_FREQUENCY) /* APB2 clock (PCLK2) is HCLK/2 (108MHz) */ - #define STM32_RCC_CFGR_PPRE2 RCC_CFGR_PPRE2_HCLKd2 /* PCLK2 = HCLK / 2 */ #define STM32_PCLK2_FREQUENCY (STM32_HCLK_FREQUENCY/2) /* Timers driven from APB2 will be twice PCLK2 */ - #define STM32_APB2_TIM1_CLKIN (2*STM32_PCLK2_FREQUENCY) #define STM32_APB2_TIM8_CLKIN (2*STM32_PCLK2_FREQUENCY) #define STM32_APB2_TIM9_CLKIN (2*STM32_PCLK2_FREQUENCY) @@ -256,8 +237,8 @@ #define BOARD_FLASH_WAITSTATES 7 -/* Alternate function pin selections ************************************************/ +/* UART/USART */ #define GPIO_USART1_RX GPIO_USART1_RX_2 /* PB7 */ #define GPIO_USART1_TX GPIO_USART1_TX_2 /* PB6 */ @@ -286,103 +267,34 @@ * GPIO_UART8_TX PE1[CN11-61] */ -/* CAN - * - * CAN1 is routed to transceiver. - * CAN2 is routed to transceiver. - */ + +/* CAN */ #define GPIO_CAN1_RX GPIO_CAN1_RX_3 /* PD0 */ #define GPIO_CAN1_TX GPIO_CAN1_TX_3 /* PD1 */ + #define GPIO_CAN2_RX GPIO_CAN2_RX_1 /* PB12 */ #define GPIO_CAN2_TX GPIO_CAN2_TX_2 /* PB6 */ -/* SPI - * - * SPI1 sensors - * SPI2 is FRAM - * SPI4 sesnors - */ -#define GPIO_SPI1_MISO GPIO_SPI1_MISO_1 /* PA6 */ -#define GPIO_SPI1_MOSI GPIO_SPI1_MOSI_1 /* PA7 */ -#define GPIO_SPI1_SCK GPIO_SPI1_SCK_1 /* PA5 */ +/* SPI */ +#define ADJ_SLEW_RATE(p) (((p) & ~GPIO_SPEED_MASK) | (GPIO_SPEED_2MHz)) -#define GPIO_SPI2_MISO GPIO_SPI2_MISO_1 /* PB14 */ -#define GPIO_SPI2_MOSI GPIO_SPI2_MOSI_1 /* PB15 */ -#define GPIO_SPI2_SCK GPIO_SPI2_SCK_3 /* PB13 */ +#define GPIO_SPI1_SCK ADJ_SLEW_RATE(GPIO_SPI1_SCK_1) /* PA5 */ +#define GPIO_SPI1_MISO GPIO_SPI1_MISO_1 /* PA6 */ +#define GPIO_SPI1_MOSI GPIO_SPI1_MOSI_1 /* PA7 */ -#define GPIO_SPI4_MISO GPIO_SPI4_MISO_1 /* PE5 */ -#define GPIO_SPI4_MOSI GPIO_SPI4_MOSI_1 /* PE6 */ -#define GPIO_SPI4_SCK GPIO_SPI4_SCK_1 /* PE2 */ +#define GPIO_SPI2_SCK ADJ_SLEW_RATE(GPIO_SPI2_SCK_3) /* PB13 */ +#define GPIO_SPI2_MISO GPIO_SPI2_MISO_1 /* PB14 */ +#define GPIO_SPI2_MOSI GPIO_SPI2_MOSI_1 /* PB15 */ -/* I2C - * - * I2C1_SCL PB8 - * I2C1_SDA PB9 - * I2C2_SCL PB10 - * I2C2_SDA PB11 - */ +#define GPIO_SPI4_SCK ADJ_SLEW_RATE(GPIO_SPI4_SCK_1) /* PE2 */ +#define GPIO_SPI4_MISO GPIO_SPI4_MISO_1 /* PE5 */ +#define GPIO_SPI4_MOSI GPIO_SPI4_MOSI_1 /* PE6 */ + +/* I2C */ #define GPIO_I2C1_SCL GPIO_I2C1_SCL_2 /* PB8 */ #define GPIO_I2C1_SDA GPIO_I2C1_SDA_2 /* PB9 */ -#define GPIO_I2C1_SCL_GPIO (GPIO_OUTPUT | GPIO_OPENDRAIN |GPIO_SPEED_50MHz | GPIO_OUTPUT_SET | GPIO_PORTB | GPIO_PIN8) -#define GPIO_I2C1_SDA_GPIO (GPIO_OUTPUT | GPIO_OPENDRAIN |GPIO_SPEED_50MHz | GPIO_OUTPUT_SET | GPIO_PORTB | GPIO_PIN9) - #define GPIO_I2C2_SCL GPIO_I2C2_SCL_1 /* PB10 */ #define GPIO_I2C2_SDA GPIO_I2C2_SDA_1 /* PB11 */ - -#define GPIO_I2C2_SCL_GPIO (GPIO_OUTPUT | GPIO_OPENDRAIN |GPIO_SPEED_50MHz | GPIO_OUTPUT_SET | GPIO_PORTB | GPIO_PIN10) -#define GPIO_I2C2_SDA_GPIO (GPIO_OUTPUT | GPIO_OPENDRAIN |GPIO_SPEED_50MHz | GPIO_OUTPUT_SET | GPIO_PORTB | GPIO_PIN11) - -/* SDMMC1 - * - * VDD 3.3 - * GND - * SDMMC1_CK PC12 - * SDMMC1_CMD PD2 - * SDMMC1_D0 PC8 - * SDMMC1_D1 PC9 - * SDMMC1_D2 PC10 - * SDMMC1_D3 PC11 - */ - -/* USB - * - * OTG_FS_DM PA11 - * OTG_FS_DP PA12 - * VBUS PA9 - */ - - -/* Board provides GPIO or other Hardware for signaling to timing analyzer */ - -#if defined(CONFIG_BOARD_USE_PROBES) -# include "stm32_gpio.h" -# define PROBE_N(n) (1<<((n)-1)) -# define PROBE_1 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTE|GPIO_PIN14) /* PE14 AUX1 */ -# define PROBE_2 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTE|GPIO_PIN13) /* PE13 AUX2 */ -# define PROBE_3 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTE|GPIO_PIN11) /* PE11 AUX3 */ -# define PROBE_4 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTE|GPIO_PIN9) /* PE9 AUX4 */ -# define PROBE_5 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTD|GPIO_PIN13) /* PD13 AUX5 */ -# define PROBE_6 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTD|GPIO_PIN14) /* PD14 AUX6 */ - -# define PROBE_INIT(mask) \ - do { \ - if ((mask)& PROBE_N(1)) { stm32_configgpio(PROBE_1); } \ - if ((mask)& PROBE_N(2)) { stm32_configgpio(PROBE_2); } \ - if ((mask)& PROBE_N(3)) { stm32_configgpio(PROBE_3); } \ - if ((mask)& PROBE_N(4)) { stm32_configgpio(PROBE_4); } \ - if ((mask)& PROBE_N(5)) { stm32_configgpio(PROBE_5); } \ - if ((mask)& PROBE_N(6)) { stm32_configgpio(PROBE_6); } \ - } while(0) - -# define PROBE(n,s) do {stm32_gpiowrite(PROBE_##n,(s));}while(0) -# define PROBE_MARK(n) PROBE(n,false);PROBE(n,true) -#else -# define PROBE_INIT(mask) -# define PROBE(n,s) -# define PROBE_MARK(n) -#endif - -#endif /*__NUTTX_CONFIG_HEX_CUBE_YELLOW_INCLUDE_BOARD_H */ diff --git a/boards/hex/cube-yellow/nuttx-config/include/board_dma_map.h b/boards/cubepilot/cubeyellow/nuttx-config/include/board_dma_map.h similarity index 100% rename from boards/hex/cube-yellow/nuttx-config/include/board_dma_map.h rename to boards/cubepilot/cubeyellow/nuttx-config/include/board_dma_map.h diff --git a/boards/hex/cube-yellow/nuttx-config/nsh/defconfig b/boards/cubepilot/cubeyellow/nuttx-config/nsh/defconfig similarity index 99% rename from boards/hex/cube-yellow/nuttx-config/nsh/defconfig rename to boards/cubepilot/cubeyellow/nuttx-config/nsh/defconfig index 9b247ad63d..223bd265a6 100644 --- a/boards/hex/cube-yellow/nuttx-config/nsh/defconfig +++ b/boards/cubepilot/cubeyellow/nuttx-config/nsh/defconfig @@ -50,7 +50,7 @@ CONFIG_CDCACM_PRODUCTSTR="CubeYellow" CONFIG_CDCACM_RXBUFSIZE=600 CONFIG_CDCACM_TXBUFSIZE=12000 CONFIG_CDCACM_VENDORID=0x2DAE -CONFIG_CDCACM_VENDORSTR="Hex/ProfiCNC" +CONFIG_CDCACM_VENDORSTR="CubePilot" CONFIG_CLOCK_MONOTONIC=y CONFIG_DEBUG_FULLOPT=y CONFIG_DEBUG_HARDFAULT_ALERT=y diff --git a/boards/hex/cube-yellow/nuttx-config/scripts/script.ld b/boards/cubepilot/cubeyellow/nuttx-config/scripts/script.ld similarity index 93% rename from boards/hex/cube-yellow/nuttx-config/scripts/script.ld rename to boards/cubepilot/cubeyellow/nuttx-config/scripts/script.ld index 17ff1023c5..40d3b89f5c 100644 --- a/boards/hex/cube-yellow/nuttx-config/scripts/script.ld +++ b/boards/cubepilot/cubeyellow/nuttx-config/scripts/script.ld @@ -1,7 +1,7 @@ /**************************************************************************** * scripts/script.ld * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2020 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * @@ -71,13 +71,13 @@ MEMORY { - FLASH_ITCM (rx) : ORIGIN = 0x00218000, LENGTH = 1952K - FLASH_AXIM (rx) : ORIGIN = 0x08018000, LENGTH = 1952K + FLASH_ITCM (rx) : ORIGIN = 0x00218000, LENGTH = 1952K + FLASH_AXIM (rx) : ORIGIN = 0x08018000, LENGTH = 1952K - ITCM_RAM (rwx) : ORIGIN = 0x00000000, LENGTH = 16K - DTCM_RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K - SRAM1 (rwx) : ORIGIN = 0x20020000, LENGTH = 368K - SRAM2 (rwx) : ORIGIN = 0x2007c000, LENGTH = 16K + ITCM_RAM (rwx) : ORIGIN = 0x00000000, LENGTH = 16K + DTCM_RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K + SRAM1 (rwx) : ORIGIN = 0x20020000, LENGTH = 368K + SRAM2 (rwx) : ORIGIN = 0x2007c000, LENGTH = 16K } OUTPUT_ARCH(arm) diff --git a/boards/hex/cube-yellow/src/CMakeLists.txt b/boards/cubepilot/cubeyellow/src/CMakeLists.txt similarity index 100% rename from boards/hex/cube-yellow/src/CMakeLists.txt rename to boards/cubepilot/cubeyellow/src/CMakeLists.txt diff --git a/boards/hex/cube-yellow/src/board_config.h b/boards/cubepilot/cubeyellow/src/board_config.h similarity index 59% rename from boards/hex/cube-yellow/src/board_config.h rename to boards/cubepilot/cubeyellow/src/board_config.h index f4b9f29fba..f3aedb6c9e 100644 --- a/boards/hex/cube-yellow/src/board_config.h +++ b/boards/cubepilot/cubeyellow/src/board_config.h @@ -34,28 +34,17 @@ /** * @file board_config.h * - * HEX Cube Orange internal definitions + * Board internal definitions */ #pragma once -/**************************************************************************************************** - * Included Files - ****************************************************************************************************/ - #include #include #include #include -/**************************************************************************************************** - * Definitions - ****************************************************************************************************/ - -#define BOARD_HAS_STATIC_MANIFEST 1 - /* PX4IO connection configuration */ - #define BOARD_USES_PX4IO_VERSION 2 #define PX4IO_SERIAL_DEVICE "/dev/ttyS4" #define PX4IO_SERIAL_TX_GPIO GPIO_USART6_TX @@ -69,36 +58,17 @@ #define PX4IO_SERIAL_CLOCK STM32_PCLK2_FREQUENCY #define PX4IO_SERIAL_BITRATE 1500000 /* 1.5Mbps -> max rate for IO */ -/* Configuration ************************************************************************************/ - -/* Cube Yellow GPIOs ***********************************************************************************/ - -/* LEDs are driven with push open drain to support Anode to 5V or 3.3V */ - -#define GPIO_nLED_AMBER /* PE12*/ (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTE|GPIO_PIN12) - -/* - * ADC channels - * - * These are the channel numbers of the ADCs of the microcontroller that - * can be used by the Px4 Firmware in the adc driver - */ - -/* ADC defines to be used in sensors.cpp to read from a particular channel */ - -#define ADC1_CH(n) (n) -#define ADC1_GPIO(n) GPIO_ADC1_IN##n - -#define ADC_HW_REV_SENSE_CHANNEL 1 +/* LEDs */ +#define GPIO_nLED_AMBER /* PE12 */ (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTE|GPIO_PIN12) /* ADC channels */ #define PX4_ADC_GPIO \ - /* PA2 */ ADC1_GPIO(2), \ - /* PA3 */ ADC1_GPIO(3), \ - /* PA4 */ ADC1_GPIO(4), \ - /* PC3 */ ADC1_GPIO(13), \ - /* PC4 */ ADC1_GPIO(14), \ - /* PC5 */ ADC1_GPIO(15) + /* PA2 */ GPIO_ADC1_IN2, \ + /* PA3 */ GPIO_ADC1_IN3, \ + /* PA4 */ GPIO_ADC1_IN4, \ + /* PC3 */ GPIO_ADC1_IN13, \ + /* PC4 */ GPIO_ADC1_IN14, \ + /* PC5 */ GPIO_ADC1_IN15 /* Define Channel numbers must match above GPIO pins */ #define ADC_BATTERY1_VOLTAGE_CHANNEL 2 /* PA2: BATT_VOLTAGE_SENS */ @@ -116,52 +86,31 @@ (1 << ADC_BATTERY2_CURRENT_CHANNEL) | \ (1 << ADC_AIRSPEED_VOLTAGE_CHANNEL)) -/* Define Battery 1 Voltage Divider and A per V - */ - -#define BOARD_BATTERY1_V_DIV (10.1f) -#define BOARD_BATTERY1_A_PER_V (17.0f) - -/* Define Battery 2 Voltage Divider and A per V - */ - -#define BOARD_BATTERY2_V_DIV (10.1f) -#define BOARD_BATTERY2_A_PER_V (17.0f) - - -/* PWM - */ +/* PWM */ #define DIRECT_PWM_OUTPUT_CHANNELS 6 -#define DIRECT_INPUT_TIMER_CHANNELS 6 +#define GPIO_PWM_VOLT_SEL /* PB4 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN4) /* Power supply control and monitoring GPIOs */ #define BOARD_NUMBER_BRICKS 2 -#define GPIO_nVDD_BRICK1_VALID /* PB5 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN5) -#define GPIO_nVDD_BRICK2_VALID /* PB7 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN7) -#define GPIO_nVDD_USB_VALID /* PC0 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTC|GPIO_PIN0) -#define GPIO_nVDD_3V3_SENSORS_EN /* PE3 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTE|GPIO_PIN3) -#define GPIO_nVDD_5V_PERIPH_EN /* PA8 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN8) -#define GPIO_nVDD_5V_PERIPH_OC /* PE15 */ (GPIO_INPUT |GPIO_FLOAT|GPIO_PORTE|GPIO_PIN15) -#define GPIO_nVDD_5V_HIPOWER_OC /* PE10 */ (GPIO_INPUT |GPIO_FLOAT|GPIO_PORTE|GPIO_PIN10) - -/* Define True logic Power Control in arch agnostic form */ -#define VDD_5V_PERIPH_EN(on_true) px4_arch_gpiowrite(GPIO_nVDD_5V_PERIPH_EN, !(on_true)) -#define VDD_3V3_SENORS_POWER_EN(on_true) px4_arch_gpiowrite(GPIO_nVDD_3V3_SENSORS_EN, (on_true)) -#define VDD_5V_RC_EN(on_true) px4_arch_gpiowrite(GPIO_VDD_5V_RC_EN, (on_true)) +#define GPIO_nVDD_BRICK1_VALID /* PB5 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN5) // VDD_BRICK_VALID +#define GPIO_nVDD_BRICK2_VALID /* PB7 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN7) // VDD_BACKUP_VALID +#define GPIO_nVDD_USB_VALID /* PC0 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTC|GPIO_PIN0) // VBUS_VALID +#define GPIO_VDD_3V3_SENSORS_EN /* PE3 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTE|GPIO_PIN3) // VDD_3V3_SENSORS_EN +#define GPIO_nVDD_5V_PERIPH_EN /* PA8 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN8) // VDD_5V_PERIPH_EN +#define GPIO_nVDD_5V_PERIPH_OC /* PE15 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTE|GPIO_PIN15) // VDD_5V_PERIPH_OC +#define GPIO_nVDD_5V_HIPOWER_OC /* PE10 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTE|GPIO_PIN10) // VDD_5V_HIPOWER_OC /* Tone alarm output */ - #define TONE_ALARM_TIMER 2 /* timer 2 */ #define TONE_ALARM_CHANNEL 1 /* PA15 TIM2_CH1 */ -#define GPIO_BUZZER_1 /* PA15 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN15) +#define GPIO_BUZZER_1 /* PA15 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN15) // ALARM #define GPIO_TONE_ALARM_IDLE GPIO_BUZZER_1 #define GPIO_TONE_ALARM GPIO_TIM2_CH1OUT_2 -/* USB OTG FS - * - * PA9 OTG_FS_VBUS VBUS sensing +/* USB + * OTG FS: PA9 OTG_FS_VBUS VBUS sensing */ #define GPIO_OTGFS_VBUS /* PA9 */ (GPIO_INPUT|GPIO_PULLDOWN|GPIO_SPEED_100MHz|GPIO_PORTA|GPIO_PIN9) @@ -169,23 +118,6 @@ #define HRT_TIMER 8 /* use timer8 for the HRT */ #define HRT_TIMER_CHANNEL 3 /* use capture/compare channel 3 */ -/* Power switch controls ******************************************************/ - -#define SDIO_SLOTNO 0 /* Only one slot */ -#define SDIO_MINOR 0 - -/* SD card bringup does not work if performed on the IDLE thread because it - * will cause waiting. Use either: - * - * CONFIG_LIB_BOARDCTL=y, OR - * CONFIG_BOARD_INITIALIZE=y && CONFIG_BOARD_INITTHREAD=y - */ - -#if defined(CONFIG_BOARD_INITIALIZE) && !defined(CONFIG_LIB_BOARDCTL) && \ - !defined(CONFIG_BOARD_INITTHREAD) -# warning SDIO initialization cannot be perfomed on the IDLE thread -#endif - /* By Providing BOARD_ADC_USB_CONNECTED (using the px4_arch abstraction) * this board support the ADC system_power interface, and therefore * provides the true logic GPIO BOARD_ADC_xxxx macros. @@ -197,49 +129,41 @@ #define BOARD_ADC_PERIPH_5V_OC (!px4_arch_gpioread(GPIO_nVDD_5V_PERIPH_OC)) #define BOARD_ADC_HIPOWER_5V_OC (!px4_arch_gpioread(GPIO_nVDD_5V_HIPOWER_OC)) -#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS - /* This board provides a DMA pool and APIs */ #define BOARD_DMA_ALLOC_POOL_SIZE 5120 /* This board provides the board_on_reset interface */ #define BOARD_HAS_ON_RESET 1 +#define BOARD_HAS_STATIC_MANIFEST 1 + +#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS + +#define BOARD_DSHOT_MOTOR_ASSIGNMENT {3, 2, 1, 0, 4}; + +#define BOARD_ENABLE_CONSOLE_BUFFER + #define PX4_GPIO_INIT_LIST { \ PX4_ADC_GPIO, \ GPIO_CAN1_TX, \ GPIO_CAN1_RX, \ GPIO_CAN2_TX, \ GPIO_CAN2_RX, \ + GPIO_PWM_VOLT_SEL, \ + GPIO_nVDD_BRICK1_VALID, \ + GPIO_nVDD_BRICK1_VALID, \ + GPIO_nVDD_USB_VALID, \ + GPIO_VDD_3V3_SENSORS_EN, \ GPIO_nVDD_5V_PERIPH_EN, \ GPIO_nVDD_5V_PERIPH_OC, \ GPIO_nVDD_5V_HIPOWER_OC, \ - GPIO_nVDD_3V3_SENSORS_EN, \ GPIO_TONE_ALARM_IDLE, \ + GPIO_OTGFS_VBUS, \ } - -#define BOARD_ENABLE_CONSOLE_BUFFER - -#define BOARD_NUM_IO_TIMERS 5 - -#define BOARD_DSHOT_MOTOR_ASSIGNMENT {3, 2, 1, 0, 4, 5}; - __BEGIN_DECLS - -/**************************************************************************************************** - * Public Types - ****************************************************************************************************/ - -/**************************************************************************************************** - * Public data - ****************************************************************************************************/ - #ifndef __ASSEMBLY__ -/**************************************************************************************************** - * Public Functions - ****************************************************************************************************/ /**************************************************************************** * Name: stm32_sdio_initialize @@ -251,22 +175,9 @@ __BEGIN_DECLS int stm32_sdio_initialize(void); -/**************************************************************************************************** - * Name: stm32_spiinitialize - * - * Description: - * Called to configure SPI chip select GPIO pins for the PX4FMU board. - * - ****************************************************************************************************/ - extern void stm32_spiinitialize(void); - -extern void stm32_usbinitialize(void); - extern void board_peripheral_reset(int ms); #include - #endif /* __ASSEMBLY__ */ - __END_DECLS diff --git a/boards/hex/cube-yellow/src/can.c b/boards/cubepilot/cubeyellow/src/can.c similarity index 100% rename from boards/hex/cube-yellow/src/can.c rename to boards/cubepilot/cubeyellow/src/can.c diff --git a/boards/hex/cube-yellow/src/i2c.cpp b/boards/cubepilot/cubeyellow/src/i2c.cpp similarity index 100% rename from boards/hex/cube-yellow/src/i2c.cpp rename to boards/cubepilot/cubeyellow/src/i2c.cpp diff --git a/boards/hex/cube-yellow/src/init.c b/boards/cubepilot/cubeyellow/src/init.c similarity index 70% rename from boards/hex/cube-yellow/src/init.c rename to boards/cubepilot/cubeyellow/src/init.c index f486b341cd..9506de2b35 100644 --- a/boards/hex/cube-yellow/src/init.c +++ b/boards/cubepilot/cubeyellow/src/init.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2012-2019 PX4 Development Team. All rights reserved. + * Copyright (c) 2020 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 @@ -34,67 +34,36 @@ /** * @file init.c * - * PX4FMU-specific early startup code. This file implements the - * board_app_initializ() function that is called early by nsh during startup. + * board-specific early startup code. This file implements the + * board_app_initialize() function that is called early by nsh during startup. * * Code here is run before the rcS script is invoked; it should start required * subsystems and perform board-specific initialisation. */ -/**************************************************************************** - * Included Files - ****************************************************************************/ - #include "board_config.h" -#include -#include -#include -#include -#include - #include #include -#include #include #include -#include -#include -#include -#include #include #include "up_internal.h" -#include #include #include #include +#include #include #include -#include #include -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -#define _GPIO_PULL_DOWN_INPUT(def) (((def) & (GPIO_PORT_MASK | GPIO_PIN_MASK)) | (GPIO_INPUT|GPIO_PULLDOWN|GPIO_SPEED_2MHz)) - -/* Configuration ************************************************************/ - -/* - * Ideally we'd be able to get these from up_internal.h, - * but since we want to be able to disable the NuttX use - * of leds for system indication at will and there is no - * separate switch, we need to build independent of the - * CONFIG_ARCH_LEDS configuration switch. - */ __BEGIN_DECLS extern void led_init(void); extern void led_on(int led); extern void led_off(int led); __END_DECLS - /************************************************************************************ * Name: board_peripheral_reset * @@ -103,20 +72,15 @@ __END_DECLS ************************************************************************************/ __EXPORT void board_peripheral_reset(int ms) { - /* set the peripheral rails off */ - - VDD_5V_PERIPH_EN(false); - VDD_3V3_SENORS_POWER_EN(false); + /* Power off Interfaces */ + stm32_gpiowrite(GPIO_nVDD_5V_PERIPH_EN, true); /* wait for the peripheral rail to reach GND */ usleep(ms * 1000); syslog(LOG_DEBUG, "reset done, %d ms\n", ms); /* re-enable power */ - - /* switch the peripheral rail back on */ - VDD_5V_PERIPH_EN(true); - VDD_3V3_SENORS_POWER_EN(true); + stm32_gpiowrite(GPIO_nVDD_5V_PERIPH_EN, false); } /************************************************************************************ @@ -150,26 +114,18 @@ __EXPORT void board_on_reset(int status) * and mapped but before any devices have been initialized. * ************************************************************************************/ - -__EXPORT void -stm32_boardinitialize(void) +__EXPORT void stm32_boardinitialize(void) { - board_on_reset(-1); /* Reset PWM first thing */ - - /* configure LEDs */ - - board_autoled_initialize(); + /* Reset PWM first thing */ + board_on_reset(-1); /* configure pins */ - const uint32_t gpio[] = PX4_GPIO_INIT_LIST; px4_gpio_init(gpio, arraySize(gpio)); board_control_spi_sensors_power_configgpio(); - /* configure USB interfaces */ - - stm32_usbinitialize(); - + /* configure LEDs */ + board_autoled_initialize(); } /**************************************************************************** @@ -183,39 +139,25 @@ stm32_boardinitialize(void) * Input Parameters: * arg - The boardctl() argument is passed to the board_app_initialize() * implementation without modification. The argument has no - * meaning to NuttX; the meaning of the argument is a contract - * between the board-specific initalization logic and the 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. + * meaning to NuttX; * * Returned Value: * Zero (OK) is returned on success; a negated errno value is returned on * any failure to indicate the nature of the failure. * ****************************************************************************/ - - __EXPORT int board_app_initialize(uintptr_t arg) { /* Power on Interfaces */ - VDD_5V_PERIPH_EN(true); - VDD_3V3_SENORS_POWER_EN(true); - - /* Need hrt running before using the ADC */ + stm32_gpiowrite(GPIO_VDD_3V3_SENSORS_EN, true); + stm32_gpiowrite(GPIO_nVDD_5V_PERIPH_EN, false); + board_control_spi_sensors_power(true, 0xffff); px4_platform_init(); - /* configure SPI interfaces (after we determined the HW version) */ - stm32_spiinitialize(); - px4_arch_configgpio(_GPIO_PULL_DOWN_INPUT(GPIO_CAN2_RX)); - /* configure the DMA allocator */ - if (board_dma_alloc_init() < 0) { syslog(LOG_ERR, "[boot] DMA alloc FAILED\n"); } diff --git a/boards/hex/cube-yellow/src/led.c b/boards/cubepilot/cubeyellow/src/led.c similarity index 85% rename from boards/hex/cube-yellow/src/led.c rename to boards/cubepilot/cubeyellow/src/led.c index a2ed212f1b..5564a16fc0 100644 --- a/boards/hex/cube-yellow/src/led.c +++ b/boards/cubepilot/cubeyellow/src/led.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2013 PX4 Development Team. All rights reserved. + * Copyright (c) 2020 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 @@ -34,7 +34,7 @@ /** * @file led.c * - * PX4FMU LED backend. + * LED backend. */ #include @@ -62,25 +62,36 @@ extern void led_off(int led); extern void led_toggle(int led); __END_DECLS -#define xlat(p) (p) +# define xlat(p) (p) +static uint32_t g_ledmap[] = { + GPIO_nLED_AMBER, +}; __EXPORT void led_init(void) { - /* Configure LED GPIOs for output */ - stm32_configgpio(GPIO_nLED_AMBER); + for (size_t l = 0; l < (sizeof(g_ledmap) / sizeof(g_ledmap[0])); l++) { + if (g_ledmap[l] != 0) { + stm32_configgpio(g_ledmap[l]); + } + } } static void phy_set_led(int led, bool state) { /* Drive Low to switch on */ - - stm32_gpiowrite(GPIO_nLED_AMBER, !state); + if (g_ledmap[led] != 0) { + stm32_gpiowrite(g_ledmap[led], !state); + } } static bool phy_get_led(int led) { /* If Low it is on */ - return !stm32_gpioread(GPIO_nLED_AMBER); + if (g_ledmap[led] != 0) { + return !stm32_gpioread(g_ledmap[led]); + } + + return false; } __EXPORT void led_on(int led) diff --git a/boards/hex/cube-yellow/src/sdio.c b/boards/cubepilot/cubeyellow/src/sdio.c similarity index 94% rename from boards/hex/cube-yellow/src/sdio.c rename to boards/cubepilot/cubeyellow/src/sdio.c index 869d757756..cfc4770656 100644 --- a/boards/hex/cube-yellow/src/sdio.c +++ b/boards/cubepilot/cubeyellow/src/sdio.c @@ -90,9 +90,7 @@ static bool g_sd_inserted = 0xff; /* Impossible value */ #ifdef HAVE_NCD static int stm32_ncd_interrupt(int irq, FAR void *context) { - bool present; - - present = !stm32_gpioread(GPIO_SDMMC1_NCD); + bool present = !stm32_gpioread(GPIO_SDMMC1_NCD); if (sdio_dev && present != g_sd_inserted) { sdio_mediachange(sdio_dev, present); @@ -121,35 +119,31 @@ int stm32_sdio_initialize(void) #ifdef HAVE_NCD /* Card detect */ - bool cd_status; /* Configure the card detect GPIO */ - stm32_configgpio(GPIO_SDMMC1_NCD); /* Register an interrupt handler for the card detect pin */ - stm32_gpiosetevent(GPIO_SDMMC1_NCD, true, true, true, stm32_ncd_interrupt); #endif /* Mount the SDIO-based MMC/SD block driver */ /* First, get an instance of the SDIO interface */ + finfo("Initializing SDIO slot %d\n", 0); - finfo("Initializing SDIO slot %d\n", SDIO_SLOTNO); - - sdio_dev = sdio_initialize(SDIO_SLOTNO); + sdio_dev = sdio_initialize(0); if (!sdio_dev) { - syslog(LOG_ERR, "[boot] Failed to initialize SDIO slot %d\n", SDIO_SLOTNO); + syslog(LOG_ERR, "[boot] Failed to initialize SDIO slot %d\n", 0); return -ENODEV; } /* Now bind the SDIO interface to the MMC/SD driver */ - finfo("Bind SDIO to the MMC/SD driver, minor=%d\n", SDIO_MINOR); + finfo("Bind SDIO to the MMC/SD driver, minor=%d\n", 0); - ret = mmcsd_slotinitialize(SDIO_MINOR, sdio_dev); + ret = mmcsd_slotinitialize(0, sdio_dev); if (ret != OK) { syslog(LOG_ERR, "[boot] Failed to bind SDIO to the MMC/SD driver: %d\n", ret); diff --git a/boards/hex/cube-yellow/src/spi.cpp b/boards/cubepilot/cubeyellow/src/spi.cpp similarity index 85% rename from boards/hex/cube-yellow/src/spi.cpp rename to boards/cubepilot/cubeyellow/src/spi.cpp index fdabc5d086..54c59fef47 100644 --- a/boards/hex/cube-yellow/src/spi.cpp +++ b/boards/cubepilot/cubeyellow/src/spi.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (C) 2020 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 @@ -37,16 +37,18 @@ constexpr px4_spi_bus_t px4_spi_buses[SPI_BUS_MAX_BUS_ITEMS] = { initSPIBus(SPI::Bus::SPI1, { - initSPIDevice(DRV_BARO_DEVTYPE_MS5611, SPI::CS{GPIO::PortD, GPIO::Pin7}), - initSPIDevice(DRV_IMU_DEVTYPE_ICM20649, SPI::CS{GPIO::PortC, GPIO::Pin2}), + initSPIDevice(DRV_IMU_DEVTYPE_ICM20649, SPI::CS{GPIO::PortC, GPIO::Pin2}, SPI::DRDY{GPIO::PortD, GPIO::Pin15}), // MPU_CS, MPU_DRDY + initSPIDevice(DRV_BARO_DEVTYPE_MS5611, SPI::CS{GPIO::PortD, GPIO::Pin7}), // BARO_CS }), + initSPIBus(SPI::Bus::SPI2, { - initSPIDevice(SPIDEV_FLASH(0), SPI::CS{GPIO::PortD, GPIO::Pin10}) + initSPIDevice(SPIDEV_FLASH(0), SPI::CS{GPIO::PortD, GPIO::Pin10}) // FRAM_CS }), + initSPIBus(SPI::Bus::SPI4, { - initSPIDevice(DRV_BARO_DEVTYPE_MS5611, SPI::CS{GPIO::PortC, GPIO::Pin14}), - initSPIDevice(DRV_IMU_DEVTYPE_ICM20602, SPI::CS{GPIO::PortC, GPIO::Pin13}), - initSPIDevice(DRV_IMU_DEVTYPE_ICM20948, SPI::CS{GPIO::PortE, GPIO::Pin4}), + initSPIDevice(DRV_IMU_DEVTYPE_ICM20948, SPI::CS{GPIO::PortE, GPIO::Pin4}), // MPU_EXT_CS + initSPIDevice(DRV_IMU_DEVTYPE_ICM20602, SPI::CS{GPIO::PortC, GPIO::Pin13}), // GYRO_EXT_CS + initSPIDevice(DRV_BARO_DEVTYPE_MS5611, SPI::CS{GPIO::PortC, GPIO::Pin14}), // BARO_EXT_CS }), }; diff --git a/boards/cubepilot/cubeyellow/src/timer_config.cpp b/boards/cubepilot/cubeyellow/src/timer_config.cpp new file mode 100644 index 0000000000..bf64e641ab --- /dev/null +++ b/boards/cubepilot/cubeyellow/src/timer_config.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** + * + * Copyright (C) 2020 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. + * + ****************************************************************************/ + +#include + +constexpr io_timers_t io_timers[MAX_IO_TIMERS] = { + initIOTimer(Timer::Timer1, DMA{DMA::Index2, DMA::Stream5, DMA::Channel6}), + initIOTimer(Timer::Timer4), +}; + +constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = { + initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel4}, {GPIO::PortE, GPIO::Pin14}), + initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel3}, {GPIO::PortE, GPIO::Pin13}), + initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel2}, {GPIO::PortE, GPIO::Pin11}), + initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel1}, {GPIO::PortE, GPIO::Pin9}), + initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel2}, {GPIO::PortD, GPIO::Pin13}), + initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel3}, {GPIO::PortD, GPIO::Pin14}), +}; + +constexpr io_timers_channel_mapping_t io_timers_channel_mapping = + initIOTimerChannelMapping(io_timers, timer_io_channels); diff --git a/boards/cubepilot/cubeyellow/src/usb.c b/boards/cubepilot/cubeyellow/src/usb.c new file mode 100644 index 0000000000..360d84d6c8 --- /dev/null +++ b/boards/cubepilot/cubeyellow/src/usb.c @@ -0,0 +1,58 @@ +/**************************************************************************** + * + * Copyright (C) 2020 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. + * + ****************************************************************************/ + +/** + * @file usb.c + * + * Board-specific USB functions. + */ + +#include "board_config.h" +#include +#include +#include + +/************************************************************************************ + * Name: stm32_usbsuspend + * + * Description: + * Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is + * used. This function is called whenever the USB enters or leaves suspend mode. + * This is an opportunity for the board logic to shutdown clocks, power, etc. + * while the USB is suspended. + * + ************************************************************************************/ +__EXPORT void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume) +{ + uinfo("resume: %d\n", resume); +} diff --git a/boards/hex/io-v2/default.cmake b/boards/cubepilot/io-v2/default.cmake similarity index 89% rename from boards/hex/io-v2/default.cmake rename to boards/cubepilot/io-v2/default.cmake index 8f1a8a1abf..7be8f4d6cd 100644 --- a/boards/hex/io-v2/default.cmake +++ b/boards/cubepilot/io-v2/default.cmake @@ -1,7 +1,7 @@ px4_add_board( PLATFORM nuttx - VENDOR hex + VENDOR cubepilot MODEL io-v2 TOOLCHAIN arm-none-eabi CONSTRAINED_FLASH diff --git a/boards/hex/io-v2/firmware.prototype b/boards/cubepilot/io-v2/firmware.prototype similarity index 100% rename from boards/hex/io-v2/firmware.prototype rename to boards/cubepilot/io-v2/firmware.prototype diff --git a/boards/hex/io-v2/nuttx-config/include/board.h b/boards/cubepilot/io-v2/nuttx-config/include/board.h similarity index 100% rename from boards/hex/io-v2/nuttx-config/include/board.h rename to boards/cubepilot/io-v2/nuttx-config/include/board.h diff --git a/boards/hex/io-v2/nuttx-config/nsh/defconfig b/boards/cubepilot/io-v2/nuttx-config/nsh/defconfig similarity index 100% rename from boards/hex/io-v2/nuttx-config/nsh/defconfig rename to boards/cubepilot/io-v2/nuttx-config/nsh/defconfig diff --git a/boards/hex/io-v2/nuttx-config/scripts/script.ld b/boards/cubepilot/io-v2/nuttx-config/scripts/script.ld similarity index 100% rename from boards/hex/io-v2/nuttx-config/scripts/script.ld rename to boards/cubepilot/io-v2/nuttx-config/scripts/script.ld diff --git a/boards/hex/io-v2/src/CMakeLists.txt b/boards/cubepilot/io-v2/src/CMakeLists.txt similarity index 100% rename from boards/hex/io-v2/src/CMakeLists.txt rename to boards/cubepilot/io-v2/src/CMakeLists.txt diff --git a/boards/hex/io-v2/src/board_config.h b/boards/cubepilot/io-v2/src/board_config.h similarity index 100% rename from boards/hex/io-v2/src/board_config.h rename to boards/cubepilot/io-v2/src/board_config.h diff --git a/boards/hex/io-v2/src/init.c b/boards/cubepilot/io-v2/src/init.c similarity index 100% rename from boards/hex/io-v2/src/init.c rename to boards/cubepilot/io-v2/src/init.c diff --git a/boards/hex/io-v2/src/timer_config.cpp b/boards/cubepilot/io-v2/src/timer_config.cpp similarity index 100% rename from boards/hex/io-v2/src/timer_config.cpp rename to boards/cubepilot/io-v2/src/timer_config.cpp diff --git a/boards/hex/cube-yellow/nuttx-config/Kconfig b/boards/hex/cube-yellow/nuttx-config/Kconfig deleted file mode 100644 index c6470f9894..0000000000 --- a/boards/hex/cube-yellow/nuttx-config/Kconfig +++ /dev/null @@ -1,17 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# -config BOARD_HAS_PROBES - bool "Board provides GPIO or other Hardware for signaling to timing analyze." - default y - ---help--- - This board provides GPIO FMU-CH1-6 as PROBE_1-6 to provide timing signals from selected drivers. - -config BOARD_USE_PROBES - bool "Enable the use the board provided FMU-CH1-6 as PROBE_1-6" - default n - depends on BOARD_HAS_PROBES - - ---help--- - Select to use GPIO FMU-CH1-6 to provide timing signals from selected drivers. diff --git a/boards/hex/cube-yellow/src/timer_config.cpp b/boards/hex/cube-yellow/src/timer_config.cpp deleted file mode 100644 index d323839b1c..0000000000 --- a/boards/hex/cube-yellow/src/timer_config.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** - * - * Copyright (C) 2012 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. - * - ****************************************************************************/ - -#include - -constexpr io_timers_t io_timers[MAX_IO_TIMERS] = { - initIOTimer(Timer::Timer1, DMA{DMA::Index2, DMA::Stream5, DMA::Channel6}), - initIOTimer(Timer::Timer4), - initIOTimer(Timer::Timer12), - initIOTimer(Timer::Timer2), - initIOTimer(Timer::Timer9), -}; - -constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = { - initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel4}, {GPIO::PortE, GPIO::Pin14}), - initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel3}, {GPIO::PortE, GPIO::Pin13}), - initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel2}, {GPIO::PortE, GPIO::Pin11}), - initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel1}, {GPIO::PortE, GPIO::Pin9}), - initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel2}, {GPIO::PortD, GPIO::Pin13}), - initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel3}, {GPIO::PortD, GPIO::Pin14}), -}; - -constexpr io_timers_channel_mapping_t io_timers_channel_mapping = - initIOTimerChannelMapping(io_timers, timer_io_channels); - -#if defined(BOARD_HAS_LED_PWM) || defined(BOARD_HAS_UI_LED_PWM) -constexpr io_timers_t led_pwm_timers[MAX_LED_TIMERS] = { -# if defined(BOARD_HAS_UI_LED_PWM) - initIOTimer(Timer::Timer5), -# endif -# if defined(BOARD_HAS_LED_PWM) && !defined(BOARD_HAS_CONTROL_STATUS_LEDS) - initIOTimer(Timer::Timer3), -# endif -}; - -/* Support driving active low (preferred) or active high LED - * on both the onboard status LEDs or the [n]UI_LED_[_EXTERNAL] - * - * Use open drain to drive the LED. This will ensure that - * if the LED has a 5 Volt supply that the LED will be - * off when high. - */ -#define CCER_C1_NUM_BITS 4 -#define ACTIVE_LOW(c) (GTIM_CCER_CC1P << (((c)-1) * CCER_C1_NUM_BITS)) -#define ACTIVE_HIGH(c) 0 - -#if defined(BOARD_LED_PWM_DRIVE_ACTIVE_LOW) -# define POLARITY(c) ACTIVE_LOW(c) -# define DRIVE_TYPE(p) ((p)|GPIO_OPENDRAIN) -#else -# define POLARITY(c) ACTIVE_HIGH((c)) -# define DRIVE_TYPE(p) (p) -#endif - -#if defined(BOARD_UI_LED_PWM_DRIVE_ACTIVE_LOW) -# define UI_POLARITY(c) ACTIVE_LOW(c) -# define UI_DRIVE_TYPE(p) ((p)|GPIO_OPENDRAIN) -#else -# define UI_POLARITY(c) ACTIVE_HIGH((c)) -# define UI_DRIVE_TYPE(p) (p) -#endif - -static inline constexpr timer_io_channels_t initIOTimerChannelUILED(const io_timers_t io_timers_conf[MAX_LED_TIMERS], - Timer::TimerChannel timer, GPIO::GPIOPin pin, int ui_polarity) -{ - timer_io_channels_t ret = initIOTimerChannel(io_timers_conf, timer, pin); - ret.gpio_out = UI_DRIVE_TYPE(ret.gpio_out); - ret.masks = UI_POLARITY(ui_polarity); - return ret; -} - -static inline constexpr timer_io_channels_t initIOTimerChannelControlLED(const io_timers_t - io_timers_conf[MAX_LED_TIMERS], - Timer::TimerChannel timer, GPIO::GPIOPin pin, int polarity) -{ - timer_io_channels_t ret = initIOTimerChannel(io_timers_conf, timer, pin); - ret.gpio_out = DRIVE_TYPE(ret.gpio_out); - ret.masks = POLARITY(polarity); - return ret; -} - -constexpr timer_io_channels_t led_pwm_channels[MAX_TIMER_LED_CHANNELS] = { -# if defined(BOARD_HAS_UI_LED_PWM) -# if defined(BOARD_UI_LED_SWAP_RG) - initIOTimerChannelUILED(led_pwm_timers, {Timer::Timer5, Timer::Channel2}, {GPIO::PortH, GPIO::Pin11}, 2), - initIOTimerChannelUILED(led_pwm_timers, {Timer::Timer5, Timer::Channel1}, {GPIO::PortH, GPIO::Pin10}, 1), - initIOTimerChannelUILED(led_pwm_timers, {Timer::Timer5, Timer::Channel3}, {GPIO::PortH, GPIO::Pin12}, 3), -# else - initIOTimerChannelUILED(led_pwm_timers, {Timer::Timer5, Timer::Channel1}, {GPIO::PortH, GPIO::Pin10}, 1), - initIOTimerChannelUILED(led_pwm_timers, {Timer::Timer5, Timer::Channel2}, {GPIO::PortH, GPIO::Pin11}, 2), - initIOTimerChannelUILED(led_pwm_timers, {Timer::Timer5, Timer::Channel3}, {GPIO::PortH, GPIO::Pin12}, 3), -# endif -# endif -# if defined(BOARD_HAS_LED_PWM) && !defined(BOARD_HAS_CONTROL_STATUS_LEDS) - initIOTimerChannelControlLED(led_pwm_timers, {Timer::Timer3, Timer::Channel4}, {GPIO::PortB, GPIO::Pin1}, 4), - initIOTimerChannelControlLED(led_pwm_timers, {Timer::Timer3, Timer::Channel1}, {GPIO::PortC, GPIO::Pin6}, 1), - initIOTimerChannelControlLED(led_pwm_timers, {Timer::Timer3, Timer::Channel2}, {GPIO::PortC, GPIO::Pin7}, 2), -# endif -}; -#endif // BOARD_HAS_LED_PWM || BOARD_HAS_UI_LED_PWM diff --git a/boards/hex/cube-yellow/src/usb.c b/boards/hex/cube-yellow/src/usb.c deleted file mode 100644 index ad6d39ec12..0000000000 --- a/boards/hex/cube-yellow/src/usb.c +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** - * - * Copyright (C) 2016 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. - * - ****************************************************************************/ - -/** - * @file usb.c - * - * Board-specific USB functions. - */ - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include "board_config.h" - -/************************************************************************************ - * Definitions - ************************************************************************************/ - -/************************************************************************************ - * Private Functions - ************************************************************************************/ - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -/************************************************************************************ - * Name: stm32_usbinitialize - * - * Description: - * Called to setup USB-related GPIO pins for the PX4FMU board. - * - ************************************************************************************/ - -__EXPORT void stm32_usbinitialize(void) -{ - /* The OTG FS has an internal soft pull-up */ - - /* Configure the OTG FS VBUS sensing GPIO, Power On, and Overcurrent GPIOs */ - -#ifdef CONFIG_STM32F7_OTGFS - stm32_configgpio(GPIO_OTGFS_VBUS); -#endif -} - -/************************************************************************************ - * Name: stm32_usbsuspend - * - * Description: - * Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is - * used. This function is called whenever the USB enters or leaves suspend mode. - * This is an opportunity for the board logic to shutdown clocks, power, etc. - * while the USB is suspended. - * - ************************************************************************************/ - -__EXPORT void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume) -{ - uinfo("resume: %d\n", resume); -}