Notifications
Clear all

Compiling Source for the MK4S  

  RSS
Audioguy140
(@audioguy140)
Member
Compiling Source for the MK4S

Hello All,

I was wondering if anyone here has tried compiling the source for the MK4S? As I understand it, the MK4S is the MK4 with some updates. Before I go and "break the apendix" (break appendix doc) I would like to confirm the MK4 option is the option to pick for the MK4S, when building the Buddy Board firmware from Source.  My overall goal is to customize the LED color/s on the GUI display assembly. Any feedback from other users experience when building source would be appreciated. 

This topic was modified 4 months temu by Audioguy140
Opublikowany : 25/08/2024 1:57 pm
Audioguy140
(@audioguy140)
Member
Topic starter answered:
RE:

Hello All,

I wanted to provide an update on my progress:

I was able to build the MK4 firmware using VScode on a raspberry pi5 as it is the only linux box I have lying around. I wouldn’t recommend tying to build on another platform. Most linux distros have all the tools needed to build by default. It appears that windows and mac need to run some extra scripts/downloads etc to build the code.

Once I had the code built, I loaded one of the bff files onto a USB stick.

SIDE NOTE: Ktpanda has done some nice work documenting the output of the builds in another forum:

https://forum.prusa3d.com/forum/english-forum-original-prusa-i3-mk4-hardware-firmware-and-software-help/custom-firmware-installation-on-mk4-_boot-bbf-or-_noboot-bbf/

“mk4_release_noboot.bbf is for running the firmware straight on the processor, without a bootloader present. I don't think this is useful to many users unless you have your own custom board.

mk4_release_boot.bbf is for running the firmware from the bootloader, and contains a bootloader image which will be flashed alongside it. The image is not built from the Prusa-Buddy-Firmware repo and is just a binary blob downloaded from Prusa's Amazon S3 bucket.

mk4_release_emptyboot.bbf is also for running the firmware from the bootloader, but does not contain the bootloader image. This is the one that ended up working for me. It is not built by default -- you have to pass --bootloader empty to build.py to get it.”

I followed the directions in this post to use a custom build on the Buddy board:

https://help.prusa3d.com/article/flashing-custom-firmware-mini_14

I proceeded to update my printer using the USB stick and received a “red screen” with an error code on it. ERROR 13612:

https://help.prusa3d.com/article/no-fw-in-internal-flash-26612-mk4s-13612-mk4-21612-mk3-9-23612-mk3-5_401149

I didn’t know what this meant at the time, and I didn’t bother to look at the link, so I proceeded to solder a debug header onto my Prusa buddy board and use the ST tools to erase the flash on the microcontroller:

https://www.st.com/en/development-tools/stm32cubeprog.html

https://www.st.com/en/development-tools/st-link-v2.html

 

I tried to flash the some of the bin files that were produced by my build, but nothing seemed to work. I was able to get a white bar on the screen with one of the bin files, but that was as much progress as I was able to achieve. Having written some bootloaders myself I understood that the bootloader sits in low flash and the application sits above the bootloader on the ST processor so I decided to try and find the OEM bootloader as my machine was essentially “bricked”. I was able to download the bootloader from the s3 bucket ktpanda was speaking of in their post. Looking in the source files there is a file called bootstap.py that fetches certain assets during the build:

Prusa-Firmware-Buddy-6.1.2 -> util -> bootstrap.py -> 'bootloader-mk4'

The path to a zip file is listed in the source.

Using the ST tools listed above I was able to reflash the OEM bootloader and update my machine to the official released 6.1.2 version of firmware.

I will continue to document my experience and progress in building the code from source. The debug port is shown in the picture attached and circled in red.Debug Port

 

 

 

 

This post was modified 4 months temu by Audioguy140
Opublikowany : 26/08/2024 12:15 pm
Oregun polubić
Audioguy140
(@audioguy140)
Member
Topic starter answered:
RE: Compiling Source for the MK4S

Hello All,

 An update on compiling source. This afternoon I was able to compile the source code and modify the LED color as I intended to do at the beginning of this task.

My first step was to use the ST tools noted above to backup a .bin file currently running on the STM32 processor. This would allow me to quickly recover the printer should I brick the unit again as I did before.

As noted above I used a Raspberry pi 5 with VScode installed to clone the Prusa-Firmware-Buddy repo. Once successfully built, several files are generated in the “build->products” folder in the file tree of the project. The file that I used to update my printer was mk4_release_boot.bbf.

The command I used to build is below. The options are documented in the README.md file of the repo:

python utils/build.py --preset mk4 --build-type release --generate-bbf

When building make sure you have the latest “tag” checked out. I was targeting v6.1.2 as it was recently released. I appreciate Prusa’a commitment to open-source information and love my new MK4S.When loading the "custom" firmware, I used the standard USB method documented throughout Prusa's help guides.

 I hope this thread helps others in the future.

Opublikowany : 26/08/2024 10:19 pm
Oregun polubić
Share: