1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00

boardloader: move memset_reg to separate source file

This commit is contained in:
mcudev 2017-10-08 11:12:23 -04:00 committed by Pavol Rusnak
parent bb5b4d2e55
commit acca6a0945
3 changed files with 20 additions and 14 deletions

View File

@ -71,6 +71,7 @@ SOURCE_STMHAL = [
SOURCE_BOARDLOADER = [
'embed/common/vectortable.s',
'embed/common/util.s',
'embed/boardloader/startup.s',
'embed/boardloader/main.c',
]

View File

@ -2,20 +2,6 @@
.text
.global memset_reg
.type memset_reg, STT_FUNC
memset_reg:
// call with the following (note that the arguments are not validated prior to use):
// r0 - address of first word to write (inclusive)
// r1 - address of first word following the address in r0 to NOT write (exclusive)
// r2 - word value to be written
// both addresses in r0 and r1 needs to be divisible by 4!
.L_loop_begin:
str r2, [r0], 4 // store the word in r2 to the address in r0, post-indexed
cmp r0, r1
bne .L_loop_begin
bx lr
.global reset_handler
.type reset_handler, STT_FUNC
reset_handler:

19
embed/common/util.s Normal file
View File

@ -0,0 +1,19 @@
.syntax unified
.text
.global memset_reg
.type memset_reg, STT_FUNC
memset_reg:
// call with the following (note that the arguments are not validated prior to use):
// r0 - address of first word to write (inclusive)
// r1 - address of first word following the address in r0 to NOT write (exclusive)
// r2 - word value to be written
// both addresses in r0 and r1 needs to be divisible by 4!
.L_loop_begin:
str r2, [r0], 4 // store the word in r2 to the address in r0, post-indexed
cmp r0, r1
bne .L_loop_begin
bx lr
.end