Skip to content

Commit

Permalink
Another Sequre product, Another random offset
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralim committed May 26, 2024
1 parent 34bad85 commit 38ffdb0
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 17 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 = 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
4 changes: 4 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
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 38ffdb0

Please sign in to comment.