Skip to content

Commit

Permalink
Sequre S99 Support (#29)
Browse files Browse the repository at this point in the history
* Add to build script

* Another Sequre product, Another random offset

* Fix build_all

* Update BackUp.md
  • Loading branch information
Ralim authored Jun 1, 2024
1 parent 6d88f82 commit c157229
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .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", "S60P", "S60"]
model: ["TS100", "TS80", "TS80P", "MHP30", "S60P", "S60", "S99"]
fail-fast: true
steps:
- name: Install dependencies (apk)
Expand Down
37 changes: 22 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,28 @@ ifeq ($(build_type), runtime)
ifeq ($(model), S60P)
VECTOR_TABLE_OFFSET := 0x5000
SRC_LD = src/stm32f103_runtime_s60p.ld
else
ifeq ($(model), S60)
VECTOR_TABLE_OFFSET := 0x4400
SRC_LD = src/stm32f103_runtime_s60.ld
else
# 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

ifeq ($(model), S60)
VECTOR_TABLE_OFFSET := 0x4400
SRC_LD = src/stm32f103_runtime_s60.ld
endif

ifeq ($(model), S99)
VECTOR_TABLE_OFFSET := 0x4C00
SRC_LD = src/stm32f103_runtime_s99.ld
endif



# For MHP30 override the runtime to offset to 32k
ifeq ($(model),MHP30)
VECTOR_TABLE_OFFSET := 0x8000
SRC_LD = src/stm32f103_32k_runtime.ld
endif
ifeq ($(model),$(filter $(model), TS100 TS80 TS80P ))
VECTOR_TABLE_OFFSET := 0x4000
SRC_LD = src/stm32f103_runtime.ld
endif
BIN = runtime

Expand Down
9 changes: 8 additions & 1 deletion build_all.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
!# bin/sh
#! bin/sh

set -eux

make clean
make -j build_type=bootloader model=TS100
Expand All @@ -25,3 +27,8 @@ 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

make -j build_type=bootloader model=S99
rm -rf build/*.o build/*.d
make -j build_type=runtime model=S99
rm -rf build/*.o build/*.d
5 changes: 5 additions & 0 deletions docs/BackUp.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ However, we will publish known checksums of the backups so you can check if your

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

### S99

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

### MHP30

`sudo dfu-util -d 28e9:0189 -U backup.bin -s 0x08000000:0x8000`
Expand Down Expand Up @@ -70,6 +74,7 @@ Known recorded MD5 checksums:
| TS80P | 3.50 | 1805EC83F64C74DD89F87A1B57B7E631 |
| TS80 | 3.45 | FADAE45B4249D4F156C30B7D4B0A853E |
| S60P | V14.00 | 631C8823D84D3F53ED80266ACE37139E |
| S99 | V12.00 | ca373fe47f4d3f736479e671c481fd6e |

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

Expand Down
9 changes: 9 additions & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@
#define FLASH_BOOTLDR_SIZE_KB 20
#define FLASH_BOOTLDR_PAYLOAD_SIZE_KB 108

#elif MODEL_S99
#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 FLASH_SIZE_KB 128
#define FLASH_BOOTLDR_SIZE_KB 19
#define FLASH_BOOTLDR_PAYLOAD_SIZE_KB 109

#elif MODEL_TS80 || MODEL_TS80P
#define GPIO_DFU_BOOT_PORT GPIOB
#define GPIO_DFU_BOOT_PIN 1
Expand Down
2 changes: 1 addition & 1 deletion src/oled.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#define DEVICEADDR_OLED (0x3c << 1)

#if MODEL_S60 || MODEL_S60P
#if MODEL_S60 || MODEL_S60P || MODEL_S99
#define OLED_AREA_X 16
#define OLED_AREA_Y 8
#define OLED_WIDTH 128
Expand Down
73 changes: 73 additions & 0 deletions src/stm32f103_runtime_s99.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 = 0x08004C00, LENGTH = 19K
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 c157229

Please sign in to comment.