Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building Maylan M200 with Marlin 2.0 and PlatformIO #11104

Closed
X7JAY7X opened this issue Jun 24, 2018 · 104 comments
Closed

Building Maylan M200 with Marlin 2.0 and PlatformIO #11104

X7JAY7X opened this issue Jun 24, 2018 · 104 comments

Comments

@X7JAY7X
Copy link

X7JAY7X commented Jun 24, 2018

When i try to use the maylan board in config.h, it throws an error "cannot find board id "maylanm200"

@xC0000005
Copy link
Contributor

Ok, so to build Marlin for the M200 you need a few more pieces:

From this repo:
https://github.com/xC0000005/M200Toolchain

You get the board .json files (which go in .platformio\platforms\ststm32\boards, and the variant definitions, which go in .platformio\packages\framework-arduinostm32\stm32f1\variants (if you don't see variants under STM32f1, it's probably directly under the arduinostm32 directory).

Alternately, you can build with STM32GENERIC by doing the following:
Clone from this repo and branch:
https://github.com/xC0000005/Marlin/tree/genericHal
Copy over the M200 configuration files you want to use.
Comment out Serial2 if it's enabled.
In your PlatformIO.ini section for the M200, set platform = https://github.com/xC0000005/platform-ststm32#M200Toolchain

Build as a appropriate. If you build from the generic tree above, it should have board definitions and variants included as it drags down the right builder and so on.

I haven't done PRs to merge these because:
A. I built the STM32GENERIC package that you're using if you set your platform=
B. I'm not 100% sure these are correct.
C. I'm still waiting for PIO support for ST's official arduino core, and then I'll likely migrate the variants and definitions to it.

That said, you should be able to build by doing so. If your end goal is to enable auto-bed leveling of some sort, there are some hacks you'll need to use to reduce the rom size - you only get 120k to play with after the bootloader and eeporm emulation eats 8k, so whatever you do needs to fit in 112k. It's doable by using dstring & removing the name demangler, or at least it was.

@X7JAY7X
Copy link
Author

X7JAY7X commented Jun 25, 2018

Thanks, I will try it tomorrow. After its built, how does it get on the M200? Does the M200 have a bootloader?

@xC0000005
Copy link
Contributor

xC0000005 commented Jun 25, 2018 via email

@X7JAY7X
Copy link
Author

X7JAY7X commented Jun 25, 2018

Hello,

It now sees the board but I am getting some build errors:

Compiling .pioenvs\malyanm200\src\src\HAL\HAL_LPC1768\arduino.cpp.o
In file included from Marlin\src\HAL\HAL_LPC1768\../../inc/MarlinConfig.h:28:0,
from Marlin\src\HAL\HAL_LPC1768\LPC1768_Servo.cpp:63:
Marlin\src\HAL\HAL_LPC1768\../../inc/../HAL/HAL_STM32F1/HAL.h:44:10: fatal error: Arduino.h: No such file or directory

Compiling .pioenvs\malyanm200\src\src\HAL\HAL_LPC1768\include\Wire.cpp.o
In file included from Marlin\src\HAL\HAL_LPC1768\../../inc/MarlinConfig.h:28:0,
from Marlin\src\HAL\HAL_LPC1768\SoftwareSPI.cpp:32:
Marlin\src\HAL\HAL_LPC1768\../../inc/../HAL/HAL_STM32F1/HAL.h:44:10: fatal error: Arduino.h: No such file or directory

@xC0000005
Copy link
Contributor

xC0000005 commented Jun 25, 2018 via email

@X7JAY7X
Copy link
Author

X7JAY7X commented Jun 25, 2018

[env:malyanm200]
platform = ststm32
framework = arduino
board = malyanM200
build_flags = !python Marlin/src/HAL/HAL_STM32F1/stm32f1_flag_script.py -DMCU_STM32F103CB -D STM32F1=1 -std=c++1y -D MOTHERBOARD="BOARD_MALYAN_M200" -DSERIAL_USB -ffunction-sections -fdata-sections -Wl,--gc-sections
src_filter = ${common.default_src_filter}
#-
lib_ignore =
U8glib
LiquidCrystal_I2C
LiquidCrystal
NewliquidCrystal
LiquidTWI2
Adafruit NeoPixel
TMC2130Stepper
Servo(STM32F1)
TMC26XStepper
U8glib-HAL
TMC2208Stepper
c1921b4

@xC0000005
Copy link
Contributor

It’s highly likely that PlatformIO has broken variants building once again. I’ll look at the PIO builder tonight, but my guess is that if they’ve done what they usually do, there’s some code that assumes that the variant will have the CPU in the name, and the LD script can be derived from that, and so on (instead of reading from the board’s json file like it used to).

Builder.zip

I've attached a zip with a couple of files that overwrite their counterparts under .platformio\platforms\ststm32\builder\frameworks\arduino\ (and one that goes in the subfolder maple, overwriting the F1 builder). It's also a hack but I needed the builder running again. Overwrite your builder files with the right versions from this zip and see if it doesn't come closer.

@X7JAY7X
Copy link
Author

X7JAY7X commented Jun 26, 2018

Alot of warnings but now there is only one error:

Compiling .pioenvs\malyanm200\src\src\HAL\HAL_STM32F4\HAL.cpp.o

Marlin\src\HAL\HAL_STM32F1\persistent_store_flash.cpp: In function 'void HAL::PersistentStore::read_data(int&, uint8_t*, uint16_t, uint16_t*, bool)':

Marlin\src\HAL\HAL_STM32F1\persistent_store_flash.cpp:96:6: error: ambiguating new declaration of 'void HAL::PersistentStore::read_data(int&, uint8_t*, uint16_t, uint16_t*, bool)'

@xC0000005
Copy link
Contributor

xC0000005 commented Jun 26, 2018 via email

@X7JAY7X
Copy link
Author

X7JAY7X commented Jun 26, 2018

That took care of that but now another popped up:

Marlin\src\module../inc/../HAL/HAL_STM32F1/HAL.h:126:24: error: '__disable_irq' was not declared in this scope

@xC0000005
Copy link
Contributor

xC0000005 commented Jun 26, 2018 via email

@X7JAY7X
Copy link
Author

X7JAY7X commented Jun 26, 2018

Ok, thanks a ton!

@xC0000005
Copy link
Contributor

xC0000005 commented Jun 26, 2018 via email

@X7JAY7X
Copy link
Author

X7JAY7X commented Jun 26, 2018

I didn't realize that I had an old copy of Marlin. I pulled the latest, made the changes to persistent_store_flash.cpp, and it now builds successfully. I will try to load it onto my M200 tonight. Thanks.

@fiveangle
Copy link
Contributor

#11120 submitted to add @xC0000005's board defines to the project.

Agreed that #10999 appears to have broken the Maylan M200 build:

...
arm-none-eabi-g++ -o .pioenvs/malyanm200/src/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.cpp.o -c -fno-rtti -fno-exceptions -std=gnu++11 -std=c++1y -g -Os -ffunction-sections -fdata-sections -Wall -mthumb -nostdlib -mcpu=cortex-m3 -Os -mcpu=cortex-m3 -mthumb -ffreestanding -fsigned-char -fno-move-loop-invariants -fno-strict-aliasing --specs=nano.specs --specs=nosys.specs -MMD -MP -ffunction-sections -fdata-sections --param max-inline-insns-single=500 -march=armv7-m -DF_CPU=72000000L -DMALYANM200 -DPLATFORMIO=30600 -DARDUINO_GENERIC_STM32F103C -DMCU_STM32F103CB -DTARGET_STM32F1 -DMCU_STM32F103CB -D__STM32F1__=1 -DMOTHERBOARD=BOARD_MALYAN_M200 -DSERIAL_USB -DARDUINO=10610 -DBOARD_malyanM200 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -DDEBUG_LEVEL=DEBUG_NONE -D__STM32F1__ -DARDUINO_ARCH_STM32F1 -DVECT_TAB_ADDR=134225920 -IMarlin -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/FreeRTOS -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/FreeRTOS/utility -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/EEPROM -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/STM32ADC/src -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/Wire -I.piolibdeps/U8glib-ARM_ID1691/src -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/SPI/src -I.piolibdeps/30aa480 -IMarlin/src/HAL -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/cores/maple -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/system/libmaple -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/system/libmaple/include -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/system/libmaple/usb/stm32f1 -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/system/libmaple/usb/usb_lib -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/variants/malyanM200 Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.cpp
In file included from Marlin/src/HAL/HAL_STM32F1/HAL.cpp:34:0:
Marlin/src/HAL/HAL_STM32F1/HAL.h:43:29: fatal error: libmaple/atomic.h: No such file or directory
#include <libmaple/atomic.h>
^
compilation terminated.
arm-none-eabi-g++ -o .pioenvs/malyanm200/src/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp.o -c -fno-rtti -fno-exceptions -std=gnu++11 -std=c++1y -g -Os -ffunction-sections -fdata-sections -Wall -mthumb -nostdlib -mcpu=cortex-m3 -Os -mcpu=cortex-m3 -mthumb -ffreestanding -fsigned-char -fno-move-loop-invariants -fno-strict-aliasing --specs=nano.specs --specs=nosys.specs -MMD -MP -ffunction-sections -fdata-sections --param max-inline-insns-single=500 -march=armv7-m -DF_CPU=72000000L -DMALYANM200 -DPLATFORMIO=30600 -DARDUINO_GENERIC_STM32F103C -DMCU_STM32F103CB -DTARGET_STM32F1 -DMCU_STM32F103CB -D__STM32F1__=1 -DMOTHERBOARD=BOARD_MALYAN_M200 -DSERIAL_USB -DARDUINO=10610 -DBOARD_malyanM200 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -DDEBUG_LEVEL=DEBUG_NONE -D__STM32F1__ -DARDUINO_ARCH_STM32F1 -DVECT_TAB_ADDR=134225920 -IMarlin -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/FreeRTOS -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/FreeRTOS/utility -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/EEPROM -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/STM32ADC/src -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/Wire -I.piolibdeps/U8glib-ARM_ID1691/src -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/SPI/src -I.piolibdeps/30aa480 -IMarlin/src/HAL -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/cores/maple -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/system/libmaple -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/system/libmaple/include -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/system/libmaple/usb/stm32f1 -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/system/libmaple/usb/usb_lib -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/variants/malyanM200 Marlin/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp
In file included from Marlin/src/HAL/HAL_STM32F1/../../inc/MarlinConfig.h:28:0,
from Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.cpp:26:
Marlin/src/HAL/HAL_STM32F1/../../inc/../HAL/HAL_STM32F1/HAL.h:43:29: fatal error: libmaple/atomic.h: No such file or directory
#include <libmaple/atomic.h>
^
compilation terminated.
arm-none-eabi-g++ -o .pioenvs/malyanm200/src/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp.o -c -fno-rtti -fno-exceptions -std=gnu++11 -std=c++1y -g -Os -ffunction-sections -fdata-sections -Wall -mthumb -nostdlib -mcpu=cortex-m3 -Os -mcpu=cortex-m3 -mthumb -ffreestanding -fsigned-char -fno-move-loop-invariants -fno-strict-aliasing --specs=nano.specs --specs=nosys.specs -MMD -MP -ffunction-sections -fdata-sections --param max-inline-insns-single=500 -march=armv7-m -DF_CPU=72000000L -DMALYANM200 -DPLATFORMIO=30600 -DARDUINO_GENERIC_STM32F103C -DMCU_STM32F103CB -DTARGET_STM32F1 -DMCU_STM32F103CB -D__STM32F1__=1 -DMOTHERBOARD=BOARD_MALYAN_M200 -DSERIAL_USB -DARDUINO=10610 -DBOARD_malyanM200 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -DDEBUG_LEVEL=DEBUG_NONE -D__STM32F1__ -DARDUINO_ARCH_STM32F1 -DVECT_TAB_ADDR=134225920 -IMarlin -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/FreeRTOS -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/FreeRTOS/utility -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/EEPROM -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/STM32ADC/src -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/Wire -I.piolibdeps/U8glib-ARM_ID1691/src -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/SPI/src -I.piolibdeps/30aa480 -IMarlin/src/HAL -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/cores/maple -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/system/libmaple -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/system/libmaple/include -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/system/libmaple/usb/stm32f1 -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/system/libmaple/usb/usb_lib -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/variants/malyanM200 Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp
In file included from Marlin/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp:39:0:
Marlin/src/HAL/HAL_STM32F1/HAL.h:43:29: fatal error: libmaple/atomic.h: No such file or directory
#include <libmaple/atomic.h>
^
compilation terminated.
arm-none-eabi-g++ -o .pioenvs/malyanm200/src/src/HAL/HAL_STM32F1/persistent_store_flash.cpp.o -c -fno-rtti -fno-exceptions -std=gnu++11 -std=c++1y -g -Os -ffunction-sections -fdata-sections -Wall -mthumb -nostdlib -mcpu=cortex-m3 -Os -mcpu=cortex-m3 -mthumb -ffreestanding -fsigned-char -fno-move-loop-invariants -fno-strict-aliasing --specs=nano.specs --specs=nosys.specs -MMD -MP -ffunction-sections -fdata-sections --param max-inline-insns-single=500 -march=armv7-m -DF_CPU=72000000L -DMALYANM200 -DPLATFORMIO=30600 -DARDUINO_GENERIC_STM32F103C -DMCU_STM32F103CB -DTARGET_STM32F1 -DMCU_STM32F103CB -D__STM32F1__=1 -DMOTHERBOARD=BOARD_MALYAN_M200 -DSERIAL_USB -DARDUINO=10610 -DBOARD_malyanM200 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -DDEBUG_LEVEL=DEBUG_NONE -D__STM32F1__ -DARDUINO_ARCH_STM32F1 -DVECT_TAB_ADDR=134225920 -IMarlin -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/FreeRTOS -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/FreeRTOS/utility -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/EEPROM -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/STM32ADC/src -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/Wire -I.piolibdeps/U8glib-ARM_ID1691/src -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/libraries/SPI/src -I.piolibdeps/30aa480 -IMarlin/src/HAL -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/cores/maple -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/system/libmaple -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/system/libmaple/include -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/system/libmaple/usb/stm32f1 -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/system/libmaple/usb/usb_lib -I/Users/speedster/.platformio/packages/framework-arduinoststm32/STM32F1/variants/malyanM200 Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp
In file included from Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp:33:0:
Marlin/src/HAL/HAL_STM32F1/HAL.h:43:29: fatal error: libmaple/atomic.h: No such file or directory
#include <libmaple/atomic.h>
^
compilation terminated.
*** [.pioenvs/malyanm200/src/src/HAL/HAL_STM32F1/HAL.cpp.o] Error 1
*** [.pioenvs/malyanm200/src/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.cpp.o] Error 1
*** [.pioenvs/malyanm200/src/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp.o] Error 1
*** [.pioenvs/malyanm200/src/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp.o] Error 1
In file included from Marlin/src/HAL/HAL_STM32F1/../../inc/MarlinConfig.h:28:0,
from Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp:32:
Marlin/src/HAL/HAL_STM32F1/../../inc/../HAL/HAL_STM32F1/HAL.h:43:29: fatal error: libmaple/atomic.h: No such file or directory
#include <libmaple/atomic.h>
^
compilation terminated.
*** [.pioenvs/malyanm200/src/src/HAL/HAL_STM32F1/persistent_store_flash.cpp.o] Error 1
========================== [ERROR] Took 4.49 seconds ==========================

@xC0000005
Copy link
Contributor

This is more likely to be PIO screwing up variant builds again. There's a rework in progress of the builders and they make some bad assumptions about how to find variant directories, names, include builders, set linker scripts, vector tables, and a few other things.

@xC0000005
Copy link
Contributor

Ah, I believe I've figured it out. In the board.json file, it's now required to have a .variant property under the build section which matches the CPU variant:
Currently, it's
"variant": "malyanM200",
But PIO's newest builder expects:
"variant": "stm32f103cb" to invoke the STM32F1 builder.
It could be that this is an error, and the intent is actually to switch on build.mcu_type, but that change alone would not fix the problem with stm32F1.py, which doesn't handle variants with specific names, ld scripts, and so on.

@X7JAY7X
Copy link
Author

X7JAY7X commented Jun 27, 2018

Thanks again for all your help. Much appreciated. I loaded the firmware. Everything works but the fan control. Do have to change something somewhere?

@xC0000005
Copy link
Contributor

xC0000005 commented Jun 27, 2018 via email

@X7JAY7X
Copy link
Author

X7JAY7X commented Jun 27, 2018

It does not. It was working with the original firmware right before I loaded Marlin. I will check the hardware tomorrow and see if its trying to turn the fan on. Maybe something happened to my board or fan but doubtful.

Also, can I disable the auto and have GCode control? I have a hardwired hotend cooling fan to 12v and I also have a layer fan on the mainboard fan plug. I want the layer fan to be controllable through Gcode.

@xC0000005
Copy link
Contributor

xC0000005 commented Jun 27, 2018 via email

@X7JAY7X
Copy link
Author

X7JAY7X commented Jun 27, 2018

So here was the problem. #define E0_AUTO_FAN_PIN -1. I didn't start with your config apparently.
I changed the Maylan pin.h. It turns on and off with GCode now but PWM isnt working. Its either 0 or 100% no matter what speed I try to set it to (ex M106 P0 S125 - 50%).

@X7JAY7X
Copy link
Author

X7JAY7X commented Jun 27, 2018

#ifndef FAN_PIN
  #define FAN_PIN        PB8   // FAN1 header on board - PRINT FAN
#endif
#define FAN1_PIN           PB3   // FAN2 header on board - CONTROLLER FAN
#define FAN2_PIN           -1    // FAN3 header on board - EXTRUDER0 FAN

@xC0000005
Copy link
Contributor

xC0000005 commented Jun 27, 2018 via email

@xC0000005
Copy link
Contributor

xC0000005 commented Jun 27, 2018 via email

@X7JAY7X
Copy link
Author

X7JAY7X commented Jun 27, 2018

Trying this now. Is your config in the examples folder? If not, can you send it to me? I want to compare settings. Thanks

@xC0000005
Copy link
Contributor

xC0000005 commented Jun 27, 2018 via email

@X7JAY7X
Copy link
Author

X7JAY7X commented Jun 27, 2018

Thanks, that worked for PWM. I never had to change any of that before. Wondering what config files I started with.

@xC0000005
Copy link
Contributor

xC0000005 commented Jun 27, 2018 via email

@jannau
Copy link

jannau commented Aug 22, 2018

@thinkyhead I did modify ststm32 4.4.0 in .platformio as described here. It compiles and links successfully but I'm not convinced it produces working binaries.

@xC0000005
Copy link
Contributor

@jannau , if you want to mail your firmware.bin file to me (git hub handle AT gmail dot com) I'll load it on to my printer and test. I have most revisions of the malyan mainboards (except the M100 one).

@jannau
Copy link

jannau commented Aug 22, 2018

@xC0000005 thanks, email sent. sha256sum: 2168e3a87516b65da3b101fe9e9e0bbf73f4325d16dbd6dca1e6d8785048a425 jannau_2018-08-22_malyanm200_firmware.bin

@thinkyhead
Copy link
Member

I'm looking for a solution that doesn't involve modifying the platform files.

@xC0000005
Copy link
Contributor

xC0000005 commented Aug 22, 2018 via email

@xC0000005
Copy link
Contributor

xC0000005 commented Aug 24, 2018 via email

@jannau
Copy link

jannau commented Aug 24, 2018

Thanks for the test. No idea what happened with configuration.h and configuration_adv.h. They should be correct ones. The Marlin configuration should be unrelated the problems I see. So there seems to be a difference between the M100 and M200 which currently prevents the same firmware image from running.

@vsavic
Copy link

vsavic commented Aug 24, 2018

Just wanted to share one more info about what I had to do in order to build this Marlin 2.0 version, and how to fix this error:

error: 'F_CPU' was not declared in this #scope

So in STSTM32\builder\main.py there's been some changes.

When I used this version, I managed to build it for M200. Here's how the file looked before these changes.

My guess is that maybe most of you who managed to compile this version without additional modifications had this STSTM32 installed earlier, and you didn't update it maybe for some time.

@Injineers
Copy link

hmm......

im at a loss, theres alot of threads pointed all around on how to fix this, but I cant seem to get it working

I am getting this
fatal error: libmaple/atomic.h

I tried updating it to the other location 'util/latomic.h

but got an error that it did not exist

I then DL'd xC0000005 builder.zip & replaced the files & still got fata error on 'util/latomic.h I then swtich the Hal.h back to libmaple/atomic.h but am still getting that it doesnt exists

@vsavic
Copy link

vsavic commented Sep 6, 2018

Did you made a typo here maybe: util/latomic.h vs util/atomic.h ?

@Injineers
Copy link

Injineers commented Sep 6, 2018

nah still same issue after removing the l before atomic

#Click to see Pio Error
Processing malyanm200 (platform: https://github.com/xC0000005/platform-ststm32#M200Toolchain; board: malyanM200; framework: arduino)
 
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 > Malyan STM32F103CB (20k RAM. 128k Flash)
SYSTEM: STM32F103CB 72MHz 20KB RAM (128KB Flash)
DEBUG: CURRENT(stlink-v2) EXTERNAL(blackmagic, stlink, stlink-v2, stlink-v2-1)

Converting Marlin.ino
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 3 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Arduino-L6470> 0.6.2
|-- <30aa480>
Compiling .pioenvs\malyanm200\src\src\HAL\HAL_STM32F1\HAL.cpp.o
Compiling .pioenvs\malyanm200\src\src\HAL\HAL_STM32F1\HAL_Servo_Stm32f1.cpp.o
Compiling .pioenvs\malyanm200\src\src\HAL\HAL_STM32F1\HAL_spi_Stm32f1.cpp.o
Compiling .pioenvs\malyanm200\src\src\HAL\HAL_STM32F1\HAL_timers_Stm32f1.cpp.o
Compiling .pioenvs\malyanm200\src\src\HAL\HAL_STM32F1\persistent_store_flash.cpp.o
Compiling .pioenvs\malyanm200\src\src\HAL\HAL_STM32F1\persistent_store_impl.cpp.o
Compiling .pioenvs\malyanm200\src\src\HAL\HAL_STM32F1\persistent_store_sdcard.cpp.o
In file included from Marlin\src\HAL\HAL_STM32F1\HAL.cpp:34:0:
Marlin\src\HAL\HAL_STM32F1\HAL.h:43:10: fatal error: util/atomic.h: No such file or directory

@vsavic
Copy link

vsavic commented Sep 6, 2018

If you are on windows, try also to remove this: C:\Users\replace.this.with.your.user\.platformio\packages\framework-arduinoststm32 and run a build again after you changed builder in platforms.

EDIT
And after that check here to see if you have util folder with atomio.h file in it or it's in libmaple:
C:\Users\**your.user**\.platformio\packages\framework-arduinoststm32\STM32F1\system\libmaple\include\

@Injineers
Copy link

Still the same.

I think I am going to purge everything & start over

@jnoxon
Copy link

jnoxon commented Sep 29, 2018

This thread is amazing. An hour ago I had never heard of PlatformIO and I now have an M200 build from the 2.x branch. It's getting late but I am definitely going to try it out tomorrow!

@jnoxon
Copy link

jnoxon commented Sep 29, 2018

Apparently my ability to get it to build does not extend to getting it to work on the printer. Something gets flashed (no version is displayed) and then the motion controller is dead afterward. I was able to recover with the v29 Malyan firmware, and tried flashing it again, and got the same result. I used the STM32f1 variant. Any suggestions would be greatly appreciated!

@xC0000005
Copy link
Contributor

xC0000005 commented Sep 29, 2018 via email

@jnoxon
Copy link

jnoxon commented Sep 30, 2018

@xC0000005 I have to admit I forgot to do that 🤦‍♂️, so I tried a clean build with the right configs and looked at the binary through strings and it seems okay, but the machine is not acting any differently.

@xC0000005
Copy link
Contributor

xC0000005 commented Sep 30, 2018 via email

@jnoxon
Copy link

jnoxon commented Sep 30, 2018

It doesn't appear in USB. With the stock firmware I see this:

Bus 020 Device 020: ID 2974:0503 2974 Malyan 3D Printer Port Serial: 6D8721A9xxxx

It might also be worth mentioning that something is making buzzing noises (steppers?) that completely goes away once the stock firmware boots.

@xC0000005
Copy link
Contributor

xC0000005 commented Sep 30, 2018 via email

@Alfrederson
Copy link

Alfrederson commented Feb 4, 2019

It doesn't appear in USB. With the stock firmware I see this:

Bus 020 Device 020: ID 2974:0503 2974 Malyan 3D Printer Port Serial: 6D8721A9xxxx

It might also be worth mentioning that something is making buzzing noises (steppers?) that completely goes away once the stock firmware boots.

I could get it to compile right away selecting the STM32F1 environment, but since the MCU is different (STM32F103RE) the board will do nothing even if it can be flashed with it. If I change the MCU to STM32F103C8, then I get the same errors @fiveangle had and can't get it to compile.

@Injineers
Copy link

This is still broken

I purged everything, used latest stm from platformio (since not it seems to include the malyanm200) atomic.h error again.

I then removed the latest stm & installed 4.5 same issue.

I then went back to this thread & grabbed the builder files, variants, etc...still errors.

anyone have any idea? or is it possible we can get a updated file structure for those who may be installing atom & platformio new & using the latest

@kajsilander78
Copy link

kajsilander78 commented Mar 7, 2019

This is still broken

I purged everything, used latest stm from platformio (since not it seems to include the malyanm200) atomic.h error again.

I then removed the latest stm & installed 4.5 same issue.

I then went back to this thread & grabbed the builder files, variants, etc...still errors.

anyone have any idea? or is it possible we can get a updated file structure for those who may be installing atom & platformio new & using the latest

Try building with stm32duino 1.5 in arduino IDE, if you know how to. I have not tried it myself yet. Tried with early versions and got it to compile, but had some issues with x&y movement, z worked fine but moved wrong direction. Will test again when I get the time.... If any success I'll update...

Here is a guide to start with:

  1. https://github.com/stm32duino/wiki/wiki/Getting-Started
    In arduino IDE:
  2. Choose Tools/Board/3D printer boards
  3. Choose Tools/Board/Board Part Nr/Malyan M200 v1 or v2
  4. .........

@xC0000005
Copy link
Contributor

xC0000005 commented Mar 7, 2019 via email

@thinkyhead
Copy link
Member

@xC0000005 — I want to add a README.md for the M200 giving instructions on the build. Is Arduino IDE still the best option? If so, then I can just itemize the steps for Arduino. But if you have steps that work with the current PlatformIO platforms, I can add those instructions too. And, if the steps are not too complicated, then we may be able to add them to the Python build script to automate the process.

@github-actions
Copy link

github-actions bot commented Jul 5, 2020

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants