BIGTREETECH-S42B-V1.0 icon indicating copy to clipboard operation
BIGTREETECH-S42B-V1.0 copied to clipboard

Make project compilable with latest PlatformIO and STM32 platform 11

Open maxgerhardt opened this issue 4 years ago • 3 comments

Since version 10 of https://github.com/platformio/platform-ststm32/, custom board JSON files need to have a product_line value with which the startup script is selected.

Without that, compiling this project gives

Processing BIGTREE_S42B_V1_0 (platform: ststm32; framework: stm32cube; board: STM32F030C8)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/STM32F030C8.html
PLATFORM: ST STM32 (11.0.0) > STM32F030C8 (8k RAM. 64k Flash)
HARDWARE: STM32F030C8T6 48MHz, 8KB RAM, 64KB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES:
 - framework-stm32cubef0 1.11.1
 - tool-ldscripts-ststm32 0.1.0
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
AssertionError: Missing MCU or Product Line field:
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\Lib\site-packages\platformio\builder\main.py", line 170:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\Max\.platformio\platforms\ststm32\builder\main.py", line 99:
    target_elf = env.BuildProgram()
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\Lib\site-packages\platformio\builder\tools\platformio.py", line 61:
    env.ProcessProgramDeps()
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\Lib\site-packages\platformio\builder\tools\platformio.py", line 127:
    env.BuildFrameworks(env.get("PIOFRAMEWORK"))
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\Lib\site-packages\platformio\builder\tools\platformio.py", line 342:
    SConscript(env.GetFrameworkScript(f), exports="env")
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 661:
    return method(*args, **kw)
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\Max\.platformio\platforms\ststm32\builder\frameworks\stm32cube.py", line 43:
    assert PRODUCT_LINE, "Missing MCU or Product Line field"
========================================================================================== [FAILED] Took 0.76 seconds ==========================================================================================

After correcting that, more errors arise during compilation


Compiling .pioenvs\BIGTREE_S42B_V1_0\src\src\Libraries\Stm32F0_lib\Src\stm32f0xx_ll_utils.o
Compiling .pioenvs\BIGTREE_S42B_V1_0\src\src\User\main.o
Compiling .pioenvs\BIGTREE_S42B_V1_0\src\src\User\stm32f0xx_it.o
Compiling .pioenvs\BIGTREE_S42B_V1_0\src\src\User\system_stm32f0xx.o
In file included from Close_loop\src\Libraries\cmsis/stm32f030x8.h:125:0,
                 from Close_loop\src\Libraries\cmsis/stm32f0xx.h:135,
                 from Close_loop\src\Libraries\Stm32F0_lib\Inc/stm32f0xx_ll_spi.h:45,
                 from Close_loop\src\Libraries\Stm32F0_lib\Src\stm32f0xx_ll_spi.c:38:
Close_loop\src\Libraries\cmsis/core_cm0.h:163:10: fatal error: core_cmInstr.h: No such file or directory

because this project includes its own CMSIS library but there is no core_cmInstr.h file. That was added.

Finally, the value of the ldscript path is corrected.

Please note that iap.py is still wrong, it does a env.Replace(LDSCRIPT_PATH="buildroot/ldscripts/BIGTREE_S42B_V1.ld") and that file doesn't exist anywhere in this repo. But since that extra_scripts directive is commented out, it is not used anyways.

You should be able to reproduce the errors if you update your PlatformIO core (pio upgrade --dev) and platforms (pio platforms update) in the CLI.

Another way of fixing would be of course to correct the line

platform = ststm32

to include the exact version with which it compiled, e.g. [email protected]. Since I don't know which versions you used, I fixed it by updating.

Note that I only tested that the firmware compiled, not that it runs. Someone else would have to verify that, since I don't have the hardware.

maxgerhardt avatar Jan 10 '21 14:01 maxgerhardt

please i need some help, i installed the Bigtreetech s42b v1.1 drives on a tevo tarantula pro on the x and y axes i didn’t change the belt or pulias but the x axis got smaller, can you solve this? the most amazing thing is that the y-axis is correct, I have already replaced the x-axis motors with the y-axis and the x-axis remains smaller no matter what I do, below is the code if you can help me I am extremely grateful
Default Axis Steps Per Unit (steps/mm)

  • Override with M92
  •                                  X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]]
    

*/ #define DEFAULT_AXIS_STEPS_PER_UNIT { 80.058, 80.058, 399.2901, 408 }

/**

  • Default Max Feed Rate (mm/s)
  • Override with M203
  •                                  X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]]
    

*/ #define DEFAULT_MAX_FEEDRATE { 400, 400, 50, 45 }

/**

  • Default Max Acceleration (change/s) change = mm/s
  • (Maximum start speed for accelerated moves)
  • Override with M201
  •                                  X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]]
    

*/ #define DEFAULT_MAX_ACCELERATION { 3000, 3000, 100, 10000 }

EduardoVillanova avatar Apr 12 '21 00:04 EduardoVillanova

Have a look for the post I put up on inaccuracies with the stepper

NZ-Nitro avatar Apr 12 '21 01:04 NZ-Nitro

What do the comments in this PR have to do with the actual PR? o_o

maxgerhardt avatar Apr 12 '21 08:04 maxgerhardt