Skip to content

Instantly share code, notes, and snippets.

@Gabboxl
Last active November 2, 2025 12:23
Show Gist options
  • Select an option

  • Save Gabboxl/0d14908a4c04e6163377a6e31e199cdd to your computer and use it in GitHub Desktop.

Select an option

Save Gabboxl/0d14908a4c04e6163377a6e31e199cdd to your computer and use it in GitHub Desktop.
ST10X MCU simple bootloader

From: https://community.st.com/t5/others-hardware-and-software/how-to-write-boot-loader/td-p/494349

This bootloader receives data until NUMBYTES is reached. NUMBYTES obviously needs to be replaced by the program that injects the bootloader based on the actual program size.

The program that is received could be another program that implements an actual transmission protocol with error recovery to finally receive the actual firmware that needs to be run on the ST10X CPU. Just like what the ST10Flasher tool does.

mov R0, #0FA60h ; R0 is the address to the next byte
W0:
jnb S0RIR, W0 ; wait until a byte is received
movb [R0], S0RBUF ; place the received byte in memory
bclr S0RIR ; clear serial receive flag
movb S0TBUF, [R0] ; transmit (echo) the byte
cmpi1 R0, #(0FA60h+NUMBYTES-1) ; see if all bytes are received
jmpr cc_NE, W0 ; if not repeat
nop
nop
nop
nop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment