Compare commits

..

4 Commits

Author SHA1 Message Date
Scott Lahteine
47d0617f9c 🧑‍💻 Update example build scripts 2025-03-01 15:05:30 -06:00
Scott Lahteine
3dddaf9fec 🩹 Fix build with Color UI touch items 2025-03-01 15:05:30 -06:00
ellensp
496d4c32ab 🩹 Fix missing BTT_SKR_MINI_E3_V3_0_1 include (#27696) 2025-03-01 15:03:11 -06:00
Scott Lahteine
56b1a70abe 📝 Update HAL documentation, README 2024-11-24 00:00:32 -06:00
29 changed files with 227 additions and 48100 deletions

View File

@@ -1,180 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* 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
/**
* Pins Debugging for HC32
*
* - NUMBER_PINS_TOTAL
* - MULTI_NAME_PAD
* - getPinByIndex(index)
* - printPinNameByIndex(index)
* - getPinIsDigitalByIndex(index)
* - digitalPinToAnalogIndex(pin)
* - getValidPinMode(pin)
* - isValidPin(pin)
* - isAnalogPin(pin)
* - digitalRead_mod(pin)
* - pwm_status(pin)
* - printPinPWM(pin)
* - printPinPort(pin)
* - printPinNumber(pin)
* - printPinAnalog(pin)
*/
#include "../../inc/MarlinConfig.h"
#include "fastio.h"
#include <drivers/timera/timera_pwm.h>
#ifndef BOARD_NR_GPIO_PINS
#error "Expected BOARD_NR_GPIO_PINS not found."
#endif
#define NUM_DIGITAL_PINS BOARD_NR_GPIO_PINS
#define NUMBER_PINS_TOTAL BOARD_NR_GPIO_PINS
#define isValidPin(P) IS_GPIO_PIN(P)
// Note: pin_array is defined in `Marlin/src/pins/pinsDebug.h`, and since this file is included
// after it, it is available in this file as well.
#define getPinByIndex(x) pin_t(pin_array[x].pin)
#define digitalRead_mod(P) extDigitalRead(P)
#define printPinNumber(P) do{ sprintf_P(buffer, PSTR("%3hd "), int16_t(P)); SERIAL_ECHO(buffer); }while(0)
#define printPinAnalog(P) do{ sprintf_P(buffer, PSTR(" (A%2d) "), digitalPinToAnalogIndex(P)); SERIAL_ECHO(buffer); }while(0)
#define printPinNameByIndex(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
#define MULTI_NAME_PAD 21 // Space needed to be pretty if not first name assigned to a pin
//
// Pins that will cause a hang / reset / disconnect in M43 Toggle and Watch utils
//
#ifndef M43_NEVER_TOUCH
// Don't touch any of the following pins:
// - Host serial pins, and
// - Pins that could be connected to oscillators (see datasheet, Table 2.1):
// - XTAL = PH0, PH1
// - XTAL32 = PC14, PC15
#define IS_HOST_USART_PIN(Q) (Q == BOARD_USART2_TX_PIN || Q == BOARD_USART2_RX_PIN)
#define IS_OSC_PIN(Q) (Q == PH0 || Q == PH1 || Q == PC14 || Q == PC15)
#define M43_NEVER_TOUCH(Q) (IS_HOST_USART_PIN(Q) || IS_OSC_PIN(Q))
#endif
int8_t digitalPinToAnalogIndex(const pin_t pin) {
if (!isValidPin(pin)) return -1;
const int8_t adc_channel = int8_t(PIN_MAP[pin].adc_info.channel);
return pin_t(adc_channel);
}
bool isAnalogPin(pin_t pin) {
if (!isValidPin(pin)) return false;
if (PIN_MAP[pin].adc_info.channel != ADC_PIN_INVALID)
return _GET_MODE(pin) == INPUT_ANALOG && !M43_NEVER_TOUCH(pin);
return false;
}
bool getValidPinMode(const pin_t pin) {
return isValidPin(pin) && !IS_INPUT(pin);
}
bool getPinIsDigitalByIndex(const int16_t index) {
const pin_t pin = getPinByIndex(index);
return (!isAnalogPin(pin));
}
/**
* @brief print pin PWM status
* @return true if pin is currently a PWM pin, false otherwise
*/
bool pwm_status(const pin_t pin) {
// Get timer assignment for pin
timera_config_t *unit;
en_timera_channel_t channel;
en_port_func_t port_function;
if (!timera_get_assignment(pin, unit, channel, port_function) || unit == nullptr) {
// No pwm pin or no unit assigned
return false;
}
// A pin that is PWM output is:
// - Assigned to a timerA unit (tested above)
// - Unit is initialized
// - Channel is active
// - PinMode is OUTPUT_PWM
return timera_is_unit_initialized(unit) && timera_is_channel_active(unit, channel) && getPinMode(pin) == OUTPUT_PWM;
}
void printPinPWM(const pin_t pin) {
// Get timer assignment for pin
timera_config_t *unit;
en_timera_channel_t channel;
en_port_func_t port_function;
if (!timera_get_assignment(pin, unit, channel, port_function) || unit == nullptr)
return; // No pwm pin or no unit assigned
// Print timer assignment of pin, eg. "TimerA1Ch2 Func4"
SERIAL_ECHOPGM("TimerA", TIMERA_REG_TO_X(unit->peripheral.register_base),
"Ch", TIMERA_CHANNEL_TO_X(channel),
" Func", int(port_function));
SERIAL_ECHO_SP(3); // 3 spaces
// Print timer unit state, eg. "1/16 PERAR=1234" OR "N/A"
if (timera_is_unit_initialized(unit)) {
// Unit initialized, print
// - Timer clock divider
// - Timer period value (PERAR)
const uint8_t clock_divider = timera_clk_div_to_n(unit->state.base_init->enClkDiv);
const uint16_t period = TIMERA_GetPeriodValue(unit->peripheral.register_base);
SERIAL_ECHOPGM("1/", clock_divider, " PERAR=", period);
}
else {
// Unit not initialized
SERIAL_ECHOPGM("N/A");
return;
}
SERIAL_ECHO_SP(3); // 3 spaces
// Print timer channel state, e.g. "CMPAR=1234" OR "N/A"
if (timera_is_channel_active(unit, channel)) {
// Channel active, print
// - Channel compare value
const uint16_t compare = TIMERA_GetCompareValue(unit->peripheral.register_base, channel);
SERIAL_ECHOPGM("CMPAR=", compare);
}
else {
// Channel inactive
SERIAL_ECHOPGM("N/A");
}
}
void printPinPort(pin_t pin) {
const char port = 'A' + char(pin >> 4); // Pin div 16
const int16_t gbit = PIN_MAP[pin].bit_pos;
char buffer[8];
sprintf_P(buffer, PSTR("P%c%hd "), port, gbit);
if (gbit < 10) {
SERIAL_CHAR(' ');
}
SERIAL_ECHO(buffer);
}

View File

@@ -36,11 +36,9 @@
#include "../../module/probe.h"
#endif
#if HAS_GRAPHICAL_TFT
#if ALL(TOUCH_SCREEN, HAS_GRAPHICAL_TFT)
#include "../tft/tft.h"
#if ENABLED(TOUCH_SCREEN)
#include "../tft/touch.h"
#endif
#include "../tft/touch.h"
#endif
#if ANY(PROBE_MANUALLY, MESH_BED_LEVELING)

View File

@@ -36,6 +36,11 @@
#define XATC_Y_POSITION ((probe.max_y() - probe.min_y())/2)
#endif
#if ALL(TOUCH_SCREEN, HAS_GRAPHICAL_TFT)
#include "../tft/tft.h"
#include "../tft/touch.h"
#endif
void _goto_manual_move_z(const_float_t);
float measured_z, z_offset;

View File

@@ -670,6 +670,8 @@
#include "stm32f4/pins_RUMBA32_BTT.h" // STM32F4 env:rumba32
#elif MB(BLACK_STM32F407VE)
#include "stm32f4/pins_BLACK_STM32F407VE.h" // STM32F4 env:STM32F407VE_black
#elif MB(BTT_SKR_MINI_E3_V3_0_1)
#include "stm32f4/pins_BTT_SKR_MINI_E3_V3_0_1.h" // STM32F4 env:STM32F401RC_btt env:STM32F401RC_btt_xfer
#elif MB(BTT_SKR_PRO_V1_1)
#include "stm32f4/pins_BTT_SKR_PRO_V1_1.h" // STM32F4 env:BIGTREE_SKR_PRO env:BIGTREE_SKR_PRO_usb_flash_drive
#elif MB(BTT_SKR_PRO_V1_2)

View File

@@ -22,7 +22,9 @@
#pragma once
/**
* ReprapWorld's Minitronics v2.0
* ReprapWorld Minitronics v2.0
* https://reprap.org/wiki/Minitronics_20
* 48MHz Atmel SAMD21J18 ARM Cortex-M0+
*/
#if NOT_TARGET(__SAMD21__)
@@ -125,6 +127,11 @@
#endif
// Verify that drivers match the hardware
#if (HAS_X_AXIS && !AXIS_DRIVER_TYPE_X(DRV8825)) || (HAS_Y_AXIS && !AXIS_DRIVER_TYPE_Y(DRV8825)) || (HAS_Z_AXIS && !AXIS_DRIVER_TYPE_Z(DRV8825)) || (HAS_EXTRUDER && !AXIS_DRIVER_TYPE_E0(DRV8825))
#error "Minitronics v2.0 has hard-wired DRV8825 drivers. Comment out this line to continue."
#endif
//
// Extruder / Bed
//

View File

@@ -60,12 +60,15 @@ Every new HAL opens up a world of hardware. At this time we need HALs for RP2040
[STM32F7x6](//www.st.com/en/microcontrollers-microprocessors/stm32f7x6.html)|ARM® Cortex-M7|The Borg, RemRam V1
[STM32G0B1RET6](//www.st.com/en/microcontrollers-microprocessors/stm32g0x1.html)|ARM® Cortex-M0+|BigTreeTech SKR mini E3 V3.0
[STM32H743xIT6](//www.st.com/en/microcontrollers-microprocessors/stm32h743-753.html)|ARM® Cortex-M7|BigTreeTech SKR V3.0, SKR EZ V3.0, SKR SE BX V2.0/V3.0
[SAMD21P20A](//www.adafruit.com/product/4064)|ARM® Cortex-M0+|Adafruit Grand Central M4
[SAMD51P20A](//www.adafruit.com/product/4064)|ARM® Cortex-M4|Adafruit Grand Central M4
[Teensy 3.5](//www.pjrc.com/store/teensy35.html)|ARM® Cortex-M4|
[Teensy 3.6](//www.pjrc.com/store/teensy36.html)|ARM® Cortex-M4|
[Teensy 4.0](//www.pjrc.com/store/teensy40.html)|ARM® Cortex-M7|
[Teensy 4.1](//www.pjrc.com/store/teensy41.html)|ARM® Cortex-M7|
Linux Native|x86/ARM/etc.|Raspberry Pi
[Teensy 3.2/3.1](//www.pjrc.com/teensy/teensy31.html)|MK20DX256VLH7 ARM® Cortex-M4|
[Teensy 3.5](//www.pjrc.com/store/teensy35.html)|MK64FX512-VMD12 ARM® Cortex-M4|
[Teensy 3.6](//www.pjrc.com/store/teensy36.html)|MK66FX1MB-VMD18 ARM® Cortex-M4|
[Teensy 4.0](//www.pjrc.com/store/teensy40.html)|MIMXRT1062-DVL6B ARM® Cortex-M7|
[Teensy 4.1](//www.pjrc.com/store/teensy41.html)|MIMXRT1062-DVJ6B ARM® Cortex-M7|
Linux Native|x86 / ARM / RISC-V|Raspberry Pi GPIO
Simulator|Windows, macOS, Linux|Desktop OS
[All supported boards](//marlinfw.org/docs/hardware/boards.html#boards-list)|All platforms|All boards
## Marlin Support

View File

@@ -2,21 +2,22 @@
#
# Usage:
#
# build_all_examples [-b|--branch=<branch>] - Branch to fetch from Configurations repo (import-2.1.x)
# build_all_examples [-a|--archive] - Copy the binary to the export location
# [-B|--base] - Base path of configurations, overriding -b
# [-b|--branch=<branch>] - Branch to fetch from Configurations repo (import-2.1.x)
# [-c|--continue] - Continue the paused build
# [-p|--purge] - Purge the status file and start over
# [-s|--skip] - Continue the paused build, skipping one
# [-r|--resume=<path>] - Start at some config in the filesystem order
# [-l|--limit=#] - Limit the number of builds in this run
# [-d|--debug] - Print extra debug output (after)
# [-n|--nobuild] - Don't actually build anything
# [-d|-v|--debug] - Print extra debug output (after)
# [-e|--export=N] - Set CONFIG_EXPORT and export to the export location
# [-f|--nofail] - Don't stop on a failed build
# [-e|--export=N] - Set CONFIG_EXPORT and export into each config folder
# [-a|--archive] - Copy the binary to the export location
# [-h|--help] - Print usage and exit
# [-l|--limit=#] - Limit the number of builds in this run
# [-m|--many] - Build all the environments for each example
# [-n|--nobuild] - Don't actually build anything
# [-o|--output] - Redirect export / archiving to another location
# (By default export to origin config folders)
# [-h|--help] - Print usage and exit
# [-p|--purge] - Purge the status file and start over
# [-r|--resume=<path>] - Start at some config in the filesystem order
# [-s|--skip] - Continue the paused build, skipping one
#
HERE=`dirname $0`
@@ -29,21 +30,22 @@ STAT_FILE=./.pio/.buildall
usage() { echo "Usage:
build_all_examples [-b|--branch=<branch>] - Branch to fetch from Configurations repo (import-2.1.x)
build_all_examples [-a|--archive] - Copy the binary to the export location
[-B|--base] - Base path of configurations, overriding -b
[-b|--branch=<branch>] - Branch to fetch from Configurations repo (import-2.1.x)
[-c|--continue] - Continue the paused build
[-p|--purge] - Purge the status file and start over
[-s|--skip] - Continue the paused build, skipping one
[-r|--resume=<path>] - Start at some config in the filesystem order
[-d|-v|--debug] - Print extra debug output (after)
[-e|--export=N] - Set CONFIG_EXPORT and export to the export location
[-a|--archive] - Copy the binary to the export location
[-o|--output] - Redirect export / archiving to another location
(By default export to origin config folders)
[-d|--debug] - Print extra debug output (after)
[-l|--limit=#] - Limit the number of builds in this run
[-n|--nobuild] - Don't actually build anything
[-f|--nofail] - Don't stop on a failed build
[-h|--help] - Print usage and exit
[-l|--limit=#] - Limit the number of builds in this run
[-m|--many] - Build all the environments for each example
[-n|--nobuild] - Don't actually build anything
[-o|--output] - Redirect export / archiving to another location
(By default export to origin config folders)
[-p|--purge] - Purge the status file and start over
[-r|--resume=<path>] - Start at some config in the filesystem order
[-s|--skip] - Continue the paused build, skipping one
"
}
@@ -53,27 +55,29 @@ unset FIRST_CONF
EXIT_USAGE=
LIMIT=1000
while getopts 'aB:b:ce:fdhl:no:pr:sv-:' OFLAG; do
while getopts 'aB:b:cde:fhl:mno:pr:sv-:' OFLAG; do
case "${OFLAG}" in
a) ARCHIVE=1 ; bugout "Archiving" ;;
B) CBASE=${OPTARG%/} ; bugout "Base: $CBASE" ;;
b) BRANCH=$OPTARG ; bugout "Branch: $BRANCH" ;;
f) NOFAIL=1 ; bugout "Continue on Fail" ;;
r) ISRES=1 ; FIRST_CONF=$OPTARG ; bugout "Resume: $FIRST_CONF" ;;
c) CONTINUE=1 ; bugout "Continue" ;;
s) CONTSKIP=1 ; bugout "Continue, skipping" ;;
d|v) DEBUG=1 ; bugout "Debug ON" ;;
e) CEXPORT=$OPTARG ; bugout "Export $CEXPORT" ;;
o) OUTBASE="${OPTARG%/}" ; bugout "Archive to $OUTBASE" ;;
f) NOFAIL=1 ; bugout "Continue on Fail" ;;
h) EXIT_USAGE=1 ; break ;;
l) LIMIT=$OPTARG ; bugout "Limit to $LIMIT build(s)" ;;
d|v) DEBUG=1 ; bugout "Debug ON" ;;
m) MANY=1 ; bugout "Many Envs" ;;
n) DRYRUN=1 ; bugout "Dry Run" ;;
o) OUTBASE="${OPTARG%/}" ; bugout "Archive to $OUTBASE" ;;
p) PURGE=1 ; bugout "Purge stat file" ;;
r) ISRES=1 ; FIRST_CONF=$OPTARG ; bugout "Resume: $FIRST_CONF" ;;
s) CONTSKIP=1 ; bugout "Continue, skipping" ;;
-) ONAM="${OPTARG%%=*}" ; OVAL="${OPTARG#*=}"
case "$ONAM" in
archive) ARCHIVE=1 ; bugout "Archiving" ;;
base) CBASE=${OVAL%/} ; bugout "Base: $CBASE" ;;
branch) BRANCH=$OVAL ; bugout "Branch: $BRANCH" ;;
many) MANY=1 ; bugout "Many Envs" ;;
nofail) NOFAIL=1 ; bugout "Continue on Fail" ;;
resume) ISRES=1 ; FIRST_CONF=$OVAL ; bugout "Resume: $FIRST_CONF" ;;
continue) CONTINUE=1 ; bugout "Continue" ;;
@@ -179,6 +183,9 @@ find -ds "$CBASE"/config/examples -type d -name 'Configuration.h' -o -name 'Conf
# Exporting? Add -e argument
((CEXPORT)) && CARGS+=("-e" "$CEXPORT")
# Build many environments? Add -m argument
((MANY)) && CARGS+=("-m")
# Continue on fail? Add -f argument
((NOFAIL)) && CARGS+=("-f")

View File

@@ -4,6 +4,8 @@
#
# build_example -b|--base=<path> - Configurations root folder (e.g., ./.pio/build-BRANCH)
# -c|--config=<rel> - Sub-path of the configs to build (within config/examples)
# [-n|--index=N] - Which environment to build, by index (Based on pins.h comments)
# [-m|--many] - Build all the board's environments listed in pins.h
# [-e|--export=N] - Use CONFIG_EXPORT N to export the config to the export location
# [-a|--archive] - Archive the build (to the export location)
# [-o|--output] - Redirect export / archiving to another location
@@ -19,6 +21,8 @@ usage() { echo "Usage:
build_example -b|--base=<path> - Configurations root folder (e.g., ./.pio/build-BRANCH)
-c|--config=<rel> - Sub-path of the configs to build (within config/examples)
[-n|--index=N] - Which environment to build, by index (Based on pins.h comments)
[-m|--many] - Build all the board's environments listed in pins.h
[-e|--export=N] - Use CONFIG_EXPORT N to export the config to the export location
[-a|--archive] - Archive the build (to the export location)
[-o|--output] - Redirect export / archiving to another location
@@ -50,15 +54,20 @@ REVEAL=
EXPNUM=
NOFAIL=
OUTBASE=
while getopts 'ab:c:e:fhio:r-:' OFLAG; do
BUILDINDEX=1
MANY=
while getopts 'ab:c:e:fhmn:o:r-:' OFLAG; do
case "${OFLAG}" in
a) ARCHIVE=1 ;;
b) BASE="${OPTARG%/}" ;;
c) CONFIG="${OPTARG%/}" ;;
e) EXPNUM="$OPTARG" ;;
o) OUTBASE="${OPTARG%/}" ;;
h) EXIT_USAGE=1 ; break ;;
f) NOFAIL=1 ;;
h) EXIT_USAGE=1 ; break ;;
m) MANY=1 ;;
n) BUILDINDEX="$OPTARG" ;;
o) OUTBASE="${OPTARG%/}" ;;
r) REVEAL=1 ;;
-) ONAM="${OPTARG%%=*}" ; OVAL="${OPTARG#*=}"
case "$ONAM" in
@@ -66,6 +75,8 @@ while getopts 'ab:c:e:fhio:r-:' OFLAG; do
allow) ALLOW=1 ;;
base) BASE="${OVAL%/}" ;;
config) CONFIG="${OVAL%/}" ;;
many) MANY=1 ;;
index) BUILDINDEX="$OVAL" ;;
export) EXPNUM="$OVAL" ;;
output) OUTBASE="${OVAL%/}" ;;
help) EXIT_USAGE=1 ; break ;;
@@ -154,11 +165,12 @@ ENAME=("-name" "marlin_config.json" \
"-o" "-name" "schema.yml")
# Possible built firmware names (in the build folder)
BNAME=("-name" 'firmware*.hex' \
BNAME=("-name" "firmware*.hex" \
"-o" "-name" "firmware*.bin" \
"-o" "-name" "project*.bin" \
"-o" "-name" "Robin*.bin" \
"-o" "-name" "main_*.bin")
"-o" "-name" "main_*.bin" \
"-o" "-name" "MarlinSimulator*")
mkdir -p "$BUILD"
@@ -166,64 +178,113 @@ mkdir -p "$BUILD"
if [[ $EXPNUM ]]; then
opt_set CONFIG_EXPORT $EXPNUM
# Clean up old exports
find "$BUILD" \( "${ENAME[@]}" \) -exec rm "{}" \;
find "$BUILD" -type f \( "${ENAME[@]}" \) -exec rm "{}" \;
fi
((ARCHIVE)) && find "$BUILD" \( "${BNAME[@]}" \) -exec rm "{}" \;
((ARCHIVE)) && find "$BUILD" -type f \( "${BNAME[@]}" \) -exec rm "{}" \;
set +e
echo "Building example $CONFIG..."
echo "Building example $CONFIG ..."
mftest -s -a -n1 ; ERR=$?
# If doing many builds get a list of all environment names,
# which also gives us the number of environments.
if ((MANY)); then
ENVLIST=$(mfenvs) # BOARD_NAME_STRING (1234): [ env1 env2 env3 ... ]
ENVLIST=${ENVLIST##*: [ }
ENVARRAY=(${ENVLIST% ]})
ENVCOUNT=${#ENVARRAY[*]}
((ENVCOUNT)) || { alrt "mfenvs failed for this board." ; exit 1 ; }
echo "Found $ENVCOUNT environment(s): ${ENVARRAY[*]}"
fi
((ERR)) && alrt "Failed ($ERR)" || annc "Success"
# Run one or more builds based on --many
# Build all from BUILDINDEX onward (usually 1) meaning ALL.
# MANY with a BUILDINDEX may be useful for continuing an interrupted build.
set -e
while ((1)); do
set +e
if [[ $ERR -gt 0 ]]; then
echo "Building example $CONFIG ($BUILDINDEX)..."
# Run a build and record the error number
mftest -s -a -n$BUILDINDEX ; ERR=$?
# "Index out of range" can fail without an error
((MANY)) && ((ERR == 66)) && ERR=0 && break # "index out of range"
set -e
if [[ $ERR -gt 0 ]]; then
alrt "Failed ($ERR)"
# Error? For --nofail simply log. Otherwise return the error.
if [[ -n $NOFAIL ]]; then
date +"%F %T [FAIL] $CONFIG ($BUILDINDEX)" >>./.pio/error-log.txt
else
exit $ERR
fi
# Error? For --nofail simply log. Otherwise return the error.
if [[ -n $NOFAIL ]]; then
date +"%F %T [FAIL] $CONFIG" >>./.pio/error-log.txt
else
exit $ERR
fi
else
annc "Success"
# Copy exports back to the configs
if [[ -n $EXPNUM ]]; then
annc "Exporting $EXPNUM"
[[ -f Marlin/Config-export.h ]] && { cp Marlin/Config-export.h "$ARCSUB"/Config.h ; }
find "$BUILD" \( "${ENAME[@]}" \) -exec cp "{}" "$ARCSUB" \;
fi
# Copy exports back to the configs
if [[ -n $EXPNUM ]]; then
annc "Exporting $EXPNUM"
[[ -f Marlin/Config-export.h ]] && { cp Marlin/Config-export.h "$ARCSUB"/Config.h ; }
find "$BUILD" -type f \( "${ENAME[@]}" \) -exec cp "{}" "$ARCSUB" \;
fi
# Copy potential firmware files into the config folder
# TODO: Consider firmware that needs an STM32F4_UPDATE folder.
# Currently only BOARD_CREALITY_F401RE env:STM32F401RE_creality
if ((ARCHIVE)); then
annc "Archiving"
rm -f "$ARCSUB"/*.bin.tar.gz "$ARCSUB"/*.hex.tar.gz
find "$BUILD" \( "${BNAME[@]}" \) -exec sh -c '
ARCSUB="$1"
CONFIG="$2"
shift 2
for FILE in "$@"; do
cd "${FILE%/*}"
NAME=${FILE##*/}
SHRT=${NAME%.*}
# When building many, create sub-folders for each build env name
if [[ -n $MANY && $ENVCOUNT -gt 1 ]]; then
ENV=${ENVARRAY[BUILDINDEX-1]}
ARCENVSUB="$ARCSUB/$ENV"
else
ARCENVSUB="$ARCSUB"
fi
# Copy potential firmware files into the config folder
# TODO: Consider firmware that needs an STM32F4_UPDATE folder.
# Currently only BOARD_CREALITY_F401RE env:STM32F401RE_creality
if ((ARCHIVE)); then
annc "Archiving"
find "$BUILD" -type f \( "${BNAME[@]}" \) -exec sh -c '
ARCDIR="$1" ; CONFIG="$2" ; FILE="$3" ; shift 3
NAME=${FILE##*/} ; SHRT=${NAME%.*} ; DIR=${FILE%/*}
ZIPX=
if [[ $CONFIG == *Simulator* ]]; then
case $(uname | tr '[:upper:]' '[:lower:]') in
darwin) SUB="macOS" ; ZIPX="-X" ;;
*linux) SUB="Linux" ;;
win*) SUB="Windows" ;;
msys*) SUB="Windows" ;;
cygwin*) SUB="Windows" ;;
mingw*) SUB="Windows" ;;
*) SUB='Unix' ;;
esac
ARCH=$(uname -m | tr '[:lower:]' '[:upper:]')
ARCDIR="$ARCDIR/$SUB-$ARCH"
fi
mkdir -p "$ARCDIR"
rm -f "$ARCDIR"/*.zip "$ARCDIR"/*.sha256.txt
cd "$DIR"
SHASUM=$(sha256sum "$NAME" | cut -d" " -f1)
tar -czf "$ARCSUB/$SHRT.tar.gz" "$NAME"
echo "$CONFIG\n$SHASUM" > "$ARCSUB/$NAME.sha256.txt"
rm "$NAME"
echo "$CONFIG\n$SHASUM" > "$ARCDIR/$NAME.sha256.txt"
zip $ZIPX "$ARCDIR/$SHRT.zip" "$NAME" && rm "$NAME"
cd - >/dev/null
done
' sh "$ARCSUB" "$CONFIG" {} +
' sh "$ARCENVSUB" "$CONFIG" {} +
fi
# Reveal the configs after the build, if requested
((REVEAL)) && { annc "Revealing $ARCENVSUB" ; open "$ARCENVSUB" ; }
fi
# Reveal the configs after the build, if requested
((REVEAL)) && { annc "Revealing $ARCSUB" ; open "$ARCSUB" ; }
((MANY)) || break # Only one build if not --many
fi
# Set up for the next build, if there is one
((++BUILDINDEX > ENVCOUNT)) && break
done
exit 0

33
buildroot/bin/mfenvs Executable file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/env bash
#
# mfenvs Print the current board and environment information
# Output -> "SHORT_NAME (###): [ env1 env2 env3 ... ]"
#
[[ -d Marlin/src ]] || { echo "Please 'cd' to the Marlin repo root." ; exit 1 ; }
which pio >/dev/null || { echo "Make sure 'pio' is in your execution PATH." ; exit 1 ; }
errout() { echo -e "\033[0;31m$1\033[0m" ; }
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
ACODE='/^[[:space:]]*#define[[:space:]]MOTHERBOARD[[:space:]]/ { sub(/^BOARD_/, "", $3); print $3 }'
MB=$(awk "$ACODE" Marlin/Configuration.h 2>/dev/null)
[[ -z $MB ]] && MB=$(awk "$ACODE" Marlin/Config.h 2>/dev/null)
[[ -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" )
[[ -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[*]}
[[ $ECOUNT == 1 ]] && EOUT=$ENVS || EOUT="${ENVS[@]}"
echo "$MB ($BNUM): [ $EOUT ]"

View File

@@ -16,23 +16,24 @@ 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]
Usage: mftest [-a|--autobuild]
mftest [-r|--rebuild]
mftest [-s|--silent]
mftest [-t|--env=<env|index>] [-n|--num=<num>] [-m|--make] [-y|--build=<Y|n>]
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.
-d --default Restore to defaults before applying configs.
-h --help Print this help.
-m --make Use the make / Docker method for the build.
-n --num The index of the test to run. (In file order.)
-r --rebuild Rebuild previous PIO Build.
-s --silent Silence build output from PlatformIO.
-t --env The environment to apply / run, or the menu index number.
-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.
-y --build Skip 'Do you want to build this test?' and assume YES.
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
"
@@ -56,7 +57,7 @@ TESTENV='-'
CHOICE=0
DEBUG=0
while getopts 'abdhmrsuvyn:t:-:' OFLAG; do
while getopts 'adhmn:rst:uvy-:' OFLAG; do
case "${OFLAG}" in
a) AUTO_BUILD=1 ; bugout "Auto-Build target..." ;;
d) DL_DEFAULTS=1 ; bugout "Restore to defaults..." ;;
@@ -195,7 +196,7 @@ if ((AUTO_BUILD)); then
fi
else
echo "Detected \"$BDESC\" | $MB ($BNUM)."
[[ $CHOICE > $ECOUNT ]] && { echo "Environment selection out of range." ; exit 1 ; }
[[ $CHOICE > $ECOUNT ]] && { echo "Environment selection out of range." ; exit 66 ; }
fi
TARGET="${ENVS[$CHOICE-1]}"
if [[ $MB == 'SIMULATED' && $TARGET == 'linux_native' ]]; then

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python
import sys, os,config
import sys, os, config
def main():
args = sys.argv[1:]

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python
import sys, os,config
import sys, os, config
def main():
args = sys.argv[1:]

View File

@@ -4,8 +4,7 @@
# Author: Taylor Talkington
# License: GPL
import bdflib.reader
import math
import bdflib.reader, math
def glyph_bits(size_x, size_y, font, glyph_ord):
asc = font[b'FONT_ASCENT']

View File

@@ -12,6 +12,7 @@ Marlin Firmware Commands:
mfadd ....... Fetch a remote branch from any Marlin fork
mfclean ..... Attempt to clean up merged and deleted branches
mfdoc ....... Build the website, serve locally, and browse
mfenvs ...... Get current board SHORT_NAME (###): [ env1 env2 ... ]
mffp ........ Push new commits directly to MarlinFirmware
mfinfo ...... Provide branch information (for the other scripts)
mfinit ...... Create an 'upstream' remote for 'MarlinFirmare'

View File

@@ -2,14 +2,9 @@
# MarlinBinaryProtocol.py
# Supporting Firmware upload via USB/Serial, saving to the attached media.
#
import serial
import math
import time
import serial, math, time, threading, sys, datetime, random
from collections import deque
import threading
import sys
import datetime
import random
try:
import heatshrink2 as heatshrink
heatshrink_exists = True

View File

@@ -18,8 +18,7 @@ Options:
--num-temps=... the number of temperature points to calculate (default: 36)
"""
from __future__ import print_function
from __future__ import division
from __future__ import print_function, division
from math import *
import sys, getopt

View File

@@ -5,8 +5,7 @@
#
# Usage: rle16_compress_cpp_image_data.py INPUT_FILE.cpp OUTPUT_FILE.cpp
#
import sys,struct
import re
import sys, struct, re
def addCompressedData(input_file, output_file):
ofile = open(output_file, 'wt')

View File

@@ -6,10 +6,11 @@
#
# Usage: rle_compress_bitmap.py INPUT_FILE OUTPUT_FILE
#
import sys,struct
import re
import sys, struct, re
def addCompressedData(input_file, output_file):
input_lines = input_file.readlines()
input_file.close()
ofile = open(output_file, 'wt')
datatype = "uint8_t"
@@ -18,8 +19,7 @@ def addCompressedData(input_file, output_file):
arrname = ''
c_data_section = False ; c_skip_data = False ; c_footer = False
while True:
line = input_file.readline()
for line in input_lines:
if not line: break
if not c_footer:
@@ -56,8 +56,6 @@ def addCompressedData(input_file, output_file):
arrname = line.split('[')[0].split(' ')[-1]
print("Found data array", arrname)
input_file.close()
#print("\nRaw Bitmap Data", raw_data)
#
@@ -190,11 +188,11 @@ if len(sys.argv) <= 2:
print('Usage: rle_compress_bitmap.py INPUT_FILE OUTPUT_FILE')
exit(1)
output_cpp = sys.argv[2]
output_h = sys.argv[2]
inname = sys.argv[1].replace('//', '/')
try:
input_cpp = open(inname)
input_h = open(inname)
print("Processing", inname, "...")
addCompressedData(input_cpp, output_cpp)
addCompressedData(input_h, output_h)
except OSError:
print("Can't find input file", inname)

View File

@@ -1,40 +0,0 @@
Overview:
1) Install Sublime
2) Install Deviot (?optional?)
3) Install WebDevShell (this will execute the auto-build script)
4) Copy the menu configuration to the proper Sublime directory
5) Add platformio to your path (usually not needed)
Sublime with autobuild
Tools
Install Package Control
Tools
Command Palette
Package Control: Install Package
type in deviot and click on it
Tools
Command Palette
Package Control: Install Package
type in WebDevShell and click on it
in Sublime, open Marlin directory with "platformio.ini" in it
starting in the top level directory, go to the folder "Buildroot/shared/Sublime"
copy the folder "auto_build_sublime_menu" and contents to:
Windows
\Users\your_user_name\AppData\Roaming\Sublime Text 3\Packages
Linux
/home/your_user_name/.config/sublime-text-3/Packages/User
macOS (Click on the Finder's 'Go' menu and hold down Option to open...)
~/Library/Application Support/Sublime Text 3/Packages/User
The menu should now be visible
If you get an error message that says "file not found" and "subprocess.Popen(['platformio' ... "
then you'll need to add platformio to your path.
macOS
sudo nano /etc/paths
add these to the bottom
/Users/bob/.platformio
/Users/bob/.platformio/penv/bin

View File

@@ -1,66 +0,0 @@
[
{
"caption": "Auto Build",
"children": [
{
"caption": "PIO Build",
"command": "webdevshell",
"args": {
"command": "python buildroot/share/vscode/auto_build.py build"
}
},
{
"caption": "PIO Clean",
"command": "webdevshell",
"args": {
"command": "python buildroot/share/vscode/auto_build.py clean"
}
},
{
"caption": "PIO Upload",
"command": "webdevshell",
"args": {
"command": "python buildroot/share/vscode/auto_build.py upload"
}
},
{
"caption": "PIO Upload (traceback)",
"command": "webdevshell",
"args": {
"command": "python buildroot/share/vscode/auto_build.py traceback"
}
},
{
"caption": "PIO Upload using Programmer",
"command": "webdevshell",
"args": {
"command": "python buildroot/share/vscode/auto_build.py program"
}
},
{
"caption": "PIO Test",
"command": "webdevshell",
"args": {
"command": "python buildroot/share/vscode/auto_build.py test"
}
},
{
"caption": "PIO Debug",
"command": "webdevshell",
"args": {
"command": "python buildroot/share/vscode/auto_build.py debug"
}
},
{
"caption": "PIO Remote",
"command": "webdevshell",
"args": {
"command": "python buildroot/share/vscode/auto_build.py remote"
}
}
],
"id": "AutoBuild",
"mnemonic": "A"
}
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,143 +0,0 @@
#!/usr/bin/env python
#
# Builds custom upload command
# 1) Run platformio as a subprocess to find a COM port
# 2) Build the upload command
# 3) Exit and let upload tool do the work
#
# This script runs between completion of the library/dependencies installation and compilation.
#
# Will continue on if a COM port isn't found so that the compilation can be done.
#
from __future__ import print_function
from __future__ import division
import subprocess, os, platform
from SCons.Script import DefaultEnvironment
current_OS = platform.system()
env = DefaultEnvironment()
build_type = os.environ.get("BUILD_TYPE", 'Not Set')
if not(build_type == 'upload' or build_type == 'traceback' or build_type == 'Not Set') :
env.Replace(UPLOAD_PROTOCOL = 'teensy-gui') # run normal Teensy2 scripts
else:
com_first = ''
com_last = ''
com_CDC = ''
description_first = ''
description_last = ''
description_CDC = ''
#
# grab the first com port that pops up unless we find one we know for sure
# is a CDC device
#
def get_com_port(com_search_text, descr_search_text, start):
global com_first
global com_last
global com_CDC
global description_first
global description_last
global description_CDC
print('\nLooking for Serial Port\n')
# stream output from subprocess and split it into lines
pio_subprocess = subprocess.Popen(['platformio', 'device', 'list'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
looking_for_description = False
for line in iter(pio_subprocess.stdout.readline, ''):
if 0 <= line.find(com_search_text):
looking_for_description = True
com_last = line.replace('\n', '')
if com_first == '':
com_first = com_last
if 0 <= line.find(descr_search_text) and looking_for_description:
looking_for_description = False
description_last = line[ start : ]
if description_first == '':
description_first = description_last
if 0 <= description_last.find('CDC'):
com_CDC = com_last
description_CDC = description_last
if com_CDC == '' and com_first != '':
com_CDC = com_first
description_CDC = description_first
elif com_CDC == '':
com_CDC = 'COM_PORT_NOT_FOUND'
while 0 <= com_CDC.find('\n'):
com_CDC = com_CDC.replace('\n', '')
while 0 <= com_CDC.find('\r'):
com_CDC = com_CDC.replace('\r', '')
if com_CDC == 'COM_PORT_NOT_FOUND':
print(com_CDC, '\n')
else:
print('FOUND: ', com_CDC)
print('DESCRIPTION: ', description_CDC, '\n')
if current_OS == 'Windows':
get_com_port('COM', 'Hardware ID:', 13)
# avrdude_conf_path = env.get("PIOHOME_DIR") + '\\packages\\toolchain-atmelavr\\etc\\avrdude.conf'
avrdude_conf_path = 'buildroot\\share\\vscode\\avrdude.conf'
avrdude_exe_path = 'buildroot\\share\\vscode\\avrdude_5.10.exe'
# source_path = env.get("PROJECTBUILD_DIR") + '\\' + env.get("PIOENV") + '\\firmware.hex'
source_path = '.pio\\build\\' + env.get("PIOENV") + '\\firmware.hex'
upload_string = avrdude_exe_path + ' -p usb1286 -c avr109 -P ' + com_CDC + ' -U flash:w:' + source_path + ':i'
if current_OS == 'Darwin': # MAC
get_com_port('usbmodem', 'Description:', 13)
# avrdude_conf_path = env.get("PIOHOME_DIR") + '/packages/toolchain-atmelavr/etc/avrdude.conf'
avrdude_conf_path = 'buildroot/share/vscode/avrdude_macOS.conf'
avrdude_exe_path = 'buildroot/share/vscode/avrdude_5.10_macOS'
# source_path = env.get("PROJECTBUILD_DIR") + '/' + env.get("PIOENV") + '/firmware.hex'
source_path = '.pio/build/' + env.get("PIOENV") + '/firmware.hex'
# upload_string = 'avrdude -p usb1286 -c avr109 -P ' + com_CDC + ' -U flash:w:' + source_path + ':i'
upload_string = avrdude_exe_path + ' -p usb1286 -c avr109 -P ' + com_CDC + ' -C ' + avrdude_conf_path + ' -U flash:w:' + source_path + ':i'
print('upload_string: ', upload_string)
if current_OS == 'Linux':
get_com_port('/dev/tty', 'Description:', 13)
# avrdude_conf_path = env.get("PIOHOME_DIR") + '/packages/toolchain-atmelavr/etc/avrdude.conf'
avrdude_conf_path = 'buildroot/share/vscode/avrdude_linux.conf'
avrdude_exe_path = 'buildroot/share/vscode/avrdude_5.10_linux'
# source_path = env.get("PROJECTBUILD_DIR") + '/' + env.get("PIOENV") + '/firmware.hex'
source_path = '.pio/build/' + env.get("PIOENV") + '/firmware.hex'
# upload_string = 'avrdude -p usb1286 -c avr109 -P ' + com_CDC + ' -U flash:w:' + source_path + ':i'
upload_string = avrdude_exe_path + ' -p usb1286 -c avr109 -P ' + com_CDC + ' -C ' + avrdude_conf_path + ' -U flash:w:' + source_path + ':i'
env.Replace(
UPLOADCMD = upload_string,
MAXIMUM_RAM_SIZE = 8192,
MAXIMUM_SIZE = 130048
)

View File

@@ -1,41 +0,0 @@
#
# Builds custom upload command
# 1) Run platformio as a subprocess to find a COM port
# 2) Build the upload command
# 3) Exit and let upload tool do the work
#
# This script runs between completion of the library/dependencies installation and compilation.
#
# Will continue on if a COM port isn't found so that the compilation can be done.
#
import os, platform
from SCons.Script import DefaultEnvironment
current_OS = platform.system()
env = DefaultEnvironment()
build_type = os.environ.get("BUILD_TYPE", 'Not Set')
if not(build_type == 'upload' or build_type == 'traceback' or build_type == 'Not Set') :
env.Replace(UPLOAD_PROTOCOL = 'teensy-gui') # run normal Teensy2 scripts
else:
if current_OS == 'Windows':
avrdude_conf_path = env.get("PIOHOME_DIR") + '\\packages\\toolchain-atmelavr\\etc\\avrdude.conf'
source_path = env.get("PROJECTBUILD_DIR") + '\\' + env.get("PIOENV") + '\\firmware.hex'
upload_string = 'avrdude -p usb1286 -c flip1 -C ' + avrdude_conf_path + ' -U flash:w:' + source_path + ':i'
else:
source_path = env.get("PROJECTBUILD_DIR") + '/' + env.get("PIOENV") + '/firmware.hex'
upload_string = 'avrdude -p usb1286 -c flip1 -U flash:w:' + source_path + ':i'
env.Replace(
UPLOADCMD = upload_string,
MAXIMUM_RAM_SIZE = 8192,
MAXIMUM_SIZE = 130048
)

View File

@@ -10,7 +10,7 @@
#################################
#
# Adafruit Grand Central M4 (Atmel SAMD51P20A ARM Cortex-M4)
# ReprapWorld Minitronics (Atmel SAMD21J18 ARM Cortex-M0+)
#
[env:SAMD21_minitronics20]
platform = atmelsam