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

Bugfix jg aurora a1 #27622

Merged

Conversation

itiserik
Copy link
Contributor

@itiserik itiserik commented Jan 5, 2025

Description

The currently available jg aurora firmware (https://firmware.jgmakerwiki.com/) is a little outdated.
So I tried to update my printer to the latest marlinfw but I immediately ran into problems.
I got a hard fault exception on application startup and it took me many hours of bootloader reversing before I found out that the bootloader SysTick interrupt was firing during application run. This causes two major issues: 1) In the non-maple build on of the first RAM locations store GPIO bases addresses and those get incremented by the bootloader interrupt. 2) The bootloader stores 3 function poiners in RAM and calls them periodically from the SysTick interrupt. When this happens after datainit or .bsszero, the bootloader attempts to execute an invalid instruction and this leads to the hard fault exception.

The fix is to disable the SysTick interrupt before memory initialization.
I also found two other minor improvements to achive a working printer with equal functionality as with the old firmware.

Requirements

jg aurora a1

Benefits

Fix hard fault exception on startup.
Fix GPIOA base reference in RAM (allows normal control of heaters and fan).
Compile without USB support, since this printer does not use the STM32 USB port.
Enable with FLASH_EEPROM_EMULATION, in order to allow operation without a SD card inserted.

Configurations

jg aurora a1

Related Issues

N/A

The SysTick interrupt was enabled by the jgaurora bootloader and stays enabled when it has jumped to the application. This causes issues because the interrupt handling routine increments specific RAM locations.
When compiling the jgaurora A1 with a non-maple configuration this causes problems because this specific memory location is reused for GPIOA_BASE. Effectively it becomes unable to use GPIOA.
Another side effect is that the bootloader also puts some function pointers in RAM and will periodically call those functions. When this happens after datainit or zerobss (with enough memory to init/zero) it will result in a hard fault exception.
As JG aurora has no direct USB connection on the board. The USB stack can be disabled to save RAM and flash.
In order to use the JG aurora A1 without a SD card inserted FLASH_EEPROM_EMULATION needs to be enabled.
@thinkyhead
Copy link
Member

Thanks for the assist. We don't always get the most complete support based on vendor forks, but we try!

@thinkyhead thinkyhead merged commit d57feea into MarlinFirmware:bugfix-2.1.x Jan 8, 2025
65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants