Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Apr 3, 2025. It is now read-only.
/stm8-bootloaderPublic archive

Serial bootloader for STM8 microcontrollers

License

NotificationsYou must be signed in to change notification settings

lujji/stm8-bootloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serial bootloader for STM8S and STM8L microcontrollers. A detailed write-up on this bootloader is postedhere.

I am no longer maintaining this repo - for more features check outthis fork byMKesenheimer.

Features

  • small - fits in 547 bytes (SDCC v3.6.8 #9951)
  • fast - uploads 4k binary in 1 second @115200bps
  • configurable - can be adjusted for parts with different flash block size

Configuration

The default configuration targets low-density devices (STM8S003). To compile for a different targetMCU andFAMILY makefile variables are adjusted accordingly.

Bootloader configuration is located inconfig.h.

  • BLOCK_SIZE - flash block size according to device datasheet. This should be set to 64 for low-density devices or 128 for devices with >8k flash.
  • BOOT_ADDR - application boot address.
  • BOOT_PIN - entry jumper. This is set to PD3 by default.
  • RELOCATE_IVT - when set to 1 (default) the interrupt vectors are relocated. When set to 0 the bootloader will overwrite it's own interrupt vector table with the application's IVT, thus eliminating additional CPU overhead during interrupts. Write-protection cannot be used in this case and resulting binary is slightly larger.

Changing boot address

Boot address must be a multiple of BLOCK_SIZE. Address is set in 2 places:

  • config.h
  • init.s

Main application is compiled with--code-loc <address> option. When RELOCATE_IVT is set to 0, 0x80 must be subtracted from application address and isr29 must be implemented:void dummy_isr() __interrupt(29) __naked { ; }.

Build instructions

Build and flash the bootloader:

$ make&& make flash

Enable write-protection (UBC) on pages 0-9(TODO: must be adjusted for STML):

$ make opt-set

Uploading the firmware

There is a demo application insideapp directory which toggles PD4 via interrupts. To upload the application short PD3 to ground, power-cycle the MCU and run the uploader utility. DTR pin on UART-USB converter can be connected to RESET pin on STM8 for automatic reset.

$cd app&& make$ python ../uploader/boot.py -p /dev/ttyUSB0 firmware.bin

About

Serial bootloader for STM8 microcontrollers

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp