diff --git a/platform.txt b/platform.txt index 41cab959d6..d7ed5acb0d 100644 --- a/platform.txt +++ b/platform.txt @@ -7,9 +7,33 @@ name=STM32 boards groups (Board to be selected from Tools submenu 'Board part number') version=2.8.0-dev + +# Define variables used multiple times in platform file +# -------------------- +tool_suffix= +tool_suffix.windows=.exe + +busybox= +busybox.windows={runtime.tools.STM32Tools.path}/win/busybox.exe + +toolchain_dir={runtime.tools.xpack-arm-none-eabi-gcc-13.2.1-1.1.path} +openocd_dir={runtime.tools.xpack-openocd-0.12.0-2.path} + +tools_bin_path.windows={runtime.tools.STM32Tools.path}/win +tools_bin_path.macosx={runtime.tools.STM32Tools.path}/macosx +tools_bin_path.linux={runtime.tools.STM32Tools.path}/linux + +core_stm32_dir={build.core.path}/stm32 +core_usb_dir={core_stm32_dir}/usb +hal_dir={build.system.path}/Drivers/{build.series}_HAL_Driver +cmsis_dir={runtime.tools.CMSIS-5.9.0.path}/CMSIS +cmsis_dev_dir={build.system.path}/Drivers/CMSIS/Device/ST/{build.series} +usbd_core_dir={build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core + # STM compile variables # ---------------------- -compiler.stm.extra_include="-I{build.source.path}" "-I{build.core.path}/avr" "-I{build.core.path}/stm32" "-I{build.core.path}/stm32/LL" "-I{build.core.path}/stm32/usb" "-I{build.core.path}/stm32/OpenAMP" "-I{build.core.path}/stm32/usb/hid" "-I{build.core.path}/stm32/usb/cdc" "-I{build.system.path}/Drivers/{build.series}_HAL_Driver/Inc" "-I{build.system.path}/Drivers/{build.series}_HAL_Driver/Src" "-I{build.system.path}/{build.series}" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core/Inc" "-I{build.system.path}/Middlewares/ST/STM32_USB_Device_Library/Core/Src" {build.virtio_extra_include} +compiler.stm.extra_include="-I{build.source.path}" "-I{build.core.path}/avr" "-I{core_stm32_dir}" "-I{core_stm32_dir}/LL" "-I{core_usb_dir}" "-I{core_stm32_dir}/OpenAMP" "-I{core_usb_dir}/hid" "-I{core_usb_dir}/cdc" "-I{hal_dir}/Inc" "-I{hal_dir}/Src" "-I{build.system.path}/{build.series}" "-I{usbd_core_dir}/Inc" "-I{usbd_core_dir}/Src" {build.virtio_extra_include} +compiler.arm.cmsis.c.flags="-I{cmsis_dir}/Core/Include/" "-I{cmsis_dev_dir}/Include/" "-I{cmsis_dev_dir}/Source/Templates/gcc/" "-I{cmsis_dir}/DSP/Include" "-I{cmsis_dir}/DSP/PrivateInclude" compiler.warning_flags=-w compiler.warning_flags.none=-w @@ -23,7 +47,7 @@ compiler.optimization_flags={build.flags.optimize} {build.flags.debug} compiler.optimization_flags.release={build.flags.optimize} {build.flags.debug} compiler.optimization_flags.debug=-Og -g -compiler.path={runtime.tools.xpack-arm-none-eabi-gcc-13.2.1-1.1.path}/bin/ +compiler.path={toolchain_dir}/bin/ compiler.S.cmd=arm-none-eabi-gcc compiler.c.cmd=arm-none-eabi-gcc @@ -75,8 +99,6 @@ compiler.ar.extra_flags= compiler.elf2bin.extra_flags= compiler.elf2hex.extra_flags= -compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-5.9.0.path}/CMSIS/Core/Include/" "-I{build.system.path}/Drivers/CMSIS/Device/ST/{build.series}/Include/" "-I{build.system.path}/Drivers/CMSIS/Device/ST/{build.series}/Source/Templates/gcc/" "-I{runtime.tools.CMSIS-5.9.0.path}/CMSIS/DSP/Include" "-I{runtime.tools.CMSIS-5.9.0.path}/CMSIS/DSP/PrivateInclude" - # USB Flags # --------- build.usb_flags=-DUSBCON {build.usb_speed} -DUSBD_VID={build.vid} -DUSBD_PID={build.pid} -DHAL_PCD_MODULE_ENABLED @@ -122,10 +144,8 @@ build.opt.path={build.path}/sketch/{build.opt.name} extras.path={build.system.path}/extras # Create {build.opt} if not exists in the output sketch dir and force include of SrcWrapper library -recipe.hooks.prebuild.1.pattern="{extras.path}/prebuild.sh" "{build.path}" "{build.source.path}" "{runtime.platform.path}" -recipe.hooks.prebuild.1.pattern.windows="{runtime.tools.STM32Tools.path}/win/busybox.exe" sh "{extras.path}/prebuild.sh" "{build.path}" "{build.source.path}" "{runtime.platform.path}" -recipe.hooks.postbuild.1.pattern="{extras.path}/postbuild.sh" "{build.path}" "{build.series}" "{runtime.platform.path}" -recipe.hooks.postbuild.1.pattern.windows="{runtime.tools.STM32Tools.path}/win/busybox.exe" sh "{extras.path}/postbuild.sh" "{build.path}" "{build.series}" "{runtime.platform.path}" +recipe.hooks.prebuild.1.pattern="{busybox}" sh "{extras.path}/prebuild.sh" "{build.path}" "{build.source.path}" "{runtime.platform.path}" +recipe.hooks.postbuild.1.pattern="{busybox}" sh "{extras.path}/postbuild.sh" "{build.path}" "{build.series}" "{runtime.platform.path}" # compile patterns # --------------------- @@ -149,7 +169,7 @@ recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.f recipe.objcopy.bin.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.elf2bin.flags} {compiler.elf2bin.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin" ## Create output (.hex file) -recipe.objcopy.hex.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" +recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" build.preferred_out_format=bin @@ -170,17 +190,12 @@ recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).* # Upload to board via mass storage tools.massStorageCopy.cmd=massStorageCopy.sh tools.massStorageCopy.cmd.windows=massStorageCopy.bat -tools.massStorageCopy.path={runtime.tools.STM32Tools.path}/win -tools.massStorageCopy.path.macosx={runtime.tools.STM32Tools.path}/macosx -tools.massStorageCopy.path.linux={runtime.tools.STM32Tools.path}/linux tools.massStorageCopy.upload.params.verbose= tools.massStorageCopy.upload.params.quiet= -tools.massStorageCopy.upload.pattern="{path}/{cmd}" {upload.verbose} -I "{build.path}/{build.project_name}.bin" -O "{node}" +tools.massStorageCopy.upload.pattern="{tools_bin_path}/{cmd}" {upload.verbose} -I "{build.path}/{build.project_name}.bin" -O "{node}" # STM32CubeProgrammer upload tools.stm32CubeProg.path={runtime.tools.STM32Tools.path} -tools.stm32CubeProg.busybox= -tools.stm32CubeProg.busybox.windows={path}/win/busybox.exe tools.stm32CubeProg.cmd=stm32CubeProg.sh tools.stm32CubeProg.upload.params.verbose= tools.stm32CubeProg.upload.params.quiet= @@ -188,7 +203,7 @@ tools.stm32CubeProg.upload.pattern="{busybox}" sh "{path}/{cmd}" {upload.protoco # blackmagic upload for generic STM32 tools.bmp_upload.cmd=arm-none-eabi-gdb -tools.bmp_upload.path={runtime.tools.xpack-arm-none-eabi-gcc.path}/bin +tools.bmp_upload.path={toolchain_dir}/bin tools.bmp_upload.upload.speed=230400 tools.bmp_upload.upload.params.verbose=-batch tools.bmp_upload.upload.params.quiet=--batch-silent @@ -198,17 +213,12 @@ tools.bmp_upload.upload.pattern.windows="{path}/{cmd}" -nx -b {upload.speed} {up # HID flash 2.2 (HID bootloader v2.2 for STM32F1 and STM32F4 series) tools.hid_upload.cmd=hid-flash tools.hid_upload.cmd.windows=hid-flash.exe -tools.hid_upload.path={runtime.tools.STM32Tools.path}/win -tools.hid_upload.path.macosx={runtime.tools.STM32Tools.path}/macosx -tools.hid_upload.path.linux={runtime.tools.STM32Tools.path}/linux tools.hid_upload.upload.params.verbose=-d tools.hid_upload.upload.params.quiet=n -tools.hid_upload.upload.pattern="{path}/{cmd}" "{build.path}/{build.project_name}.bin" {serial.port.file} +tools.hid_upload.upload.pattern="{tools_bin_path}/{cmd}" "{build.path}/{build.project_name}.bin" {serial.port.file} # Upload using Maple bootloader over DFU tools.maple_upload.script=maple_upload.sh -tools.maple_upload.busybox= -tools.maple_upload.busybox.windows={path}/win/busybox.exe tools.maple_upload.path={runtime.tools.STM32Tools.path} tools.maple_upload.upload.params.verbose=-d tools.maple_upload.upload.params.quiet=n @@ -216,8 +226,6 @@ tools.maple_upload.upload.pattern="{busybox}" sh "{path}/{script}" {serial.port. # STM32MP1 self-contained shell script tools.remoteproc_gen.path={runtime.tools.STM32Tools.path} -tools.remoteproc_gen.busybox= -tools.remoteproc_gen.busybox.windows={path}/win/busybox.exe tools.remoteproc_gen.script=run_arduino_gen.sh tools.remoteproc_gen.upload.params.verbose= tools.remoteproc_gen.upload.params.quiet= @@ -229,9 +237,9 @@ tools.remoteproc_gen.upload.pattern="{busybox}" sh "{path}/{script}" generate "{ # - this is alpha and may be subject to change without notice debug.executable={build.path}/{build.project_name}.elf debug.toolchain=gcc -debug.toolchain.path={compiler.path} +debug.toolchain.path={toolchain_dir.path}/bin debug.toolchain.prefix=arm-none-eabi- debug.server=openocd -debug.server.openocd.path={runtime.tools.xpack-openocd-0.12.0-2.path}/bin/openocd -debug.server.openocd.scripts_dir={runtime.tools.xpack-openocd-0.12.0-2.path}/openocd/scripts +debug.server.openocd.path={openocd_dir}/bin/openocd +debug.server.openocd.scripts_dir={openocd_dir}/openocd/scripts debug.server.openocd.script={build.path}/openocd.cfg diff --git a/system/extras/postbuild.sh b/system/extras/postbuild.sh index 3588971e4a..36569f1435 100755 --- a/system/extras/postbuild.sh +++ b/system/extras/postbuild.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh - BUILD_PATH="$1" BUILD_SERIE="$2" diff --git a/system/extras/prebuild.sh b/system/extras/prebuild.sh index 91f878c66f..8be41a9035 100755 --- a/system/extras/prebuild.sh +++ b/system/extras/prebuild.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh - BUILD_PATH="$1" BUILD_SOURCE_PATH="$2" @@ -9,20 +9,38 @@ if [ ! -f "$BUILD_PATH/sketch" ]; then mkdir -p "$BUILD_PATH/sketch" fi -# Create empty build.opt if build_opt.h does not exists in the original sketch dir -# Then add or append -fmacro-prefix-map option to change __FILE__ absolute path of -# the board platform folder to a relative path by using '.'. -# (i.e. the folder containing boards.txt) +# Create empty build.opt or clear it if build_opt.h does not exists in the original sketch dir if [ ! -f "$BUILD_SOURCE_PATH/build_opt.h" ]; then - printf '\n-fmacro-prefix-map="%s"=.' "${BOARD_PLATFORM_PATH//\\/\\\\}" > "$BUILD_PATH/sketch/build.opt" + true >"$BUILD_PATH/sketch/build.opt" else # Else copy the build_opt.h as build.opt # Workaround to the header file preprocessing done by arduino-cli # See https://github.com/arduino/arduino-cli/issues/1338 - cp "$BUILD_SOURCE_PATH/build_opt.h" "$BUILD_PATH/sketch/build.opt" - printf '\n-fmacro-prefix-map="%s"=.' "${BOARD_PLATFORM_PATH//\\/\\\\}" >> "$BUILD_PATH/sketch/build.opt" + cp -f "$BUILD_SOURCE_PATH/build_opt.h" "$BUILD_PATH/sketch/build.opt" fi - +# On Windows, need to protect '\' in path +UNAME_OS="$(uname -s)" +case "${UNAME_OS}" in + Windows*) + i=1 + prefix="" + while [ "$i" -le "${#BOARD_PLATFORM_PATH}" ]; do + c=$(printf '%s' "$BOARD_PLATFORM_PATH" | cut -c $i) + prefix=${prefix}${c} + if [ "${c}" = "\\" ]; then + prefix=${prefix}"\\" + fi + i="$((i + 1))" + done + ;; + *) + prefix=${BOARD_PLATFORM_PATH} + ;; +esac +# Then append -fmacro-prefix-map option to change __FILE__ absolute path of +# the board platform folder to a relative path by using '.'. +# (i.e. the folder containing boards.txt) +printf '\n-fmacro-prefix-map="%s"=.' "${prefix}" >>"$BUILD_PATH/sketch/build.opt" # Force include of SrcWrapper library -echo "#include " > "$BUILD_PATH/sketch/SrcWrapper.cpp" +echo "#include " >"$BUILD_PATH/sketch/SrcWrapper.cpp" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy