MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.27k stars 19.23k forks source link

Unable to compile chitu_f103_maple code using the documented configuration. #25926

Closed phucly01 closed 1 year ago

phucly01 commented 1 year ago

Did you test the latest bugfix-2.1.x code?

Yes, and the problem still exists.

Bug Description

Ok so this is my second time here and I messed up the first time so please bear with me. Just for a bit of a background. I attempted to compile a baseline for my tronxy x5sa pro so I have a working code to work with. Ultimately I am trying to add code to compensate the inaccuracy of the prints. So far I already tried two repositories that generate firmware for the printer I have, supposedly. Yet, they both didn't compile. So My attempt is to use this code to make the firmware.
I followed the instruction here: https://github.com/MarlinFirmware/Configurations/blob/release-2.0.9.3/config/examples/Tronxy/X5SA/HOWTO-INSTALL.md to set the configuration. How ever it yield the compilation error.
I don't think it is the error from the code. I think it is more likely the platformio issue. I hope some senior members can point me to the right direction.

Additional info: VSCode: 1.87.2 Platformio: 6.1.7

This is the error: Processing chitu_f103_maple (board: marlin_maple_CHITU_F103; platform: ststm32@~12.1; framework: arduino)

Verbose mode can be enabled via -v, --verbose option CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/marlin_maple_CHITU_F103.html PLATFORM: ST STM32 (12.1.1) > CHITU STM32F103Z (64k RAM. 512k Flash) HARDWARE: STM32F103ZET6 72MHz, 59.12KB RAM, 469.03KB Flash DEBUG: Current (blackmagic) External (blackmagic, jlink, stlink) PACKAGES:

Environment Status Duration


chitu_f103_maple FAILED 00:00:12.248 ================================================================================ 1 failed, 0 succeeded in 00:00:12.248 ================================================================================

Bug Timeline

Not sure, I am a newbie

Expected behavior

No response

Actual behavior

No response

Steps to Reproduce

Install the latest VSCode Download/extract this repository Open it in VSCode (also tried in administrator mode) VSCode downloaded required plugins Change the configuration according to https://github.com/MarlinFirmware/Configurations/blob/release-2.0.9.3/config/examples/Tronxy/X5SA/HOWTO-INSTALL.md for the x5sa pro: {

define MOTHERBOARD BOARD_CHITU3D_V6

// The size of the printable area

define X_BED_SIZE 330

define Y_BED_SIZE 330

define Z_MAX_POS 400

define X_DRIVER_TYPE TMC2208_STANDALONE

define Y_DRIVER_TYPE TMC2208_STANDALONE

define Z_DRIVER_TYPE TMC2208_STANDALONE

define E0_DRIVER_TYPE TMC2208_STANDALONE

define DEFAULT_AXIS_STEPS_PER_UNIT { 160, 160, 800, 764 }

// Extruder seems inverted on titan!

define INVERT_E0_DIR true

} Click on build.

Version of Marlin Firmware

Tronxy x5sa pro V1.32

Printer model

Tronxy x5sa pro

Electronics

No response

Add-ons

No response

Bed Leveling

None

Your Slicer

None

Host Software

None

Don't forget to include

Additional information & file uploads

Configuration.zip

ellensp commented 1 year ago

That read me is not a full list of changes, just the highlights

Look at the example config provided

define SERIAL_PORT 1

define SERIAL_PORT_2 3

you have SERIAL_PORT 0

which is why you getting the error

error: static assertion failed: SERIAL_PORT must be from 1 to 5. You can also use -1 if the board supports Native USB.

GMagician commented 1 year ago

OT: I see that STRINGIFY is not working in assert

ellensp commented 1 year ago

@GMagician it does but the assert is printed as well as the error line

Marlin\src\HAL\STM32F1../../inc/../HAL/../HAL/STM32F1/HAL.h:97:3: error: static assertion failed: SERIAL_PORT must be from 1 to 5. You can also use -1 if the board supports Native USB.

and

static_assert(false, "SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")

GMagician commented 1 year ago

ops missed first!

phucly01 commented 1 year ago

Thank you Ellensp and GMagician I got it compiled now but the printer doesn't recognize the cbd. I am trying to figure out how to set the platformio to keep the bin file to try it out. It looks like platformio removed the bin file after encrypting it.

phucly01 commented 1 year ago

Thank you Ellensp and GMagician I got it compiled now but the printer doesn't recognize the cbd. I am trying to figure out how to set the platformio to keep the bin file to try it out. It looks like platformio removed the bin file after encrypting it.

I tried the bin file and it still didn't update. I am trying to update the tronxy's official firmware to this firmware. Is it doable or I have to do something in between like some sort of conversion?

phucly01 commented 1 year ago

I managed to put the bin file in using the STM32CubeProgrammer. However, the screen is black. Am I missing something in the configuration?

EvilGremlin commented 1 year ago

Both boot and marlin, with correct addresses?

phucly01 commented 1 year ago

I am not sure what you mean by boot and marlin.
I compiled the code and flashed the firmware.bin with STM32CubeProgrammer at 0x08000000

EvilGremlin commented 1 year ago

This won't work, env expect bootloader board_build.address = 0x0800A000 you have to change that to 0x08000000 (or just delete line) I'm blind apparently

phucly01 commented 1 year ago

Can you elaborate this a bit. I just started this two days ago. I am using the chitu_f103 env and made some changes in the configuration.h to meet the tronxy x5sa pro settings. Am I supposed to make the bootloader and the firmware.bin and flash them both?

EvilGremlin commented 1 year ago

Ok, i'm not so blind in the end... it's a mess, chitu_f103_maple env expect bootloader (thus encrypt bin) but missing board_build.offset Delete buildroot/share/PlatformIO/scripts/chitu_crypt.py fron env and it should work But better use chitu_f103 env and also delete board_build.crypt_chitu board_build.offset and extra_scripts

phucly01 commented 1 year ago

chitu_f103_maple didn't compile. I have been using chitu_f103. I also did what you recommended but the screen does not turn on so I have no idea if the firmware even run. The download seems to gone through fine.

I think the bootloader is gone. Is there an instruction to build bootloader for this printer?

EvilGremlin commented 1 year ago

Download is always fine, it will flash absolutely whatever, there are no checks. Yep, boot is gone because you flashed with no offset. You'll have to find some opensource boot, configure and build for this board (not easy). Or find somewhere dump of stock one, which i cant google up. Eh, good riddance i say :) How you env look like now?

phucly01 commented 1 year ago

How do you put the offset? in the programmer or in the compilation?
In STM32CubeProgrammer, each time I open the bin file and set to 0x08000000 it says address out of range. There is no option to tell it to start at 0x08000000

in stm32f1.ini:

#
# Chitu boards like Tronxy X5s (STM32F103ZET6)
#
[env:chitu_f103]
extends              = stm32_variant
board                = genericSTM32F103ZE
#board_build.crypt_chitu = update.cbd
board_build.variant  = MARLIN_F103Zx
#board_build.offset   = 0x8800
build_flags          = ${stm32_variant.build_flags}
                       -DSTM32F1xx
build_unflags        = ${stm32_variant.build_unflags}
#extra_scripts        = ${stm32_variant.extra_scripts}
#                       buildroot/share/PlatformIO/scripts/chitu_crypt.py

platformio.ini:

[platformio]
src_dir      = Marlin
boards_dir   = buildroot/share/PlatformIO/boards
default_envs = chitu_f103
include_dir  = Marlin
extra_configs =
    Marlin/config.ini
    ini/avr.ini
    ini/due.ini
    ini/esp32.ini
    ini/features.ini
    ini/lpc176x.ini
    ini/native.ini
    ini/samd21.ini
    ini/samd51.ini
    ini/stm32-common.ini
    ini/stm32f0.ini
    ini/stm32f1-maple.ini
    ini/stm32f1.ini
    ini/stm32f4.ini
    ini/stm32f7.ini
    ini/stm32h7.ini
    ini/stm32g0.ini
    ini/teensy.ini
    ini/renamed.ini

Configuration.zip

EvilGremlin commented 1 year ago

Bboth or neither i guess? 0x08000000 is flash start, no offset. I don't use cube though, so no idea if it checks anything

EvilGremlin commented 1 year ago

this is unreadable, use code brackets ( triple ``` )

EvilGremlin commented 1 year ago

looks right, should work if it can at all

phucly01 commented 1 year ago

So I think the problem is the programmer didn't write to the correct offset. Will setting this line force the offset? board_build.offset = 0x08000000 What program do you use that can tell the it the offset?

EvilGremlin commented 1 year ago

Nope, without bootloader you don't set any offsets anywhere. just open bin and flash

phucly01 commented 1 year ago

so the bin file must have the bootloader prepended?

I have the bootloader from tronxy

EvilGremlin commented 1 year ago

no

phucly01 commented 1 year ago

I have the bootloader. What do I do to get this to work?

EvilGremlin commented 1 year ago

Forget about bootloader for now, just build like this and flash, don't touch any address settings in cube.

[env:chitu_f103]
extends              = stm32_variant
board                = genericSTM32F103ZE
#board_build.crypt_chitu = update.cbd
board_build.variant  = MARLIN_F103Zx
#board_build.offset   = 0x8800
build_flags          = ${stm32_variant.build_flags}
                       -DSTM32F1xx
build_unflags        = ${stm32_variant.build_unflags}
#extra_scripts        = ${stm32_variant.extra_scripts}
#                       buildroot/share/PlatformIO/scripts/chitu_crypt.py
phucly01 commented 1 year ago

I did that, it didn't work

EvilGremlin commented 1 year ago

Then it doesn't work at all now, so flash back boot and then flash stock firmware from SD

phucly01 commented 1 year ago

Yup I did that, back to ground 0 now. So, if I understand your correctly, this code set isn't working for my printer.

EvilGremlin commented 1 year ago

Seems like it. Of course you might be omitting some crucial thing that breaks everything as is often the case, only so much can be guessed remotely

phucly01 commented 1 year ago

Yeah,maybe I missed something but I won't know. I did everything from the document for the my printer. Thanks for your help.

github-actions[bot] commented 1 year ago

This issue has had no activity in the last 60 days. Please add a reply if you want to keep this issue active, otherwise it will be automatically closed within 10 days.

github-actions[bot] commented 1 year ago

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.