ItsyBitsy M4 COM port disappearing after upload

Having trouble with platformio and my itsybitsy M4. After upload, it disappears on both my mac and PC. The only way to get it to show up again is to double tap the reset. I’m using TinyUSB. As well the Serial connection is obviously unavailable during this time as well. I’ve seen others with this problem but no solution. I should add that this happens no matter which sketch I am using. Here is some info:

[env:adafruit_itsybitsy_m4]
platform = atmelsam
board = adafruit_itsybitsy_m4
framework = arduino
build_flags =
   -DUSE_TINYUSB
lib_deps = 
	adafruit/SdFat - Adafruit Fork@^1.5.1
	adafruit/Adafruit DotStar@^1.1.5
	adafruit/Adafruit Unified Sensor@^1.1.4
	adafruit/Adafruit MPU6050@^2.0.6
	adafruit/Adafruit SPIFlash@^3.8.0
Resolving adafruit_itsybitsy_m4 environment packages...
Platform atmelsam @ 8.1.0 (required: atmelsam)
├── framework-arduino-samd-adafruit @ 1.7.10 (required: platformio/framework-arduino-samd-adafruit @ ~1.7.10)
├── framework-cmsis @ 2.50400.181126 (required: platformio/framework-cmsis @ ~2.50400.0)
├── framework-cmsis-atmel @ 1.2.2 (required: platformio/framework-cmsis-atmel @ ~1.2.2)
├── tool-bossac @ 1.10900.0 (required: platformio/tool-bossac @ ~1.10900.0)
└── toolchain-gccarmnoneeabi @ 1.90301.200702 (required: platformio/toolchain-gccarmnoneeabi @ ~1.90301.0)

Libraries
├── Adafruit DotStar @ 1.2.1 (required: adafruit/Adafruit DotStar @ ^1.1.5)
│   └── Adafruit BusIO @ 1.12.0 (required: Adafruit BusIO)
├── Adafruit MPU6050 @ 2.2.1 (required: adafruit/Adafruit MPU6050 @ ^2.0.6)
│   ├── Adafruit BusIO @ 1.12.0 (required: Adafruit BusIO)
│   ├── Adafruit GFX Library @ 1.11.3 (required: Adafruit GFX Library)
│   │   └── Adafruit BusIO @ 1.12.0 (required: Adafruit BusIO)
│   ├── Adafruit SSD1306 @ 2.5.6 (required: Adafruit SSD1306)
│   │   └── Adafruit GFX Library @ 1.11.3 (required: Adafruit GFX Library)
│   │   │   └── Adafruit BusIO @ 1.12.0 (required: Adafruit BusIO)
│   └── Adafruit Unified Sensor @ 1.1.5 (required: Adafruit Unified Sensor)
├── Adafruit SPIFlash @ 3.10.0 (required: adafruit/Adafruit SPIFlash @ ^3.8.0)
│   ├── Adafruit NeoPixel @ 1.10.5 (required: Adafruit NeoPixel)
│   └── SdFat - Adafruit Fork @ 1.5.1 (required: SdFat - Adafruit Fork)
│   │   └── SD @ 0.0.0-alpha+sha.041f788250 (required: SD)
├── Adafruit Unified Sensor @ 1.1.5 (required: adafruit/Adafruit Unified Sensor @ ^1.1.4)
└── SdFat - Adafruit Fork @ 1.5.1 (required: adafruit/SdFat - Adafruit Fork @ ^1.5.1)
│   └── SD @ 0.0.0-alpha+sha.041f788250 (required: SD)

Thanks for the help!

Add

lib_archive = no

to the platformio.ini and reupload.

1 Like

interesting, what does this do?

This results in compilation errors:

...
(.text._ZN10SdioCardEX9readBlockEmPh+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SdCard/SdioCardEX.cpp.o: in function `SdioCardEX::syncBlocks()':
SdioCardEX.cpp:(.text._ZN10SdioCardEX10syncBlocksEv+0x0): multiple definition of `SdioCardEX::syncBlocks()'; .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SdCard/SdioCardEX 2.cpp.o:SdioCardEX 2.cpp:(.text._ZN10SdioCardEX10syncBlocksEv+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SdCard/SdioCardEX.cpp.o: in function `SdioCardEX::writeBlock(unsigned long, unsigned char const*)':
SdioCardEX.cpp:(.text._ZN10SdioCardEX10writeBlockEmPKh+0x0): multiple definition of `SdioCardEX::writeBlock(unsigned long, unsigned char const*)'; .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SdCard/SdioCardEX 2.cpp.o:SdioCardEX 2.cpp:(.text._ZN10SdioCardEX10writeBlockEmPKh+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SdCard/SdioCardEX.cpp.o:(.rodata._ZTV10SdioCardEX+0x0): multiple definition of `vtable for SdioCardEX'; .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SdCard/SdioCardEX 2.cpp.o:(.rodata._ZTV10SdioCardEX+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SpiDriver/SdSpiSAMD.cpp.o: in function `SdSpiAltDriver::activate()':
SdSpiSAMD.cpp:(.text._ZN14SdSpiAltDriver8activateEv+0x0): multiple definition of `SdSpiAltDriver::activate()'; .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SpiDriver/SdSpiSAMD 2.cpp.o:SdSpiSAMD 2.cpp:(.text._ZN14SdSpiAltDriver8activateEv+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SpiDriver/SdSpiSAMD.cpp.o: in function `SdSpiAltDriver::begin(unsigned char)':
SdSpiSAMD.cpp:(.text._ZN14SdSpiAltDriver5beginEh+0x0): multiple definition of `SdSpiAltDriver::begin(unsigned char)'; .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SpiDriver/SdSpiSAMD 2.cpp.o:SdSpiSAMD 2.cpp:(.text._ZN14SdSpiAltDriver5beginEh+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SpiDriver/SdSpiSAMD.cpp.o: in function `SdSpiAltDriver::deactivate()':
SdSpiSAMD.cpp:(.text._ZN14SdSpiAltDriver10deactivateEv+0x0): multiple definition of `SdSpiAltDriver::deactivate()'; .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SpiDriver/SdSpiSAMD 2.cpp.o:SdSpiSAMD 2.cpp:(.text._ZN14SdSpiAltDriver10deactivateEv+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SpiDriver/SdSpiSAMD.cpp.o: in function `SdSpiAltDriver::receive()':
SdSpiSAMD.cpp:(.text._ZN14SdSpiAltDriver7receiveEv+0x0): multiple definition of `SdSpiAltDriver::receive()'; .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SpiDriver/SdSpiSAMD 2.cpp.o:SdSpiSAMD 2.cpp:(.text._ZN14SdSpiAltDriver7receiveEv+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SpiDriver/SdSpiSAMD.cpp.o: in function `SdSpiAltDriver::receive(unsigned char*, unsigned int)':
SdSpiSAMD.cpp:(.text._ZN14SdSpiAltDriver7receiveEPhj+0x0): multiple definition of `SdSpiAltDriver::receive(unsigned char*, unsigned int)'; .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SpiDriver/SdSpiSAMD 2.cpp.o:SdSpiSAMD 2.cpp:(.text._ZN14SdSpiAltDriver7receiveEPhj+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SpiDriver/SdSpiSAMD.cpp.o: in function `SdSpiAltDriver::send(unsigned char)':
SdSpiSAMD.cpp:(.text._ZN14SdSpiAltDriver4sendEh+0x0): multiple definition of `SdSpiAltDriver::send(unsigned char)'; .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SpiDriver/SdSpiSAMD 2.cpp.o:SdSpiSAMD 2.cpp:(.text._ZN14SdSpiAltDriver4sendEh+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SpiDriver/SdSpiSAMD.cpp.o: in function `SdSpiAltDriver::send(unsigned char const*, unsigned int)':
SdSpiSAMD.cpp:(.text._ZN14SdSpiAltDriver4sendEPKhj+0x0): multiple definition of `SdSpiAltDriver::send(unsigned char const*, unsigned int)'; .pio/build/adafruit_itsybitsy_m4/lib0b2/SdFat - Adafruit Fork/SpiDriver/SdSpiSAMD 2.cpp.o:SdSpiSAMD 2.cpp:(.text._ZN14SdSpiAltDriver4sendEPKhj+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD.cpp.o: in function `Adafruit_FlashTransport_QSPI::end()':
Adafruit_FlashTransport_QSPI_SAMD.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI3endEv+0x0): multiple definition of `Adafruit_FlashTransport_QSPI::end()'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD 2.cpp.o:Adafruit_FlashTransport_QSPI_SAMD 2.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI3endEv+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD.cpp.o: in function `Adafruit_FlashTransport_QSPI::setClockSpeed(unsigned long, unsigned long)':
Adafruit_FlashTransport_QSPI_SAMD.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI13setClockSpeedEmm+0x0): multiple definition of `Adafruit_FlashTransport_QSPI::setClockSpeed(unsigned long, unsigned long)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD 2.cpp.o:Adafruit_FlashTransport_QSPI_SAMD 2.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI13setClockSpeedEmm+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD.cpp.o: in function `Adafruit_FlashTransport_QSPI::begin()':
Adafruit_FlashTransport_QSPI_SAMD.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI5beginEv+0x0): multiple definition of `Adafruit_FlashTransport_QSPI::begin()'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD 2.cpp.o:Adafruit_FlashTransport_QSPI_SAMD 2.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI5beginEv+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD.cpp.o: in function `Adafruit_FlashTransport_QSPI::runCommand(unsigned char)':
Adafruit_FlashTransport_QSPI_SAMD.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI10runCommandEh+0x0): multiple definition of `Adafruit_FlashTransport_QSPI::runCommand(unsigned char)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD 2.cpp.o:Adafruit_FlashTransport_QSPI_SAMD 2.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI10runCommandEh+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD.cpp.o: in function `Adafruit_FlashTransport_QSPI::readCommand(unsigned char, unsigned char*, unsigned long)':
Adafruit_FlashTransport_QSPI_SAMD.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI11readCommandEhPhm+0x0): multiple definition of `Adafruit_FlashTransport_QSPI::readCommand(unsigned char, unsigned char*, unsigned long)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD 2.cpp.o:Adafruit_FlashTransport_QSPI_SAMD 2.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI11readCommandEhPhm+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD.cpp.o: in function `Adafruit_FlashTransport_QSPI::writeCommand(unsigned char, unsigned char const*, unsigned long)':
Adafruit_FlashTransport_QSPI_SAMD.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI12writeCommandEhPKhm+0x0): multiple definition of `Adafruit_FlashTransport_QSPI::writeCommand(unsigned char, unsigned char const*, unsigned long)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD 2.cpp.o:Adafruit_FlashTransport_QSPI_SAMD 2.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI12writeCommandEhPKhm+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD.cpp.o: in function `Adafruit_FlashTransport_QSPI::eraseCommand(unsigned char, unsigned long)':
Adafruit_FlashTransport_QSPI_SAMD.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI12eraseCommandEhm+0x0): multiple definition of `Adafruit_FlashTransport_QSPI::eraseCommand(unsigned char, unsigned long)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD 2.cpp.o:Adafruit_FlashTransport_QSPI_SAMD 2.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI12eraseCommandEhm+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD.cpp.o: in function `Adafruit_FlashTransport_QSPI::readMemory(unsigned long, unsigned char*, unsigned long)':
Adafruit_FlashTransport_QSPI_SAMD.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI10readMemoryEmPhm+0x0): multiple definition of `Adafruit_FlashTransport_QSPI::readMemory(unsigned long, unsigned char*, unsigned long)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD 2.cpp.o:Adafruit_FlashTransport_QSPI_SAMD 2.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI10readMemoryEmPhm+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD.cpp.o: in function `Adafruit_FlashTransport_QSPI::writeMemory(unsigned long, unsigned char const*, unsigned long)':
Adafruit_FlashTransport_QSPI_SAMD.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI11writeMemoryEmPKhm+0x0): multiple definition of `Adafruit_FlashTransport_QSPI::writeMemory(unsigned long, unsigned char const*, unsigned long)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD 2.cpp.o:Adafruit_FlashTransport_QSPI_SAMD 2.cpp:(.text._ZN28Adafruit_FlashTransport_QSPI11writeMemoryEmPKhm+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD.cpp.o: in function `Adafruit_FlashTransport_QSPI::Adafruit_FlashTransport_QSPI()':
Adafruit_FlashTransport_QSPI_SAMD.cpp:(.text._ZN28Adafruit_FlashTransport_QSPIC2Ev+0x0): multiple definition of `Adafruit_FlashTransport_QSPI::Adafruit_FlashTransport_QSPI()'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD 2.cpp.o:Adafruit_FlashTransport_QSPI_SAMD 2.cpp:(.text._ZN28Adafruit_FlashTransport_QSPIC2Ev+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD.cpp.o: in function `Adafruit_FlashTransport_QSPI::Adafruit_FlashTransport_QSPI()':
Adafruit_FlashTransport_QSPI_SAMD.cpp:(.text._ZN28Adafruit_FlashTransport_QSPIC2Ev+0x0): multiple definition of `Adafruit_FlashTransport_QSPI::Adafruit_FlashTransport_QSPI()'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD 2.cpp.o:Adafruit_FlashTransport_QSPI_SAMD 2.cpp:(.text._ZN28Adafruit_FlashTransport_QSPIC2Ev+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD.cpp.o: in function `Adafruit_FlashTransport_QSPI::Adafruit_FlashTransport_QSPI(signed char, signed char, signed char, signed char, signed char, signed char)':
Adafruit_FlashTransport_QSPI_SAMD.cpp:(.text._ZN28Adafruit_FlashTransport_QSPIC2Eaaaaaa+0x0): multiple definition of `Adafruit_FlashTransport_QSPI::Adafruit_FlashTransport_QSPI(signed char, signed char, signed char, signed char, signed char, signed char)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD 2.cpp.o:Adafruit_FlashTransport_QSPI_SAMD 2.cpp:(.text._ZN28Adafruit_FlashTransport_QSPIC2Eaaaaaa+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD.cpp.o: in function `Adafruit_FlashTransport_QSPI::Adafruit_FlashTransport_QSPI(signed char, signed char, signed char, signed char, signed char, signed char)':
Adafruit_FlashTransport_QSPI_SAMD.cpp:(.text._ZN28Adafruit_FlashTransport_QSPIC2Eaaaaaa+0x0): multiple definition of `Adafruit_FlashTransport_QSPI::Adafruit_FlashTransport_QSPI(signed char, signed char, signed char, signed char, signed char, signed char)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD 2.cpp.o:Adafruit_FlashTransport_QSPI_SAMD 2.cpp:(.text._ZN28Adafruit_FlashTransport_QSPIC2Eaaaaaa+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD.cpp.o:(.rodata._ZTV28Adafruit_FlashTransport_QSPI+0x0): multiple definition of `vtable for Adafruit_FlashTransport_QSPI'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/qspi/Adafruit_FlashTransport_QSPI_SAMD 2.cpp.o:(.rodata._ZTV28Adafruit_FlashTransport_QSPI+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI.cpp.o: in function `Adafruit_FlashTransport_SPI::setClockSpeed(unsigned long, unsigned long)':
Adafruit_FlashTransport_SPI.cpp:(.text._ZN27Adafruit_FlashTransport_SPI13setClockSpeedEmm+0x0): multiple definition of `Adafruit_FlashTransport_SPI::setClockSpeed(unsigned long, unsigned long)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI 2.cpp.o:Adafruit_FlashTransport_SPI 2.cpp:(.text._ZN27Adafruit_FlashTransport_SPI13setClockSpeedEmm+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI.cpp.o: in function `Adafruit_FlashTransport_SPI::begin()':
Adafruit_FlashTransport_SPI.cpp:(.text._ZN27Adafruit_FlashTransport_SPI5beginEv+0x0): multiple definition of `Adafruit_FlashTransport_SPI::begin()'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI 2.cpp.o:Adafruit_FlashTransport_SPI 2.cpp:(.text._ZN27Adafruit_FlashTransport_SPI5beginEv+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI.cpp.o: in function `Adafruit_FlashTransport_SPI::end()':
Adafruit_FlashTransport_SPI.cpp:(.text._ZN27Adafruit_FlashTransport_SPI3endEv+0x0): multiple definition of `Adafruit_FlashTransport_SPI::end()'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI 2.cpp.o:Adafruit_FlashTransport_SPI 2.cpp:(.text._ZN27Adafruit_FlashTransport_SPI3endEv+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI.cpp.o: in function `Adafruit_FlashTransport_SPI::runCommand(unsigned char)':
Adafruit_FlashTransport_SPI.cpp:(.text._ZN27Adafruit_FlashTransport_SPI10runCommandEh+0x0): multiple definition of `Adafruit_FlashTransport_SPI::runCommand(unsigned char)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI 2.cpp.o:Adafruit_FlashTransport_SPI 2.cpp:(.text._ZN27Adafruit_FlashTransport_SPI10runCommandEh+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI.cpp.o: in function `Adafruit_FlashTransport_SPI::readCommand(unsigned char, unsigned char*, unsigned long)':
Adafruit_FlashTransport_SPI.cpp:(.text._ZN27Adafruit_FlashTransport_SPI11readCommandEhPhm+0x0): multiple definition of `Adafruit_FlashTransport_SPI::readCommand(unsigned char, unsigned char*, unsigned long)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI 2.cpp.o:Adafruit_FlashTransport_SPI 2.cpp:(.text._ZN27Adafruit_FlashTransport_SPI11readCommandEhPhm+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI.cpp.o: in function `Adafruit_FlashTransport_SPI::writeCommand(unsigned char, unsigned char const*, unsigned long)':
Adafruit_FlashTransport_SPI.cpp:(.text._ZN27Adafruit_FlashTransport_SPI12writeCommandEhPKhm+0x0): multiple definition of `Adafruit_FlashTransport_SPI::writeCommand(unsigned char, unsigned char const*, unsigned long)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI 2.cpp.o:Adafruit_FlashTransport_SPI 2.cpp:(.text._ZN27Adafruit_FlashTransport_SPI12writeCommandEhPKhm+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI.cpp.o: in function `Adafruit_FlashTransport_SPI::Adafruit_FlashTransport_SPI(unsigned char, SPIClass*)':
Adafruit_FlashTransport_SPI.cpp:(.text._ZN27Adafruit_FlashTransport_SPIC2EhP8SPIClass+0x0): multiple definition of `Adafruit_FlashTransport_SPI::Adafruit_FlashTransport_SPI(unsigned char, SPIClass*)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI 2.cpp.o:Adafruit_FlashTransport_SPI 2.cpp:(.text._ZN27Adafruit_FlashTransport_SPIC2EhP8SPIClass+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI.cpp.o: in function `Adafruit_FlashTransport_SPI::Adafruit_FlashTransport_SPI(unsigned char, SPIClass*)':
Adafruit_FlashTransport_SPI.cpp:(.text._ZN27Adafruit_FlashTransport_SPIC2EhP8SPIClass+0x0): multiple definition of `Adafruit_FlashTransport_SPI::Adafruit_FlashTransport_SPI(unsigned char, SPIClass*)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI 2.cpp.o:Adafruit_FlashTransport_SPI 2.cpp:(.text._ZN27Adafruit_FlashTransport_SPIC2EhP8SPIClass+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI.cpp.o: in function `Adafruit_FlashTransport_SPI::Adafruit_FlashTransport_SPI(unsigned char, SPIClass&)':
Adafruit_FlashTransport_SPI.cpp:(.text._ZN27Adafruit_FlashTransport_SPIC2EhR8SPIClass+0x0): multiple definition of `Adafruit_FlashTransport_SPI::Adafruit_FlashTransport_SPI(unsigned char, SPIClass&)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI 2.cpp.o:Adafruit_FlashTransport_SPI 2.cpp:(.text._ZN27Adafruit_FlashTransport_SPIC2EhR8SPIClass+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI.cpp.o: in function `Adafruit_FlashTransport_SPI::Adafruit_FlashTransport_SPI(unsigned char, SPIClass&)':
Adafruit_FlashTransport_SPI.cpp:(.text._ZN27Adafruit_FlashTransport_SPIC2EhR8SPIClass+0x0): multiple definition of `Adafruit_FlashTransport_SPI::Adafruit_FlashTransport_SPI(unsigned char, SPIClass&)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI 2.cpp.o:Adafruit_FlashTransport_SPI 2.cpp:(.text._ZN27Adafruit_FlashTransport_SPIC2EhR8SPIClass+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI.cpp.o: in function `Adafruit_FlashTransport_SPI::fillAddress(unsigned char*, unsigned long)':
Adafruit_FlashTransport_SPI.cpp:(.text._ZN27Adafruit_FlashTransport_SPI11fillAddressEPhm+0x0): multiple definition of `Adafruit_FlashTransport_SPI::fillAddress(unsigned char*, unsigned long)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI 2.cpp.o:Adafruit_FlashTransport_SPI 2.cpp:(.text._ZN27Adafruit_FlashTransport_SPI11fillAddressEPhm+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI.cpp.o: in function `Adafruit_FlashTransport_SPI::eraseCommand(unsigned char, unsigned long)':
Adafruit_FlashTransport_SPI.cpp:(.text._ZN27Adafruit_FlashTransport_SPI12eraseCommandEhm+0x0): multiple definition of `Adafruit_FlashTransport_SPI::eraseCommand(unsigned char, unsigned long)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI 2.cpp.o:Adafruit_FlashTransport_SPI 2.cpp:(.text._ZN27Adafruit_FlashTransport_SPI12eraseCommandEhm+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI.cpp.o: in function `Adafruit_FlashTransport_SPI::readMemory(unsigned long, unsigned char*, unsigned long)':
Adafruit_FlashTransport_SPI.cpp:(.text._ZN27Adafruit_FlashTransport_SPI10readMemoryEmPhm+0x0): multiple definition of `Adafruit_FlashTransport_SPI::readMemory(unsigned long, unsigned char*, unsigned long)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI 2.cpp.o:Adafruit_FlashTransport_SPI 2.cpp:(.text._ZN27Adafruit_FlashTransport_SPI10readMemoryEmPhm+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI.cpp.o: in function `Adafruit_FlashTransport_SPI::writeMemory(unsigned long, unsigned char const*, unsigned long)':
Adafruit_FlashTransport_SPI.cpp:(.text._ZN27Adafruit_FlashTransport_SPI11writeMemoryEmPKhm+0x0): multiple definition of `Adafruit_FlashTransport_SPI::writeMemory(unsigned long, unsigned char const*, unsigned long)'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI 2.cpp.o:Adafruit_FlashTransport_SPI 2.cpp:(.text._ZN27Adafruit_FlashTransport_SPI11writeMemoryEmPKhm+0x0): first defined here
/Users/ewoolsey/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI.cpp.o:(.rodata._ZTV27Adafruit_FlashTransport_SPI+0x0): multiple definition of `vtable for Adafruit_FlashTransport_SPI'; .pio/build/adafruit_itsybitsy_m4/lib69f/Adafruit SPIFlash/spi/Adafruit_FlashTransport_SPI 2.cpp.o:(.rodata._ZTV27Adafruit_FlashTransport_SPI+0x0): first defined here
collect2: error: ld returned 1 exit status
*** [.pio/build/adafruit_itsybitsy_m4/firmware.elf] Error 1

