Marlin/src/HAL/HC32/README.md
This document provides notes on the HAL for the HC32F460 MCU.
The HC32F460 HAL is designed to be generic enough for any HC32F460-based board. Adding support for a new HC32F460-based board will require the following steps:
boards.h and pins.h, etc.)hc32.ini.)HC32F460C_common base env for 256K, or HC32F460E_common for 512K.board_upload.offset_address to the app start address once you've found it. If your board doesn't use a bootloader, you may be able to use the "ICSP" header or DFU. This document will be updated once we have more information about flashing without a bootloader.If the board contains a bootloader you'll need to find the application address. This is the address the bootloader jumps to after it's done. You can find this address in a few different ways:
If you're lucky, the bootloader may print the app start address on the serial output during boot. To check for this, use your favorite serial monitor to observe the serial output when you power on the board. Look for a message like "Jumping to 0xC000" or "GotoApp->addr=0xC000". This line would be printed before Marlin's "start" message.
Example:
[...]
version 1.2
sdio init success!
Disk init
Tips ------ None Firmware file
GotoApp->addr=0xC000
start
[...]
If the vendor has published Marlin source code that includes the bootloader, you can search the bootloader source code for the address. Begin your search with the following steps:
The vector table offset is usually set using a line like this:
SCB->VTOR = ((uint32_t) APP_START_ADDRESS & SCB_VTOR_TBLOFF_Msk);
Just searching for SCB->VTOR should yield some results. From there, you just need to look at the value that's assigned to it. The example uses APP_START_ADDRESS.
[!NOTE]
Some vendors publish incomplete source code. But they sometimes leave version control related files in the repo, which can contain previous version of files that were removed. Find these by including folders like
.gitor.svnin your search.
[!NOTE]
The example is based on the Voxelab-64/Aquila_X2 which actually includes deleted files in its repo.
If the repository contains a linker script, look at the memory regions, specifically a region named FLASH or similar. The ORIGIN of that region will be the application start address.
Example:
MEMORY
{
FLASH (rx): ORIGIN = 0x0000C000, LENGTH = 512K
OTP (rx): ORIGIN = 0x03000C00, LENGTH = 1020
RAM (rwx): ORIGIN = 0x1FFF8000, LENGTH = 188K
RET_RAM (rwx): ORIGIN = 0x200F0000, LENGTH = 4K
}
[!NOTE]
This example is based on Voxelab-64/Aquila_X2
Due to uncertain licensing (w/r/t STMicro), documentation for the HC32F460 is only available upon request. Documentation includes the following:
Contact me on Discord (@shadow578) if you need it.
This HAL depends on the following projects:
This HAL wouldn't be possible without the following projects: