Skip to content

Commit

Permalink
Merge pull request #22 from Ralim/S60P
Browse files Browse the repository at this point in the history
S60P Support
  • Loading branch information
Ralim authored Feb 14, 2024
2 parents 63ec6b7 + e9afff5 commit e658e40
Show file tree
Hide file tree
Showing 8 changed files with 152 additions and 54 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
image: alpine:3.15
strategy:
matrix:
model: ["TS100", "TS80", "TS80P", "MHP30"]
model: ["TS100", "TS80", "TS80P", "MHP30", "S60P", "S60"]
fail-fast: true
steps:
- name: Install dependencies (apk)
Expand All @@ -18,7 +18,7 @@ jobs:
- name: Install dependencies (py)
run: pip3 install IntelHex

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -38,7 +38,7 @@ jobs:
run: cp build/*.hex build/*.dfu /tmp/${{ matrix.model }}

- name: Archive artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.model }}
path: |
Expand Down
25 changes: 15 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@ build_type ?= runtime
model ?= unknown

ifeq ($(build_type), runtime)
ifeq ($(model), S60)
VECTOR_TABLE_OFFSET := 0x4400
SRC_LD = src/stm32f103_runtime_s60.ld
ifeq ($(model), S60P)
VECTOR_TABLE_OFFSET := 0x5000
SRC_LD = src/stm32f103_runtime_s60p.ld
else
# For MHP30 override the runtime to offset to 32k
ifeq ($(model),"MHP30")
VECTOR_TABLE_OFFSET := 0x8000
SRC_LD = stm32f103_32k_runtime.ld
ifeq ($(model), S60)
VECTOR_TABLE_OFFSET := 0x4400
SRC_LD = src/stm32f103_runtime_s60.ld
else

VECTOR_TABLE_OFFSET := 0x4000
SRC_LD = src/stm32f103_runtime.ld
# For MHP30 override the runtime to offset to 32k
ifeq ($(model),"MHP30")
VECTOR_TABLE_OFFSET := 0x8000
SRC_LD = stm32f103_32k_runtime.ld
else

VECTOR_TABLE_OFFSET := 0x4000
SRC_LD = src/stm32f103_runtime.ld
endif
endif
endif
BIN = runtime
Expand Down
5 changes: 5 additions & 0 deletions build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ make -j build_type=bootloader model=MHP30
rm -rf build/*.o build/*.d
make -j build_type=runtime model=MHP30
rm -rf build/*.o build/*.d

make -j build_type=bootloader model=S60P
rm -rf build/*.o build/*.d
make -j build_type=runtime model=S60P
rm -rf build/*.o build/*.d
39 changes: 23 additions & 16 deletions docs/BackUp.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,26 @@ The Iron will show a IronOS logo and then show the text "DFU" with its version n

## Step 2: Use dfu-util to read out your current bootloader

```
For TS80,TS80P,TS100
sudo dfu-util -d 28e9:0189 -U backup.bin -s 0x08000000:0x4000
OR for MHP30
sudo dfu-util -d 28e9:0189 -U backup.bin -s 0x08000000:0x8000
```

Run this command with the iron connected via USB, and it will create a file called backup.bin in the current folder. this will be a copy of your bootloader for you to keep should you wish to return.
Due to this being copright Miniware, the bootloader files will _NOT_ be hosted in this repo.
However, we will publish known checksums of the backups so you can check if yours is a known one or not.

### TS80,TS80P,TS100

`sudo dfu-util -d 28e9:0189 -U backup.bin -s 0x08000000:0x4000`

### S60

`sudo dfu-util -d 28e9:0189 -U backup.bin -s 0x08000000:0x4400`

### S60P

`sudo dfu-util -d 28e9:0189 -U backup.bin -s 0x08000000:0x5000`

### MHP30

`sudo dfu-util -d 28e9:0189 -U backup.bin -s 0x08000000:0x8000`

If it works, our output should look like this:

```
Expand All @@ -54,14 +62,13 @@ If you have lost your backup, and you need one; if you contact @ralim really nic

Known recorded MD5 checksums:

| Device | DFU Version | MD5 |
|:-------|:------------:|----------------------------------|
| TS100 | 3.42 | CD1038179B3FDA32E75D6F300D153CB3 |
| TS100 | 3.43 | F67879424D73345E4BDDCA69A4F9C75C |
| TS100 | 3.45 | 17FFF8A9D561B226D1DDC2D19BA2198E |
| TS80P | 3.50 | 1805EC83F64C74DD89F87A1B57B7E631 |
| TS80 | 3.45 | FADAE45B4249D4F156C30B7D4B0A853E |

| Device | DFU Version | MD5 |
| :----- | :---------: | -------------------------------- |
| TS100 | 3.42 | CD1038179B3FDA32E75D6F300D153CB3 |
| TS100 | 3.43 | F67879424D73345E4BDDCA69A4F9C75C |
| TS100 | 3.45 | 17FFF8A9D561B226D1DDC2D19BA2198E |
| TS80P | 3.50 | 1805EC83F64C74DD89F87A1B57B7E631 |
| TS80 | 3.45 | FADAE45B4249D4F156C30B7D4B0A853E |

In the mean time, you can validate if your backup looks valid by loading it into [hexed.it](https://hexed.it/).

Expand Down
10 changes: 9 additions & 1 deletion docs/Bootloader.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ This software can be used to replace the bootloader built into your device from

This DFU loader replaces the often troubled usb-disk method with the well known dfu-util. This is the same method used on the Pinecil, and lets all your devices enjoy more stable updating.

## Notice

**Please note: There has been a report that TS100 units shipping with DFU 3.48 may have the lock bits set. If you have this DFU version its reccomended to have a cheap st-link or other SWD programmer in case recovery is needed. #9**
There has been a report that TS100 units shipping with DFU 3.48 may have the lock bits set. If you have this DFU version its reccomended to have a cheap st-link or other SWD programmer in case recovery is needed.
It has also been noted that TS101 units, some MHP30 units and some newer TS80P units may also have the lock bits set.
On **all** Sequre parts the lock bits are set, so a programmer is required.
On these devices, flashing the runtime will work fine, so you can backup your bootloader. However if you use the runtime to flash the main bootloader it will not work and your device will loose its bootloader.
To work around this, the best action is to use a cheap SWD programmer to connect to the device and remove the lock bits. You can then flash your old bootloader or this new one at will.

On Miniware devices, the newer ones have the SWD pins wired up to D+/D-.
On Sequre devices the pads are under the OLED but are clearly labeled (V=3.3V,C=SWCLK,D=SWDIO,G=GND).

## Flashing this bootloader

Expand Down
6 changes: 3 additions & 3 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
#define FLASH_SIZE_KB 128
#define FLASH_BOOTLDR_SIZE_KB 16
#define FLASH_BOOTLDR_PAYLOAD_SIZE_KB 112
#elif MODEL_S60
#elif MODEL_S60 || MODEL_S60P
#define GPIO_DFU_BOOT_PORT GPIOB
#define GPIO_DFU_BOOT_PIN 0
#define GPIO_DP_PULLUP_PORT GPIOA
#define GPIO_DP_PULLUP_PIN 8
#define GPIO_DP_PULLUP_PORT GPIOA
#define GPIO_DP_PULLUP_PIN 8
#define FLASH_SIZE_KB 128
#define FLASH_BOOTLDR_SIZE_KB 17
#define FLASH_BOOTLDR_PAYLOAD_SIZE_KB 111
Expand Down
42 changes: 21 additions & 21 deletions src/oled.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@

#define DEVICEADDR_OLED (0x3c << 1)

#ifdef MODEL_S60
// TODO; for now just cropping in on the screen from 128x32 to 96x16
#define OLED_WIDTH 96
#define OLED_HEIGHT 16
#define OLED_GRAM_START 0x10 // Should be 0x00 when we have full width
#define OLED_GRAM_END 0x6F // Should be 0x7F when we have full width
#define OLED_VCOM_LAYOUT 0x12
#define OLED_SEGMENT_MAP 0xA1
#if MODEL_S60 || MODEL_S60P
// TODO; for now just cropping in on the screen from 128x32 to 96x16
#define OLED_WIDTH 96
#define OLED_HEIGHT 16
#define OLED_GRAM_START 0x10 // Should be 0x00 when we have full width
#define OLED_GRAM_END 0x6F // Should be 0x7F when we have full width
#define OLED_VCOM_LAYOUT 0x12
#define OLED_SEGMENT_MAP 0xA1
#else
#define OLED_WIDTH 96
#define OLED_HEIGHT 16
#define OLED_VCOM_LAYOUT 0x02

#ifdef OLED_FLIP
#define OLED_GRAM_START 0 // Should be 0x00 when we have full width
#define OLED_GRAM_END 95
#define OLED_SEGMENT_MAP 0xA1
#else
#define OLED_GRAM_START 0x20 // Should be 0x00 when we have full width
#define OLED_GRAM_END 0x7F
#define OLED_SEGMENT_MAP 0xA0
#endif
#define OLED_WIDTH 96
#define OLED_HEIGHT 16
#define OLED_VCOM_LAYOUT 0x02

#ifdef OLED_FLIP
#define OLED_GRAM_START 0 // Should be 0x00 when we have full width
#define OLED_GRAM_END 95
#define OLED_SEGMENT_MAP 0xA1
#else
#define OLED_GRAM_START 0x20 // Should be 0x00 when we have full width
#define OLED_GRAM_END 0x7F
#define OLED_SEGMENT_MAP 0xA0
#endif

#endif
#define FRAMEBUFFER_START 17
Expand Down
73 changes: 73 additions & 0 deletions src/stm32f103_runtime_s60p.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* This file is part of the libopenstm32 project.
*
* Copyright (C) 2010 Thomas Otto <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/* Define memory regions. */
MEMORY
{
rom (rx) : ORIGIN = 0x08005000, LENGTH = 8K
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 8k
}

/* Enforce emmition of the vector table. */
EXTERN (vector_table)

/* Define the entry point of the output file. */
ENTRY(reset_handler)

/* Define sections. */
SECTIONS
{
.text : {
*(.vectors) /* Vector table */
*(.text*) /* Program code */
. = ALIGN(4);
*(.rodata*) /* Read-only data */
. = ALIGN(4);
} >rom

_etext = .;

.data : {
_data = .;
*(.data*) /* Read-write initialized data */
. = ALIGN(4);
_edata = .;
} >ram AT >rom
_data_loadaddr = LOADADDR(.data);

.bss : {
*(.bss*) /* Read-write zero initialized data */
*(COMMON)
. = ALIGN(4);
_ebss = .;
} >ram

/*
* The .eh_frame section appears to be used for C++ exception handling.
* You may need to fix this if you're using C++.
*/
/DISCARD/ : { *(.eh_frame) }

. = ALIGN(4);
end = .;
}

PROVIDE(_stack = ORIGIN(ram) + LENGTH(ram));


0 comments on commit e658e40

Please sign in to comment.