Fix build for USB

This commit is contained in:
Eric Helgeson 2022-05-22 12:53:57 -05:00
parent 61ae8a59db
commit 5c0724703b
2 changed files with 50 additions and 35 deletions

View File

@ -32,13 +32,47 @@ board_build.core = maple
[env:STM32F1-XCVR]
extends = env:STM32F1
build_flags = ${env.build_flags}
build_flags = ${env.build_flags}
-DXCVR
-D BUILD_TAGS="\"-XCVR\""
[env:STM32F1-USB-128MHz]
# Max overclock for STM32
# Can use for APM32F1 as well.
extends = env:STM32F1-USB
board_build.f_cpu = 128000000L
build_flags = ${env.build_flags}
-D BUILD_TAGS="\"-USB-128MHz\""
[env:STM32F1-USB-96MHz]
# Slight overclock for STM32
# Use for APM32F1's - it's default clock is 96MHz and runs unstable at 72MHz(STM32F1's default)
extends = env:STM32F1-USB
# Explicilty define the multiplier as maple only handles a few cases.
build_flags = ${env.build_flags}
-D BUILD_TAGS="\"-USB-96MHz\""
-D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
-D USBCON
-D USBD_VID=0x0483
-D USB_MANUFACTURER="Unknown"
-D USB_PRODUCT="\"BLUEPILL_F103C8\""
-D HAL_PCD_MODULE_ENABLED
-DBOARD_RCC_PLLMUL=RCC_PLLMUL_12 #96000000L
# TODO: Find out why USB build flags get trampled when extending an extended env.
[env:STM32F1-USB]
extends = env:STM32F1
build_flags = ${env.build_flags}
platform = ststm32
board = genericSTM32F103C8
board_build.mcu = stm32f103c8t6
board_build.core = maple
board_build.f_cpu = 128000000L
framework = arduino
lib_deps =
greiman/SdFat @ ^2.0.6
upload_protocol = dfu
; Different gcc versions produce much different binaries in terms of speed.
platform_packages = platformio/toolchain-gccarmnoneeabi@1.90301.200702
build_flags =
-D BUILD_TAGS="\"-USB\""
-D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
-D USBCON
@ -46,36 +80,17 @@ build_flags = ${env.build_flags}
-D USB_MANUFACTURER="Unknown"
-D USB_PRODUCT="\"BLUEPILL_F103C8\""
-D HAL_PCD_MODULE_ENABLED
[env:STM32F1-USB-128MHZ]
extends = env:STM32F1
board_build.f_cpu = 128000000L
build_flags = ${env.build_flags}
-D BUILD_TAGS="\"-USB-128MHZ\""
[env:APM32F1]
# The APM32F1's default clock is 96MHz and runs unstable at 72MHz(STM32F1's default)
extends = env:STM32F1
# Explicilty define the multiplier as maple only handles a few cases.
build_flags = ${env.build_flags}
-D BUILD_TAGS="\"-APM32\""
-DBOARD_RCC_PLLMUL=RCC_PLLMUL_12 #96000000L
[env:APM32F1-USB]
# The APM32F1's default clock is 96MHz and runs unstable at 72MHz(STM32F1's default)
extends = env:APM32F1
# Explicilty define the multiplier as maple only handles a few cases.
build_flags = ${env.build_flags}
-D BUILD_TAGS="\"-APM32-USB\""
-D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
-D USBCON
-D USBD_VID=0x0483
-D USB_MANUFACTURER="Unknown"
-D USB_PRODUCT="\"BLUEPILL_F103C8\""
-D HAL_PCD_MODULE_ENABLED
-DBOARD_RCC_PLLMUL=RCC_PLLMUL_12 #96000000L
# Or go all out at 128Mhz, your call :)
#board_build.f_cpu = 128000000L
-w
-DARDUINO_GENERIC_STM32F103C
-DARDUINO_LIB_DISCOVERY_PHASE
-DARDUINO=10813
-DARDUINO_ARCH_STM32
-DDEBUG_LEVEL=DEBUG_NONE
-O2
build_unflags =
-Os
-DARDUINO_ARCH_STM32F1
upload_flags = -c set CPUTAPID 0
; [env:debug]
; build_type = debug

View File

@ -278,7 +278,7 @@ uint32_t db_bsrr[256];
//#undef PTY
// Log File
#define VERSION "1.1-SNAPSHOT-20220407"
#define VERSION "1.1-SNAPSHOT-20220522"
#define LOG_FILENAME "LOG.txt"
FsFile LOG_FILE;
@ -681,7 +681,7 @@ void initFileLog(int success_mhz) {
LOG_FILE.println(SDFAT_FILE_TYPE);
LOG_FILE.print("SdFat version: ");
LOG_FILE.println(SD_FAT_VERSION_STR);
LOG_FILE.print("SD Format: ");
LOG_FILE.print("Sd Format: ");
switch(SD.vol()->fatType()) {
case FAT_TYPE_EXFAT:
LOG_FILE.println("exFAT");