Smoothieware_best-for-pnp 工具链的升级尝试
概述
正在迁移Smoothieware_best-for-pnp到MCUXPresso的失败实验中徘徊.
现在已知2者的工具链版本是不一样的. 通过2进制比对, 知道2家用的都是公版的gcc for arm的版本.
MCUXPresso 是10.3, NXP家并没有改gcc, 是公版的实现. gcc-arm-none-eabi-10.3-2021.10-win32.zip
Smoothieware_best-for-pnp 是4.8, 也是公版的实现 gcc-arm-none-eabi-4_8-2014q1-20140314-win32.zip
但是在MCUXPresso尝试编译, 发现有些语法都过不了, 要手工改实现.
Smoothieware_best-for-pnp的命令行编译, 是直接能编译过的.
先怀疑自己吧, 有点怀疑我编译的文件集合不太对, 或者文件编译时, 编译宏是否没加上? 头文件路径包含的不对?
那就去仔细研究一下Smoothieware_best-for-pnp的工具链安装和makefile.
做过实验后才知道, 正如Smoothieware_best-for-pnp作者在工程文档中说的那样, 这个工程只能用他们提供的工具链(gcc-arm-none-eabi-4_8-2014q1-20140314-win32.zip)进行编译, 验证了作者的这个说明真是杯具.
不过每个实验都没有白做的, 或多或少的都有收获.
以后如果有命令行编译的工程, 那我就知道怎么给他们升级工具链了.
也启发了新实验想法:
- 将IDE的工具链换为Smoothieware_best-for-pnp的, 再实验吧.
- 将makefile弄清楚, 那么我就可以将要编译的文件集合弄清, 将每个文件要包含的头文件, 参数宏弄清. 在IDE中, 哪里语法不合适, 哪个文件编译的命令行不合适, 手工修改也不难啊.
将这次实验记录一下.
实验
改了win_install.cmd为case_win_install.cmd, 打印了每句脚本的含义, 弄清楚了工具链的安装过程, 工具链环境的构造.
case_win_install.cmd 内容如下:
@echo on
rem Copyright 2013 Adam Green (http://mbed.org/users/AdamGreen/)
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
rem Setup batch file specific environment variables.
setlocal
rem ROOTDIR = D:\3rd_prj\Smoothieware_best-for-pnp\
set ROOTDIR=%~dp0
rem LOGFILE = D:\3rd_prj\Smoothieware_best-for-pnp\win_install.log
set LOGFILE=%ROOTDIR%win_install.log
rem ERRORFILE = D:\3rd_prj\Smoothieware_best-for-pnp\win_install.err
set ERRORFILE=%ROOTDIR%win_install.err
rem GCC4ARM_VERSION = gcc-arm-none-eabi-4_8-2014q1
set GCC4ARM_VERSION=gcc-arm-none-eabi-10.3-2021.10
rem GCC4ARM_FILENAME = gcc-arm-none-eabi-4_8-2014q1-20140314-win32.zip
set GCC4ARM_FILENAME=gcc-arm-none-eabi-10.3-2021.10_M.zip
rem GCC4ARM_URL = https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/gcc-arm-none-eabi-4_8-2014q1-20140314-win32.zip
set GCC4ARM_URL=https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/%GCC4ARM_FILENAME%
rem GCC4ARM_TAR = D:\3rd_prj\Smoothieware_best-for-pnp\gcc-arm-none-eabi-4_8-2014q1-20140314-win32.zip
set GCC4ARM_TAR=%ROOTDIR%%GCC4ARM_FILENAME%
rem GCC4ARM_MD5 = 09c19b3248863074f5498a88f31bee16
set GCC4ARM_MD5=355ac5330cc42d316f92dc39313c6dba
rem GCC4ARM_MD5_FILENAME = D:\3rd_prj\Smoothieware_best-for-pnp\gcc-arm-none-eabi.md5
set GCC4ARM_MD5_FILENAME=%ROOTDIR%gcc-arm-none-eabi.md5
rem GCC4ARM_DIR = D:\3rd_prj\Smoothieware_best-for-pnp\gcc-arm-none-eabi
set GCC4ARM_DIR=%ROOTDIR%gcc-arm-none-eabi
rem GCC4ARM_BINDIR = D:\3rd_prj\Smoothieware_best-for-pnp\gcc-arm-none-eabi\bin
set GCC4ARM_BINDIR=%GCC4ARM_DIR%\bin
rem OUR_MAKE = D:\3rd_prj\Smoothieware_best-for-pnp\build\win32\make.exe
set OUR_MAKE=%ROOTDIR%build\win32\make.exe
rem BUILDENV_CMD = D:\3rd_prj\Smoothieware_best-for-pnp\gcc-arm-none-eabi\bin\buildenv.cmd
set BUILDENV_CMD=%GCC4ARM_BINDIR%\buildenv.cmd
rem BUILDSHELL_CMD = D:\3rd_prj\Smoothieware_best-for-pnp\BuildShell.cmd
set BUILDSHELL_CMD=%ROOTDIR%BuildShell.cmd
rem BUILDSHELL_DEBUG_CMD = D:\3rd_prj\Smoothieware_best-for-pnp\BuildShellDebug.cmd
set BUILDSHELL_DEBUG_CMD=%ROOTDIR%BuildShellDebug.cmd
echo ROOTDIR = %ROOTDIR%
echo LOGFILE = %LOGFILE%
echo ERRORFILE = %ERRORFILE%
echo GCC4ARM_VERSION = %GCC4ARM_VERSION%
echo GCC4ARM_FILENAME = %GCC4ARM_FILENAME%
echo GCC4ARM_URL = %GCC4ARM_URL%
echo GCC4ARM_TAR = %GCC4ARM_TAR%
echo GCC4ARM_MD5 = %GCC4ARM_MD5%
echo GCC4ARM_MD5_FILENAME = %GCC4ARM_MD5_FILENAME%
echo GCC4ARM_DIR = %GCC4ARM_DIR%
echo GCC4ARM_BINDIR = %GCC4ARM_BINDIR%
echo OUR_MAKE = %OUR_MAKE%
echo BUILDENV_CMD = %BUILDENV_CMD%
echo BUILDSHELL_CMD = %BUILDSHELL_CMD%
echo BUILDSHELL_DEBUG_CMD = %BUILDSHELL_DEBUG_CMD%
rem Make sure that we are running with current directory set to where this
rem batch file is located.
pushd %ROOTDIR%
rem Initialize install log files.
echo Logging install results to %LOGFILE%
echo %DATE% %TIME% Starting %0 %*>%LOGFILE%
rem echo Downloading GNU Tools for ARM Embedded Processors...
rem echo %DATE% %TIME% Executing build\win32\curl -kL0 %GCC4ARM_URL%>>%LOGFILE%
rem curl -kL0 https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/gcc-arm-none-eabi-4_8-2014q1-20140314-win32.zip 1>D:\3rd_prj\Smoothieware_best-for-pnp\gcc-arm-none-eabi-4_8-2014q1-20140314-win32.zip
rem build\win32\curl -kL0 %GCC4ARM_URL% >%GCC4ARM_TAR%
rem if errorlevel 1 goto ExitOnError
echo Validating md5 signature of GNU Tools for ARM Embedded Processors...
echo %GCC4ARM_MD5% *%GCC4ARM_FILENAME%>%GCC4ARM_MD5_FILENAME%
call :RunAndLog build\win32\md5sum --check %GCC4ARM_MD5_FILENAME%
if errorlevel 1 goto ExitOnError
rem del "%GCC4ARM_MD5_FILENAME%"
echo Extracting GNU Tools for ARM Embedded Processors...
call :RunAndLog rd /s /q %GCC4ARM_DIR%
call :RunAndLog md %GCC4ARM_DIR%
if errorlevel 1 goto ExitOnError
call :RunAndLog cd %GCC4ARM_DIR%
call :RunAndLog ..\build\win32\bsdtar xf %GCC4ARM_TAR%
if errorlevel 1 goto ExitOnError
call :RunAndLog cd ..
echo Creating helper scripts...
echo @echo off>%BUILDENV_CMD%
echo REM Uncomment next line and set destination drive to match mbed device>>%BUILDENV_CMD%
echo REM SET LPC_DEPLOY=copy PROJECT.bin f:\>>%BUILDENV_CMD%
echo.>>%BUILDENV_CMD%
echo SET PATH=%%~dp0;%%~dp0..\..\build\win32;%%PATH%%>>%BUILDENV_CMD%
echo.>>%BUILDENV_CMD%
echo REM execute given command if any >>%BUILDENV_CMD%
echo %%*>>%BUILDENV_CMD%
rem
echo @cmd.exe /K %%~dp0\gcc-arm-none-eabi\bin\buildenv.cmd %%*>%BUILDSHELL_CMD%
rem Place GNU Tool for ARM Embedded Processors in the path before building gcc4mbed code.
set path=%GCC4ARM_BINDIR%;%ROOTDIR%build\win32;%PATH%
echo Performing a clean build of the gcc4mbed samples...
call :RunAndLog %OUR_MAKE% clean
if errorlevel 1 goto ExitOnError
call :RunAndLog %OUR_MAKE%
if errorlevel 1 goto ExitOnError
rem case by ls
goto :MyEnd
echo Cleaning up intermediate files...
rem call :RunAndLog del /f %GCC4ARM_TAR%
echo **************************************************************************
echo To build gcc4mbed samples, you will first need to run the following batch
echo file so that your environment variables are set correctly:
echo %BUILDSHELL_CMD%
echo You will want to run this each time you start a new Command Prompt. You
echo can simply double-click on this batch file from Explorer to launch a
echo Command Prompt that has been properly initialized for building gcc4mbed
echo based code.
echo **************************************************************************
rem Restore current directory and exit batch file on success.
echo %DATE% %TIME% Finished successfully>>%LOGFILE%
echo Finished successfully
goto Exit
rem Logs the command to be run and then executes the command while logging the results.
:RunAndLog
echo %DATE% %TIME% Executing %*>>%LOGFILE%
%* 1>>%LOGFILE% 2>%ERRORFILE%
goto :EOF
:my_after_call
echo %DATE% %TIME% Executing %*>>log1.txt
%* 1>>log1.txt 2>log2.txt
goto :EOF
rem Exits the batch file due to error.
rem Make sure that any stderr text ends up in win_install.log and then restore
rem the current directory before forcing an early exit.
:ExitOnError
type %ERRORFILE% >>%LOGFILE%
echo %DATE% %TIME% Failure forced early exit>>%LOGFILE%
type %LOGFILE%
:Exit
del %ERRORFILE%
popd
pause
:MyEnd
rem >> :MyEnd
popd
pause
工具链安装的思路
Smoothieware_best-for-pnp工程中, 已经自带了编译时用到的工具 位置 ./build/win32
脚本中用到的exe如下:
curl.exe 下载远端的https链接的gcc_for_arm预编译好的zip包
md5sum.exe 验证下载后的zip包的哈希值是否正确.
bsdtar.exe 用来将下载后的.zip文件解包.
make.exe 用来编译工程. 只需要make即可, 具体操作定义在makefile和子目录中的.mk中, 需要用到解压后的gcc工具链…
win_install.cmd运行时, 先去下载远端编译好的gcc压缩包. 到本地后, 比较win_install.cmd中手工预定义的md5
解压gcc的zip包到工程根目录, 名称为gcc-arm-none-eabi.
然后写2个cmd, 作为工具链环境.
编译时, 需要先执行buildShell.cmd, 然后执行make编译工程.
更换工具链的工作
将gcc-arm-none-eabi-10.3-2021.10-win32.zip解压开, 再打一个zip包, 让根目录下直接为4个子目录, 保持和4.8的目录结构一致.
用/build/win32/md5sum.exe 来确定新做的.zip包的hash值, 填入case_win_install.cmd
因为我们用的是手工摆放的gcc.zip包, 就不需要下载了.
将case_win_installed.cmd中的包下载和解压完删除下载后的.zip包的操作注释掉.
运行完case_win_installed.cmd时, 其实已经编译工程一次了, 不过没编译过. 因为很多屏幕上的结果都重定向到日志中了.
此时, 在工具链环境中尝试编译, 先运行 BuildShell.cmd, 然后运行make.
D:\3rd_prj\Smoothieware_best-for-pnp>make
make[1]: Entering directory `D:/3rd_prj/Smoothieware_best-for-pnp/mbed'
Building src
make[2]: Entering directory `D:/3rd_prj/Smoothieware_best-for-pnp/mbed/src'
Building mbed-lpc1768.mk
make[3]: Entering directory `D:/3rd_prj/Smoothieware_best-for-pnp/mbed/src'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `D:/3rd_prj/Smoothieware_best-for-pnp/mbed/src'
Building mbed-lpc11u24.mk
make[3]: Entering directory `D:/3rd_prj/Smoothieware_best-for-pnp/mbed/src'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `D:/3rd_prj/Smoothieware_best-for-pnp/mbed/src'
make[2]: Leaving directory `D:/3rd_prj/Smoothieware_best-for-pnp/mbed/src'
make[1]: Leaving directory `D:/3rd_prj/Smoothieware_best-for-pnp/mbed'
Building Smoothie
**NOTE** Excluding modules tools/drillingcycles tools/spindle
make[1]: Entering directory `D:/3rd_prj/Smoothieware_best-for-pnp/src'
Building for device lpc1768
make[2]: Entering directory `D:/3rd_prj/Smoothieware_best-for-pnp/src'
Compiling version.cpp
Compiling modules/tools/zprobe/CartGridStrategy.cpp
In file included from modules/tools/zprobe/CartGridStrategy.cpp:87:
modules/tools/zprobe/CartGridStrategy.h:39:10: error: 'string' in namespace 'std' does not name a type
39 | std::string before_probe, after_probe;
| ^~~~~~
modules/tools/zprobe/CartGridStrategy.h:7:1: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
6 | #include <tuple>
+++ |+#include <string>
7 |
modules/tools/zprobe/CartGridStrategy.h:48:9: error: 'uint8_t' does not name a type; did you mean 'wint_t'?
48 | uint8_t configured_grid_x_size:8;
| ^~~~~~~
| wint_t
modules/tools/zprobe/CartGridStrategy.h:49:9: error: 'uint8_t' does not name a type; did you mean 'wint_t'?
49 | uint8_t configured_grid_y_size:8;
| ^~~~~~~
| wint_t
modules/tools/zprobe/CartGridStrategy.h:50:9: error: 'uint8_t' does not name a type; did you mean 'wint_t'?
50 | uint8_t current_grid_x_size:8;
| ^~~~~~~
| wint_t
modules/tools/zprobe/CartGridStrategy.h:51:9: error: 'uint8_t' does not name a type; did you mean 'wint_t'?
51 | uint8_t current_grid_y_size:8;
| ^~~~~~~
| wint_t
modules/tools/zprobe/CartGridStrategy.cpp: In member function 'virtual bool CartGridStrategy::handleConfig()':
modules/tools/zprobe/CartGridStrategy.cpp:146:11: error: 'class CartGridStrategy' has no member named 'current_grid_x_size'
146 | this->current_grid_x_size = this->configured_grid_x_size = THEKERNEL->config->value(leveling_strategy_checksum, cart_grid_leveling_strategy_checksum, grid_x_size_checksum)->by_default(grid_size)->as_number();
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:146:39: error: 'class CartGridStrategy' has no member named 'configured_grid_x_size'
146 | this->current_grid_x_size = this->configured_grid_x_size = THEKERNEL->config->value(leveling_strategy_checksum, cart_grid_leveling_strategy_checksum, grid_x_size_checksum)->by_default(grid_size)->as_number();
| ^~~~~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:147:11: error: 'class CartGridStrategy' has no member named 'current_grid_y_size'
147 | this->current_grid_y_size = this->configured_grid_y_size = THEKERNEL->config->value(leveling_strategy_checksum, cart_grid_leveling_strategy_checksum, grid_y_size_checksum)->by_default(grid_size)->as_number();
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:147:39: error: 'class CartGridStrategy' has no member named 'configured_grid_y_size'
147 | this->current_grid_y_size = this->configured_grid_y_size = THEKERNEL->config->value(leveling_strategy_checksum, cart_grid_leveling_strategy_checksum, grid_y_size_checksum)->by_default(grid_size)->as_number();
| ^~~~~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:150:29: error: 'configured_grid_x_size' was not declared in this scope
150 | this->new_file_format= (configured_grid_x_size != configured_grid_y_size);
| ^~~~~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:150:55: error: 'configured_grid_y_size' was not declared in this scope
150 | this->new_file_format= (configured_grid_x_size != configured_grid_y_size);
| ^~~~~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:210:11: error: 'class CartGridStrategy' has no member named 'before_probe'
210 | this->before_probe = THEKERNEL->config->value(leveling_strategy_checksum, cart_grid_leveling_strategy_checksum, before_probe_gcode_checksum)->by_default("")->as_string();
| ^~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:211:11: error: 'class CartGridStrategy' has no member named 'after_probe'
211 | this->after_probe = THEKERNEL->config->value(leveling_strategy_checksum, cart_grid_leveling_strategy_checksum, after_probe_gcode_checksum)->by_default("")->as_string();
| ^~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:214:18: error: 'before_probe' was not declared in this scope
214 | std::replace(before_probe.begin(), before_probe.end(), '_', ' '); // replace _ with space
| ^~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:215:18: error: 'after_probe' was not declared in this scope
215 | std::replace(after_probe.begin(), after_probe.end(), '_', ' '); // replace _ with space
| ^~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp: In member function 'void CartGridStrategy::save_grid(StreamOutput*)':
modules/tools/zprobe/CartGridStrategy.cpp:242:9: error: 'current_grid_x_size' was not declared in this scope
242 | if((current_grid_x_size != configured_grid_x_size) || (current_grid_y_size != configured_grid_y_size)) {
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:242:32: error: 'configured_grid_x_size' was not declared in this scope
242 | if((current_grid_x_size != configured_grid_x_size) || (current_grid_y_size != configured_grid_y_size)) {
| ^~~~~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:242:60: error: 'current_grid_y_size' was not declared in this scope
242 | if((current_grid_x_size != configured_grid_x_size) || (current_grid_y_size != configured_grid_y_size)) {
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:242:83: error: 'configured_grid_y_size' was not declared in this scope
242 | if((current_grid_x_size != configured_grid_x_size) || (current_grid_y_size != configured_grid_y_size)) {
| ^~~~~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:254:40: error: 'configured_grid_x_size' was not declared in this scope; did you mean 'tmp_configured_grid_size'?
254 | uint8_t tmp_configured_grid_size = configured_grid_x_size;
| ^~~~~~~~~~~~~~~~~~~~~~
| tmp_configured_grid_size
modules/tools/zprobe/CartGridStrategy.cpp:262:36: error: 'configured_grid_y_size' was not declared in this scope; did you mean 'tmp_configured_grid_size'?
262 | tmp_configured_grid_size = configured_grid_y_size;
| ^~~~~~~~~~~~~~~~~~~~~~
| tmp_configured_grid_size
modules/tools/zprobe/CartGridStrategy.cpp:282:25: error: 'configured_grid_y_size' was not declared in this scope; did you mean 'tmp_configured_grid_size'?
282 | for (int y = 0; y < configured_grid_y_size; y++) {
| ^~~~~~~~~~~~~~~~~~~~~~
| tmp_configured_grid_size
modules/tools/zprobe/CartGridStrategy.cpp: In member function 'bool CartGridStrategy::load_grid(StreamOutput*)':
modules/tools/zprobe/CartGridStrategy.cpp:320:28: error: 'configured_grid_x_size' was not declared in this scope; did you mean 'load_grid_x_size'?
320 | if(load_grid_x_size != configured_grid_x_size) {
| ^~~~~~~~~~~~~~~~~~~~~~
| load_grid_x_size
modules/tools/zprobe/CartGridStrategy.cpp:335:32: error: 'configured_grid_y_size' was not declared in this scope; did you mean 'load_grid_y_size'?
335 | if(load_grid_y_size != configured_grid_y_size) {
| ^~~~~~~~~~~~~~~~~~~~~~
| load_grid_y_size
modules/tools/zprobe/CartGridStrategy.cpp:336:102: error: 'configured_grid_x_size' was not declared in this scope; did you mean 'load_grid_x_size'?
336 | stream->printf("error:grid size y is different read %d - config %d\n", load_grid_y_size, configured_grid_x_size);
| ^~~~~~~~~~~~~~~~~~~~~~
| load_grid_x_size
modules/tools/zprobe/CartGridStrategy.cpp:360:25: error: 'configured_grid_y_size' was not declared in this scope; did you mean 'load_grid_y_size'?
360 | for (int y = 0; y < configured_grid_y_size; y++) {
| ^~~~~~~~~~~~~~~~~~~~~~
| load_grid_y_size
modules/tools/zprobe/CartGridStrategy.cpp:361:29: error: 'configured_grid_x_size' was not declared in this scope; did you mean 'load_grid_x_size'?
361 | for (int x = 0; x < configured_grid_x_size; x++) {
| ^~~~~~~~~~~~~~~~~~~~~~
| load_grid_x_size
modules/tools/zprobe/CartGridStrategy.cpp: In member function 'virtual bool CartGridStrategy::handleGcode(Gcode*)':
modules/tools/zprobe/CartGridStrategy.cpp:386:17: error: 'before_probe' was not declared in this scope
386 | if(!before_probe.empty()) {
| ^~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:399:17: error: 'after_probe' was not declared in this scope
399 | if(!after_probe.empty()) {
| ^~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:415:17: error: 'before_probe' was not declared in this scope
415 | if(!before_probe.empty()) {
| ^~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:424:17: error: 'after_probe' was not declared in this scope
424 | if(!after_probe.empty()) {
| ^~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp: In member function 'bool CartGridStrategy::scan_bed(Gcode*)':
modules/tools/zprobe/CartGridStrategy.cpp:522:56: error: 'configured_grid_x_size' was not declared in this scope
522 | int n = gc->has_letter('I') ? gc->get_value('I') : configured_grid_x_size;
| ^~~~~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:523:56: error: 'configured_grid_y_size' was not declared in this scope
523 | int m = gc->has_letter('J') ? gc->get_value('J') : configured_grid_y_size;
| ^~~~~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp: In member function 'bool CartGridStrategy::doProbe(Gcode*)':
modules/tools/zprobe/CartGridStrategy.cpp:621:29: error: 'current_grid_x_size' was not declared in this scope
621 | if(gc->has_letter('I')) current_grid_x_size = gc->get_value('I'); // override default grid x size
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:622:29: error: 'current_grid_y_size' was not declared in this scope
622 | if(gc->has_letter('J')) current_grid_y_size = gc->get_value('J'); // override default grid y size
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:624:15: error: 'class CartGridStrategy' has no member named 'current_grid_x_size'
624 | if((this->current_grid_x_size * this->current_grid_y_size) > (this->configured_grid_x_size * this->configured_grid_y_size)){
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:624:43: error: 'class CartGridStrategy' has no member named 'current_grid_y_size'
624 | if((this->current_grid_x_size * this->current_grid_y_size) > (this->configured_grid_x_size * this->configured_grid_y_size)){
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:624:74: error: 'class CartGridStrategy' has no member named 'configured_grid_x_size'
624 | if((this->current_grid_x_size * this->current_grid_y_size) > (this->configured_grid_x_size * this->configured_grid_y_size)){
| ^~~~~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:624:105: error: 'class CartGridStrategy' has no member named 'configured_grid_y_size'
624 | if((this->current_grid_x_size * this->current_grid_y_size) > (this->configured_grid_x_size * this->configured_grid_y_size)){
| ^~~~~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:626:35: error: 'class CartGridStrategy' has no member named 'current_grid_x_size'
626 | this->current_grid_x_size, this->current_grid_y_size, this->current_grid_x_size*this->current_grid_x_size,
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:626:62: error: 'class CartGridStrategy' has no member named 'current_grid_y_size'
626 | this->current_grid_x_size, this->current_grid_y_size, this->current_grid_x_size*this->current_grid_x_size,
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:626:89: error: 'class CartGridStrategy' has no member named 'current_grid_x_size'
626 | this->current_grid_x_size, this->current_grid_y_size, this->current_grid_x_size*this->current_grid_x_size,
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:626:115: error: 'class CartGridStrategy' has no member named 'current_grid_x_size'
626 | this->current_grid_x_size, this->current_grid_y_size, this->current_grid_x_size*this->current_grid_x_size,
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:627:35: error: 'class CartGridStrategy' has no member named 'configured_grid_x_size'
627 | this->configured_grid_x_size, this->configured_grid_y_size, this->configured_grid_x_size*this->configured_grid_y_size);
| ^~~~~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:627:65: error: 'class CartGridStrategy' has no member named 'configured_grid_y_size'
627 | this->configured_grid_x_size, this->configured_grid_y_size, this->configured_grid_x_size*this->configured_grid_y_size);
| ^~~~~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:627:95: error: 'class CartGridStrategy' has no member named 'configured_grid_x_size'
627 | this->configured_grid_x_size, this->configured_grid_y_size, this->configured_grid_x_size*this->configured_grid_y_size);
| ^~~~~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:627:124: error: 'class CartGridStrategy' has no member named 'configured_grid_y_size'
627 | this->configured_grid_x_size, this->configured_grid_y_size, this->configured_grid_x_size*this->configured_grid_y_size);
| ^~~~~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:651:209: error: 'current_grid_x_size' was not declared in this scope
651 | gc->stream->printf("Probe start ht: %0.3f mm, start MCS x,y: %0.3f,%0.3f, rectangular bed width,height in mm: %0.3f,%0.3f, grid size: %dx%d\n", zprobe->getProbeHeight(), x_start, y_start, x_size, y_size, current_grid_x_size, current_grid_y_size);
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:651:230: error: 'current_grid_y_size' was not declared in this scope
651 | gc->stream->printf("Probe start ht: %0.3f mm, start MCS x,y: %0.3f,%0.3f, rectangular bed width,height in mm: %0.3f,%0.3f, grid size: %dx%d\n", zprobe->getProbeHeight(), x_start, y_start, x_size, y_size, current_grid_x_size, current_grid_y_size);
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:663:41: error: 'class CartGridStrategy' has no member named 'current_grid_y_size'
663 | for (int yCount = 0; yCount < this->current_grid_y_size; yCount++) {
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:664:63: error: 'class CartGridStrategy' has no member named 'current_grid_y_size'
664 | float yProbe = this->y_start + (this->y_size / (this->current_grid_y_size - 1)) * yCount;
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:667:28: error: 'class CartGridStrategy' has no member named 'current_grid_x_size'
667 | xStart = this->current_grid_x_size - 1;
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:672:27: error: 'class CartGridStrategy' has no member named 'current_grid_x_size'
672 | xStop = this->current_grid_x_size;
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:677:67: error: 'class CartGridStrategy' has no member named 'current_grid_x_size'
677 | float xProbe = this->x_start + (this->x_size / (this->current_grid_x_size - 1)) * xCount;
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:685:34: error: 'class CartGridStrategy' has no member named 'current_grid_x_size'
685 | grid[xCount + (this->current_grid_x_size * yCount)] = measured_z;
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp: In member function 'void CartGridStrategy::doCompensation(float*, bool)':
modules/tools/zprobe/CartGridStrategy.cpp:737:52: error: 'class CartGridStrategy' has no member named 'current_grid_x_size'
737 | float grid_x = std::max(0.001F, std::min(this->current_grid_x_size - 1.001F, (x_target - this->x_start) / (this->x_size / (this->current_grid_x_size - 1))));
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:737:134: error: 'class CartGridStrategy' has no member named 'current_grid_x_size'
737 | float grid_x = std::max(0.001F, std::min(this->current_grid_x_size - 1.001F, (x_target - this->x_start) / (this->x_size / (this->current_grid_x_size - 1))));
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:738:52: error: 'class CartGridStrategy' has no member named 'current_grid_x_size'
738 | float grid_y = std::max(0.001F, std::min(this->current_grid_x_size - 1.001F, (y_target - this->y_start) / (this->y_size / (this->current_grid_y_size - 1))));
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:738:134: error: 'class CartGridStrategy' has no member named 'current_grid_y_size'
738 | float grid_y = std::max(0.001F, std::min(this->current_grid_x_size - 1.001F, (y_target - this->y_start) / (this->y_size / (this->current_grid_y_size - 1))));
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:743:52: error: 'class CartGridStrategy' has no member named 'current_grid_x_size'
743 | float z1 = grid[(floor_x) + ((floor_y) * this->current_grid_x_size)];
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:744:56: error: 'class CartGridStrategy' has no member named 'current_grid_x_size'
744 | float z2 = grid[(floor_x) + ((floor_y + 1) * this->current_grid_x_size)];
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:745:56: error: 'class CartGridStrategy' has no member named 'current_grid_x_size'
745 | float z3 = grid[(floor_x + 1) + ((floor_y) * this->current_grid_x_size)];
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:746:60: error: 'class CartGridStrategy' has no member named 'current_grid_x_size'
746 | float z4 = grid[(floor_x + 1) + ((floor_y + 1) * this->current_grid_x_size)];
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp: In member function 'void CartGridStrategy::print_bed_level(StreamOutput*)':
modules/tools/zprobe/CartGridStrategy.cpp:785:29: error: 'current_grid_y_size' was not declared in this scope
785 | for (int y = 0; y < current_grid_y_size; y++) {
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:786:33: error: 'current_grid_x_size' was not declared in this scope
786 | for (int x = 0; x < current_grid_x_size; x++) {
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:793:40: error: 'current_grid_x_size' was not declared in this scope
793 | int xStart = (x_size>0) ? 0 : (current_grid_x_size - 1);
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:797:40: error: 'current_grid_y_size' was not declared in this scope
797 | int yStart = (y_size<0) ? 0 : (current_grid_y_size - 1);
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp: In member function 'void CartGridStrategy::reset_bed_level()':
modules/tools/zprobe/CartGridStrategy.cpp:826:25: error: 'current_grid_y_size' was not declared in this scope
826 | for (int y = 0; y < current_grid_y_size; y++) {
| ^~~~~~~~~~~~~~~~~~~
modules/tools/zprobe/CartGridStrategy.cpp:827:29: error: 'current_grid_x_size' was not declared in this scope
827 | for (int x = 0; x < current_grid_x_size; x++) {
| ^~~~~~~~~~~~~~~~~~~
make[2]: *** [../LPC1768/./modules/tools/zprobe/CartGridStrategy.o] Error 1
make[2]: Leaving directory `D:/3rd_prj/Smoothieware_best-for-pnp/src'
make[1]: *** [lpc1768] Error 2
make[1]: Leaving directory `D:/3rd_prj/Smoothieware_best-for-pnp/src'
make: *** [all] Error 2
D:\3rd_prj\Smoothieware_best-for-pnp>
可以看到, 有语法差异. 导致编译不过.
现在准备将工具链换为原版的, 将日志加细致一些, 先将每个文件的命令行编译参数确认清楚.
备注
真正规范的工程, 换了工具链, 高版本的工具链可以正常编译低版本工具链能通过的工程才正常.
程序员正常写程序就好, 不用关心工具链的问题. 这不就是向下兼容么? 如果换了同一个系列的高版本编译器, 工程就编译不过了, 那成啥了…
Smoothieware_best-for-pnp工程选择的工具链挺膈应的, 初始作者的思路清奇.
补充
观察到Smoothieware_best-for-pnp用的是arm-none-eabi-g++.exe, MCUXPresso用的是arm-none-eabi-c++.exe
现在想确认一下arm-none-eabi-c++.exe和arm-none-eabi-g++.exe功能上有啥区别? 是否有可能将Smoothieware_best-for-pnp编译由arm-none-eabi-g++.exe改为arm-none-eabi-c++.exe?
做了实验gcc-arm-none-eabi-10.3-2021.10-src.tar.bz2 的编译环境搭建
arm-none-eabi-g++.exe和arm-none-eabi-c++.exe是一个东西, 不是拷贝出来的, 而是编译出来有2进制区别, 但是功能完全一致.
我现在遇到的问题: 用nxp编译, 现在是编译不过的, 应该是有一些编译选项没加上.
但是现在Smoothieware_best-for-pnp原版工具链和nxp不一样.
现在已经将Smoothieware_best-for-pnp的工具链换的和MCUXpresso一样了, 只是命令行编译时出了一些语法错误, 估计是gcc编译器没有向下兼容引起的.
换个思路:
现在就在更换了10.3编译器的基础上, 先用命令行将Smoothieware_best-for-pnp过.
然后再调整MCUXPresso的每个文件的编译选项, 使每个文件的编译参数都和Smoothieware_best-for-pnp工程一样, 这样理论上就能搞定编译问题.
给原始工程换了工具链之后, 编译过了
在原始工程中, 换了工具链(10.3), 编译过了(原来的编译选项c++11换为c++14, 补了几个头文件). 没有开始想的那么离谱.
又试了一下, 只加了头文件, 还是用c++11, 也能编译过.
编译时有些警告, 不用管, 原始工程编译时, 也有警告.
做的修改如下:
这次放在虚拟盘根目录下编译的, 路径比较短, 应该和这个关系不大.
剩下的事情, 再仔细研究一下原版编译时的操作(开始拷贝了一些.h出来, 后来又编译了个lib. 最后的.bin是链接了这个库, 而且用到了.ld).
还要看每个文件的编译参数. MCUXPresso是可以设置编译的命令行参数的, 调整的一样就可以.文章来源:https://www.toymoban.com/news/detail-451800.html
补充
从gnu官网下载了最新的make4.4的工程, 自己编译了一个make.exe, 放入build\win32.
尝试重新编译工程, 可以编译过.文章来源地址https://www.toymoban.com/news/detail-451800.html
END
到了这里,关于Smoothieware_best-for-pnp 工具链的升级尝试的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!