2021-11-05 04:48 AM
I have written an open source 3D Printer firmware for Arduino Mega - RAMPS 1.6 board which i have uploaded to github: https://github.com/3DHexfw/3DHex
Now i am trying to port the code to Creality v4.2.7 board (STM32F103RE on board). To do so i have downloaded SMT32Cube in order to initilize the peripherals, write and build the code.
Creality v4.2.7 board comes with pre-installed bootloader so the firmware.bin(compiled) can be uploaded directly from micro-SD card without the need of external programmer.
My first attempt was just to set HIGH one of the output pins, code on github: https://github.com/3DHexfw/3DHex/blob/master/MCU/Creality/Creality_v4.2.7_Silent/Core/Src/main.c
The steps i followed:
For the time being i cannot make it to work.
Do i have to edit the linker file for the STM32 project, so that it doesn't try to use the flash memory space used by the bootloader? I am not sure how to do it and what is the offset.
Any suggestions?
Notes:
2021-11-05 05:06 AM
You likely want to inspect the boot loader source or binary to determine an origin for the application code, and expectations about signing or checksumming.
Generally one would need to advance the base of flash in the linker script and make sure the vector table address matches in SystemInit().
2021-11-05 06:03 PM
Thank you very much for your comment, i used the same starting address as the marlin fw and seems to work: https://github.com/MarlinFirmware/Marlin/blob/2.0.x/buildroot/share/PlatformIO/ldscripts/creality.ld
Maybe i will create a new loop for my next issue but if you could take a quick look here: https://github.com/3DHexfw/3DHex/blob/master/MCU/Creality/Creality_v4.2.7_Silent/Core/Src/main.c
I am trying to send data over USB. The MCU "talks" via USART1 to a serial to usb converter (ch340g). I have also added __HAL_UART_ENABLE(&huart1); but with no luck so far.
Any advice? Thank you in advance!