Initial commit

This commit is contained in:
2024-10-25 21:01:00 +02:00
parent 3f7932870d
commit 42a09c0a91
2865 changed files with 1662903 additions and 0 deletions
.devcontainer
.editorconfig.gitattributes
.github
.gitignore
.vscode
LICENSEMakefile
Marlin
Configuration.hConfiguration_adv.hMakefileMarlin.inoVersion.hconfig.ini
lib
src
HAL
AVR
DUE
ESP32
HAL.h
LINUX
LPC1768
NATIVE_SIM
SAMD21
SAMD51
STM32
STM32F1
TEENSY31_32
TEENSY35_36
TEENSY40_41
platforms.h
shared
MarlinCore.cppMarlinCore.h
core
feature
adc
ammeter.cppammeter.hbabystep.cppbabystep.hbacklash.cppbacklash.hbaricuda.cppbaricuda.h
bedlevel
binary_stream.cppbinary_stream.hbltouch.cppbltouch.hcancel_object.cppcancel_object.hcaselight.cppcaselight.hclosedloop.cppclosedloop.hcontrollerfan.cppcontrollerfan.hcooler.cppcooler.h
dac
digipot
direct_stepping.cppdirect_stepping.he_parser.cppe_parser.heasythreed_ui.cppeasythreed_ui.hencoder_i2c.cppencoder_i2c.hethernet.cppethernet.hfancheck.cppfancheck.hfanmux.cppfanmux.hfilwidth.cppfilwidth.hfwretract.cppfwretract.hhost_actions.cpphost_actions.hhotend_idle.cpphotend_idle.hjoystick.cppjoystick.h
leds
max7219.cppmax7219.hmeatpack.cppmeatpack.hmixing.cppmixing.h
mmu
password
pause.cpppause.hpower.cpppower.hpower_monitor.cpppower_monitor.hpowerloss.cpppowerloss.hprobe_temp_comp.cppprobe_temp_comp.hrepeat.cpprepeat.hrunout.cpprunout.hsolenoid.cppsolenoid.hspindle_laser.cppspindle_laser.hspindle_laser_types.hstepper_driver_safety.cppstepper_driver_safety.htmc_util.cpptmc_util.htramming.cpptramming.htwibus.cpptwibus.hx_twist.cppx_twist.hz_stepper_align.cppz_stepper_align.h
gcode
bedlevel
calibrate
config
control
eeprom
feature
gcode.cppgcode.hgcode_d.cpp
geometry
host
lcd
motion
parser.cppparser.h
probe
queue.cppqueue.h
scara
sd
stats
temp
units
inc
lcd
HD44780
TFTGLCD
buttons.h
dogm
e3v2
extui
anycubic_chiron
anycubic_i3mega
dgus
dgus_reloaded
example
ftdi_eve_touch_ui
archim2-flash
bioprinter
cocoa_press
compat.hconfig.hftdi_eve_extui.cpp
ftdi_eve_lib
generic
about_screen.cppabout_screen.hadvanced_settings_menu.cppadvanced_settings_menu.halert_dialog_box.cppalert_dialog_box.hbacklash_compensation_screen.cppbacklash_compensation_screen.hbase_numeric_adjustment_screen.cppbase_numeric_adjustment_screen.hbase_screen.cppbase_screen.hbed_mesh_base.cppbed_mesh_base.hbed_mesh_edit_screen.cppbed_mesh_edit_screen.hbed_mesh_view_screen.cppbed_mesh_view_screen.hboot_screen.cppboot_screen.hcase_light_screen.cppcase_light_screen.hchange_filament_screen.cppchange_filament_screen.hconfirm_abort_print_dialog_box.cppconfirm_abort_print_dialog_box.hconfirm_auto_calibration_dialog_box.cppconfirm_auto_calibration_dialog_box.hconfirm_erase_flash_dialog_box.cppconfirm_erase_flash_dialog_box.hconfirm_start_print_dialog_box.cppconfirm_start_print_dialog_box.hconfirm_user_request_alert_box.cppconfirm_user_request_alert_box.hcustom_user_menus.cppcustom_user_menus.hdefault_acceleration_screen.cppdefault_acceleration_screen.hdeveloper_menu.cppdeveloper_menu.hdialog_box_base_class.cppdialog_box_base_class.hdisplay_tuning_screen.cppdisplay_tuning_screen.hendstop_state_screen.cppendstop_state_screen.hfeedrate_percent_screen.cppfeedrate_percent_screen.hfilament_menu.cppfilament_menu.hfilament_runout_screen.cppfilament_runout_screen.hfiles_screen.cppfiles_screen.hflow_percent_screen.cppflow_percent_screen.hinterface_settings_screen.cppinterface_settings_screen.hinterface_sounds_screen.cppinterface_sounds_screen.hjerk_screen.cppjerk_screen.hjunction_deviation_screen.cppjunction_deviation_screen.hkill_screen.cppkill_screen.hlanguage_menu.cpplanguage_menu.hleveling_menu.cppleveling_menu.hlinear_advance_screen.cpplinear_advance_screen.hlock_screen.cpplock_screen.hmain_menu.cppmain_menu.hmax_acceleration_screen.cppmax_acceleration_screen.hmax_velocity_screen.cppmax_velocity_screen.hmedia_player_screen.cppmedia_player_screen.hmove_axis_screen.cppmove_axis_screen.hnozzle_offsets_screen.cppnozzle_offsets_screen.hnudge_nozzle_screen.cppnudge_nozzle_screen.hrestore_failsafe_dialog_box.cpprestore_failsafe_dialog_box.hsave_settings_dialog_box.cppsave_settings_dialog_box.hscreens.hspinner_dialog_box.cppspinner_dialog_box.hstatistics_screen.cppstatistics_screen.hstatus_screen.cppstatus_screen.hstepper_bump_sensitivity_screen.cppstepper_bump_sensitivity_screen.hstepper_current_screen.cppstepper_current_screen.hsteps_screen.cppsteps_screen.hstress_test_screen.cppstress_test_screen.hstring_format.cppstring_format.htemperature_screen.cpptemperature_screen.htouch_calibration_screen.cpptouch_calibration_screen.htouch_registers_screen.cpptouch_registers_screen.htune_menu.cpptune_menu.hwidget_demo_screen.cppwidget_demo_screen.hz_offset_screen.cppz_offset_screen.h
language
pin_mappings.hscreen_data.hscreens.cppscreens.h
theme
malyan
mks_ui
SPIFlashStorage.cppSPIFlashStorage.hSPI_TFT.cppSPI_TFT.hdraw_about.cppdraw_about.hdraw_acceleration_settings.cppdraw_acceleration_settings.hdraw_advance_settings.cppdraw_advance_settings.hdraw_auto_level_offset_settings.cppdraw_auto_level_offset_settings.hdraw_baby_stepping.cppdraw_baby_stepping.hdraw_change_speed.cppdraw_change_speed.hdraw_cloud_bind.cppdraw_cloud_bind.hdraw_dialog.cppdraw_dialog.hdraw_eeprom_settings.cppdraw_eeprom_settings.hdraw_encoder_settings.cppdraw_encoder_settings.hdraw_error_message.cppdraw_error_message.hdraw_extrusion.cppdraw_extrusion.hdraw_fan.cppdraw_fan.hdraw_filament_change.cppdraw_filament_change.hdraw_filament_settings.cppdraw_filament_settings.hdraw_gcode.cppdraw_gcode.hdraw_home.cppdraw_home.hdraw_homing_sensitivity_settings.cppdraw_homing_sensitivity_settings.hdraw_jerk_settings.cppdraw_jerk_settings.hdraw_keyboard.cppdraw_keyboard.hdraw_language.cppdraw_language.hdraw_level_settings.cppdraw_level_settings.hdraw_machine_para.cppdraw_machine_para.hdraw_machine_settings.cppdraw_machine_settings.hdraw_manuaLevel.cppdraw_manuaLevel.hdraw_max_feedrate_settings.cppdraw_max_feedrate_settings.hdraw_media_select.cppdraw_media_select.hdraw_more.cppdraw_more.hdraw_motor_settings.cppdraw_motor_settings.hdraw_move_motor.cppdraw_move_motor.hdraw_number_key.cppdraw_number_key.hdraw_operation.cppdraw_operation.hdraw_pause_message.cppdraw_pause_message.hdraw_pause_position.cppdraw_pause_position.hdraw_preHeat.cppdraw_preHeat.hdraw_print_file.cppdraw_print_file.hdraw_printing.cppdraw_printing.hdraw_ready_print.cppdraw_ready_print.hdraw_set.cppdraw_set.hdraw_step_settings.cppdraw_step_settings.hdraw_tmc_current_settings.cppdraw_tmc_current_settings.hdraw_tmc_step_mode_settings.cppdraw_tmc_step_mode_settings.hdraw_tool.cppdraw_tool.hdraw_touch_calibration.cppdraw_touch_calibration.hdraw_tramming_pos_settings.cppdraw_tramming_pos_settings.hdraw_ui.cppdraw_ui.hdraw_wifi.cppdraw_wifi.hdraw_wifi_list.cppdraw_wifi_list.hdraw_wifi_settings.cppdraw_wifi_settings.hdraw_wifi_tips.cppdraw_wifi_tips.hdraw_z_offset_wizard.cppdraw_z_offset_wizard.hgb2312_puhui16.cppirq_overrid.cppmks_hardware.cppmks_hardware.hpic_manager.cpppic_manager.hprinter_operation.cppprinter_operation.htft_Language_en.htft_Language_fr.htft_Language_it.htft_Language_ru.htft_Language_s_cn.htft_Language_sp.htft_Language_t_cn.htft_lvgl_configuration.cpptft_lvgl_configuration.htft_multi_language.cpptft_multi_language.hwifiSerial.hwifiSerial_STM32.cppwifiSerial_STM32.hwifiSerial_STM32F1.cppwifiSerial_STM32F1.hwifi_module.cppwifi_module.hwifi_upload.cppwifi_upload.h
nextion
ui_api.cppui_api.h
language
lcdprint.cpplcdprint.hmarlinui.cppmarlinui.h
menu
scaled_tft.h
tft
bitmaps
canvas.cppcanvas.h
fontdata
images
tft.cpptft.htft_color.htft_image.cpptft_image.htft_queue.cpptft_queue.htft_string.cpptft_string.htouch.cpptouch.hui_1024x600.cppui_1024x600.hui_320x240.cppui_320x240.hui_480x320.cppui_480x320.hui_common.cppui_common.h
tft_io
thermistornames.h
touch
utf8.cpputf8.h
libs
module
pins
esp32
gd32f1
linux
lpc1768
lpc1769
mega
pins.hpinsDebug.hpinsDebug_list.hpins_postprocess.h
rambo
ramps
sam
samd
sanguino
sensitive_pins.h
stm32f0
stm32f1
stm32f4
stm32f7
stm32g0
stm32h7
teensy2
teensy3
teensy4
sd
tests
buildroot
bin
etc
share
PlatformIO
boards
debugging
ldscripts
scripts
variants
MARLIN_ARCHIM
MARLIN_ARTILLERY_RUBY
MARLIN_BIGTREE_BTT002
MARLIN_BIGTREE_E3_RRF
MARLIN_BIGTREE_GTR_V1
MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429
MARLIN_BIGTREE_OCTOPUS_V1
MARLIN_BIGTREE_SKR_PRO_11
MARLIN_BTT_EBB42_V1_1
MARLIN_BTT_SKR_SE_BX
MARLIN_CREALITY_STM32F401RC
MARLIN_CREALITY_STM32F401RE
MARLIN_F103Rx
MARLIN_F103VE_LONGER
MARLIN_F103Vx
MARLIN_F103Zx
MARLIN_F401RC
MARLIN_F407VE
MARLIN_F407ZE
MARLIN_F446VE
MARLIN_F446Zx_TRONXY
MARLIN_F4x7Vx
MARLIN_FLY_F407ZG
MARLIN_FYSETC_CHEETAH_V20
MARLIN_FYSETC_S6
MARLIN_FYSETC_SPIDER_KING407
MARLIN_G0B1RE
MARLIN_G0B1VE
MARLIN_H723VG
MARLIN_H723ZE
MARLIN_H743VI
MARLIN_LERDGE
MARLIN_MEGA_EXTENDED
MARLIN_MKS_ROBIN2
MARLIN_MKS_SKIPR_V1
MARLIN_TH3D_EZBOARD_V2
marlin_maple_CHITU_F103
marlin_maple_MEEB_3DP
cmake
dwin
bin
icons-3
icons-4
icons-7
000-ICON_LOGO_Creality.jpg001-ICON_Print_0.jpg002-ICON_Print_1.jpg003-ICON_Prepare_0.jpg004-ICON_Prepare_1.jpg005-ICON_Control_0.jpg006-ICON_Control_1.jpg007-ICON_Leveling_0.jpg008-ICON_Leveling_1.jpg009-ICON_HotendTemp.jpg010-ICON_BedTemp.jpg011-ICON_Speed.jpg012-ICON_Zoffset.jpg013-ICON_Back.jpg014-ICON_File.jpg015-ICON_PrintTime.jpg016-ICON_RemainTime.jpg017-ICON_Setup_0.jpg018-ICON_Setup_1.jpg019-ICON_Pause_0.jpg020-ICON_Pause_1.jpg021-ICON_Continue_0.jpg022-ICON_Continue_1.jpg023-ICON_Stop_0.jpg024-ICON_Stop_1.jpg025-ICON_Bar.jpg026-ICON_More.jpg027-ICON_Axis.jpg028-ICON_CloseMotor.jpg029-ICON_Homing.jpg030-ICON_SetHome.jpg031-ICON_PLAPreheat.jpg032-ICON_ABSPreheat.jpg033-ICON_Cool.jpg034-ICON_Language.jpg035-ICON_MoveX.jpg036-ICON_MoveY.jpg037-ICON_MoveZ.jpg038-ICON_Extruder.jpg040-ICON_Temperature.jpg041-ICON_Motion.jpg042-ICON_WriteEEPROM.jpg043-ICON_ReadEEPROM.jpg044-ICON_ResetEEPROM.jpg045-ICON_Info.jpg046-ICON_SetEndTemp.jpg047-ICON_SetBedTemp.jpg048-ICON_FanSpeed.jpg049-ICON_SetPLAPreheat.jpg050-ICON_SetABSPreheat.jpg051-ICON_MaxSpeed.jpg052-ICON_MaxAccelerated.jpg053-ICON_MaxJerk.jpg054-ICON_Step.jpg055-ICON_PrintSize.jpg056-ICON_Version.jpg057-ICON_Contact.jpg058-ICON_StockConfiguraton.jpg059-ICON_MaxSpeedX.jpg060-ICON_MaxSpeedY.jpg061-ICON_MaxSpeedZ.jpg062-ICON_MaxSpeedE.jpg063-ICON_MaxAccX.jpg064-ICON_MaxAccY.jpg065-ICON_MaxAccZ.jpg066-ICON_MaxAccE.jpg067-ICON_MaxSpeedJerkX.jpg068-ICON_MaxSpeedJerkY.jpg069-ICON_MaxSpeedJerkZ.jpg070-ICON_MaxSpeedJerkE.jpg071-ICON_StepX.jpg072-ICON_StepY.jpg073-ICON_StepZ.jpg074-ICON_StepE.jpg075-ICON_Setspeed.jpg076-ICON_SetZOffset.jpg077-ICON_Rectangle.jpg078-ICON_BLTouch.jpg079-ICON_TempTooLow.jpg080-ICON_AutoLeveling.jpg081-ICON_TempTooHigh.jpg082-ICON_NoTips_C.jpg083-ICON_NoTips_E.jpg084-ICON_Continue_C.jpg085-ICON_Continue_E.jpg086-ICON_Cancel_C.jpg087-ICON_Cancel_E.jpg088-ICON_Confirm_C.jpg089-ICON_Confirm_E.jpg090-ICON_Info_0.jpg091-ICON_Info_1.jpg
icons-svg
make_jpgs.sh
extras
fonts
git
pin_interrupt_test
pixmaps
scripts
sublime
vscode
test-gcode
tests
web-ui
config
docker
docs
ini
platformio.iniprocess-palette.json

1
buildroot/bin/.gitattributes vendored Normal file

@ -0,0 +1 @@
* text=auto eol=lf

173
buildroot/bin/build_all_examples Executable file

@ -0,0 +1,173 @@
#!/usr/bin/env bash
#
# Usage:
#
# build_all_examples [-b|--branch=<branch>] - Branch to fetch from Configurations repo
# [-c|--continue] - Continue the paused build
# [-d|--debug] - Print extra debug output
# [-i|--ini] - Archive ini/json/yml files in the temp config folder
# [-l|--limit=#] - Limit the number of builds in this run
# [-n|--nobuild] - Don't actually build anything.
# [-r|--resume=<path>] - Start at some config in the filesystem order
# [-s|--skip] - Do the thing
#
# build_all_examples [...] branch [resume-from]
#
HERE=`dirname $0`
. "$HERE/mfutil"
GITREPO=https://github.com/MarlinFirmware/Configurations.git
STAT_FILE=./.pio/.buildall
usage() { echo "
Usage: $SELF [-b|--branch=<branch>] [-d|--debug] [-i|--ini] [-r|--resume=<path>]
$SELF [-b|--branch=<branch>] [-d|--debug] [-i|--ini] [-c|--continue]
$SELF [-b|--branch=<branch>] [-d|--debug] [-i|--ini] [-s|--skip]
$SELF [-b|--branch=<branch>] [-d|--debug] [-n|--nobuild]
$SELF [...] branch [resume-point]
"
}
# Assume the most recent configs
BRANCH=import-2.1.x
unset FIRST_CONF
EXIT_USAGE=
LIMIT=1000
while getopts 'b:cdhil:nqr:sv-:' OFLAG; do
case "${OFLAG}" in
b) BRANCH=$OPTARG ; bugout "Branch: $BRANCH" ;;
r) FIRST_CONF="$OPTARG" ; bugout "Resume: $FIRST_CONF" ;;
c) CONTINUE=1 ; bugout "Continue" ;;
s) CONTSKIP=1 ; bugout "Continue, skipping" ;;
i) COPY_INI=1 ; bugout "Archive INI/JSON/YML files" ;;
h) EXIT_USAGE=1 ; break ;;
l) LIMIT=$OPTARG ; bugout "Limit to $LIMIT build(s)" ;;
d|v) DEBUG=1 ; bugout "Debug ON" ;;
n) DRYRUN=1 ; bugout "Dry Run" ;;
-) IFS="=" read -r ONAM OVAL <<< "$OPTARG"
case "$ONAM" in
branch) BRANCH=$OVAL ; bugout "Branch: $BRANCH" ;;
resume) FIRST_CONF="$OVAL" ; bugout "Resume: $FIRST_CONF" ;;
continue) CONTINUE=1 ; bugout "Continue" ;;
skip) CONTSKIP=2 ; bugout "Continue, skipping" ;;
limit) LIMIT=$OVAL ; bugout "Limit to $LIMIT build(s)" ;;
ini) COPY_INI=1 ; bugout "Archive INI/JSON/YML files" ;;
help) [[ -z "$OVAL" ]] || perror "option can't take value $OVAL" $ONAM ; EXIT_USAGE=1 ;;
debug) DEBUG=1 ; bugout "Debug ON" ;;
nobuild) DRYRUN=1 ; bugout "Dry Run" ;;
*) EXIT_USAGE=2 ; echo "$SELF: unrecognized option \`--$ONAM'" ; break ;;
esac
;;
*) EXIT_USAGE=2 ; break ;;
esac
done
# Extra arguments count as BRANCH, FIRST_CONF
shift $((OPTIND - 1))
[[ $# > 0 ]] && { BRANCH=$1 ; shift 1 ; bugout "BRANCH=$BRANCH" ; }
[[ $# > 0 ]] && { FIRST_CONF=$1 ; shift 1 ; bugout "FIRST_CONF=$FIRST_CONF" ; }
[[ $# > 0 ]] && { EXIT_USAGE=2 ; echo "too many arguments" ; }
((EXIT_USAGE)) && { usage ; let EXIT_USAGE-- ; exit $EXIT_USAGE ; }
echo "This script downloads each Configuration and attempts to build it."
echo "On failure the last-built configs will be left in your working copy."
echo "Restore your configs with 'git checkout -f' or 'git reset --hard HEAD'."
if [[ -f "$STAT_FILE" ]]; then
IFS='*' read BRANCH FIRST_CONF <"$STAT_FILE"
fi
# If -c is given start from the last attempted build
if ((CONTINUE)); then
if [[ -z $BRANCH || -z $FIRST_CONF ]]; then
echo "Nothing to continue"
exit
fi
elif ((CONTSKIP)); then
if [[ -n $BRANCH && -n $FIRST_CONF ]]; then
SKIP_CONF=1
else
echo "Nothing to skip"
exit
fi
fi
# Check if the current repository has unmerged changes
if [[ $SKIP_CONF ]]; then
echo "Skipping $FIRST_CONF"
elif [[ $FIRST_CONF ]]; then
echo "Resuming from $FIRST_CONF"
else
git diff --quiet || { echo "The working copy is modified. Commit or stash changes before proceeding."; exit ; }
fi
# Create a temporary folder inside .pio
TMP=./.pio/build-$BRANCH
[[ -d "$TMP" ]] || mkdir -p $TMP
# Download Configurations into the temporary folder
if [[ ! -e "$TMP/README.md" ]]; then
echo "Fetching Configurations from GitHub to $TMP"
git clone --depth=1 --single-branch --branch "$BRANCH" $GITREPO "$TMP" || { echo "Failed to clone the configuration repository"; exit ; }
else
echo "Using cached Configurations at $TMP"
fi
echo -e "Start build...\n====================="
shopt -s nullglob
IFS='
'
CONF_TREE=$( ls -d "$TMP"/config/examples/*/ "$TMP"/config/examples/*/*/ "$TMP"/config/examples/*/*/*/ "$TMP"/config/examples/*/*/*/*/ | grep -vE ".+\.(\w+)$" )
for CONF in $CONF_TREE ; do
# Get a config's directory name
DIR=$( echo $CONF | "$SED" "s|$TMP/config/examples/||" )
# If looking for a config, skip others
[[ $FIRST_CONF ]] && [[ $FIRST_CONF != $DIR && "$FIRST_CONF/" != $DIR ]] && continue
# Once found, stop looking
unset FIRST_CONF
# If skipping, don't build the found one
[[ $SKIP_CONF ]] && { unset SKIP_CONF ; continue ; }
# ...if skipping, don't build this one
compgen -G "${CONF}Con*.h" > /dev/null || continue
# Build or print build command for --nobuild
if [[ $DRYRUN ]]; then
echo -e "\033[0;32m[DRYRUN] build_example internal \"$TMP\" \"$DIR\"\033[0m"
else
# Remember where we are in case of failure
echo "${BRANCH}*${DIR}" >"$STAT_FILE"
# Build folder is unknown so delete all report files
if [[ $COPY_INI ]]; then
IFIND='find ./.pio/build/ -name "config.ini" -o -name "schema.json" -o -name "schema.yml"'
$IFIND -exec rm "{}" \;
fi
((DEBUG)) && echo "\"$HERE/build_example\" internal \"$TMP\" \"$DIR\""
"$HERE/build_example" internal "$TMP" "$DIR" || { echo "Failed to build $DIR"; exit ; }
# Build folder is unknown so copy all report files
[[ $COPY_INI ]] && $IFIND -exec cp "{}" "$CONF" \;
fi
((--LIMIT)) || { echo "Limit reached" ; PAUSE=1 ; break ; }
done
# Delete the build state if not paused early
[[ $PAUSE ]] || rm "$STAT_FILE"
# Delete the temp folder if not preserving generated INI files
if [[ -e "$TMP/config/examples" ]]; then
if [[ $COPY_INI ]]; then
OPEN=$( which gnome-open xdg-open open | head -n1 )
$OPEN "$TMP"
elif [[ ! $PAUSE ]]; then
rm -rf "$TMP"
fi
fi

43
buildroot/bin/build_example Executable file

@ -0,0 +1,43 @@
#!/usr/bin/env bash
#
# build_example
#
# Usage: build_example internal config-home config-folder
#
HERE=`dirname $0`
. "$HERE/mfutil"
# Require 'internal' as the first argument
[[ "$1" == "internal" ]] || { echo "Don't call this script directly, use build_all_examples instead." ; exit 1 ; }
echo "Testing $3:"
SUB=$2/config/examples/$3
[[ -d "$SUB" ]] || { echo "$SUB is not a good path" ; exit 1 ; }
compgen -G "${SUB}Con*.h" > /dev/null || { echo "No configuration files found in $SUB" ; exit 1 ; }
echo "Getting configuration files from $SUB"
cp "$2/config/default"/*.h Marlin/
cp "$SUB"/Configuration.h Marlin/ 2>/dev/null
cp "$SUB"/Configuration_adv.h Marlin/ 2>/dev/null
cp "$SUB"/_Bootscreen.h Marlin/ 2>/dev/null
cp "$SUB"/_Statusscreen.h Marlin/ 2>/dev/null
set -e
# Strip #error lines from Configuration.h
IFS=$'\n'; set -f
$SED -i~ -e "20,30{/#error/d}" Marlin/Configuration.h
rm Marlin/Configuration.h~
unset IFS; set +f
# Suppress fatal warnings
echo -e "\n#define NO_CONTROLLER_CUSTOM_WIRING_WARNING" >> Marlin/Configuration.h
echo "Building the firmware now..."
"$HERE/mftest" -s -a -n1 || { echo "Failed"; exit 1; }
echo "Success"

14
buildroot/bin/ci_src_filter Executable file

@ -0,0 +1,14 @@
#!/usr/bin/env bash
# exit on first failure
set -e
SED=$(which gsed sed | head -n1)
FN="platformio.ini"
if [[ $1 == "-n" ]]; then
"${SED}" -i "s/default_src_filter/org_src_filter/" $FN
"${SED}" -i "/org_src_filter/ s/^/default_src_filter = +<src\/*>\n/" $FN
else
git checkout $FN 2>/dev/null
fi

30
buildroot/bin/format_code Executable file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
#
# format_code [dir/file...]
#
HERE=`dirname $0`
while [[ $# -gt 0 ]]; do
val="$1"
if [ -d "$val" ]; then
find $val -name *.cpp -exec "$HERE/uncrust" '{}' \;
elif [ -d "./Marlin/src/$val" ]; then
find "./Marlin/src/$val" -name *.cpp -exec "$HERE/uncrust" '{}' \;
elif [ -f "./Marlin/src/$val" ]; then
uncrust "./Marlin/src/$val"
elif [ -f "$val" ]; then
uncrust "$val"
fi
done

132
buildroot/bin/generate_version Executable file

@ -0,0 +1,132 @@
#!/usr/bin/env bash
#
# generate_version
#
# Make a Version.h file to accompany CUSTOM_VERSION_FILE
#
# Authors: jbrazio, thinkyhead, InsanityAutomation, rfinnie
#
set -e
DIR="${1:-Marlin}"
READ_FILE="${READ_FILE:-${DIR}/Version.h}"
WRITE_FILE="${WRITE_FILE:-${READ_FILE}}"
BRANCH="$(git -C "${DIR}" symbolic-ref -q --short HEAD 2>/dev/null || true)"
VERSION="$(git -C "${DIR}" describe --tags --first-parent 2>/dev/null || true)"
STRING_DISTRIBUTION_DATE="${STRING_DISTRIBUTION_DATE:-$(date '+%Y-%m-%d %H:%M')}"
SHORT_BUILD_VERSION="${SHORT_BUILD_VERSION:-${BRANCH}}"
DETAILED_BUILD_VERSION="${DETAILED_BUILD_VERSION:-${BRANCH}-${VERSION}}"
# Gets some misc options from their defaults
DEFAULT_MACHINE_UUID="${DEFAULT_MACHINE_UUID:-$(awk -F'"' \
'/#define DEFAULT_MACHINE_UUID/{ print $2 }' < "${READ_FILE}")}"
MACHINE_NAME="${MACHINE_NAME:-$(awk -F'"' \
'/#define MACHINE_NAME/{ print $2 }' < "${READ_FILE}")}"
PROTOCOL_VERSION="${PROTOCOL_VERSION:-$(awk -F'"' \
'/#define PROTOCOL_VERSION/{ print $2 }' < "${READ_FILE}")}"
SOURCE_CODE_URL="${SOURCE_CODE_URL:-$(awk -F'"' \
'/#define SOURCE_CODE_URL/{ print $2 }' < "${READ_FILE}")}"
WEBSITE_URL="${WEBSITE_URL:-$(awk -F'"' \
'/#define WEBSITE_URL/{ print $2 }' < "${READ_FILE}")}"
cat > "${WRITE_FILE}" <<EOF
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* THIS FILE IS AUTOMATICALLY GENERATED DO NOT MANUALLY EDIT IT.
* IT DOES NOT GET COMMITTED TO THE REPOSITORY.
*
* Branch: ${BRANCH}
* Version: ${VERSION}
*/
/**
* Marlin release version identifier
*/
#ifndef SHORT_BUILD_VERSION
#define SHORT_BUILD_VERSION "${SHORT_BUILD_VERSION}"
#endif
/**
* Verbose version identifier which should contain a reference to the location
* from where the binary was downloaded or the source code was compiled.
*/
#ifndef DETAILED_BUILD_VERSION
#define DETAILED_BUILD_VERSION "${DETAILED_BUILD_VERSION}"
#endif
/**
* The STRING_DISTRIBUTION_DATE represents when the binary file was built,
* here we define this default string as the date where the latest release
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "${STRING_DISTRIBUTION_DATE}"
#endif
/**
* The protocol for communication to the host. Protocol indicates communication
* standards such as the use of ASCII, "echo:" and "error:" line prefixes, etc.
* (Other behaviors are given by the firmware version and capabilities report.)
*/
#ifndef PROTOCOL_VERSION
#define PROTOCOL_VERSION "${PROTOCOL_VERSION}"
#endif
/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
*/
#ifndef MACHINE_NAME
#define MACHINE_NAME "${MACHINE_NAME}"
#endif
/**
* The SOURCE_CODE_URL is the location where users will find the Marlin Source
* Code which is installed on the device. In most cases —unless the manufacturer
* has a distinct Github fork— the Source Code URL should just be the main
* Marlin repository.
*/
#ifndef SOURCE_CODE_URL
#define SOURCE_CODE_URL "${SOURCE_CODE_URL}"
#endif
/**
* Default generic printer UUID.
*/
#ifndef DEFAULT_MACHINE_UUID
#define DEFAULT_MACHINE_UUID "${DEFAULT_MACHINE_UUID}"
#endif
/**
* The WEBSITE_URL is the location where users can get more information such as
* documentation about a specific Marlin release.
*/
#ifndef WEBSITE_URL
#define WEBSITE_URL "${WEBSITE_URL}"
#endif
EOF

340
buildroot/bin/mftest Executable file

@ -0,0 +1,340 @@
#!/usr/bin/env bash
#
# mftest Select a test to apply and build
# mftest -b [#] Build the auto-detected environment
# mftest -u [#] Upload the auto-detected environment
# mftest -tname -n# [-y] Set config options and optionally build a test
#
[[ -d Marlin/src ]] || { echo "Please 'cd' to the Marlin repo root." ; exit 1 ; }
which pio || { echo "Make sure 'pio' is in your execution PATH." ; exit 1 ; }
perror() { echo -e "$0: \033[0;31m$1 -- $2\033[0m" ; }
errout() { echo -e "\033[0;31m$1\033[0m" ; }
bugout() { ((DEBUG)) && echo -e "\033[0;32m$1\033[0m" ; }
usage() {
echo "
Usage: mftest [-t|--env=<env|index>] [-n|--num=<num>] [-m|--make] [-y|--build=<Y|n>]
mftest [-a|--autobuild]
mftest [-r|--rebuild]
mftest [-s|--silent]
mftest [-u|--autoupload] [-n|--num=<num>]
OPTIONS
-t --env The environment to apply / run, or the menu index number.
-n --num The index of the test to run. (In file order.)
-m --make Use the make / Docker method for the build.
-y --build Skip 'Do you want to build this test?' and assume YES.
-h --help Print this help.
-a --autobuild PIO Build using the MOTHERBOARD environment.
-u --autoupload PIO Upload using the MOTHERBOARD environment.
-v --verbose Extra output for debugging.
-s --silent Silence build output from PlatformIO.
-d --default Restore to defaults before applying configs.
env shortcuts: tree due esp lin lp8|lpc8 lp9|lpc9 m128 m256|mega stm|f1 f4 f7 s6 teensy|t31|t32 t35|t36 t40|t41
"
}
TESTPATH=buildroot/tests
STATE_FILE="./.pio/.mftestrc"
SED=$(which gsed sed | head -n1)
shopt -s extglob nocasematch
# Matching patterns
ISNUM='^[0-9]+$'
ISRST='^(restore)_'
ISCMD='^(restore|opt|exec|use|pins|env)_'
ISEXEC='^exec_'
ISCONT='\\ *$'
# Get environment, test number, etc. from the command
TESTENV='-'
CHOICE=0
DEBUG=0
while getopts 'abdhmrsuvyn:t:-:' OFLAG; do
case "${OFLAG}" in
a) AUTO_BUILD=1 ; bugout "Auto-Build target..." ;;
d) DL_DEFAULTS=1 ; bugout "Restore to defaults..." ;;
h) EXIT_USAGE=1 ;;
m) USE_MAKE=1 ; bugout "Using make with Docker..." ;;
n) case "$OPTARG" in
*[!0-9]*) perror "option requires a number" $OFLAG ; EXIT_USAGE=2 ;;
*) CHOICE="$OPTARG" ; bugout "Got a number: $CHOICE" ;;
esac
;;
r) REBUILD=1 ; bugout "Rebuilding previous..." ;;
s) SILENT_FLAG="-s" ;;
t) TESTENV="$OPTARG" ; bugout "Got a target: $TESTENV" ;;
u) AUTO_BUILD=2 ; bugout "Auto-Upload target..." ;;
v) DEBUG=1 ; bugout "Debug ON" ;;
y) BUILD_YES='Y' ; bugout "Build will initiate..." ;;
-) IFS="=" read -r ONAM OVAL <<< "$OPTARG"
case "$ONAM" in
help) [[ -z "$OVAL" ]] || perror "option can't take value $OVAL" $ONAM ; EXIT_USAGE=1 ;;
autobuild) AUTO_BUILD=1 ; bugout "Auto-Build target..." ;;
autoupload) AUTO_BUILD=2 ; bugout "Auto-Upload target..." ;;
env) case "$OVAL" in
'') perror "option requires a value" $ONAM ; EXIT_USAGE=2 ;;
*) TESTENV="$OVAL" ; bugout "Got a target: $TESTENV" ;;
esac
;;
num) case "$OVAL" in
[0-9]+) CHOICE="$OVAL" ; bugout "Got a number: $CHOICE" ;;
*) perror "option requires a value" $ONAM ; EXIT_USAGE=2 ;;
esac
;;
rebuild) REBUILD=1 ; bugout "Rebuilding previous..." ;;
silent) SILENT_FLAG="-s" ;;
make) USE_MAKE=1 ; bugout "Using make with Docker..." ;;
debug|verbose) DEBUG=1 ; bugout "Debug ON" ;;
default) DL_DEFAULTS=1 ; bugout "Restore to defaults..." ;;
build) case "$OVAL" in
''|y|yes) BUILD_YES='Y' ;;
n|no) BUILD_YES='N' ;;
*) perror "option value must be y, n, yes, or no" $ONAM ; EXIT_USAGE=2 ;;
esac
bugout "Build will initiate? ($BUILD_YES)"
;;
*) perror "Unknown flag" "$OPTARG" ; EXIT_USAGE=2 ;;
esac
;;
*) EXIT_USAGE=2 ;;
esac
done
((EXIT_USAGE)) && { usage ; let EXIT_USAGE-- ; exit $EXIT_USAGE ; }
if ((REBUILD)); then
bugout "Rebuilding previous..."
# Build with the last-built env
[[ -f "$STATE_FILE" ]] || { errout "No previous (-r) build state found." ; exit 1 ; }
read TESTENV <"$STATE_FILE"
pio run $SILENT_FLAG -d . -e $TESTENV
exit 0
fi
case $TESTENV in
tree) pio run -d . -e include_tree ; exit 1 ;;
due) TESTENV='DUE' ;;
esp) TESTENV='esp32' ;;
lin*) TESTENV='linux_native' ;;
lp8|lpc8) TESTENV='LPC1768' ;;
lp9|lpc9) TESTENV='LPC1769' ;;
m128) TESTENV='mega1280' ;;
m256) TESTENV='mega2560' ;;
mega) TESTENV='mega2560' ;;
stm) TESTENV='STM32F103RE' ;;
f1) TESTENV='STM32F103RE' ;;
f4) TESTENV='STM32F4' ;;
f7) TESTENV='STM32F7' ;;
s6) TESTENV='FYSETC_S6' ;;
teensy) TESTENV='teensy31' ;;
t31) TESTENV='teensy31' ;;
t32) TESTENV='teensy31' ;;
t35) TESTENV='teensy35' ;;
t36) TESTENV='teensy35' ;;
t40) TESTENV='teensy41' ;;
t41) TESTENV='teensy41' ;;
[1-9]|[1-9][0-9]) TESTNUM=$TESTENV ; TESTENV=- ;;
esac
if ((AUTO_BUILD)); then
#
# List environments that apply to the current MOTHERBOARD.
#
case $(uname | tr '[:upper:]' '[:lower:]') in
darwin) SYS='mac' ;;
*linux) SYS='lin' ;;
win*) SYS='win' ;;
msys*) SYS='win' ;;
cygwin*) SYS='win' ;;
mingw*) SYS='win' ;;
*) SYS='uni' ;;
esac
echo ; echo -n "Auto " ; ((AUTO_BUILD == 2)) && echo "Upload..." || echo "Build..."
MB=$( grep -E "^\s*#define MOTHERBOARD" Marlin/Configuration.h | awk '{ print $3 }' | $SED 's/BOARD_//;s/\r//' )
[[ -z $MB ]] && { echo "Error - Can't read MOTHERBOARD setting." ; exit 1 ; }
BLINE=$( grep -E "define\s+BOARD_$MB\b" Marlin/src/core/boards.h )
BNUM=$( $SED -E 's/^.+BOARD_[^ ]+ +([0-9]+).+$/\1/' <<<"$BLINE" )
BDESC=$( $SED -E 's/^.+\/\/ *(.+)$/\1/' <<<"$BLINE" )
[[ -z $BNUM ]] && { echo "Error - Can't find BOARD_$MB in core/boards.h." ; exit 1 ; }
ENVS=( $( grep -EA1 "MB\(.*\b$MB\b.*\)" Marlin/src/pins/pins.h | grep -E "#include.+//.+(env|$SYS):[^ ]+" | grep -oE "(env|$SYS):[^ ]+" | $SED -E "s/(env|$SYS)://" ) )
[[ -z $ENVS ]] && { errout "Error - Can't find target(s) for $MB ($BNUM)." ; exit 1 ; }
ECOUNT=${#ENVS[*]}
if [[ $ECOUNT == 1 ]]; then
TARGET=$ENVS
else
if [[ $CHOICE == 0 ]]; then
# List env names and numbers. Get selection.
echo "Available targets for \"$BDESC\" | $MB ($BNUM):"
IND=0 ; for ENV in "${ENVS[@]}"; do let IND++ ; echo " $IND) $ENV" ; done
if [[ $ECOUNT > 1 ]]; then
for (( ; ; ))
do
read -p "Select a target for '$MB' (1-$ECOUNT) : " CHOICE
[[ -z "$CHOICE" ]] && { echo '(canceled)' ; exit 1 ; }
[[ $CHOICE =~ $ISNUM ]] && ((CHOICE >= 1 && CHOICE <= ECOUNT)) && break
errout ">>> Invalid environment choice '$CHOICE'."
done
echo
fi
else
echo "Detected \"$BDESC\" | $MB ($BNUM)."
[[ $CHOICE > $ECOUNT ]] && { echo "Environment selection out of range." ; exit 1 ; }
fi
TARGET="${ENVS[$CHOICE-1]}"
echo "Selected $TARGET"
fi
echo "$TARGET" >"$STATE_FILE"
if ((AUTO_BUILD == 2)); then
echo "Uploading environment $TARGET for board $MB ($BNUM)..." ; echo
pio run $SILENT_FLAG -t upload -e $TARGET
else
echo "Building environment $TARGET for board $MB ($BNUM)..." ; echo
pio run $SILENT_FLAG -e $TARGET
fi
exit $?
fi
#
# List available tests and ask for selection
#
if [[ $TESTENV == '-' ]]; then
IND=0
NAMES=()
MENU=()
BIGLEN=0
for FILE in $( ls -1 $TESTPATH/* | sort -f )
do
let IND++
TNAME=${FILE/$TESTPATH\//}
NAMES+=($TNAME)
IFS=""
ITEM=$( printf "%2i) %s" $IND $TNAME )
MENU+=($ITEM)
[[ ${#ITEM} -gt $BIGLEN ]] && BIGLEN=${#ITEM}
done
(( BIGLEN += 2 ))
THIRD=$(( (${#MENU[@]} + 2) / 3 ))
for ((i = 0; i < $THIRD; i++))
do
COL1=$i ; COL2=$(( $i + $THIRD )) ; COL3=$(( $i + 2 * $THIRD ))
FMT="%-${BIGLEN}s"
printf "${FMT}${FMT}${FMT}\n" ${MENU[$COL1]} ${MENU[$COL2]} ${MENU[$COL3]}
done
echo
for (( ; ; ))
do
if [[ $TESTNUM -gt 0 ]]; then
NAMEIND=$TESTNUM
else
read -p "Select a test to apply (1-$IND) : " NAMEIND
fi
[[ -z $NAMEIND ]] && { errout "(canceled)" ; exit 1 ; }
TESTENV=${NAMES[$NAMEIND-1]}
[[ $TESTNUM -gt 0 ]] && { echo "Preselected test $TESTNUM ... ($TESTENV)" ; TESTNUM='' ; }
[[ $NAMEIND =~ $ISNUM ]] && ((NAMEIND >= 1 && NAMEIND <= IND)) && { TESTENV=${NAMES[$NAMEIND-1]} ; echo ; break ; }
errout "Invalid selection."
done
fi
# Get the contents of the test file
OUT=$( cat $TESTPATH/$TESTENV 2>/dev/null ) || { errout "Can't find test '$TESTENV'." ; exit 1 ; }
# Count up the number of tests
TESTCOUNT=$( awk "/$ISEXEC/{a++}END{print a}" <<<"$OUT" )
# User entered a number?
(( CHOICE && CHOICE > TESTCOUNT )) && { errout "Invalid test selection '$CHOICE' (1-$TESTCOUNT)." ; exit 1 ; }
if [[ $CHOICE == 0 ]]; then
#
# List test descriptions with numbers and get selection
#
echo "Available '$TESTENV' tests:" ; echo "$OUT" | {
IND=0
while IFS= read -r LINE
do
if [[ $LINE =~ $ISEXEC ]]; then
DESC=$( "$SED" -E 's/^exec_test \$1 \$2 "([^"]+)".*$/\1/g' <<<"$LINE" )
(( ++IND < 10 )) && echo -n " "
echo " $IND) $DESC"
fi
done
}
CHOICE=1
if [[ $TESTCOUNT > 1 ]]; then
for (( ; ; ))
do
read -p "Select a '$TESTENV' test (1-$TESTCOUNT) : " CHOICE
[[ -z "$CHOICE" ]] && { errout "(canceled)" ; exit 1 ; }
[[ $CHOICE =~ $ISNUM ]] && ((CHOICE >= 1 && CHOICE <= TESTCOUNT)) && break
errout ">>> Invalid test selection '$CHOICE'."
done
fi
fi
#
# Restore to defaults if requested
#
((DL_DEFAULTS)) && use_example_configs
#
# Run the specified test lines
#
echo -ne "\033[0;33m"
echo "$OUT" | {
IND=0
GOTX=0
CMD=""
while IFS= read -r LINE
do
if [[ $LINE =~ $ISCMD || $GOTX == 1 ]]; then
((!IND)) && let IND++
if [[ $LINE =~ $ISEXEC ]]; then
((IND++ > CHOICE)) && break
else
((!HEADER)) && {
HEADER=1
echo -e "\n#\n# Test $TESTENV ($CHOICE) $DESC\n#"
}
((IND == CHOICE)) && {
GOTX=1
[[ -n $DL_DEFAULTS && $LINE =~ $ISRST ]] && LINE="use_example_configs"
[[ $CMD == "" ]] && CMD="$LINE" || CMD=$( echo -e "$CMD$LINE" | $SED -e 's/\\//g' | $SED -E 's/ +/ /g' )
[[ $LINE =~ $ISCONT ]] || { echo "$CMD" ; eval "$CMD" ; CMD="" ; }
}
fi
fi
done
}
echo -ne "\033[0m"
# Make clear it's a TEST
opt_set CUSTOM_MACHINE_NAME "\"Test $TESTENV ($CHOICE)\""
# Build the test too?
if [[ -z "$BUILD_YES" ]]; then
echo
read -p "Build $TESTENV test #$CHOICE (y/N) ? " BUILD_YES
fi
[[ $BUILD_YES == 'Y' || $BUILD_YES == 'Yes' ]] && {
((USE_MAKE)) && make tests-single-local TEST_TARGET=$TESTENV ONLY_TEST=$CHOICE
((USE_MAKE)) || pio run $SILENT_FLAG -d . -e $TESTENV
echo "$TESTENV" >"$STATE_FILE"
}

21
buildroot/bin/mfutil Executable file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
#
# mfutil - check env and define helpers
#
# Check dependencies
which curl 1>/dev/null 2>&1 || { echo "curl not found! Please install it."; exit ; }
which git 1>/dev/null 2>&1 || { echo "git not found! Please install it."; exit ; }
SED=$(which gsed sed | head -n1)
[[ -z "$SED" ]] && { echo "No sed found, please install sed" ; exit 1 ; }
OPEN=$( which gnome-open xdg-open open | head -n1 )
SELF=`basename "$0"`
# Check if called in the right location
[[ -e "Marlin/src" ]] || { echo -e "This script must be called from a Marlin working copy with:\n ./buildroot/bin/$SELF $1" ; exit ; }
perror() { echo -e "$0: \033[0;31m$1 -- $2\033[0m" ; }
bugout() { ((DEBUG)) && echo -e "\033[0;32m$1\033[0m" ; }

3
buildroot/bin/opt_add Executable file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
eval "echo '#define ${@}' | cat - Marlin/Configuration.h > temp && mv temp Marlin/Configuration.h"

15
buildroot/bin/opt_disable Executable file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
# exit on first failure
set -e
SED=$(which gsed sed | head -n1)
for opt in "$@" ; do
DID=0 ; FOUND=0
for FN in Configuration Configuration_adv; do
"${SED}" -i "/^\(\s*\)\(#define\s\+${opt}\b\s\?\)\(\s\s\)\?/{s//\1\/\/\2/;h};\${x;/./{x;q0};x;q9}" Marlin/$FN.h && DID=1
((DID||FOUND)) || { grep -E "^\s*//\s*#define\s+${opt}\b" Marlin/$FN.h >/dev/null && FOUND=1 ; }
done
((DID||FOUND)) || (echo "ERROR: $(basename $0) Can't find ${opt}" >&2 && exit 9)
done

15
buildroot/bin/opt_enable Executable file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
# exit on first failure
set -e
SED=$(which gsed sed | head -n1)
for opt in "$@" ; do
DID=0 ; FOUND=0
for FN in Configuration Configuration_adv; do
"${SED}" -i "/^\(\s*\)\/\/\(\s*\)\(#define\s\+${opt}\b\)\( \?\)/{s//\1\2\3\4\4\4/;h};\${x;/./{x;q0};x;q9}" Marlin/$FN.h && DID=1
((DID||FOUND)) || { grep -E "^\s*#define\s+${opt}\b" Marlin/$FN.h >/dev/null && FOUND=1 ; }
done
((DID||FOUND)) || (echo "ERROR: $(basename $0) Can't find ${opt}" >&2 && exit 9)
done

33
buildroot/bin/opt_find Executable file

@ -0,0 +1,33 @@
#!/usr/bin/env bash
#
# opt_find
# Find one or more Marlin options - Configuration lines starting with #define
#
MYNAME=$(basename $0)
[[ $# == 0 ]] && ONE="-h" || ONE=$1
COMM="(//\\s*)?" ; TYPE=""
case "$ONE" in
-d|--disabled )
shift ; COMM="(//\\s*)" ; TYPE="disabled " ;;
-e|--enabled )
shift ; COMM="" ; TYPE="enabled " ;;
-h|--help )
echo "$MYNAME [-d|--disabled|-e|--enabled] STRING ... Find matching Marlin configuration options."
echo ; shift ;;
-* )
echo "Unknown option $ONE" ; shift ;;
esac
while [[ $# > 0 ]]; do
DID=0
for FN in Configuration Configuration_adv; do
FOUND=$( grep -HEn "^\s*${COMM}#define\s+[A-Z0-9_]*${1}" "Marlin/$FN.h" 2>/dev/null )
[[ -n "$FOUND" ]] && { echo "$FOUND" ; DID=1 ; }
done
((DID)) || { echo "ERROR: ${MYNAME} - No ${TYPE}match for ${1}" ; exit 9; }
shift
echo
done

17
buildroot/bin/opt_set Executable file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
# exit on first failure
set -e
SED=$(which gsed sed | head -n1)
while [[ $# > 1 ]]; do
DID=0
for FN in Configuration Configuration_adv; do
"${SED}" -i "/^\(\s*\)\/*\s*\(#define\s\+${1}\b\) *\(.*\)$/{s//\1\2 ${2} \/\/ \3/;h};\${x;/./{x;q0};x;q9}" Marlin/$FN.h && DID=1
done
((DID)) ||
eval "echo '#define ${1} ${2}' >>Marlin/Configuration.h" ||
(echo "ERROR: opt_set Can't set or add ${1}" >&2 && exit 9)
shift 2
done

16
buildroot/bin/pins_set Executable file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
IFS='/' read -r -a PINPATH <<< "$1"
DIR=${PINPATH[0]}
NAM=${PINPATH[1]}
SED=$(which gsed sed | head -n1)
shift
while [[ $# > 1 ]]; do
PIN=$1 ; VAL=$2
FOUT="${DIR}/pins_${NAM}.h"
eval "${SED} -i '/^[[:blank:]]*\(\/\/\)*[[:blank:]]*\(#define \+${PIN}\b\).*$/{s//\2 ${VAL}/;h};\${x;/./{x;q0};x;q9}' Marlin/src/pins/${FOUT}" ||
(echo "ERROR: pins_set Can't find ${PIN} in ${FOUT}" >&2 && exit 9)
shift 2
done

11
buildroot/bin/restore_configs Executable file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
rm -f Marlin/_Bootscreen.h Marlin/_Statusscreen.h marlin_config.json .pio/build/mc.zip
if [[ $1 == '-d' || $1 == '--default' ]]; then
use_example_configs
else
git checkout Marlin/Configuration.h 2>/dev/null
git checkout Marlin/Configuration_adv.h 2>/dev/null
git checkout Marlin/src/pins/ramps/pins_RAMPS.h 2>/dev/null
fi

77
buildroot/bin/run_tests Executable file

@ -0,0 +1,77 @@
#!/usr/bin/env bash
#
# run_tests
#
HERE="$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )"
TESTS="$HERE/../tests"
export PATH="$HERE:$TESTS:$PATH"
# exit on first failure
set -e
exec_test () {
printf "\n\033[0;32m[Test $2] \033[0m$3...\n"
# Check to see if we should skip tests
if [[ -n "$4" ]] ; then
if [[ ! "$3" =~ $4 ]] ; then
printf "\033[1;33mSkipped\033[0m\n"
return 0
fi
fi
if [[ -z "$VERBOSE_PLATFORMIO" ]] ; then
silent="--silent"
else
silent="-v"
fi
if platformio run --project-dir $1 -e $2 $silent; then
printf "\033[0;32mPassed\033[0m\n"
return 0
else
if [[ -n $GIT_RESET_HARD ]]; then
git reset --hard HEAD
else
restore_configs
fi
printf "\033[0;31mFailed!\033[0m\n"
return 1
fi
}
export -f exec_test
printf "Running \033[0;32m$2\033[0m Tests\n"
if [[ $2 = "ALL" ]]; then
tests=("$TESTS"/*)
for f in "${tests[@]}"; do
testenv=$(basename $f)
printf "Running \033[0;32m$f\033[0m Tests\n"
exec_test $1 "$testenv --target clean" "Setup Build Environment"
if [[ $GIT_RESET_HARD == "true" ]]; then
git reset --hard HEAD
else
restore_configs
fi
done
else
exec_test $1 "$2 --target clean" "Setup Build Environment"
test_name="$3"
# If the test name is 1 or 2 digits, treat it as an index
if [[ "$test_name" =~ ^[0-9][0-9]?$ ]] ; then
# Find the test name that corresponds to that index
test_name="$(cat $TESTS/$2 | grep -e '^exec_test' | sed -n "$3p" | sed "s/.*\$1 \$2 \"\([^\"]*\).*/\1/g")"
if [[ -z "$test_name" ]] ; then
# Fail if none matches
printf "\033[0;31mCould not find test \033[0m#$3\033[0;31m in \033[0mbuildroot/tests/$2\n"
exit 1
else
printf "\033[0;32mMatching test \033[0m#$3\033[0;32m: '\033[0m$test_name\033[0;32m'\n"
fi
fi
"$TESTS/$2" $1 $2 "$test_name"
if [[ $GIT_RESET_HARD == "true" ]]; then
git reset --hard HEAD
else
restore_configs
fi
fi
printf "\033[0;32mAll tests completed successfully\033[0m\n"

18
buildroot/bin/uncrust Executable file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
#
# Run uncrustify for a file in-place
#
TMPDIR=`mktemp -d`
HERE=`dirname "$0"`
# Reformat a single file to tmp/
if uncrustify -l CPP -c "$HERE/../share/extras/uncrustify.cfg" -f "$1" >$TMPDIR/uncrustify.out ; then
cp "$TMPDIR/uncrustify.out" "$1" ; # Replace the original file
else
echo "Something went wrong with uncrustify."
fi
# Clean up, deliberately
[[ -f "$TMPDIR/uncrustify.out" ]] && rm "$TMPDIR/uncrustify.out"
rmdir "$TMPDIR"

@ -0,0 +1,53 @@
#!/usr/bin/env bash
#
# use_example_configs [repo:]configpath
#
# Examples:
# use_example_configs
# use_example_configs Creality/CR-10/CrealityV1
# use_example_configs release-2.0.9.4:Creality/CR-10/CrealityV1
#
# If a configpath has spaces (or quotes) escape them or enquote the path
# If no branch: prefix is given use configs based on the current branch name.
# e.g., For `latest-2.1.x` name the working branch something like "my_work-2.1.x."
# The branch or tag must first exist at MarlinFirmware/Configurations.
# The fallback branch is bugfix-2.1.x.
#
which curl >/dev/null && TOOL='curl -L -s -S -f -o wgot'
which wget >/dev/null && TOOL='wget -q -O wgot'
CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g')
case "$CURR" in
bugfix-2.*.x ) BRANCH=$CURR ;;
*-2.1.x|2.1.x ) BRANCH=latest-2.1.x ;;
*-2.0.x|2.0.x ) BRANCH=latest-2.0.x ;;
*-1.1.x|1.1.x ) BRANCH=latest-1.1.x ;;
*-1.0.x|1.0.x ) BRANCH=latest-1.0.x ;;
* ) BRANCH=bugfix-2.1.x ;;
esac
if [[ $# > 0 ]]; then
IFS=: read -r PART1 PART2 <<< "$@"
[[ -n $PART2 ]] && { UDIR="$PART2" ; BRANCH="$PART1" ; } \
|| { UDIR="$PART1" ; }
RDIR="${UDIR// /%20}"
echo "Fetching $UDIR configurations from $BRANCH..."
EXAMPLES="examples/$RDIR"
else
EXAMPLES="default"
fi
CONFIGS="https://raw.githubusercontent.com/MarlinFirmware/Configurations/$BRANCH/config/${EXAMPLES}"
restore_configs
cd Marlin
$TOOL "$CONFIGS/Configuration.h" >/dev/null 2>&1 && mv wgot Configuration.h
$TOOL "$CONFIGS/Configuration_adv.h" >/dev/null 2>&1 && mv wgot Configuration_adv.h
$TOOL "$CONFIGS/_Bootscreen.h" >/dev/null 2>&1 && mv wgot _Bootscreen.h
$TOOL "$CONFIGS/_Statusscreen.h" >/dev/null 2>&1 && mv wgot _Statusscreen.h
rm -f wgot
cd - >/dev/null

23
buildroot/etc/.astylerc Normal file

@ -0,0 +1,23 @@
--style=google
--keep-one-line-blocks
--indent=spaces=2
--indent-preproc-block
--indent-preproc-define
--indent-col1-comments
--remove-brackets
--break-after-logical
--delete-empty-lines
--pad-oper
--pad-header
--unpad-paren
--align-pointer=type
--align-reference=type
--attach-classes
--attach-inlines
--keep-one-line-statements
--indent-namespaces

@ -0,0 +1,207 @@
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#####################################################################################
#
# INSTALLATION
#
# Please visit > https://docs.platformio.org/en/latest/faq.html#platformio-udev-rules
#
#####################################################################################
#
# Boards
#
# CP210X USB UART
SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE:="0666"
# FT232R USB UART
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE:="0666"
# Prolific Technology, Inc. PL2303 Serial Port
SUBSYSTEMS=="usb", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", MODE:="0666"
# QinHeng Electronics HL-340 USB-Serial adapter
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE:="0666"
# Arduino boards
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="[08][02]*", MODE:="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2a03", ATTRS{idProduct}=="[08][02]*", MODE:="0666"
# Arduino SAM-BA
ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="6124", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="6124", ENV{MTP_NO_PROBE}="1"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="6124", MODE:="0666"
KERNEL=="ttyACM*", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="6124", MODE:="0666"
# Digistump boards
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="0753", MODE:="0666"
KERNEL=="ttyACM*", ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="0753", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
# STM32 discovery boards, with onboard st/linkv2
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374?", MODE:="0666"
# USBtiny
SUBSYSTEMS=="usb", ATTRS{idProduct}=="0c9f", ATTRS{idVendor}=="1781", MODE="0666"
# USBasp V2.0
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", MODE:="0666"
# Teensy boards
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789]?", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789]?", ENV{MTP_NO_PROBE}="1"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789]?", MODE:="0666"
KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789]?", MODE:="0666"
#TI Stellaris Launchpad
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", MODE="0666"
#TI MSP430 Launchpad
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="f432", MODE="0666"
#
# Debuggers
#
# Black Magic Probe
SUBSYSTEM=="tty", ATTRS{interface}=="Black Magic GDB Server"
SUBSYSTEM=="tty", ATTRS{interface}=="Black Magic UART Port"
# opendous and estick
ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="204f", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Original FT232/FT245 VID:PID
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Original FT2232 VID:PID
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Original FT4232 VID:PID
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Original FT232H VID:PID
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6014", MODE="660", GROUP="plugdev", TAG+="uaccess"
# DISTORTEC JTAG-lock-pick Tiny 2
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8220", MODE="660", GROUP="plugdev", TAG+="uaccess"
# TUMPA, TUMPA Lite
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8a98", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8a99", MODE="660", GROUP="plugdev", TAG+="uaccess"
# XDS100v2
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="a6d0", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Xverve Signalyzer Tool (DT-USB-ST), Signalyzer LITE (DT-USB-SLITE)
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bca0", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bca1", MODE="660", GROUP="plugdev", TAG+="uaccess"
# TI/Luminary Stellaris Evaluation Board FTDI (several)
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bcd9", MODE="660", GROUP="plugdev", TAG+="uaccess"
# TI/Luminary Stellaris In-Circuit Debug Interface FTDI (ICDI) Board
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bcda", MODE="660", GROUP="plugdev", TAG+="uaccess"
# egnite Turtelizer 2
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="bdc8", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Section5 ICEbear
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="c140", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="c141", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Amontec JTAGkey and JTAGkey-tiny
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="cff8", MODE="660", GROUP="plugdev", TAG+="uaccess"
# TI ICDI
ATTRS{idVendor}=="0451", ATTRS{idProduct}=="c32a", MODE="660", GROUP="plugdev", TAG+="uaccess"
# STLink v1
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3744", MODE="660", GROUP="plugdev", TAG+="uaccess"
# STLink v2
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", MODE="660", GROUP="plugdev", TAG+="uaccess"
# STLink v2-1
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Hilscher NXHX Boards
ATTRS{idVendor}=="0640", ATTRS{idProduct}=="0028", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Hitex STR9-comStick
ATTRS{idVendor}=="0640", ATTRS{idProduct}=="002c", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Hitex STM32-PerformanceStick
ATTRS{idVendor}=="0640", ATTRS{idProduct}=="002d", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Altera USB Blaster
ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6001", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Amontec JTAGkey-HiSpeed
ATTRS{idVendor}=="0fbb", ATTRS{idProduct}=="1000", MODE="660", GROUP="plugdev", TAG+="uaccess"
# SEGGER J-Link
ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0101", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0102", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0103", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0104", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0105", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0107", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0108", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1010", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1011", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1012", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1013", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1014", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1015", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1016", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1017", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1018", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Raisonance RLink
ATTRS{idVendor}=="138e", ATTRS{idProduct}=="9000", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Debug Board for Neo1973
ATTRS{idVendor}=="1457", ATTRS{idProduct}=="5118", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Olimex ARM-USB-OCD
ATTRS{idVendor}=="15ba", ATTRS{idProduct}=="0003", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Olimex ARM-USB-OCD-TINY
ATTRS{idVendor}=="15ba", ATTRS{idProduct}=="0004", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Olimex ARM-JTAG-EW
ATTRS{idVendor}=="15ba", ATTRS{idProduct}=="001e", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Olimex ARM-USB-OCD-TINY-H
ATTRS{idVendor}=="15ba", ATTRS{idProduct}=="002a", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Olimex ARM-USB-OCD-H
ATTRS{idVendor}=="15ba", ATTRS{idProduct}=="002b", MODE="660", GROUP="plugdev", TAG+="uaccess"
# USBprog with OpenOCD firmware
ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c63", MODE="660", GROUP="plugdev", TAG+="uaccess"
# TI/Luminary Stellaris In-Circuit Debug Interface (ICDI) Board
ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Marvell Sheevaplug
ATTRS{idVendor}=="9e88", ATTRS{idProduct}=="9e8f", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Keil Software, Inc. ULink
ATTRS{idVendor}=="c251", ATTRS{idProduct}=="2710", MODE="660", GROUP="plugdev", TAG+="uaccess"
# CMSIS-DAP compatible adapters
ATTRS{product}=="*CMSIS-DAP*", MODE="660", GROUP="plugdev", TAG+="uaccess"

@ -0,0 +1,60 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F401xx",
"f_cpu": "84000000L",
"hwids": [
[
"0x0483",
"0xDF11"
]
],
"mcu": "stm32f401rct6",
"variant": "MARLIN_ARTILLERY_RUBY"
},
"debug": {
"jlink_device": "STM32F401RC",
"openocd_target": "stm32f4x",
"svd_path": "STM32F40x.svd",
"tools": {
"stlink": {
"server": {
"arguments": [
"-f",
"scripts/interface/stlink.cfg",
"-c",
"transport select hla_swd",
"-f",
"scripts/target/stm32f4x.cfg",
"-c",
"reset_config none"
],
"executable": "bin/openocd",
"package": "tool-openocd"
}
}
}
},
"frameworks": [
"arduino",
"stm32cube"
],
"name": "STM32F401RC (64k RAM. 256k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 65536,
"maximum_size": 262144,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink"
],
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/evaluation-tools/steval-3dp001v1.html",
"vendor": "Generic"
}

@ -0,0 +1,47 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m0plus",
"extra_flags": "-DSTM32G0xx -DSTM32G0B1xx",
"f_cpu": "64000000L",
"framework_extra_flags": {
"arduino": "-D__CORTEX_SC=0"
},
"mcu": "stm32g0b1cbt6",
"product_line": "STM32G0B1xx",
"variant": "MARLIN_BTT_EBB42_V1_1"
},
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32G0B1CB",
"onboard_tools": [
"stlink"
],
"openocd_target": "stm32g0x",
"svd_path": "STM32G0B1.svd"
},
"frameworks": [
"arduino",
"cmsis",
"libopencm3",
"stm32cube",
"zephyr"
],
"name": "STM32G0B1CB",
"upload": {
"maximum_ram_size": 147456,
"maximum_size": 131072,
"protocol": "stlink",
"protocols": [
"stlink",
"jlink",
"cmsis-dap",
"blackmagic",
"mbed"
]
},
"url": "https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus/stm32-mainstream-mcus/stm32g0-series/stm32g0x1.html",
"vendor": "ST"
}

@ -0,0 +1,56 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m7",
"extra_flags": "-DSTM32H743xx",
"f_cpu": "480000000L",
"mcu": "stm32h743iit6",
"variant": "MARLIN_BTT_SKR_SE_BX"
},
"debug": {
"jlink_device": "STM32H743II",
"openocd_target": "stm32h7x",
"svd_path": "STM32H7x3.svd",
"tools": {
"stlink": {
"server": {
"arguments": [
"-f",
"scripts/interface/stlink.cfg",
"-c",
"transport select hla_swd",
"-f",
"scripts/target/stm32h7x.cfg",
"-c",
"reset_config none"
],
"executable": "bin/openocd",
"package": "tool-openocd"
}
}
}
},
"frameworks": [
"arduino",
"stm32cube"
],
"name": "STM32H743II (1024k RAM. 2048k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 1048576,
"maximum_size": 2097152,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink",
"cmsis-dap"
],
"offset_address": "0x8020000",
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32h743ii.html",
"vendor": "Generic"
}

@ -0,0 +1,46 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F4 -DSTM32F407xx -DSTM32F40_41xxx",
"f_cpu": "168000000L",
"hwids": [
[
"0x1EAF",
"0x0003"
],
[
"0x0483",
"0x3748"
]
],
"mcu": "stm32f407vgt6",
"variant": "MARLIN_BIGTREE_BTT002"
},
"debug": {
"jlink_device": "STM32F407VG",
"openocd_target": "stm32f4x",
"svd_path": "STM32F40x.svd"
},
"frameworks": [
"arduino"
],
"name": "STM32F407VG (192k RAM. 1024k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 131072,
"maximum_size": 1048576,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink"
],
"offset_address": "0x8008000",
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f407vg.html",
"vendor": "Generic"
}

@ -0,0 +1,46 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F4 -DSTM32F407xx -DSTM32F40_41xxx",
"f_cpu": "168000000L",
"hwids": [
[
"0x1EAF",
"0x0003"
],
[
"0x0483",
"0x3748"
]
],
"mcu": "stm32f407vet6",
"variant": "MARLIN_BIGTREE_BTT002"
},
"debug": {
"jlink_device": "STM32F407VE",
"openocd_target": "stm32f4x",
"svd_path": "STM32F40x.svd"
},
"frameworks": [
"arduino"
],
"name": "STM32F407VE (192k RAM. 512k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 131072,
"maximum_size": 524288,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink"
],
"offset_address": "0x8008000",
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f407ve.html",
"vendor": "ST"
}

@ -0,0 +1,46 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F4 -DSTM32F407xx -DSTM32F40_41xxx",
"f_cpu": "168000000L",
"hwids": [
[
"0x1EAF",
"0x0003"
],
[
"0x0483",
"0x3748"
]
],
"mcu": "stm32f407zgt6",
"variant": "MARLIN_BIGTREE_GTR_V1"
},
"debug": {
"jlink_device": "STM32F407ZG",
"openocd_target": "stm32f4x",
"svd_path": "STM32F40x.svd"
},
"frameworks": [
"arduino"
],
"name": "STM32F407ZG (192k RAM. 1024k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 196608,
"maximum_size": 1048576,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink"
],
"offset_address": "0x8008000",
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f407zg.html",
"vendor": "Generic"
}

@ -0,0 +1,50 @@
{
"build": {
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F4 -DSTM32F429xx",
"f_cpu": "168000000L",
"mcu": "stm32f429zgt6",
"product_line": "STM32F429xx",
"variant": "MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429"
},
"connectivity": [
"can"
],
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32F429ZG",
"onboard_tools": [
"stlink"
],
"openocd_board": "stm32f429",
"openocd_target": "stm32f4x",
"svd_path": "STM32F429x.svd"
},
"frameworks": [
"arduino",
"cmsis",
"mbed",
"stm32cube",
"libopencm3",
"zephyr"
],
"name": "STM32F429ZG (128k RAM, 64k CCM RAM, 1024k Flash",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 131072,
"maximum_size": 1048576,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink"
],
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f429-439.html",
"vendor": "ST"
}

@ -0,0 +1,35 @@
{
"build": {
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F446xx",
"f_cpu": "180000000L",
"mcu": "stm32f446zet6",
"variant": "MARLIN_BIGTREE_OCTOPUS_V1"
},
"connectivity": [
"can"
],
"debug": {
"jlink_device": "STM32F446ZE",
"openocd_target": "stm32f4x",
"svd_path": "STM32F446x.svd"
},
"frameworks": [
"arduino",
"stm32cube"
],
"name": "STM32F446ZE (128k RAM. 512k Flash)",
"upload": {
"maximum_ram_size": 131072,
"maximum_size": 524288,
"protocol": "stlink",
"protocols": [
"jlink",
"stlink",
"blackmagic",
"serial"
]
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f446.html",
"vendor": "Generic"
}

@ -0,0 +1,46 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F4 -DSTM32F407xx -DSTM32F40_41xxx",
"f_cpu": "168000000L",
"hwids": [
[
"0x1EAF",
"0x0003"
],
[
"0x0483",
"0x3748"
]
],
"mcu": "stm32f407zgt6",
"variant": "MARLIN_BIGTREE_SKR_PRO_11"
},
"debug": {
"jlink_device": "STM32F407ZG",
"openocd_target": "stm32f4x",
"svd_path": "STM32F40x.svd"
},
"frameworks": [
"arduino"
],
"name": "STM32F407ZG (192k RAM. 1024k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 196608,
"maximum_size": 1048576,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink"
],
"offset_address": "0x8008000",
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f407zg.html",
"vendor": "Generic"
}

@ -0,0 +1,65 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F401xx",
"f_cpu": "84000000L",
"hwids": [
[
"0x1EAF",
"0x0003"
],
[
"0x0483",
"0x3748"
]
],
"ldscript": "ldscript.ld",
"mcu": "stm32f401ret6",
"variant": "MARLIN_CREALITY_STM32F401RE"
},
"debug": {
"jlink_device": "STM32F401RE",
"openocd_target": "stm32f4x",
"svd_path": "STM32F40x.svd",
"tools": {
"stlink": {
"server": {
"arguments": [
"-f",
"scripts/interface/stlink.cfg",
"-c",
"transport select hla_swd",
"-f",
"scripts/target/stm32f4x.cfg",
"-c",
"reset_config none"
],
"executable": "bin/openocd",
"package": "tool-openocd"
}
}
}
},
"frameworks": [
"arduino",
"stm32cube"
],
"name": "STM32F401RE (64k RAM. 512k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 65536,
"maximum_size": 514288,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink"
],
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f401re.html",
"vendor": "Generic"
}

@ -0,0 +1,65 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F401xx",
"f_cpu": "84000000L",
"hwids": [
[
"0x1EAF",
"0x0003"
],
[
"0x0483",
"0x3748"
]
],
"mcu": "stm32f401rct6",
"variant": "MARLIN_FYSETC_CHEETAH_V20"
},
"debug": {
"jlink_device": "STM32F401RC",
"openocd_target": "stm32f4x",
"svd_path": "STM32F40x.svd",
"tools": {
"stlink": {
"server": {
"arguments": [
"-f",
"scripts/interface/stlink.cfg",
"-c",
"transport select hla_swd",
"-f",
"scripts/target/stm32f4x.cfg",
"-c",
"reset_config none"
],
"executable": "bin/openocd",
"package": "tool-openocd"
}
}
}
},
"frameworks": [
"arduino",
"stm32cube"
],
"name": "STM32F401RC (64k RAM. 256k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 65536,
"maximum_size": 262144,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink"
],
"offset_address": "0x8008000",
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.fysetc.com",
"vendor": "Generic"
}

@ -0,0 +1,35 @@
{
"build": {
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F446xx",
"f_cpu": "180000000L",
"mcu": "stm32f446ret6",
"variant": "MARLIN_F446VE"
},
"connectivity": [
"can"
],
"debug": {
"jlink_device": "STM32F446RE",
"openocd_target": "stm32f4x",
"svd_path": "STM32F446x.svd"
},
"frameworks": [
"arduino",
"stm32cube"
],
"name": "3D Printer control board",
"upload": {
"maximum_ram_size": 131072,
"maximum_size": 524288,
"protocol": "stlink",
"protocols": [
"jlink",
"stlink",
"blackmagic",
"serial"
]
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f446.html",
"vendor": "FYSETC"
}

@ -0,0 +1,65 @@
{
"build": {
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F407xx",
"f_cpu": "168000000L",
"hwids": [
[
"0x1EAF",
"0x0003"
],
[
"0x0483",
"0x3748"
]
],
"ldscript": "ldscript.ld",
"mcu": "stm32f407zet6",
"variant": "MARLIN_MKS_ROBIN2"
},
"debug": {
"jlink_device": "STM32F407ZE",
"openocd_target": "stm32f4x",
"svd_path": "STM32F40x.svd",
"tools": {
"stlink": {
"server": {
"arguments": [
"-f",
"scripts/interface/stlink.cfg",
"-c",
"transport select hla_swd",
"-f",
"scripts/target/stm32f4x.cfg",
"-c",
"reset_config none"
],
"executable": "bin/openocd",
"package": "tool-openocd"
}
}
}
},
"frameworks": [
"arduino",
"stm32cube"
],
"name": "STM32F407ZE (192k RAM. 512k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 131072,
"maximum_size": 514288,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink",
"cmsis-dap"
],
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "http://www.st.com/en/microcontrollers/stm32f407ze.html",
"vendor": "Generic"
}

@ -0,0 +1,55 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F4 -DSTM32F407xx",
"f_cpu": "168000000L",
"offset": "0xC000",
"hwids": [
[
"0x1EAF",
"0x0003"
],
[
"0x0483",
"0x3748"
]
],
"mcu": "stm32f407vet6",
"product_line": "STM32F407xx",
"variant": "MARLIN_MKS_SKIPR_V1"
},
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32F407VE",
"openocd_extra_args": [
"-c",
"reset_config none"
],
"openocd_target": "stm32f4x",
"svd_path": "STM32F40x.svd"
},
"frameworks": [
"arduino"
],
"name": "STM32F407VE (128k RAM, 64k CCM RAM, 512k Flash",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 131072,
"maximum_size": 524288,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink"
],
"offset_address": "0x0800C000",
"require_upload_port": false,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f407ve.html",
"vendor": "ST"
}

@ -0,0 +1,38 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F401xC -DSTM32F4xx",
"f_cpu": "84000000L",
"mcu": "stm32f401rct6",
"product_line": "STM32F401xC",
"variant": "MARLIN_F401RC"
},
"debug": {
"jlink_device": "STM32F401RC",
"openocd_target": "stm32f4x",
"svd_path": "STM32F401x.svd"
},
"frameworks": [
"arduino",
"cmsis",
"spl",
"stm32cube",
"libopencm3"
],
"name": "STM32F401RC (64k RAM. 256k Flash)",
"upload": {
"maximum_ram_size": 65536,
"maximum_size": 262144,
"protocol": "serial",
"protocols": [
"blackmagic",
"dfu",
"jlink",
"serial",
"stlink"
]
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f401rc.html",
"vendor": "Generic"
}

@ -0,0 +1,56 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F407xx -DSTM32F4",
"f_cpu": "168000000L",
"hwids": [
[
"0x1EAF",
"0x0003"
],
[
"0x0483",
"0x3748"
]
],
"mcu": "stm32f407vet6",
"product_line": "STM32F407xx",
"variant": "Generic_F4x7Vx"
},
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32F407VE",
"openocd_extra_args": [
"-c",
"reset_config none"
],
"openocd_target": "stm32f4x",
"svd_path": "STM32F40x.svd"
},
"frameworks": [
"arduino",
"cmsis",
"stm32cube",
"libopencm3"
],
"name": "STM32F407VE (128k RAM, 64k CCM RAM, 512k Flash",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 131072,
"maximum_size": 524288,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink"
],
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32-high-performance-mcus/stm32f4-series/stm32f407-417/stm32f407vg.html",
"vendor": "Generic"
}

@ -0,0 +1,56 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F407xx -DSTM32F4",
"f_cpu": "168000000L",
"hwids": [
[
"0x1EAF",
"0x0003"
],
[
"0x0483",
"0x3748"
]
],
"mcu": "stm32f407vgt6",
"product_line": "STM32F407xx",
"variant": "Generic_F4x7Vx"
},
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32F407VG",
"openocd_extra_args": [
"-c",
"reset_config none"
],
"openocd_target": "stm32f4x",
"svd_path": "STM32F40x.svd"
},
"frameworks": [
"arduino",
"cmsis",
"stm32cube",
"libopencm3"
],
"name": "STM32F407VG (128k RAM, 64k CCM RAM, 1024k Flash",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 131072,
"maximum_size": 1048576,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink"
],
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32-high-performance-mcus/stm32f4-series/stm32f407-417/stm32f407vg.html",
"vendor": "Generic"
}

@ -0,0 +1,50 @@
{
"build": {
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F4 -DSTM32F407xx",
"f_cpu": "168000000L",
"mcu": "stm32f407zgt6",
"product_line": "STM32F407xx",
"variant": "MARLIN_F407ZE"
},
"connectivity": [
"can"
],
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32F407ZE",
"onboard_tools": [
"stlink"
],
"openocd_board": "stm32f407",
"openocd_target": "stm32f4x",
"svd_path": "STM32F407x.svd"
},
"frameworks": [
"arduino",
"cmsis",
"mbed",
"stm32cube",
"libopencm3",
"zephyr"
],
"name": "STM32F407ZE (128k RAM, 64k CCM RAM, 512k Flash",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 131072,
"maximum_size": 524288,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink"
],
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f407-417.html",
"vendor": "ST"
}

@ -0,0 +1,63 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F407xx",
"f_cpu": "168000000L",
"hwids": [
[
"0x1EAF",
"0x0003"
],
[
"0x0483",
"0x3748"
]
],
"mcu": "stm32f407zgt6"
},
"debug": {
"jlink_device": "STM32F407ZG",
"openocd_target": "stm32f4x",
"svd_path": "STM32F40x.svd",
"tools": {
"stlink": {
"server": {
"arguments": [
"-f",
"scripts/interface/stlink.cfg",
"-c",
"transport select hla_swd",
"-f",
"scripts/target/stm32f4x.cfg",
"-c",
"reset_config none"
],
"executable": "bin/openocd",
"package": "tool-openocd"
}
}
}
},
"frameworks": [
"arduino",
"stm32cube"
],
"name": "STM32F407ZGT6(192k RAM. 1024k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 196608,
"maximum_size": 1048576,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink"
],
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f407ZG.html",
"vendor": "Generic"
}

@ -0,0 +1,50 @@
{
"build": {
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F4 -DSTM32F429xx",
"f_cpu": "168000000L",
"mcu": "stm32f429vgt6",
"product_line": "STM32F429xx",
"variant": "MARLIN_F4x7Vx"
},
"connectivity": [
"can"
],
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32F429VG",
"onboard_tools": [
"stlink"
],
"openocd_board": "stm32f429",
"openocd_target": "stm32f4x",
"svd_path": "STM32F429x.svd"
},
"frameworks": [
"arduino",
"cmsis",
"mbed",
"stm32cube",
"libopencm3",
"zephyr"
],
"name": "STM32F429VG (128k RAM, 64k CCM RAM, 1024k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 131072,
"maximum_size": 1048576,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink"
],
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f429-439.html",
"vendor": "ST"
}

@ -0,0 +1,35 @@
{
"build": {
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F446xx",
"f_cpu": "180000000L",
"mcu": "stm32f446zet6",
"variant": "MARLIN_F446Zx_TRONXY"
},
"connectivity": [
"can"
],
"debug": {
"jlink_device": "STM32F446ZE",
"openocd_target": "stm32f4x",
"svd_path": "STM32F446x.svd"
},
"frameworks": [
"arduino",
"stm32cube"
],
"name": "STM32F446ZE (128k RAM. 512k Flash)",
"upload": {
"maximum_ram_size": 131072,
"maximum_size": 524288,
"protocol": "stlink",
"protocols": [
"jlink",
"stlink",
"blackmagic",
"serial"
]
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f446.html",
"vendor": "Generic"
}

@ -0,0 +1,47 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m0plus",
"extra_flags": "-DSTM32G0xx -DSTM32G0B1xx",
"f_cpu": "64000000L",
"framework_extra_flags": {
"arduino": "-D__CORTEX_SC=0"
},
"mcu": "stm32g0b1ret6",
"product_line": "STM32G0B1xx",
"variant": "MARLIN_G0B1RE"
},
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32G0B1RE",
"onboard_tools": [
"stlink"
],
"openocd_target": "stm32g0x",
"svd_path": "STM32G0B1.svd"
},
"frameworks": [
"arduino",
"cmsis",
"libopencm3",
"stm32cube",
"zephyr"
],
"name": "STM32G0B1RE",
"upload": {
"maximum_ram_size": 147456,
"maximum_size": 524288,
"protocol": "stlink",
"protocols": [
"stlink",
"jlink",
"cmsis-dap",
"blackmagic",
"mbed"
]
},
"url": "https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus/stm32-mainstream-mcus/stm32g0-series/stm32g0x1.html",
"vendor": "ST"
}

@ -0,0 +1,47 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m0plus",
"extra_flags": "-DSTM32G0xx -DSTM32G0B1xx",
"f_cpu": "64000000L",
"framework_extra_flags": {
"arduino": "-D__CORTEX_SC=0"
},
"mcu": "stm32g0b1vet6",
"product_line": "STM32G0B1xx",
"variant": "MARLIN_G0B1VE"
},
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32G0B1VE",
"onboard_tools": [
"stlink"
],
"openocd_target": "stm32g0x",
"svd_path": "STM32G0B1.svd"
},
"frameworks": [
"arduino",
"cmsis",
"libopencm3",
"stm32cube",
"zephyr"
],
"name": "STM32G0B1VE",
"upload": {
"maximum_ram_size": 147456,
"maximum_size": 524288,
"protocol": "stlink",
"protocols": [
"stlink",
"jlink",
"cmsis-dap",
"blackmagic",
"mbed"
]
},
"url": "https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus/stm32-mainstream-mcus/stm32g0-series/stm32g0x1.html",
"vendor": "ST"
}

@ -0,0 +1,61 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m7",
"extra_flags": "-DSTM32H7xx -DSTM32H723xx",
"f_cpu": "550000000L",
"mcu": "stm32h723vgt6",
"product_line": "STM32H723xx",
"variant": "MARLIN_H723VG"
},
"connectivity": [
"can",
"ethernet"
],
"debug": {
"jlink_device": "STM32H723VG",
"openocd_target": "stm32h7x",
"svd_path": "STM32H7x3.svd",
"tools": {
"stlink": {
"server": {
"arguments": [
"-f",
"scripts/interface/stlink.cfg",
"-c",
"transport select hla_swd",
"-f",
"scripts/target/stm32h7x.cfg",
"-c",
"reset_config none"
],
"executable": "bin/openocd",
"package": "tool-openocd"
}
}
}
},
"frameworks": [
"arduino",
"stm32cube"
],
"name": "STM32H723VG (564k RAM. 1024k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 577536,
"maximum_size": 1048576,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink",
"cmsis-dap"
],
"offset_address": "0x8020000",
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32h723vg.html",
"vendor": "ST"
}

@ -0,0 +1,61 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m7",
"extra_flags": "-DSTM32H7xx -DSTM32H723xx",
"f_cpu": "550000000L",
"mcu": "stm32h723zet6",
"product_line": "STM32H723xx",
"variant": "MARLIN_H723ZE"
},
"connectivity": [
"can",
"ethernet"
],
"debug": {
"jlink_device": "STM32H723ZE",
"openocd_target": "stm32h7x",
"svd_path": "STM32H7x3.svd",
"tools": {
"stlink": {
"server": {
"arguments": [
"-f",
"scripts/interface/stlink.cfg",
"-c",
"transport select hla_swd",
"-f",
"scripts/target/stm32h7x.cfg",
"-c",
"reset_config none"
],
"executable": "bin/openocd",
"package": "tool-openocd"
}
}
}
},
"frameworks": [
"arduino",
"stm32cube"
],
"name": "STM32H723ZE (564k RAM. 512k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 577536,
"maximum_size": 524288,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink",
"cmsis-dap"
],
"offset_address": "0x8020000",
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32h723ze.html",
"vendor": "ST"
}

@ -0,0 +1,61 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m7",
"extra_flags": "-DSTM32H7xx -DSTM32H743xx",
"f_cpu": "480000000L",
"mcu": "stm32h743vit6",
"product_line": "STM32H743xx",
"variant": "MARLIN_H743VI"
},
"connectivity": [
"can",
"ethernet"
],
"debug": {
"jlink_device": "STM32H743VI",
"openocd_target": "stm32h7x",
"svd_path": "STM32H7x3.svd",
"tools": {
"stlink": {
"server": {
"arguments": [
"-f",
"scripts/interface/stlink.cfg",
"-c",
"transport select hla_swd",
"-f",
"scripts/target/stm32h7x.cfg",
"-c",
"reset_config none"
],
"executable": "bin/openocd",
"package": "tool-openocd"
}
}
}
},
"frameworks": [
"arduino",
"stm32cube"
],
"name": "STM32H743VI (1024k RAM. 2048k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 1048576,
"maximum_size": 2097152,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink",
"cmsis-dap"
],
"offset_address": "0x8020000",
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32h743vi.html",
"vendor": "ST"
}

@ -0,0 +1,59 @@
{
"build": {
"core": "arduino",
"cpu": "cortex-m3",
"extra_flags": "-D__SAM3X8E__ -DARDUINO_ARCH_SAM -DARDUINO_SAM_DUE",
"f_cpu": "84000000L",
"hwids": [
[
"0x27B1",
"0x0001"
],
[
"0x2341",
"0x003E"
],
[
"0x2341",
"0x003D"
]
],
"ldscript": "linker_scripts/gcc/flash.ld",
"mcu": "at91sam3x8e",
"usb_product": "Archim",
"variant": "MARLIN_ARCHIM"
},
"connectivity": [
"can"
],
"debug": {
"jlink_device": "ATSAM3X8E",
"openocd_chipname": "at91sam3X8E",
"openocd_target": "at91sam3XXX",
"svd_path": "ATSAM3X8E.svd"
},
"frameworks": [
"arduino",
"simba"
],
"name": "Archim",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 98304,
"maximum_size": 524288,
"native_usb": true,
"protocol": "sam-ba",
"protocols": [
"sam-ba",
"jlink",
"blackmagic",
"atmel-ice",
"stlink"
],
"require_upload_port": true,
"use_1200bps_touch": true,
"wait_for_upload_port": true
},
"url": "https://ultimachine.com",
"vendor": "UltiMachine"
}

@ -0,0 +1,21 @@
{
"build": {
"core": "teensy",
"extra_flags": "-DTEENSY2PP -fsingle-precision-constant",
"f_cpu": "16000000L",
"mcu": "at90usb1286"
},
"frameworks": [
"arduino"
],
"platform": "teensy",
"name": "Atmel AT90USB1286 based",
"upload": {
"maximum_ram_size": 8192,
"maximum_size": 122880,
"require_upload_port": true,
"protocol": ""
},
"url": "https://github.com/MarlinFirmware/Marlin",
"vendor": "various"
}

@ -0,0 +1,64 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F407xx -DARDUINO_BLACK_F407VE",
"f_cpu": "168000000L",
"hwids": [
[
"0x1EAF",
"0x0003"
],
[
"0x0483",
"0x3748"
]
],
"mcu": "stm32f407vet6",
"variant": "MARLIN_F407VE"
},
"debug": {
"jlink_device": "STM32F407VE",
"openocd_target": "stm32f4x",
"svd_path": "STM32F40x.svd",
"tools": {
"stlink": {
"server": {
"arguments": [
"-f",
"scripts/interface/stlink.cfg",
"-c",
"transport select hla_swd",
"-f",
"scripts/target/stm32f4x.cfg",
"-c",
"reset_config none"
],
"executable": "bin/openocd",
"package": "tool-openocd"
}
}
}
},
"frameworks": [
"arduino",
"stm32cube"
],
"name": "STM32F407VE (192k RAM. 512k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 131072,
"maximum_size": 524288,
"protocol": "stlink",
"protocols": [
"stlink",
"dfu",
"jlink"
],
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f407ve.html",
"vendor": "Generic"
}

@ -0,0 +1,35 @@
{
"build": {
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F446xx",
"f_cpu": "180000000L",
"mcu": "stm32f446ret6",
"variant": "MARLIN_FYSETC_S6"
},
"connectivity": [
"can"
],
"debug": {
"jlink_device": "STM32F446RE",
"openocd_target": "stm32f4x",
"svd_path": "STM32F446x.svd"
},
"frameworks": [
"arduino",
"stm32cube"
],
"name": "3D Printer control board",
"upload": {
"maximum_ram_size": 131072,
"maximum_size": 524288,
"protocol": "stlink",
"protocols": [
"jlink",
"stlink",
"blackmagic",
"serial"
]
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f446.html",
"vendor": "FYSETC"
}

@ -0,0 +1,35 @@
{
"build": {
"core": "maple",
"cpu": "cortex-m3",
"extra_flags": "-DARDUINO_GENERIC_STM32F103C -DMCU_STM32F103CB",
"f_cpu": "72000000L",
"hwids": [
["0x1EAF", "0x0003"],
["0x1EAF", "0x0004"]
],
"ldscript": "jtagOffset.ld",
"mcu": "stm32f103cb",
"variant": "malyanM200",
"vec_tab_addr": "0x8002000"
},
"debug": {
"jlink_device": "STM32F103CB",
"openocd_target": "stm32f1x",
"svd_path": "STM32F103xx.svd"
},
"platform": "ststm32",
"frameworks": ["arduino"],
"name": "Malyan STM32F103CB (20k RAM. 128k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 20480,
"maximum_size": 131072,
"protocol": "serial",
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f1-series/stm32f103/stm32f103cb.html",
"vendor": "Generic"
}

@ -0,0 +1,41 @@
{
"build": {
"cpu": "cortex-m0",
"extra_flags": "-DSTM32F070xB",
"f_cpu": "48000000L",
"mcu": "stm32f070rbt6",
"variant": "MALYANMx00_F070CB",
"vec_tab_addr": "0x8002000"
},
"debug": {
"jlink_device": "STM32F070RB",
"default_tools": [
"stlink"
],
"onboard_tools": [
"stlink"
],
"openocd_board": "st_nucleo_f0",
"openocd_target": "stm32f0x"
},
"platform": "ststm32",
"frameworks": [
"mbed",
"stm32cube",
"arduino"
],
"name": "Malyan M200 V2/Delta",
"upload": {
"maximum_ram_size": 16384,
"maximum_size": 131072,
"protocol": "mbed",
"protocols": [
"jlink",
"stlink",
"blackmagic",
"mbed"
]
},
"url": "https://developer.mbed.org/platforms/ST-Nucleo-F070RB/",
"vendor": "Malyan"
}

@ -0,0 +1,47 @@
{
"build": {
"core": "maple",
"cpu": "cortex-m3",
"extra_flags": "-DSTM32F103xE -DSTM32F1",
"f_cpu": "72000000L",
"hwids": [
[
"0x1EAF",
"0x0003"
],
[
"0x1EAF",
"0x0004"
]
],
"mcu": "stm32f103zet6",
"variant": "marlin_maple_CHITU_F103"
},
"debug": {
"jlink_device": "STM32F103ZE",
"openocd_target": "stm32f1x",
"svd_path": "STM32F103xx.svd"
},
"frameworks": [
"arduino"
],
"name": "CHITU STM32F103Z (64k RAM. 512k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 60536,
"maximum_size": 480288,
"protocol": "stlink",
"protocols": [
"jlink",
"stlink",
"blackmagic",
"serial",
"dfu"
],
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f103ze.html",
"vendor": "Generic"
}

@ -0,0 +1,53 @@
{
"build": {
"core": "maple",
"cpu": "cortex-m3",
"extra_flags": "-DSTM32F103xE -DSTM32F1",
"f_cpu": "72000000L",
"hwids": [
[
"0x1EAF",
"0x0003"
],
[
"0x1EAF",
"0x0004"
]
],
"libopencm3": {
"ldscript": "stm32f103xc.ld"
},
"mcu": "stm32f103rct6",
"variant": "marlin_maple_MEEB_3DP"
},
"debug": {
"jlink_device": "STM32F103RC",
"openocd_target": "stm32f1x",
"svd_path": "STM32F103xx.svd"
},
"frameworks": [
"arduino",
"cmsis",
"libopencm3",
"stm32cube"
],
"name": "3D Printer control board for MEEB with 512k flash/rs422 bus/tmc2208 drivers",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 49152,
"maximum_size": 524288,
"protocol": "dfu",
"protocols": [
"jlink",
"stlink",
"blackmagic",
"serial",
"dfu"
],
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://github.com/ccrobot-online/MEEB_3DP",
"vendor": "CCROBOT-ONLINE"
}

@ -0,0 +1,51 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F407xx",
"f_cpu": "168000000L",
"hwids": [
[
"0x0483",
"0xdf11"
],
[
"0x1EAF",
"0x0003"
],
[
"0x0483",
"0x3748"
]
],
"mcu": "stm32f407vet6",
"variant": "MARLIN_F407VE"
},
"debug": {
"jlink_device": "STM32F407VE",
"openocd_target": "stm32f4x",
"svd_path": "STM32F40x.svd"
},
"frameworks": [
"arduino",
"stm32cube"
],
"name": "STM32F407VE (192k RAM. 512k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 131072,
"maximum_size": 524288,
"protocol": "dfu",
"protocols": [
"stlink",
"dfu",
"jlink",
"blackmagic"
],
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f407ve.html",
"vendor": "Generic"
}

@ -0,0 +1,51 @@
{
"build": {
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32F407xx",
"f_cpu": "168000000L",
"hwids": [
[
"0x0483",
"0xdf11"
],
[
"0x1EAF",
"0x0003"
],
[
"0x0483",
"0x3748"
]
],
"mcu": "stm32f407vet6",
"variant": "MARLIN_F407VE"
},
"debug": {
"jlink_device": "STM32F407VE",
"openocd_target": "stm32f4x",
"svd_path": "STM32F40x.svd"
},
"frameworks": [
"arduino",
"stm32cube"
],
"name": "STM32F407VE (192k RAM. 512k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 131072,
"maximum_size": 524288,
"protocol": "dfu",
"protocols": [
"stlink",
"dfu",
"jlink",
"blackmagic"
],
"require_upload_port": true,
"use_1200bps_touch": false,
"wait_for_upload_port": false
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f407ve.html",
"vendor": "Generic"
}

@ -0,0 +1,59 @@
/**
* Remote debugging on STM32 using the "Cortex Debug" extension.
*
* Copy one or more of the configurations items below into .vscode/launch.json
* to add those debug options to the PlatformIO IDE "Run & Debug" panel.
*
* Examples for BigTreeTech SKR 2 (USB) and Native Simulator. Modify for your own build.
*
* NOTE: The PlatformIO extension will remove items when regenerating launch.json.
*/
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug STM32 (ST-Link)",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"cwd": "${workspaceRoot}",
"showDevDebugOutput": false,
"configFiles": [ "interface/stlink.cfg", "target/stm32f4x.cfg" ],
"device": "stlink",
"executable": "${workspaceRoot}/.pio/build/BIGTREE_SKR_2_USB_debug/firmware.elf",
"openOCDLaunchCommands": [ "init", "reset init" ],
"svdFile": "${env:HOME}/.platformio/platforms/ststm32@12.1.1/misc/svd/STM32F40x.svd",
},
{
"name": "Launch Sim (ggdb)",
"request": "launch",
"type": "cppdbg",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/.pio/build/simulator_macos_debug/debug/MarlinSimulator",
//"program": "${workspaceRoot}/.pio/build/simulator_linux_debug/MarlinSimulator",
//"program": "${workspaceRoot}/.pio/build/simulator_windows/MarlinSimulator",
"miDebuggerPath": "/opt/local/bin/ggdb",
"MIMode": "gdb"
},
{
"name": "Launch Sim (lldb)",
"request": "launch",
"type": "cppdbg",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/.pio/build/simulator_macos_debug/debug/MarlinSimulator",
//"program": "${workspaceRoot}/.pio/build/simulator_linux_debug/MarlinSimulator",
//"program": "${workspaceRoot}/.pio/build/simulator_windows/MarlinSimulator",
//"targetArchitecture": "arm64",
"MIMode": "lldb"
},
{
"name": "Launch Sim (Windows gdb)",
"request": "launch",
"type": "cppdbg",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/.pio/build/simulator_windows/debug/MarlinSimulator.exe",
"MIMode": "gdb",
"miDebuggerPath": "C:/msys64/mingw64/bin/gdb.exe"
}
]
}

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K - 40
rom (rx) : ORIGIN = 0x08002000, LENGTH = 512K - 8K - 4K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K - 40
rom (rx) : ORIGIN = 0x08007000, LENGTH = 256K - 28K - 4K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K - 40
rom (rx) : ORIGIN = 0x08007000, LENGTH = 512K - 28K - 4K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K - 40
rom (rx) : ORIGIN = 0x08010000, LENGTH = 512K - 64K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K - 40
rom (rx) : ORIGIN = 0x08005000, LENGTH = 256K - 20K - 4K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K - 40
rom (rx) : ORIGIN = 0x08005000, LENGTH = 512K - 20K - 4K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K - 40
rom (rx) : ORIGIN = 0x08007000, LENGTH = 512K - 64K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K - 40
rom (rx) : ORIGIN = 0x08007000, LENGTH = 256K - 28K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K - 40
rom (rx) : ORIGIN = 0x08010000, LENGTH = 512K - 64K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K - 4K
rom (rx) : ORIGIN = 0x08004000, LENGTH = 512K - 16K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K - 40
rom (rx) : ORIGIN = 0x08005000, LENGTH = 256K - 20K - 4K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 64K - 3K
rom (rx) : ORIGIN = 0x0800A000, LENGTH = 512K - 40K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K - 40
rom (rx) : ORIGIN = 0x08007000, LENGTH = 512K - 28K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K - 40
rom (rx) : ORIGIN = 0x08005000, LENGTH = 256K - 20K - 4K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K - 40
rom (rx) : ORIGIN = 0x08007000, LENGTH = 512K - 28K - 4K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K - 40
rom (rx) : ORIGIN = 0x08005000, LENGTH = 256K - 20K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K - 40
rom (rx) : ORIGIN = 0x08005000, LENGTH = 256K - 20K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K - 40
rom (rx) : ORIGIN = 0x08007000, LENGTH = 512K - 28K - 4K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K - 40
rom (rx) : ORIGIN = 0x08007000, LENGTH = 512K - 28K - 4K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K - 40
rom (rx) : ORIGIN = 0x08007000, LENGTH = 512K - 28K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,14 @@
MEMORY
{
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K - 40
rom (rx) : ORIGIN = 0x08007000, LENGTH = 512K - 28K
}
/* Provide memory region aliases for common.inc */
REGION_ALIAS("REGION_TEXT", rom);
REGION_ALIAS("REGION_DATA", ram);
REGION_ALIAS("REGION_BSS", ram);
REGION_ALIAS("REGION_RODATA", rom);
/* Let common.inc handle the real work. */
INCLUDE common.inc

@ -0,0 +1,19 @@
#
# SAMD21_minitronics20.py
# Customizations for env:SAMD21_minitronics20
#
import pioutil
if pioutil.is_pio_build():
from os.path import join, isfile
import shutil
Import("env")
mf = env["MARLIN_FEATURES"]
rxBuf = mf["RX_BUFFER_SIZE"] if "RX_BUFFER_SIZE" in mf else "0"
txBuf = mf["TX_BUFFER_SIZE"] if "TX_BUFFER_SIZE" in mf else "0"
serialBuf = str(max(int(rxBuf), int(txBuf), 350))
build_flags = env.get('BUILD_FLAGS')
env.Replace(BUILD_FLAGS=build_flags)

@ -0,0 +1,20 @@
#
# SAMD51_grandcentral_m4.py
# Customizations for env:SAMD51_grandcentral_m4
#
import pioutil
if pioutil.is_pio_build():
from os.path import join, isfile
import shutil
Import("env")
mf = env["MARLIN_FEATURES"]
rxBuf = mf["RX_BUFFER_SIZE"] if "RX_BUFFER_SIZE" in mf else "0"
txBuf = mf["TX_BUFFER_SIZE"] if "TX_BUFFER_SIZE" in mf else "0"
serialBuf = str(max(int(rxBuf), int(txBuf), 350))
build_flags = env.get('BUILD_FLAGS')
build_flags.append("-DSERIAL_BUFFER_SIZE=" + serialBuf)
env.Replace(BUILD_FLAGS=build_flags)

@ -0,0 +1,19 @@
#
# STM32F103RC_MEEB_3DP.py
#
import pioutil
if pioutil.is_pio_build():
Import("env", "projenv")
flash_size = 0
vect_tab_addr = 0
for define in env['CPPDEFINES']:
if define[0] == "VECT_TAB_ADDR":
vect_tab_addr = define[1]
if define[0] == "STM32_FLASH_SIZE":
flash_size = define[1]
print('Use the {0:s} address as the marlin app entry point.'.format(vect_tab_addr))
print('Use the {0:d}KB flash version of stm32f103rct6 chip.'.format(flash_size))

@ -0,0 +1,27 @@
#
# STM32F103RC_fysetc.py
#
import pioutil
if pioutil.is_pio_build():
from os.path import join
from os.path import expandvars
Import("env")
# Custom HEX from ELF
env.AddPostAction(
join("$BUILD_DIR", "${PROGNAME}.elf"),
env.VerboseAction(" ".join([
"$OBJCOPY", "-O ihex", "$TARGET",
"\"" + join("$BUILD_DIR", "${PROGNAME}.hex") + "\"", # Note: $BUILD_DIR is a full path
]), "Building $TARGET"))
# In-line command with arguments
UPLOAD_TOOL="stm32flash"
platform = env.PioPlatform()
if platform.get_package_dir("tool-stm32duino") != None:
UPLOAD_TOOL=expandvars("\"" + join(platform.get_package_dir("tool-stm32duino"),"stm32flash","stm32flash") + "\"")
env.Replace(
UPLOADER=UPLOAD_TOOL,
UPLOADCMD=expandvars(UPLOAD_TOOL + " -v -i rts,-dtr,dtr -R -b 115200 -g 0x8000000 -w \"" + join("$BUILD_DIR","${PROGNAME}.hex")+"\"" + " $UPLOAD_PORT")
)

@ -0,0 +1,31 @@
#
# STM32F1_create_variant.py
#
import pioutil
if pioutil.is_pio_build():
import shutil,marlin
from pathlib import Path
Import("env")
platform = env.PioPlatform()
board = env.BoardConfig()
FRAMEWORK_DIR = Path(platform.get_package_dir("framework-arduinoststm32-maple"))
assert FRAMEWORK_DIR.is_dir()
source_root = Path("buildroot/share/PlatformIO/variants")
assert source_root.is_dir()
variant = board.get("build.variant")
variant_dir = FRAMEWORK_DIR / "STM32F1/variants" / variant
source_dir = source_root / variant
assert source_dir.is_dir()
if variant_dir.is_dir():
shutil.rmtree(variant_dir)
if not variant_dir.is_dir():
variant_dir.mkdir()
marlin.copytree(source_dir, variant_dir)

@ -0,0 +1,6 @@
#
# add_nanolib.py
#
Import("env")
env.Append(LINKFLAGS=["--specs=nano.specs"])

@ -0,0 +1,126 @@
#
# chitu_crypt.py
# Customizations for Chitu boards
#
import pioutil
if pioutil.is_pio_build():
import struct,uuid,marlin
board = marlin.env.BoardConfig()
def calculate_crc(contents, seed):
accumulating_xor_value = seed
for i in range(0, len(contents), 4):
value = struct.unpack('<I', contents[ i : i + 4])[0]
accumulating_xor_value = accumulating_xor_value ^ value
return accumulating_xor_value
def xor_block(r0, r1, block_number, block_size, file_key):
# This is the loop counter
loop_counter = 0x0
# This is the key length
key_length = 0x18
# This is an initial seed
xor_seed = 0x4BAD
# This is the block counter
block_number = xor_seed * block_number
#load the xor key from the file
r7 = file_key
for loop_counter in range(0, block_size):
# meant to make sure different bits of the key are used.
xor_seed = int(loop_counter / key_length)
# IP is a scratch register / R12
ip = loop_counter - (key_length * xor_seed)
# xor_seed = (loop_counter * loop_counter) + block_number
xor_seed = (loop_counter * loop_counter) + block_number
# shift the xor_seed left by the bits in IP.
xor_seed = xor_seed >> ip
# load a byte into IP
ip = r0[loop_counter]
# XOR the seed with r7
xor_seed = xor_seed ^ r7
# and then with IP
xor_seed = xor_seed ^ ip
#Now store the byte back
r1[loop_counter] = xor_seed & 0xFF
#increment the loop_counter
loop_counter = loop_counter + 1
def encrypt_file(input, output_file, file_length):
input_file = bytearray(input.read())
block_size = 0x800
key_length = 0x18
uid_value = uuid.uuid4()
file_key = int(uid_value.hex[0:8], 16)
xor_crc = 0xEF3D4323
# the input file is exepcted to be in chunks of 0x800
# so round the size
while len(input_file) % block_size != 0:
input_file.extend(b'0x0')
# write the file header
output_file.write(struct.pack(">I", 0x443D2D3F))
# encrypt the contents using a known file header key
# write the file_key
output_file.write(struct.pack("<I", file_key))
#TODO - how to enforce that the firmware aligns to block boundaries?
block_count = int(len(input_file) / block_size)
print ("Block Count is ", block_count)
for block_number in range(0, block_count):
block_offset = (block_number * block_size)
block_end = block_offset + block_size
block_array = bytearray(input_file[block_offset: block_end])
xor_block(block_array, block_array, block_number, block_size, file_key)
for n in range (0, block_size):
input_file[block_offset + n] = block_array[n]
# update the expected CRC value.
xor_crc = calculate_crc(block_array, xor_crc)
# write CRC
output_file.write(struct.pack("<I", xor_crc))
# finally, append the encrypted results.
output_file.write(input_file)
return
# Encrypt ${PROGNAME}.bin and save it as 'update.cbd'
def encrypt(source, target, env):
from pathlib import Path
fwpath = Path(target[0].path)
fwsize = fwpath.stat().st_size
enname = board.get("build.crypt_chitu")
enpath = Path(target[0].dir.path)
fwfile = fwpath.open("rb")
enfile = (enpath / enname).open("wb")
print(f"Encrypting {fwpath} to {enname}")
encrypt_file(fwfile, enfile, fwsize)
fwfile.close()
enfile.close()
fwpath.unlink()
marlin.relocate_firmware("0x08008800")
marlin.add_post_action(encrypt)

@ -0,0 +1,46 @@
#
# common-cxxflags.py
# Convenience script to apply customizations to CPP flags
#
import pioutil
if pioutil.is_pio_build():
Import("env")
cxxflags = [
# "-Wno-incompatible-pointer-types",
# "-Wno-unused-const-variable",
# "-Wno-maybe-uninitialized",
# "-Wno-sign-compare"
]
if "teensy" not in env["PIOENV"]:
cxxflags += ["-Wno-register"]
env.Append(CXXFLAGS=cxxflags)
#
# Add CPU frequency as a compile time constant instead of a runtime variable
#
def add_cpu_freq():
if "BOARD_F_CPU" in env:
env["BUILD_FLAGS"].append("-DBOARD_F_CPU=" + env["BOARD_F_CPU"])
# Useful for JTAG debugging
#
# It will separate release and debug build folders.
# It useful to keep two live versions: a debug version for debugging and another for
# release, for flashing when upload is not done automatically by jlink/stlink.
# Without this, PIO needs to recompile everything twice for any small change.
if env.GetBuildType() == "debug" and env.get("UPLOAD_PROTOCOL") not in ["jlink", "stlink", "custom"]:
env["BUILD_DIR"] = "$PROJECT_BUILD_DIR/$PIOENV/debug"
def on_program_ready(source, target, env):
import shutil
shutil.copy(target[0].get_abspath(), env.subst("$PROJECT_BUILD_DIR/$PIOENV"))
env.AddPostAction("$PROGPATH", on_program_ready)
# On some platform, F_CPU is a runtime variable. Since it's used to convert from ns
# to CPU cycles, this adds overhead preventing small delay (in the order of less than
# 30 cycles) to be generated correctly. By using a compile time constant instead
# the compiler will perform the computation and this overhead will be avoided
add_cpu_freq()

@ -0,0 +1,16 @@
#
# post:common-dependencies-post.py
# Convenience script to add build flags for Marlin Enabled Features
#
import pioutil
if pioutil.is_pio_build():
Import("env", "projenv")
def apply_board_build_flags():
if not 'BOARD_CUSTOM_BUILD_FLAGS' in env['MARLIN_FEATURES']:
return
projenv.Append(CCFLAGS=env['MARLIN_FEATURES']['BOARD_CUSTOM_BUILD_FLAGS'].split())
# We need to add the board build flags in a post script
# so the platform build script doesn't overwrite the custom CCFLAGS
apply_board_build_flags()

@ -0,0 +1,107 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/**
* The purpose of this file is just include Marlin Configuration files,
* to discover which FEATURES are enabled, without any HAL include.
* Used by common-dependencies.py
*/
#include "../../../../Marlin/src/inc/MarlinConfig.h"
//
// Conditionals only used for [features]
//
#if ENABLED(SR_LCD_3W_NL)
// Feature checks for SR_LCD_3W_NL
#elif ANY(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008)
#define USES_LIQUIDTWI2
#elif ENABLED(LCD_I2C_TYPE_PCA8574)
#define USES_LIQUIDCRYSTAL_I2C
#elif ANY(HAS_MARLINUI_HD44780, LCD_I2C_TYPE_PCF8575, SR_LCD_2W_NL, LCM1602)
#define USES_LIQUIDCRYSTAL
#endif
#if SAVED_POSITIONS
#define HAS_SAVED_POSITIONS
#endif
#if ENABLED(DUET_SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD)
#define HAS_SMART_EFF_MOD
#endif
#if HAS_MARLINUI_MENU
#if ENABLED(BACKLASH_GCODE)
#define HAS_MENU_BACKLASH
#endif
#if ENABLED(LCD_BED_TRAMMING)
#define HAS_MENU_BED_TRAMMING
#endif
#if ENABLED(CANCEL_OBJECTS)
#define HAS_MENU_CANCELOBJECT
#endif
#if ANY(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION)
#define HAS_MENU_DELTA_CALIBRATE
#endif
#if ANY(LED_CONTROL_MENU, CASE_LIGHT_MENU)
#define HAS_MENU_LED
#endif
#if ENABLED(ADVANCED_PAUSE_FEATURE)
#define HAS_MENU_FILAMENT
#endif
#if HAS_MEDIA
#define HAS_MENU_MEDIA
#endif
#if ENABLED(MIXING_EXTRUDER)
#define HAS_MENU_MIXER
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
#define HAS_MENU_JOB_RECOVERY
#endif
#if HAS_POWER_MONITOR
#define HAS_MENU_POWER_MONITOR
#endif
#if HAS_CUTTER
#define HAS_MENU_CUTTER
#endif
#if HAS_TEMPERATURE
#define HAS_MENU_TEMPERATURE
#endif
#if ENABLED(MMU2_MENUS)
#define HAS_MENU_MMU2
#endif
#if ENABLED(PASSWORD_FEATURE)
#define HAS_MENU_PASSWORD
#endif
#if HAS_TRINAMIC_CONFIG
#define HAS_MENU_TMC
#endif
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
#define HAS_MENU_TOUCH_SCREEN
#endif
#if ENABLED(ASSISTED_TRAMMING_WIZARD)
#define HAS_MENU_TRAMMING_WIZARD
#endif
#if ENABLED(AUTO_BED_LEVELING_UBL)
#define HAS_MENU_UBL
#endif
#endif

@ -0,0 +1,322 @@
#
# common-dependencies.py
# Convenience script to check dependencies and add libs and sources for Marlin Enabled Features
#
import pioutil
if pioutil.is_pio_build():
import subprocess,os,re,fnmatch,glob
srcfilepattern = re.compile(r".*[.](cpp|c)$")
marlinbasedir = os.path.join(os.getcwd(), "Marlin/")
Import("env")
from platformio.package.meta import PackageSpec
from platformio.project.config import ProjectConfig
verbose = 0
FEATURE_CONFIG = {}
def validate_pio():
PIO_VERSION_MIN = (6, 0, 1)
try:
from platformio import VERSION as PIO_VERSION
weights = (1000, 100, 1)
version_min = sum([x[0] * float(re.sub(r'[^0-9]', '.', str(x[1]))) for x in zip(weights, PIO_VERSION_MIN)])
version_cur = sum([x[0] * float(re.sub(r'[^0-9]', '.', str(x[1]))) for x in zip(weights, PIO_VERSION)])
if version_cur < version_min:
print()
print("**************************************************")
print("****** An update to PlatformIO is ******")
print("****** required to build Marlin Firmware. ******")
print("****** ******")
print("****** Minimum version: ", PIO_VERSION_MIN, " ******")
print("****** Current Version: ", PIO_VERSION, " ******")
print("****** ******")
print("****** Update PlatformIO and try again. ******")
print("**************************************************")
print()
exit(1)
except SystemExit:
exit(1)
except:
print("Can't detect PlatformIO Version")
def blab(str,level=1):
if verbose >= level:
print("[deps] %s" % str)
def add_to_feat_cnf(feature, flines):
try:
feat = FEATURE_CONFIG[feature]
except:
FEATURE_CONFIG[feature] = {}
# Get a reference to the FEATURE_CONFIG under construction
feat = FEATURE_CONFIG[feature]
# Split up passed lines on commas or newlines and iterate.
# Take care to convert Windows '\' paths to Unix-style '/'.
# Add common options to the features config under construction.
# For lib_deps replace a previous instance of the same library.
atoms = re.sub(r',\s*', '\n', flines.replace('\\', '/')).strip().split('\n')
for line in atoms:
parts = line.split('=')
name = parts.pop(0)
if name in ['build_flags', 'extra_scripts', 'build_src_filter', 'lib_ignore']:
feat[name] = '='.join(parts)
blab("[%s] %s=%s" % (feature, name, feat[name]), 3)
else:
for dep in re.split(r',\s*', line):
lib_name = re.sub(r'@([~^]|[<>]=?)?[\d.]+', '', dep.strip()).split('=').pop(0)
lib_re = re.compile('(?!^' + lib_name + '\\b)')
if not 'lib_deps' in feat: feat['lib_deps'] = {}
feat['lib_deps'] = list(filter(lib_re.match, feat['lib_deps'])) + [dep]
blab("[%s] lib_deps = %s" % (feature, dep), 3)
def load_features():
blab("========== Gather [features] entries...")
for key in ProjectConfig().items('features'):
feature = key[0].upper()
if not feature in FEATURE_CONFIG:
FEATURE_CONFIG[feature] = { 'lib_deps': [] }
add_to_feat_cnf(feature, key[1])
# Add options matching custom_marlin.MY_OPTION to the pile
blab("========== Gather custom_marlin entries...")
for n in env.GetProjectOptions():
key = n[0]
mat = re.match(r'custom_marlin\.(.+)', key)
if mat:
try:
val = env.GetProjectOption(key)
except:
val = None
if val:
opt = mat[1].upper()
blab("%s.custom_marlin.%s = '%s'" % ( env['PIOENV'], opt, val ), 2)
add_to_feat_cnf(opt, val)
def get_all_known_libs():
known_libs = []
for feature in FEATURE_CONFIG:
feat = FEATURE_CONFIG[feature]
if not 'lib_deps' in feat:
continue
for dep in feat['lib_deps']:
known_libs.append(PackageSpec(dep).name)
return known_libs
def get_all_env_libs():
env_libs = []
lib_deps = env.GetProjectOption('lib_deps')
for dep in lib_deps:
env_libs.append(PackageSpec(dep).name)
return env_libs
def set_env_field(field, value):
proj = env.GetProjectConfig()
proj.set("env:" + env['PIOENV'], field, value)
# All unused libs should be ignored so that if a library
# exists in .pio/lib_deps it will not break compilation.
def force_ignore_unused_libs():
env_libs = get_all_env_libs()
known_libs = get_all_known_libs()
diff = (list(set(known_libs) - set(env_libs)))
lib_ignore = env.GetProjectOption('lib_ignore') + diff
blab("Ignore libraries: %s" % lib_ignore)
set_env_field('lib_ignore', lib_ignore)
def apply_features_config():
load_features()
blab("========== Apply enabled features...")
build_filters = ' '.join(env.GetProjectOption('build_src_filter'))
for feature in FEATURE_CONFIG:
if not env.MarlinHas(feature):
continue
feat = FEATURE_CONFIG[feature]
if 'lib_deps' in feat and len(feat['lib_deps']):
blab("========== Adding lib_deps for %s... " % feature, 2)
# feat to add
deps_to_add = {}
for dep in feat['lib_deps']:
deps_to_add[PackageSpec(dep).name] = dep
blab("==================== %s... " % dep, 2)
# Does the env already have the dependency?
deps = env.GetProjectOption('lib_deps')
for dep in deps:
name = PackageSpec(dep).name
if name in deps_to_add:
del deps_to_add[name]
# Are there any libraries that should be ignored?
lib_ignore = env.GetProjectOption('lib_ignore')
for dep in deps:
name = PackageSpec(dep).name
if name in deps_to_add:
del deps_to_add[name]
# Is there anything left?
if len(deps_to_add) > 0:
# Only add the missing dependencies
set_env_field('lib_deps', deps + list(deps_to_add.values()))
if 'build_flags' in feat:
f = feat['build_flags']
blab("========== Adding build_flags for %s: %s" % (feature, f), 2)
new_flags = env.GetProjectOption('build_flags') + [ f ]
env.Replace(BUILD_FLAGS=new_flags)
if 'extra_scripts' in feat:
blab("Running extra_scripts for %s... " % feature, 2)
env.SConscript(feat['extra_scripts'], exports="env")
if 'build_src_filter' in feat:
blab("========== Adding build_src_filter for %s... " % feature, 2)
build_filters = build_filters + ' ' + feat['build_src_filter']
# Just append the filter in the order that the build environment specifies.
# Important here is the order of entries in the "features.ini" file.
if 'lib_ignore' in feat:
blab("========== Adding lib_ignore for %s... " % feature, 2)
lib_ignore = env.GetProjectOption('lib_ignore') + [feat['lib_ignore']]
set_env_field('lib_ignore', lib_ignore)
build_src_filter = ""
if True:
# Build the actual equivalent build_src_filter list based on the inclusions by the features.
# PlatformIO doesn't do it this way, but maybe in the future....
cur_srcs = set()
# Remove the references to the same folder
my_srcs = re.findall(r'([+-]<.*?>)', build_filters)
for d in my_srcs:
# Assume normalized relative paths
plain = d[2:-1]
if d[0] == '+':
def addentry(fullpath, info=None):
relp = os.path.relpath(fullpath, marlinbasedir)
if srcfilepattern.match(relp):
if info:
blab("Added src file %s (%s)" % (relp, str(info)), 3)
else:
blab("Added src file %s " % relp, 3)
cur_srcs.add(relp)
# Special rule: If a direct folder is specified add all files within.
fullplain = os.path.join(marlinbasedir, plain)
if os.path.isdir(fullplain):
blab("Directory content addition for %s " % plain, 3)
gpattern = os.path.join(fullplain, "**")
for fname in glob.glob(gpattern, recursive=True):
addentry(fname, "dca")
else:
# Add all the things from the pattern by GLOB.
def srepl(matchi):
g0 = matchi.group(0)
return r"**" + g0[1:]
gpattern = re.sub(r'[*]($|[^*])', srepl, plain)
gpattern = os.path.join(marlinbasedir, gpattern)
for fname in glob.glob(gpattern, recursive=True):
addentry(fname)
else:
# Special rule: If a direct folder is specified then remove all files within.
def onremove(relp, info=None):
if info:
blab("Removed src file %s (%s)" % (relp, str(info)), 3)
else:
blab("Removed src file %s " % relp, 3)
fullplain = os.path.join(marlinbasedir, plain)
if os.path.isdir(fullplain):
blab("Directory content removal for %s " % plain, 2)
def filt(x):
common = os.path.commonpath([plain, x])
if not common == os.path.normpath(plain): return True
onremove(x, "dcr")
return False
cur_srcs = set(filter(filt, cur_srcs))
else:
# Remove matching source entries.
def filt(x):
if not fnmatch.fnmatch(x, plain): return True
onremove(x)
return False
cur_srcs = set(filter(filt, cur_srcs))
# Transform the resulting set into a string.
for x in cur_srcs:
if build_src_filter != "": build_src_filter += ' '
build_src_filter += "+<" + x + ">"
#blab("Final build_src_filter: " + build_src_filter, 3)
else:
build_src_filter = build_filters
# Update in PlatformIO
set_env_field('build_src_filter', [build_src_filter])
env.Replace(SRC_FILTER=build_src_filter)
#
# Use the compiler to get a list of all enabled features
#
def load_marlin_features():
if 'MARLIN_FEATURES' in env:
return
# Process defines
from preprocessor import run_preprocessor
define_list = run_preprocessor(env)
marlin_features = {}
for define in define_list:
feature = define[8:].strip().decode().split(' ')
feature, definition = feature[0], ' '.join(feature[1:])
marlin_features[feature] = definition
env['MARLIN_FEATURES'] = marlin_features
#
# Return True if a matching feature is enabled
#
def MarlinHas(env, feature):
load_marlin_features()
r = re.compile('^' + feature + '$', re.IGNORECASE)
found = list(filter(r.match, env['MARLIN_FEATURES']))
# Defines could still be 'false' or '0', so check
some_on = False
if len(found):
for f in found:
val = env['MARLIN_FEATURES'][f]
if val in [ '', '1', 'true' ]:
some_on = True
elif val in env['MARLIN_FEATURES']:
some_on = env.MarlinHas(val)
#blab("%s is %s" % (feature, str(some_on)), 2)
return some_on
validate_pio()
try:
verbose = int(env.GetProjectOption('custom_verbose'))
except:
pass
#
# Add a method for other PIO scripts to query enabled features
#
env.AddMethod(MarlinHas)
#
# Add dependencies for enabled Marlin features
#
apply_features_config()
force_ignore_unused_libs()
#print(env.Dump())
from signature import compute_build_signature
compute_build_signature(env)

