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

Commit cee9d57

Browse files
committed
[uploader] toggle RESET via DTR
1 parent c660e58 commit cee9d57

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ clean:
4040

4141
size:
4242
@$(OBJCOPY) -I ihex --output-target=binary $(TARGET) $(TARGET).bin
43-
@echo '-----\nImage size:'
43+
@echo "-----\nImage size:"
4444
@stat -L -c %s $(TARGET).bin
4545

4646
# enable write-protection on first 10 pages

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ $ make && make flash
3232
Enable write-protection (UBC) on pages 0-10:
3333

3434
``` bash
35-
make opt-set
35+
$ make opt-set
3636
```
3737

3838
## Uploading the firmware
3939

40-
There is a demo application inside `app` directory which toggles PD4 via interrupts. To upload the application short PD3 to ground, power-cycle the MCU and run the uploader utility.
40+
There is a demo application inside `app` 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.
4141

4242
``` bash
4343
$ cd app && make

uploader/boot.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ def get_crc():
3030
return crc
3131

3232
def bootloader_enter(ser):
33+
# toggle reset via DTR
34+
ser.setDTR(True)
35+
sleep(0.1)
36+
ser.setDTR(False)
37+
# send payload
3338
req = bytearray(REQ_ENTER)
3439
chunks = os.path.getsize(FILE)
3540
chunks = int(math.ceil(float(chunks) / BLOCK_SIZE))

0 commit comments

Comments
 (0)