You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.0KB

  1. /***************************************************************************
  2. * Copyright (C) 2010 by Spencer Oliver *
  3. * spen@spen-soft.co.uk *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License as published by *
  7. * the Free Software Foundation; either version 2 of the License, or *
  8. * (at your option) any later version. *
  9. * *
  10. * This program is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License *
  16. * along with this program; if not, write to the *
  17. * Free Software Foundation, Inc., *
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
  19. ***************************************************************************/
  20. /*
  21. parameters:
  22. r0 - address in - crc out
  23. r1 - char count
  24. */
  25. .text
  26. .syntax unified
  27. .cpu cortex-m0
  28. .thumb
  29. .thumb_func
  30. .align 2
  31. _start:
  32. main:
  33. mov r2, r0
  34. movs r0, #0
  35. mvns r0, r0
  36. ldr r6, CRC32XOR
  37. mov r3, r1
  38. movs r4, #0
  39. b ncomp
  40. nbyte:
  41. ldrb r1, [r2, r4]
  42. lsls r1, r1, #24
  43. eors r0, r0, r1
  44. movs r5, #0
  45. loop:
  46. cmp r0, #0
  47. bge notset
  48. lsls r0, r0, #1
  49. eors r0, r0, r6
  50. b cont
  51. notset:
  52. lsls r0, r0, #1
  53. cont:
  54. adds r5, r5, #1
  55. cmp r5, #8
  56. bne loop
  57. adds r4, r4, #1
  58. ncomp:
  59. cmp r4, r3
  60. bne nbyte
  61. bkpt #0
  62. .align 2
  63. CRC32XOR: .word 0x04c11db7
  64. .end