TinyUSB has an eternally unmerged PR Hint platform io to not statically link by JoonasMelin · Pull Request #116 · adafruit/Adafruit_TinyUSB_Arduino · GitHub that the library needs due to linker internals (correct linking of interrupt handlers needed for USB) but was never merged.

Hm that’s not good.

Can you either turn of TinyUSB (remove build_flags) or create a new project with no libraries but just

[env:adafruit_itsybitsy_m4]
platform = atmelsam
board = adafruit_itsybitsy_m4
framework = arduino
build_flags =
   -DUSE_TINYUSB
lib_archive = no

and a

#include <Arduino.h>
#include <Adafruit_TinyUSB.h>
void setup() {
  Serial.begin(115200);
}
void loop() {
  Serial.println("test"); 
  delay(1000);
}

to test whether TinyUSB works in principle?

1 Like

Really appreciate your help! I’ll try that right now and get back to you.

OH MY GOD THAT WORKED. This problem has lost me like 6 hours of frustration. You are my saviour. Now, any ideas how to fix those compilation errors with the rest of my code?

Thank Hint platform io to not statically link by JoonasMelin · Pull Request #116 · adafruit/Adafruit_TinyUSB_Arduino · GitHub for never getting merged and it not getting looked at on the PlatformIO side :smiley:

This seems really weird. Why is there Adafruit_FlashTransport_SPI.cpp and Adafruit_FlashTransport_SPI 2.cpp? That doesn’t appear in Adafruit_SPIFlash/src at master · adafruit/Adafruit_SPIFlash · GitHub. It almost looks to me like someone just duplicated the file.

Can you remove the .pio folder of the project to get a clean redownload of the libraries when you build again?

Sure! will try.

Also just this header file is enough to cause those errors FYI:

#ifndef _FLASHSTORAGE_H
#define _FLASHSTORAGE_H
#include <Arduino.h>
#include <SPI.h>
#include "SdFat.h"
#include "Adafruit_SPIFlash.h"
#include "Adafruit_TinyUSB.h"

//general file access functions
//read 16-bit (2 byte) unsigned int from file
uint16_t read16(File &f);
//read 32-bit (4 byte) unsigned int from file
uint32_t read32(File &f);
//read line (until \n ) from file and save it to l
//skips all whitespace (including CR and tab)
int readLine(File &f, char  l[]);



void msc_init();   //initialize mass storage object
//callbacks for read/write requests from connected computer
int32_t msc_read_cb (uint32_t lba, void* buffer, uint32_t bufsize);
int32_t msc_write_cb (uint32_t lba, uint8_t* buffer, uint32_t bufsize);
void msc_flush_cb (void);


//Global variables

extern Adafruit_FlashTransport_QSPI flashTransport;
extern Adafruit_SPIFlash flash;   //flash device
extern FatFileSystem fatfs;       // fat filesystem on flash
extern Adafruit_USBD_MSC usb_msc; // USB mass storage object

#endif

Damn okay we are getting somewhere. Deleting .pio worked for me. Although uploading is still broken it seems. The sketch uploads fine after a reset, but stalls during a normal upload.

Checking size .pio/build/adafruit_itsybitsy_m4/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [====      ]  39.6% (used 77824 bytes from 196608 bytes)
Flash: [=         ]   8.5% (used 44780 bytes from 524288 bytes)
Configuring upload protocol...
AVAILABLE: atmel-ice, jlink, sam-ba
CURRENT: upload_protocol = sam-ba
Looking for upload port...
Auto-detected: /dev/cu.usbmodem21401
Forcing reset using 1200bps open/close on port /dev/cu.usbmodem21401
Waiting for the new upload port...
Uploading .pio/build/adafruit_itsybitsy_m4/firmware.bin
Write 44780 bytes to flash (88 pages)

[                              ] 0% (0/88 pages)
[==                            ] 9% (8/88 pages)
[=====                         ] 18% (16/88 pages)
[========                      ] 27% (24/88 pages)
[==========                    ] 36% (32/88 pages)
[=============                 ] 45% (40/88 pages)
[================              ] 54% (48/88 pages)
[===================           ] 63% (56/88 pages)
[=====================         ] 72% (64/88 pages)
[========================   
SAM-BA operation failed
*** [upload] Error 1  

That’s uh, interesting.

With what code configuration was it broken before?

Uploading a minimal TinyUSB serial sketch repeadedly as shown above also results in this error?

When not using TinyUSB everything is fine?

Hey there, sorry for the slow reply, was away for the long weekend.

Uploading a minimal TinyUSB serial sketch repeadedly as shown above also results in this error?

yes it does :stuck_out_tongue:

When not using TinyUSB everything is fine?

Yep, If I don’t use tinyusb I have no problems.
Any ideas?

As an additional follow up. Everything is 100% working on my windows machine when using the changes you suggested. It is just my M1 Max Macbook Pro that gets the SAM-BA error. I have done lots of googling and cannot find a solution :frowning: I would really like to develop on my Macbook so if you have any ideas that would be amazing. Maybe a driver issue?

Sounds like Short delay to ensure port is flushed in OS X (and prevent download h… by dledge · Pull Request #121 · shumatech/BOSSA · GitHub or better Fix MacOS write error caused by unflushed buffer by kaysievers · Pull Request #150 · shumatech/BOSSA · GitHub? Are you able to recompile BOSSAC from source from the latter fork?

If you have patched binaries, use them to replace ~/.platformio/packages/tool-bossac@<version> (you get the version number in the “PACKAGE” overview at the start of compilation).

Hm in fact, Releases · adafruit/ArduinoCore-samd · GitHub fixed that implicitly by updating the bossac version that incorprates that fix by… downgrading to 1.8.

You should be able to download the precompiled binary at http://downloads.arduino.cc/tools/bossac-1.8-48-gb176eee-i386-apple-darwin16.1.0.tar.gz. Place the bossac executable from there into the right tool-bossac folder as detailed above and retry.

Man you really know your stuff… Thanks so much. Heading out visiting family for the week so won’t be able to test until next weekend. Will be sure to reply then!

1 Like

Using the binary you linked Does not improve the situation it seems. It is now disappearing from the com port again after upload on my Mac.

And this is with your full sketch or ItsyBitsy M4 COM port disappearing after upload - #5 by maxgerhardt?

Both unfortunately. With the old binary it doesn’t disappear from the com port, but reupload fails with sam-ba error.

Please open an issue at Issues · platformio/platform-atmelsam · GitHub so that the devs can work on this.