diff --git a/.gitignore b/.gitignore index 89cc49c..7925ddb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ .vscode/c_cpp_properties.json .vscode/launch.json .vscode/ipch +*.cache* +*.ccls* +*compile_commands* diff --git a/README.md b/README.md index 17b42eb..d0acff5 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,8 @@ This firmware is comprised of two individual PlatformIO projects, one for the M7 ## Usage +Note: If you have any issues with linting/LSP with (neo)vim then try running `pio run -t compiledb` in both the /m7 and m4 directories. + [A full guide on the code structure is being developed and can currently be found here](https://share.note.sx/n340o95a#1ld68Rexy9NMUivdsulvSYpptsx1KMYcsj4a4mlvtj4). The location of these docs may change in the future, but a link to the newest docs will always be on this GitHub repository. diff --git a/m4/.clang-tidy b/m4/.clang-tidy new file mode 100644 index 0000000..3f9824b --- /dev/null +++ b/m4/.clang-tidy @@ -0,0 +1 @@ +Checks: '-*, -misc-definitions-in-headers' diff --git a/m4/.clangd b/m4/.clangd new file mode 100644 index 0000000..05f45f8 --- /dev/null +++ b/m4/.clangd @@ -0,0 +1,18 @@ +CompileFlags: + Add: + [ + # -mlong-calls, + -DSSIZE_MAX, + -DLWIP_NO_UNISTD_H=1, + -Dssize_t=long, + -D_SSIZE_T_DECLARED, + ] + Remove: + [ + -fno-tree-switch-conversion, + -mtext-section-literals, + -mlongcalls, + -fstrict-volatile-bitfields, + -free, + -fipa-pta, + ] diff --git a/m4/.vscode/c_cpp_properties.json b/m4/.vscode/c_cpp_properties.json deleted file mode 100644 index 03bcffe..0000000 --- a/m4/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,227 +0,0 @@ -// -// !!! WARNING !!! AUTO-GENERATED FILE! -// PLEASE DO NOT MODIFY IT AND USE "platformio.ini": -// https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags -// -{ - "configurations": [ - { - "name": "PlatformIO", - "includePath": [ - "c:/Users/lab/Desktop/dac-adc-firmware-dual-core/m4/include", - "c:/Users/lab/Desktop/dac-adc-firmware-dual-core/m4/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/SPI", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Portenta_SDRAM/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/ea_malloc", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/cores/arduino", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/cores/arduino/api/deprecated", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/cores/arduino/api/deprecated-avr-comp", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/variants/GENERIC_STM32H747_M4", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Arduino_CAN/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Arduino_H7_Video/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Camera/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Ethernet/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/GC2145", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/GPS/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/GSM/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Himax_HM01B0", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Himax_HM0360", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/KernelDebug/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/MCUboot/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/MLC/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/MRI/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/NDP/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Nano33BLE_System/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Nicla_System/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/OV7670", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/PDM/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Portenta_Audio/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Portenta_SDCARD/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/RPC/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/SE05X/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/SFU/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/STM32H747_System/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Scheduler/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/SocketWrapper/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/ThreadDebug/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/USBAudio", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/USBHID/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/USBHOST/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/USBMIDI", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/USBMSD/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/WiFi/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Wire", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/doom/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/mbed-memory-status", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/openamp_arduino/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/rpclib/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/syntiant_ilib/src", - "" - ], - "browse": { - "limitSymbolsToIncludedHeaders": true, - "path": [ - "c:/Users/lab/Desktop/dac-adc-firmware-dual-core/m4/include", - "c:/Users/lab/Desktop/dac-adc-firmware-dual-core/m4/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/SPI", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Portenta_SDRAM/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/ea_malloc", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/cores/arduino", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/cores/arduino/api/deprecated", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/cores/arduino/api/deprecated-avr-comp", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/variants/GENERIC_STM32H747_M4", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Arduino_CAN/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Arduino_H7_Video/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Camera/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Ethernet/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/GC2145", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/GPS/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/GSM/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Himax_HM01B0", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Himax_HM0360", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/KernelDebug/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/MCUboot/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/MLC/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/MRI/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/NDP/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Nano33BLE_System/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Nicla_System/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/OV7670", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/PDM/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Portenta_Audio/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Portenta_SDCARD/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/RPC/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/SE05X/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/SFU/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/STM32H747_System/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Scheduler/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/SocketWrapper/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/ThreadDebug/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/USBAudio", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/USBHID/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/USBHOST/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/USBMIDI", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/USBMSD/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/WiFi/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/Wire", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/doom/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/mbed-memory-status", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/openamp_arduino/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/rpclib/src", - "C:/Users/lab/.platformio/packages/framework-arduino-mbed/libraries/syntiant_ilib/src", - "" - ] - }, - "defines": [ - "PLATFORMIO=60115", - "ARDUINO_GIGA", - "ARDUINO_GIGA_M4", - "GIGA_PINS", - "ARM_MATH_CM4", - "BT_UART_NO_3M_SUPPORT", - "CM4_BOOT_BY_APPLICATION", - "__CMSIS_RTOS", - "COMPONENT_4343W_FS=1", - "COMPONENT_CYW43XXX=1", - "COMPONENT_FLASHIAP=1", - "COMPONENT_QSPIF=1", - "COMPONENT_WHD=1", - "CORE_CM4", - "__CORTEX_M4", - "CYW43XXX_UNBUFFERED_UART", - "DEVICE_ANALOGIN=1", - "DEVICE_ANALOGOUT=1", - "DEVICE_CAN=1", - "DEVICE_CRC=1", - "DEVICE_FLASH=1", - "DEVICE_I2C=1", - "DEVICE_I2C_ASYNCH=1", - "DEVICE_I2CSLAVE=1", - "DEVICE_INTERRUPTIN=1", - "DEVICE_LPTICKER=1", - "DEVICE_PORTIN=1", - "DEVICE_PORTINOUT=1", - "DEVICE_PORTOUT=1", - "DEVICE_PWMOUT=1", - "DEVICE_QSPI=1", - "DEVICE_RESET_REASON=1", - "DEVICE_RTC=1", - "DEVICE_SERIAL=1", - "DEVICE_SERIAL_FC=1", - "DEVICE_SLEEP=1", - "DEVICE_SPI=1", - "DEVICE_SPI_ASYNCH=1", - "DEVICE_SPISLAVE=1", - "DEVICE_STDIO_MESSAGES=1", - "DEVICE_TRNG=1", - "DEVICE_USTICKER=1", - "DEVICE_WATCHDOG=1", - "EXTRA_IDLE_STACK_REQUIRED", - "FEATURE_BLE=1", - "__FPU_PRESENT=1", - "__MBED__=1", - "MBED_BUILD_TIMESTAMP=1720438822.17746", - "__MBED_CMSIS_RTOS_CM", - "MBED_MPU_CUSTOM", - "MBED_TICKLESS", - "MBEDTLS_FS_IO", - "MBEDTLS_SHA1_C", - "METAL_INTERNAL", - "METAL_MAX_DEVICE_REGIONS=2", - "NO_ATOMIC_64_SUPPORT", - "NO_VTOR_RELOCATE", - "RPMSG_BUFFER_SIZE=512", - "STM32H747xx", - "TARGET_CORDIO", - "TARGET_CORTEX", - "TARGET_CORTEX_M", - "TARGET_GENERIC_STM32H747_M4", - "TARGET_LIKE_CORTEX_M4", - "TARGET_LIKE_MBED", - "TARGET_M4", - "TARGET_MCU_STM32", - "TARGET_MCU_STM32H7", - "TARGET_MCU_STM32H747xI", - "TARGET_MCU_STM32H747xI_CM4", - "TARGET_NAME=GENERIC_STM32H747_M4", - "TARGET_RELEASE", - "TARGET_RTOS_M4_M7", - "TARGET_STM", - "TARGET_STM32H7", - "TARGET_STM32H747xI", - "TARGET_STM32H747xI_CM4", - "TOOLCHAIN_GCC", - "TOOLCHAIN_GCC_ARM", - "TRANSACTION_QUEUE_SIZE_SPI=2", - "USE_FULL_LL_DRIVER", - "USE_HAL_DRIVER", - "VIRTIO_DEVICE_ONLY", - "MBED_NO_GLOBAL_USING_DIRECTIVE=1", - "CORE_MAJOR=4", - "CORE_MINOR=1", - "CORE_PATCH=5", - "USE_ARDUINO_PINOUT", - "ARDUINO=10810", - "ARDUINO_ARCH_MBED", - "CM4_BINARY_START=0x08100000", - "CM4_BINARY_END=0x08200000", - "" - ], - "cStandard": "gnu11", - "cppStandard": "gnu++14", - "compilerPath": "C:/Users/lab/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc.exe", - "compilerArgs": [ - "-mcpu=cortex-m4", - "-mfloat-abi=softfp", - "-mfpu=fpv4-sp-d16", - "-mthumb", - "-iprefixC:/Users/lab/.platformio/packages/framework-arduino-mbed/cores/arduino", - "@C:/Users/lab/.platformio/packages/framework-arduino-mbed/variants/GENERIC_STM32H747_M4/includes.txt", - "-mfloat-abi=soft", - "-mfpu=fpv4-sp-d16", - "" - ] - } - ], - "version": 4 -} diff --git a/m4/.vscode/launch.json b/m4/.vscode/launch.json deleted file mode 100644 index ddfa9eb..0000000 --- a/m4/.vscode/launch.json +++ /dev/null @@ -1,44 +0,0 @@ -// AUTOMATICALLY GENERATED FILE. PLEASE DO NOT MODIFY IT MANUALLY -// -// PlatformIO Debugging Solution -// -// Documentation: https://docs.platformio.org/en/latest/plus/debugging.html -// Configuration: https://docs.platformio.org/en/latest/projectconf/sections/env/options/debug/index.html - -{ - "version": "0.2.0", - "configurations": [ - { - "type": "platformio-debug", - "request": "launch", - "name": "PIO Debug", - "executable": "c:/Users/lab/Desktop/dac-adc-firmware-dual-core/m4/.pio/build/giga_r1_m4/firmware.elf", - "projectEnvName": "giga_r1_m4", - "toolchainBinDir": "C:/Users/lab/.platformio/packages/toolchain-gccarmnoneeabi/bin", - "internalConsoleOptions": "openOnSessionStart", - "preLaunchTask": { - "type": "PlatformIO", - "task": "Pre-Debug" - } - }, - { - "type": "platformio-debug", - "request": "launch", - "name": "PIO Debug (skip Pre-Debug)", - "executable": "c:/Users/lab/Desktop/dac-adc-firmware-dual-core/m4/.pio/build/giga_r1_m4/firmware.elf", - "projectEnvName": "giga_r1_m4", - "toolchainBinDir": "C:/Users/lab/.platformio/packages/toolchain-gccarmnoneeabi/bin", - "internalConsoleOptions": "openOnSessionStart" - }, - { - "type": "platformio-debug", - "request": "launch", - "name": "PIO Debug (without uploading)", - "executable": "c:/Users/lab/Desktop/dac-adc-firmware-dual-core/m4/.pio/build/giga_r1_m4/firmware.elf", - "projectEnvName": "giga_r1_m4", - "toolchainBinDir": "C:/Users/lab/.platformio/packages/toolchain-gccarmnoneeabi/bin", - "internalConsoleOptions": "openOnSessionStart", - "loadMode": "manual" - } - ] -} diff --git a/m4/Makefile b/m4/Makefile new file mode 100644 index 0000000..587eaef --- /dev/null +++ b/m4/Makefile @@ -0,0 +1,21 @@ +# Uncomment lines below if you have problems with $PATH +SHELL := /bin/bash +PATH := /usr/local/bin:$(PATH) + +all: + pio -f -c vim run + +upload: + pio -f -c vim run --target upload + +clean: + pio -f -c vim run --target clean + +program: + pio -f -c vim run --target program + +uploadfs: + pio -f -c vim run --target uploadfs + +update: + pio -f -c vim update diff --git a/m4/platformio.ini b/m4/platformio.ini index 189e80c..d137104 100644 --- a/m4/platformio.ini +++ b/m4/platformio.ini @@ -11,4 +11,6 @@ [env:giga_r1_m4] platform = ststm32 board = giga_r1_m4 -framework = arduino \ No newline at end of file +framework = arduino + +extra_scripts = pre:gen_compile_commands.py \ No newline at end of file diff --git a/m7/.clang-tidy b/m7/.clang-tidy new file mode 100644 index 0000000..3f9824b --- /dev/null +++ b/m7/.clang-tidy @@ -0,0 +1 @@ +Checks: '-*, -misc-definitions-in-headers' diff --git a/m7/.clangd b/m7/.clangd new file mode 100644 index 0000000..05f45f8 --- /dev/null +++ b/m7/.clangd @@ -0,0 +1,18 @@ +CompileFlags: + Add: + [ + # -mlong-calls, + -DSSIZE_MAX, + -DLWIP_NO_UNISTD_H=1, + -Dssize_t=long, + -D_SSIZE_T_DECLARED, + ] + Remove: + [ + -fno-tree-switch-conversion, + -mtext-section-literals, + -mlongcalls, + -fstrict-volatile-bitfields, + -free, + -fipa-pta, + ] diff --git a/m7/Makefile b/m7/Makefile new file mode 100644 index 0000000..587eaef --- /dev/null +++ b/m7/Makefile @@ -0,0 +1,21 @@ +# Uncomment lines below if you have problems with $PATH +SHELL := /bin/bash +PATH := /usr/local/bin:$(PATH) + +all: + pio -f -c vim run + +upload: + pio -f -c vim run --target upload + +clean: + pio -f -c vim run --target clean + +program: + pio -f -c vim run --target program + +uploadfs: + pio -f -c vim run --target uploadfs + +update: + pio -f -c vim update diff --git a/m7/platformio.ini b/m7/platformio.ini index 8b7cac4..a7c00b7 100644 --- a/m7/platformio.ini +++ b/m7/platformio.ini @@ -11,4 +11,6 @@ [env:giga_r1_m7] platform = ststm32 board = giga_r1_m7 -framework = arduino \ No newline at end of file +framework = arduino + +extra_scripts = pre:gen_compile_commands.py \ No newline at end of file