armv7m_0_erase_check.s 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /***************************************************************************
  2. * Copyright (C) 2014 by Jeff Ciesielski *
  3. * jeffciesielski@gmail.com *
  4. * *
  5. * Based on the armv7m erase checker by: *
  6. * Copyright (C) 2010 by Spencer Oliver *
  7. * spen@spen-soft.co.uk *
  8. * *
  9. * This program is free software; you can redistribute it and/or modify *
  10. * it under the terms of the GNU General Public License as published by *
  11. * the Free Software Foundation; either version 2 of the License, or *
  12. * (at your option) any later version. *
  13. * *
  14. * This program is distributed in the hope that it will be useful, *
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  17. * GNU General Public License for more details. *
  18. * *
  19. ***************************************************************************/
  20. /*
  21. parameters:
  22. r0 - address in
  23. r1 - byte count
  24. r2 - mask - result out
  25. */
  26. .text
  27. .syntax unified
  28. .cpu cortex-m0
  29. .thumb
  30. .thumb_func
  31. .align 2
  32. loop:
  33. ldrb r3, [r0]
  34. adds r0, #1
  35. orrs r2, r2, r3
  36. subs r1, r1, #1
  37. bne loop
  38. end:
  39. bkpt #0
  40. .end