-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
brom-dump: payloads: implement usb-dump payload for mt6589
- Loading branch information
Showing
8 changed files
with
209 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
@ SPDX-License-Identifier: GPL-3.0-only | ||
@ SPDX-FileCopyrightText: 2023 arzamas-16 <https://github.com/arzamas-16> | ||
|
||
.equ DA_print_hex_value, 0x12003F50 @ void print_hex_value(uint value, uint width) | ||
.equ DA_putc_wrapper_uart, 0x12003F3A @ void putc_uart_wrapper(uint chr) | ||
.equ DA_printf_uart, 0x12003F7C @ void printf_uart(char* fmt, uint* val1, uint val2, uint val3) | ||
@ void __fastcall putc_uart_wrapper(uint8_t c) | ||
.equ DA_putc_wrapper_uart, 0x12003F3A | ||
@ void __fastcall print_hex_value(uint32_t val, uint32_t width) | ||
.equ DA_print_hex_value, 0x12003F50 | ||
@ void __fastcall printf_uart(uint8_t* fmt, uint32_t* arg1, uint32_t arg2, uint32_t arg3) | ||
.equ DA_printf_uart, 0x12003F7C | ||
|
||
|
||
|
||
@ void __fastcall io_usb_write(uint8_t* data, uint32_t len) | ||
.equ DA_io_usb_write, 0x12008E60 | ||
@ uint32_t __fastcall io_usb_readl() | ||
.equ DA_io_usb_readl, 0x12009032 | ||
@ void __fastcall io_usb_writel(uint32_t val) | ||
.equ DA_io_usb_writel, 0x12009060 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
.include "da-api.s" | ||
.include "hw-api.s" | ||
|
||
|
||
.syntax unified | ||
.global _main | ||
_main: | ||
LDR R1, =usb_seq_hello | ||
LDR R0, [R1] | ||
BL DA_io_usb_writel | ||
|
||
LDR R0, =dump_task_brom @ dump BootROM | ||
BL usb_dump | ||
LDR R0, =dump_task_sram @ dump SRAM | ||
BL usb_dump | ||
LDR R0, =dump_task_da @ dump Download Agent | ||
BL usb_dump | ||
|
||
LDR R1, =usb_seq_goodbye | ||
LDR R0, [R1] | ||
BL DA_io_usb_writel | ||
busy_wait: | ||
NOP | ||
B busy_wait @ do not go any further, must reset manually! | ||
|
||
|
||
|
||
.func usb_dump | ||
usb_dump: | ||
PUSH {R5, LR} | ||
PUSH {R0} @ save dump_task pointer on stack | ||
|
||
MOV R5, R0 | ||
LDMIA R5!, {R0, R1} @ offset -> R0, length -> R1 | ||
MOV R0, R1 @ length -> R0 | ||
BL DA_io_usb_writel @ DA_io_usb_writel(length) | ||
|
||
POP {R5} @ load dump_task pointer from task | ||
LDMIA R5!, {R0, R1} @ offset -> R0, length -> R1 | ||
BL DA_io_usb_write @ DA_io_usb_write(offset, length) | ||
|
||
POP {R5, PC} | ||
.endfunc | ||
|
||
|
||
|
||
.data | ||
usb_seq_hello: | ||
.word 0x3E4D746B | ||
usb_seq_goodbye: | ||
.word 0x4D746B3C | ||
dump_task_brom: | ||
.word MEM_brom_start @ offset | ||
.word MEM_brom_length @ length | ||
dump_task_sram: | ||
.word MEM_sram_start @ offset | ||
.word MEM_sram_length @ length | ||
dump_task_da: | ||
.word MEM_da_start @ offset | ||
.word MEM_da_length @ length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.