Custom Firmware Connection Issue

Hi,

I have been trying compile a custom version of the copter firmware. I have followed the instructions and advice from the wiki:

Building the code — Dev documentation (ardupilot.org)

ardupilot/BUILD.md at master · ArduPilot/ardupilot (github.com)

I am using WSL on windows 10 and compiling with waf.
As a test I have added a few gsc.sendtext() printouts in one of the files.
I have been editing the files in VCode.
I have configured the code to be uploaded onto a CubeBlack.

"“python ./waf configure --board CubeBlack”

I have compiled a copter firmware version:

“python ./waf copter”

The code has compiled, and I am able to upload to the Cube Black using Mission Planner.

The issue that I now face is trying to connect to the cube via MAVLink over USB. Once the custom firmware has been uploaded the cube appears on the COM port list as PX4 FMU (COM3).

image

When I select this port on the drop-down list in Mission Planner it is unable to connect. I have notice that when I load the stable version of Copter V4.2.3 Official. The Cube appears on the COM port list as USB Serial Device (COM26).

image

Is there an additional parameter that is required in the configuration to change how the cube appears when connected via USB?

Th is is the output of the configuration step:

bob@LAPTOP-H386RJN1:~/ardupilot$  python ./waf configure --board CubeBlack
Setting top to                           : /home/bob/ardupilot
Setting out to                           : /home/bob/ardupilot/build
Autoconfiguration                        : enabled
Setting board to                         : CubeBlack
Using toolchain                          : arm-none-eabi
Checking for 'g++' (C++ compiler)        : /usr/lib/ccache/arm-none-eabi-g++
Checking for 'gcc' (C compiler)          : /usr/lib/ccache/arm-none-eabi-gcc
Checking for c flags '-MMD'              : yes
Checking for cxx flags '-MMD'            : yes
CXX Compiler                             : g++ 10.2.1
Checking for program 'make'              : /usr/bin/make
Checking for program 'arm-none-eabi-objcopy' : /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-objcopy
Including /home/bob/ardupilot/libraries/AP_HAL_ChibiOS/hwdef/fmuv3/hwdef.dat
Adding environment OPTIMIZE -O2
Removing PB0
Removing PB1
Removing PA8
Removing PE3
Setup for MCU STM32F427xx
Writing hwdef setup in /home/bob/ardupilot/build/CubeBlack/hwdef.h
Setting up as normal firmware
Writing DMA map
No change in hwdef.h
Generating ldscript.ld
Default parameters path from hwdef: /home/bob/ardupilot/libraries/AP_HAL_ChibiOS/hwdef/CubeBlack/defaults.parm
Checking for env.py
env set OPTIMIZE=-O2
env set ENABLE_DFU_BOOT=0
env set WITH_FATFS=1
env set PROCESS_STACK=0x1C00
env set MAIN_STACK=0x600
env set IOMCU_FW=0
env set PERIPH_FW=0
env set HAL_NUM_CAN_IFACES=2
env set HAL_CANFD_SUPPORTED=0
env set BOARD_FLASH_SIZE=2048
env set EXT_FLASH_SIZE_MB=0
env set ENABLE_CRASHDUMP=1
env set APP_RAM_START=None
env set CPU_FLAGS=['-mcpu=cortex-m4', '-mfpu=fpv4-sp-d16', '-mfloat-abi=hard', '-DARM_MATH_CM4', '-u_printf_float']
env set CORTEX=cortex-m4
env set APJ_BOARD_ID=9
env set APJ_BOARD_TYPE=STM32F427xx
env set USBID=0x2dae/0x1011
env set BOOTLOADER_EMBED=1
env set FLASH_RESERVE_START_KB=16
env set EXT_FLASH_RESERVE_START_KB=0
env set FLASH_TOTAL=2080768
env set HAS_EXTERNAL_FLASH_SECTIONS=0
env set DEFAULT_PARAMETERS=/home/bob/ardupilot/libraries/AP_HAL_ChibiOS/hwdef/CubeBlack/defaults.parm
env set CHIBIOS_BUILD_FLAGS=USE_FATFS=yes CHIBIOS_STARTUP_MK=os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk CHIBIOS_PLATFORM_MK=os/hal/ports/STM32/STM32F4xx/platform.mk MCU=cortex-m4 ENV_UDEFS=-DCHPRINTF_USE_FLOAT=1
Enabling ChibiOS asserts                     : no
Disabling Watchdog                           : no
Enabling malloc guard                        : no
Enabling ChibiOS thread statistics           : no
Enabling -Werror                             : yes
Checking for intelhex module:                : OK
Enabled OpenDroneID                          : no
Enabled firmware ID checking                 : no
GPS Debug Logging                            : no
Enabled custom controller                    : no
Checking for HAVE_CMATH_ISFINITE             : yes
Checking for HAVE_CMATH_ISINF                : yes
Checking for HAVE_CMATH_ISNAN                : yes
Checking for NEED_CMATH_ISFINITE_STD_NAMESPACE : yes
Checking for NEED_CMATH_ISINF_STD_NAMESPACE    : yes
Checking for NEED_CMATH_ISNAN_STD_NAMESPACE    : yes
Checking for header endian.h                   : not found
Checking for header byteswap.h                 : not found
Checking for HAVE_MEMRCHR                      : no
Configured VSCode Intellisense:                : no
Checking for program 'python'                  : /usr/bin/python
Checking for python version >= 2.7.0           : 3.8.10
Checking for program 'python'                  : /usr/bin/python
Checking for python version >= 2.7.0           : 3.8.10
Source is git repository                       : yes
Update submodules                              : yes
Checking for program 'git'                     : /usr/bin/git
Gtest                                          : STM32 boards currently don't support compiling gtest
Checking for program 'arm-none-eabi-size'      : /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-size
Benchmarks                                     : disabled
Unit tests                                     : disabled
Scripting                                      : enabled
Scripting runtime checks                       : enabled
Debug build                                    : disabled
Coverage build                                 : disabled
SITL 32-bit build                              : disabled
Checking for program 'rsync'                   : /usr/bin/rsync
'configure' finished successfully (0.707s)

Thanks, in advance.

Update: (SOLVED)
Before the setup() sequence has completed the Cube flight controller appears as just a USB device. If the MAVlink protocol has not setup correctly Mission planner will not connect. I had accidently added a gcs.sent text() command before the gcs class was properly setup and initiated. The setup() function therefore did not complete and had stalled somewhere.