@ -0,0 +1,291 @@
#!/usr/bin/env python3
#
# configuration.py
# Apply options from config.ini to the existing Configuration headers
#
import re, shutil, configparser, datetime
from pathlib import Path
verbose = 0
def blab(str,level=1):
if verbose >= level: print(f"[config] {str}")
def config_path(cpath):
return Path("Marlin", cpath, encoding='utf-8')
# Apply a single name = on/off ; name = value ; etc.
# TODO: Limit to the given (optional) configuration
def apply_opt(name, val, conf=None):
if name == "lcd": name, val = val, "on"
# Create a regex to match the option and capture parts of the line
# 1: Indentation
# 2: Comment
# 3: #define and whitespace
# 4: Option name
# 5: First space after name
# 6: Remaining spaces between name and value
# 7: Option value
# 8: Whitespace after value
# 9: End comment
regex = re.compile(rf'^(\s*)(//\s*)?(#define\s+)({name}\b)(\s?)(\s*)(.*?)(\s*)(//.*)?$', re.IGNORECASE)
# Find and enable and/or update all matches
for file in ("Configuration.h", "Configuration_adv.h"):
fullpath = config_path(file)
lines = fullpath.read_text(encoding='utf-8').split('\n')
found = False
for i in range(len(lines)):
line = lines[i]
match = regex.match(line)
if match and match[4].upper() == name.upper():
found = True
# For boolean options un/comment the define
if val in ("on", "", None):
newline = re.sub(r'^(\s*)//+\s*(#define)(\s{1,3})?(\s*)', r'\1\2 \4', line)
elif val == "off":
# TODO: Comment more lines in a multi-line define with \ continuation
newline = re.sub(r'^(\s*)(#define)(\s{1,3})?(\s*)', r'\1//\2 \4', line)
else:
# For options with values, enable and set the value
addsp = '' if match[5] else ' '
newline = match[1] + match[3] + match[4] + match[5] + addsp + val + match[6]
if match[9]:
sp = match[8] if match[8] else ' '
newline += sp + match[9]
lines[i] = newline
blab(f"Set {name} to {val}")
# If the option was found, write the modified lines
if found:
fullpath.write_text('\n'.join(lines), encoding='utf-8')
break
# If the option didn't appear in either config file, add it
if not found:
# OFF options are added as disabled items so they appear
# in config dumps. Useful for custom settings.
prefix = ""
if val == "off":
prefix, val = "//", "" # Item doesn't appear in config dump
#val = "false" # Item appears in config dump
# Uppercase the option unless already mixed/uppercase
added = name.upper() if name.islower() else name
# Add the provided value after the name
if val != "on" and val != "" and val is not None:
added += " " + val
# Prepend the new option after the first set of #define lines
fullpath = config_path("Configuration.h")
with fullpath.open(encoding='utf-8') as f:
lines = f.readlines()
linenum = 0
gotdef = False
for line in lines:
isdef = line.startswith("#define")
if not gotdef:
gotdef = isdef
elif not isdef:
break
linenum += 1
currtime = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
lines.insert(linenum, f"{prefix}#define {added:30} // Added by config.ini {currtime}\n")
fullpath.write_text(''.join(lines), encoding='utf-8')
# Disable all (most) defined options in the configuration files.
# Everything in the named sections. Section hint for exceptions may be added.
def disable_all_options():
# Create a regex to match the option and capture parts of the line
regex = re.compile(r'^(\s*)(#define\s+)([A-Z0-9_]+\b)(\s?)(\s*)(.*?)(\s*)(//.*)?$', re.IGNORECASE)
# Disable all enabled options in both Config files
for file in ("Configuration.h", "Configuration_adv.h"):
fullpath = config_path(file)
lines = fullpath.read_text(encoding='utf-8').split('\n')
found = False
for i in range(len(lines)):
line = lines[i]
match = regex.match(line)
if match:
name = match[3].upper()
if name in ('CONFIGURATION_H_VERSION', 'CONFIGURATION_ADV_H_VERSION'): continue
if name.startswith('_'): continue
found = True
# Comment out the define
# TODO: Comment more lines in a multi-line define with \ continuation
lines[i] = re.sub(r'^(\s*)(#define)(\s{1,3})?(\s*)', r'\1//\2 \4', line)
blab(f"Disable {name}")
# If the option was found, write the modified lines
if found:
fullpath.write_text('\n'.join(lines), encoding='utf-8')
# Fetch configuration files from GitHub given the path.
# Return True if any files were fetched.
def fetch_example(url):
if url.endswith("/"): url = url[:-1]
if not url.startswith('http'):
brch = "bugfix-2.1.x"
if '@' in url: url, brch = map(str.strip, url.split('@'))
if url == 'examples/default': url = 'default'
url = f"https://raw.githubusercontent.com/MarlinFirmware/Configurations/{brch}/config/{url}"
url = url.replace("%", "%25").replace(" ", "%20")
# Find a suitable fetch command
if shutil.which("curl") is not None:
fetch = "curl -L -s -S -f -o"
elif shutil.which("wget") is not None:
fetch = "wget -q -O"
else:
blab("Couldn't find curl or wget", -1)
return False
import os
# Reset configurations to default
os.system("git checkout HEAD Marlin/*.h")
# Try to fetch the remote files
gotfile = False
for fn in ("Configuration.h", "Configuration_adv.h", "_Bootscreen.h", "_Statusscreen.h"):
if os.system(f"{fetch} wgot {url}/{fn} >/dev/null 2>&1") == 0:
shutil.move('wgot', config_path(fn))
gotfile = True
if Path('wgot').exists(): shutil.rmtree('wgot')
return gotfile
def section_items(cp, sectkey):
return cp.items(sectkey) if sectkey in cp.sections() else []
# Apply all items from a config section. Ignore ini_ items outside of config:base and config:root.
def apply_ini_by_name(cp, sect):
iniok = True
if sect in ('config:base', 'config:root'):
iniok = False
items = section_items(cp, 'config:base') + section_items(cp, 'config:root')
else:
items = section_items(cp, sect)
for item in items:
if iniok or not item[0].startswith('ini_'):
apply_opt(item[0], item[1])
# Apply all config sections from a parsed file
def apply_all_sections(cp):
for sect in cp.sections():
if sect.startswith('config:'):
apply_ini_by_name(cp, sect)
# Apply certain config sections from a parsed file
def apply_sections(cp, ckey='all'):
blab(f"Apply section key: {ckey}")
if ckey == 'all':
apply_all_sections(cp)
else:
# Apply the base/root config.ini settings after external files are done
if ckey in ('base', 'root'):
apply_ini_by_name(cp, 'config:base')
# Apply historically 'Configuration.h' settings everywhere
if ckey == 'basic':
apply_ini_by_name(cp, 'config:basic')
# Apply historically Configuration_adv.h settings everywhere
# (Some of which rely on defines in 'Conditionals_LCD.h')
elif ckey in ('adv', 'advanced'):
apply_ini_by_name(cp, 'config:advanced')
# Apply a specific config:<name> section directly
elif ckey.startswith('config:'):
apply_ini_by_name(cp, ckey)
# Apply settings from a top level config.ini
def apply_config_ini(cp):
blab("=" * 20 + " Gather 'config.ini' entries...")
# Pre-scan for ini_use_config to get config_keys
base_items = section_items(cp, 'config:base') + section_items(cp, 'config:root')
config_keys = ['base']
for ikey, ival in base_items:
if ikey == 'ini_use_config':
config_keys = map(str.strip, ival.split(','))
# For each ini_use_config item perform an action
for ckey in config_keys:
addbase = False
# For a key ending in .ini load and parse another .ini file
if ckey.endswith('.ini'):
sect = 'base'
if '@' in ckey: sect, ckey = map(str.strip, ckey.split('@'))
cp2 = configparser.ConfigParser()
cp2.read(config_path(ckey))
apply_sections(cp2, sect)
ckey = 'base'
# (Allow 'example/' as a shortcut for 'examples/')
elif ckey.startswith('example/'):
ckey = 'examples' + ckey[7:]
# For 'examples/<path>' fetch an example set from GitHub.
# For https?:// do a direct fetch of the URL.
if ckey.startswith('examples/') or ckey.startswith('http'):
fetch_example(ckey)
ckey = 'base'
#
# [flatten] Write out Configuration.h and Configuration_adv.h files with
# just the enabled options and all other content removed.
#
#if ckey == '[flatten]':
# write_flat_configs()
if ckey == '[disable]':
disable_all_options()
elif ckey == 'all':
apply_sections(cp)
else:
# Apply keyed sections after external files are done
apply_sections(cp, 'config:' + ckey)
if __name__ == "__main__":
#
# From command line use the given file name
#
import sys
args = sys.argv[1:]
if len(args) > 0:
if args[0].endswith('.ini'):
ini_file = args[0]
else:
print("Usage: %s <.ini file>" % sys.argv[0])
else:
ini_file = config_path('config.ini')
if ini_file:
user_ini = configparser.ConfigParser()
user_ini.read(ini_file)
apply_config_ini(user_ini)
else:
#
# From within PlatformIO use the loaded INI file
#
import pioutil
if pioutil.is_pio_build():
Import("env")
try:
verbose = int(env.GetProjectOption('custom_verbose'))
except:
pass
from platformio.project.config import ProjectConfig
apply_config_ini(ProjectConfig())

@ -0,0 +1,18 @@
#
# custom_board.py
#
# - For build.address replace VECT_TAB_ADDR to relocate the firmware
# - For build.ldscript use one of the linker scripts in buildroot/share/PlatformIO/ldscripts
#
import pioutil
if pioutil.is_pio_build():
import marlin
board = marlin.env.BoardConfig()
address = board.get("build.address", "")
if address:
marlin.relocate_firmware(address)
ldscript = board.get("build.ldscript", "")
if ldscript:
marlin.custom_ld_script(ldscript)

@ -0,0 +1,53 @@
#
# download_mks_assets.py
# Added by HAS_TFT_LVGL_UI to download assets from Makerbase repo
#
import pioutil
if pioutil.is_pio_build():
Import("env")
import requests,zipfile,tempfile,shutil
from pathlib import Path
url = "https://github.com/makerbase-mks/Mks-Robin-Nano-Marlin2.0-Firmware/archive/0263cdaccf.zip"
deps_path = Path(env.Dictionary("PROJECT_LIBDEPS_DIR"))
zip_path = deps_path / "mks-assets.zip"
assets_path = Path(env.Dictionary("PROJECT_BUILD_DIR"), env.Dictionary("PIOENV"), "assets")
def download_mks_assets():
print("Downloading MKS Assets for TFT_LVGL_UI")
r = requests.get(url, stream=True)
# the user may have a very clean workspace,
# so create the PROJECT_LIBDEPS_DIR directory if not exits
if not deps_path.exists():
deps_path.mkdir()
with zip_path.open('wb') as fd:
for chunk in r.iter_content(chunk_size=128):
fd.write(chunk)
def copy_mks_assets():
print("Copying MKS Assets for TFT_LVGL_UI")
output_path = Path(tempfile.mkdtemp())
zip_obj = zipfile.ZipFile(zip_path, 'r')
zip_obj.extractall(output_path)
zip_obj.close()
if assets_path.exists() and not assets_path.is_dir():
assets_path.unlink()
if not assets_path.exists():
assets_path.mkdir()
base_path = ''
for filename in output_path.iterdir():
base_path = filename
fw_path = (output_path / base_path / 'Firmware')
font_path = fw_path / 'mks_font'
for filename in font_path.iterdir():
shutil.copy(font_path / filename, assets_path)
pic_path = fw_path / 'mks_pic'
for filename in pic_path.iterdir():
shutil.copy(pic_path / filename, assets_path)
shutil.rmtree(output_path, ignore_errors=True)
if not zip_path.exists():
download_mks_assets()
if not assets_path.exists():
copy_mks_assets()

@ -0,0 +1,104 @@
/* *****************************************************************************
* The MIT License
*
* Copyright (c) 2010 Perry Hung.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* ****************************************************************************/
# On an exception, push a fake stack thread mode stack frame and redirect
# thread execution to a thread mode error handler
# From RM008:
# The SP is decremented by eight words by the completion of the stack push.
# Figure 5-1 shows the contents of the stack after an exception pre-empts the
# current program flow.
#
# Old SP--> <previous>
# xPSR
# PC
# LR
# r12
# r3
# r2
# r1
# SP--> r0
.text
.globl __exc_nmi
.weak __exc_nmi
.globl __exc_hardfault
.weak __exc_hardfault
.globl __exc_memmanage
.weak __exc_memmanage
.globl __exc_busfault
.weak __exc_busfault
.globl __exc_usagefault
.weak __exc_usagefault
.code 16
.thumb_func
__exc_nmi:
mov r0, #1
b __default_exc
.thumb_func
__exc_hardfault:
mov r0, #2
b __default_exc
.thumb_func
__exc_memmanage:
mov r0, #3
b __default_exc
.thumb_func
__exc_busfault:
mov r0, #4
b __default_exc
.thumb_func
__exc_usagefault:
mov r0, #5
b __default_exc
.thumb_func
__default_exc:
ldr r2, NVIC_CCR @ Enable returning to thread mode even if there are
mov r1 ,#1 @ pending exceptions. See flag NONEBASETHRDENA.
str r1, [r2]
cpsid i @ Disable global interrupts
ldr r2, SYSTICK_CSR @ Disable systick handler
mov r1, #0
str r1, [r2]
ldr r1, CPSR_MASK @ Set default CPSR
push {r1}
ldr r1, TARGET_PC @ Set target pc
push {r1}
sub sp, sp, #24 @ Don't care
ldr r1, EXC_RETURN @ Return to thread mode
mov lr, r1
bx lr @ Exception exit
.align 4
CPSR_MASK: .word 0x61000000
EXC_RETURN: .word 0xFFFFFFF9
TARGET_PC: .word __error
NVIC_CCR: .word 0xE000ED14 @ NVIC configuration control register
SYSTICK_CSR: .word 0xE000E010 @ Systick control register

@ -0,0 +1,35 @@
#
# fix_framework_weakness.py
#
import pioutil
if pioutil.is_pio_build():
import shutil
from os.path import join, isfile
from pprint import pprint
Import("env")
if env.MarlinHas("POSTMORTEM_DEBUGGING"):
FRAMEWORK_DIR = env.PioPlatform().get_package_dir("framework-arduinoststm32-maple")
patchflag_path = join(FRAMEWORK_DIR, ".exc-patching-done")
# patch file only if we didn't do it before
if not isfile(patchflag_path):
print("Patching libmaple exception handlers")
original_file = join(FRAMEWORK_DIR, "STM32F1", "cores", "maple", "libmaple", "exc.S")
backup_file = join(FRAMEWORK_DIR, "STM32F1", "cores", "maple", "libmaple", "exc.S.bak")
src_file = join("buildroot", "share", "PlatformIO", "scripts", "exc.S")
assert isfile(original_file) and isfile(src_file)
shutil.copyfile(original_file, backup_file)
shutil.copyfile(src_file, original_file)
def _touch(path):
with open(path, "w") as fp:
fp.write("")
env.Execute(lambda *args, **kwargs: _touch(patchflag_path))
print("Done patching exception handler")
print("Libmaple modified and ready for post mortem debugging")

@ -0,0 +1,65 @@
#
# generic_create_variant.py
#
# Copy one of the variants from buildroot/platformio/variants into
# the appropriate framework variants folder, so that its contents
# will be picked up by PlatformIO just like any other variant.
#
import pioutil, re
marlin_variant_pattern = re.compile("marlin_.*")
if pioutil.is_pio_build():
import shutil,marlin
from pathlib import Path
#
# Get the platform name from the 'platform_packages' option,
# or look it up by the platform.class.name.
#
env = marlin.env
platform = env.PioPlatform()
from platformio.package.meta import PackageSpec
platform_packages = env.GetProjectOption('platform_packages')
# Remove all tool items from platform_packages
platform_packages = [x for x in platform_packages if not x.startswith("platformio/tool-")]
if len(platform_packages) == 0:
framewords = {
"Ststm32Platform": "framework-arduinoststm32",
"AtmelavrPlatform": "framework-arduino-avr"
}
platform_name = framewords[platform.__class__.__name__]
else:
spec = PackageSpec(platform_packages[0])
if spec.uri and '@' in spec.uri:
platform_name = re.sub(r'@.+', '', spec.uri)
else:
platform_name = spec.name
FRAMEWORK_DIR = Path(platform.get_package_dir(platform_name))
assert FRAMEWORK_DIR.is_dir()
board = env.BoardConfig()
#mcu_type = board.get("build.mcu")[:-2]
variant = board.get("build.variant")
#series = mcu_type[:7].upper() + "xx"
# Only prepare a new variant if the PlatformIO configuration provides it (board_build.variant).
# This check is important to avoid deleting official board config variants.
if marlin_variant_pattern.match(str(variant).lower()):
# Prepare a new empty folder at the destination
variant_dir = FRAMEWORK_DIR / "variants" / variant
if variant_dir.is_dir():
shutil.rmtree(variant_dir)
if not variant_dir.is_dir():
variant_dir.mkdir()
# Source dir is a local variant sub-folder
source_dir = Path("buildroot/share/PlatformIO/variants", variant)
assert source_dir.is_dir()
print("Copying variant " + str(variant) + " to framework directory...")
marlin.copytree(source_dir, variant_dir)

@ -0,0 +1,35 @@
#
# jgaurora_a5s_a1_with_bootloader.py
# Customizations for env:jgaurora_a5s_a1
#
import pioutil
if pioutil.is_pio_build():
# Append ${PROGNAME}.bin firmware after bootloader and save it as 'jgaurora_firmware.bin'
def addboot(source, target, env):
from pathlib import Path
fw_path = Path(target[0].path)
fwb_path = fw_path.parent / 'firmware_with_bootloader.bin'
with fwb_path.open("wb") as fwb_file:
bl_path = Path("buildroot/share/PlatformIO/scripts/jgaurora_bootloader.bin")
bl_file = bl_path.open("rb")
while True:
b = bl_file.read(1)
if b == b'': break
else: fwb_file.write(b)
with fw_path.open("rb") as fw_file:
while True:
b = fw_file.read(1)
if b == b'': break
else: fwb_file.write(b)
fws_path = Path(target[0].dir.path, 'firmware_for_sd_upload.bin')
if fws_path.exists():
fws_path.unlink()
fw_path.rename(fws_path)
import marlin
marlin.add_post_action(addboot)

Binary file not shown.

@ -0,0 +1,47 @@
#
# lerdge.py
# Customizations for Lerdge build environments:
# env:LERDGEX env:LERDGEX_usb_flash_drive
# env:LERDGES env:LERDGES_usb_flash_drive
# env:LERDGEK env:LERDGEK_usb_flash_drive
#
import pioutil
if pioutil.is_pio_build():
import os,marlin
board = marlin.env.BoardConfig()
def encryptByte(byte):
byte = 0xFF & ((byte << 6) | (byte >> 2))
i = 0x58 + byte
j = 0x05 + byte + (i >> 8)
byte = (0xF8 & i) | (0x07 & j)
return byte
def encrypt_file(input, output_file, file_length):
input_file = bytearray(input.read())
for i in range(len(input_file)):
input_file[i] = encryptByte(input_file[i])
output_file.write(input_file)
# Encrypt ${PROGNAME}.bin and save it with the name given in build.crypt_lerdge
def encrypt(source, target, env):
fwpath = target[0].path
enname = board.get("build.crypt_lerdge")
print("Encrypting %s to %s" % (fwpath, enname))
fwfile = open(fwpath, "rb")
enfile = open(target[0].dir.path + "/" + enname, "wb")
length = os.path.getsize(fwpath)
encrypt_file(fwfile, enfile, length)
fwfile.close()
enfile.close()
os.remove(fwpath)
if 'crypt_lerdge' in board.get("build").keys():
if board.get("build.crypt_lerdge") != "":
marlin.add_post_action(encrypt)
else:
print("LERDGE builds require output file via board_build.crypt_lerdge = 'filename' parameter")
exit(1)

@ -0,0 +1,73 @@
#
# marlin.py
# Helper module with some commonly-used functions
#
import shutil
from pathlib import Path
from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()
def copytree(src, dst, symlinks=False, ignore=None):
for item in src.iterdir():
if item.is_dir():
shutil.copytree(item, dst / item.name, symlinks, ignore)
else:
shutil.copy2(item, dst / item.name)
def replace_define(field, value):
envdefs = env['CPPDEFINES'].copy()
for define in envdefs:
if define[0] == field:
env['CPPDEFINES'].remove(define)
env['CPPDEFINES'].append((field, value))
# Relocate the firmware to a new address, such as "0x08005000"
def relocate_firmware(address):
replace_define("VECT_TAB_ADDR", address)
# Relocate the vector table with a new offset
def relocate_vtab(address):
replace_define("VECT_TAB_OFFSET", address)
# Replace the existing -Wl,-T with the given ldscript path
def custom_ld_script(ldname):
apath = str(Path("buildroot/share/PlatformIO/ldscripts", ldname).resolve())
for i, flag in enumerate(env["LINKFLAGS"]):
if "-Wl,-T" in flag:
env["LINKFLAGS"][i] = "-Wl,-T" + apath
elif flag == "-T":
env["LINKFLAGS"][i + 1] = apath
# Encrypt ${PROGNAME}.bin and save it with a new name. This applies (mostly) to MKS boards
# This PostAction is set up by offset_and_rename.py for envs with 'build.encrypt_mks'.
def encrypt_mks(source, target, env, new_name):
import sys
key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
# If FIRMWARE_BIN is defined by config, override all
mf = env["MARLIN_FEATURES"]
if "FIRMWARE_BIN" in mf: new_name = mf["FIRMWARE_BIN"]
fwpath = Path(target[0].path)
fwfile = fwpath.open("rb")
enfile = Path(target[0].dir.path, new_name).open("wb")
length = fwpath.stat().st_size
position = 0
try:
while position < length:
byte = fwfile.read(1)
if 320 <= position < 31040:
byte = chr(ord(byte) ^ key[position & 31])
if sys.version_info[0] > 2:
byte = bytes(byte, 'latin1')
enfile.write(byte)
position += 1
finally:
fwfile.close()
enfile.close()
fwpath.unlink()
def add_post_action(action):
env.AddPostAction(str(Path("$BUILD_DIR", "${PROGNAME}.bin")), action)

Some files were not shown because too many files have changed in this diff Show More