Skip to content
This repository was archived by the owner on Apr 3, 2025. It is now read-only.

Commit 58cfe6a

Browse files
committed
updated documentation
1 parent cee9d57 commit 58cfe6a

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
MCU ?= stm8s003f3
22
ARCH = stm8
33

4-
F_CPU ?= 16000000
54
TARGET ?= main.ihx
65

76
SRCS := $(wildcard *.c)
@@ -15,8 +14,7 @@ LD = sdld
1514
AS = sdasstm8
1615
OBJCOPY = sdobjcopy
1716
ASFLAGS = -plosgff
18-
CFLAGS = -m$(ARCH) -p$(MCU)
19-
CFLAGS += -DF_CPU=$(F_CPU)UL -I.
17+
CFLAGS = -m$(ARCH) -p$(MCU) -I.
2018
CFLAGS += --stack-auto --noinduction --use-non-free --noinvariant --opt-code-size
2119
LDFLAGS = -m$(ARCH) -l$(ARCH) --out-fmt-ihx
2220
LDFLAGS += -Wl-bIVT=0x8000 -Wl-bGSINIT=0x8080
@@ -45,7 +43,7 @@ size:
4543

4644
# enable write-protection on first 10 pages
4745
opt-set:
48-
@echo '0x00 0x0a 0xf5 0x00 0xff 0x00 0xff 0x00 0xff 0x00 0xff' | xxd -r > opt.bin
46+
@echo '0x00 0x09 0xf6 0x00 0xff 0x00 0xff 0x00 0xff 0x00 0xff' | xxd -r > opt.bin
4947
stm8flash -c stlinkv2 -p stm8s003f3 -s opt -w opt.bin
5048

5149
# reset option-bytes to factory defaults

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# stm8-bootloader
2-
Serial bootloader for STM8S microcontrollers.
2+
Serial bootloader for STM8S microcontrollers. A detailed write-up on this bootloader is posted [here](https://lujji.github.io/blog/serial-bootloader-for-stm8).
33

44
## Features
55

6-
* **small** - fits in 9 pages (547 bytes w/ SDCC v3.6.8 #9951)
6+
* **small** - fits in 547 bytes (SDCC v3.6.8 #9951)
77
* **fast** - uploads 4k binary in 1 second @115200bps
88
* **configurable** - can be adjusted for parts with different flash block size
99

@@ -29,7 +29,7 @@ Build and flash the bootloader:
2929
$ make && make flash
3030
```
3131

32-
Enable write-protection (UBC) on pages 0-10:
32+
Enable write-protection (UBC) on pages 0-9:
3333

3434
``` bash
3535
$ make opt-set

config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
#define BAUDRATE 115200
77

8+
/* internal RC oscillator, CKDIVR = 0 */
9+
#define F_CPU 16000000UL
10+
#define UART_DIV ((F_CPU + BAUDRATE / 2) / BAUDRATE)
11+
812
/* application address */
913
#define BOOT_ADDR 0x8280
1014

main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
#include "stm8s.h"
44
#include "ram.h"
55

6-
#define UART_DIV ((F_CPU + BAUDRATE / 2) / BAUDRATE)
7-
86
static uint8_t CRC;
97
static uint8_t ivt[128];
108
static uint8_t f_ram[128];

0 commit comments

Comments
 (0)