From acca6a09451035126deb218469a365823a0a9d3a Mon Sep 17 00:00:00 2001 From: mcudev <29890609+mcudev@users.noreply.github.com> Date: Sun, 8 Oct 2017 11:12:23 -0400 Subject: [PATCH] boardloader: move memset_reg to separate source file --- SConscript.boardloader | 1 + embed/boardloader/startup.s | 14 -------------- embed/common/util.s | 19 +++++++++++++++++++ 3 files changed, 20 insertions(+), 14 deletions(-) create mode 100644 embed/common/util.s diff --git a/SConscript.boardloader b/SConscript.boardloader index 9d410c958b..65447a0d05 100644 --- a/SConscript.boardloader +++ b/SConscript.boardloader @@ -71,6 +71,7 @@ SOURCE_STMHAL = [ SOURCE_BOARDLOADER = [ 'embed/common/vectortable.s', + 'embed/common/util.s', 'embed/boardloader/startup.s', 'embed/boardloader/main.c', ] diff --git a/embed/boardloader/startup.s b/embed/boardloader/startup.s index cb489b85f5..5afaeedd6e 100644 --- a/embed/boardloader/startup.s +++ b/embed/boardloader/startup.s @@ -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: diff --git a/embed/common/util.s b/embed/common/util.s new file mode 100644 index 0000000000..8d960b626b --- /dev/null +++ b/embed/common/util.s @@ -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