123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- .syntax unified
- .arch armv6-m
-
- .extern main
- .section .stack
- .align 3
- .equ Stack_Size, 0x800
- .globl __StackTop
- .globl __StackLimit
- __StackLimit:
- .space Stack_Size
- .size __StackLimit, . - __StackLimit
- __StackTop:
- .size __StackTop, . - __StackTop
- .section .heap
- .align 3
- .equ Heap_Size, 0
- .globl __HeapBase
- .globl __HeapLimit
- __HeapBase:
- .if Heap_Size
- .space Heap_Size
- .endif
- .size __HeapBase, . - __HeapBase
- __HeapLimit:
- .size __HeapLimit, . - __HeapLimit
- .section .isr_vector
- .align 2
- .globl __isr_vector
- __isr_vector:
- .long 0x10014000
- .long Reset_Handler
- .long NMI_Handler
- .long HardFault_Handler
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long 0
- .long SysTick_Handler
- .long usb_handler
- .long iicd_handler
- .long qspi_handler
- .long spid_handler
- .long uart_handler
- .long uartb_handler
- .long adcd_handler
- .long i2s_handler
- .long bt_handler
- .long rsa_handler
- .size __isr_vector, . - __isr_vector
- .text
-
-
- .thumb
- .thumb_func
- .align 1
- .globl Reset_Handler
- .type Reset_Handler, %function
- Reset_Handler:
- ldr r1, =__etext
- ldr r2, =__data_start__
- ldr r3, =__data_end__
- subs r3, r2
- ble .L_loop1_done
- .L_loop1:
- subs r3, #4
- ldr r0, [r1,r3]
- str r0, [r2,r3]
- bgt .L_loop1
- .L_loop1_done:
- /* Single BSS section scheme.
- *
- * The BSS section is specified by following symbols
- * __bss_start__: start of the BSS section.
- * __bss_end__: end of the BSS section.
- *
- * Both addresses must be aligned to 4 bytes boundary.
- */
- ldr r1, =__bss_start__
- ldr r2, =__bss_end__
- movs r0, 0
- subs r2, r1
- ble .L_loop3_done
- .L_loop3:
- subs r2, #4
- str r0, [r1, r2]
- bgt .L_loop3
- .L_loop3_done:
- ldr r0,=0x12345
- ldr r3,=0x1111
- bl main
- .pool
- .size Reset_Handler, . - Reset_Handler
- .align 1
- .thumb_func
- .weak Default_Handler
- .type Default_Handler, %function
- Default_Handler:
- b .
- .size Default_Handler, . - Default_Handler
- /* Macro to define default handlers. Default handler
- * will be weak symbol and just dead loops. They can be
- * overwritten by other handlers */
- .macro def_irq_handler handler_name
- .weak \handler_name
- .set \handler_name, Default_Handler
- .endm
- def_irq_handler NMI_Handler
- def_irq_handler HardFault_Handler
- def_irq_handler SVC_Handler
- def_irq_handler PendSV_Handler
- def_irq_handler SysTick_Handler
- def_irq_handler DEF_IRQHandler
- def_irq_handler usb_handler
- def_irq_handler iicd_handler
- def_irq_handler qspi_handler
- def_irq_handler spid_handler
- def_irq_handler uart_handler
- def_irq_handler uartb_handler
- def_irq_handler adcd_handler
- def_irq_handler i2s_handler
- def_irq_handler bt_handler
- def_irq_handler rsa_handler
-
- @ int __aeabi_idiv(int num:r0, int denom:r1)
- @
- @ Divide r0 by r1 and return quotient in r0 (all signed).
- @ Use __aeabi_uidivmod() but check signs before and change signs afterwards.
- @
- .syntax unified @should be here
- .thumb_func
- .global __aeabi_idiv
- __aeabi_idiv:
- cmp r0, #0
- bge L_num_pos
- rsbs r0, #0
- cmp r1, #0
- bge L_neg_result
- rsbs r1, #0 @ den = -den
- b __aeabi_uidivmod
- L_num_pos:
- cmp r1, #0
- bge __aeabi_uidivmod
- rsbs r1, #0 @ den = -den
- L_neg_result:
- push {lr}
- bl __aeabi_uidivmod
- rsbs r0, #0 @ quot = -quot
- pop {pc}
- @ {int quotient:r0, int remainder:r1}
- @ __aeabi_idivmod(int numerator:r0, int denominator:r1)
- @
- @ Divide r0 by r1 and return the quotient in r0 and the remainder in r1
- @
- .thumb_func
- .global __aeabi_idivmod
- __aeabi_idivmod:
- cmp r0, #0
- bge L_num_pos_bis
- rsbs r0, #0 @ num = -num
- cmp r1, #0
- bge L_neg_both
- rsbs r1, #0 @ den = -den
- push {lr}
- bl __aeabi_uidivmod
- rsbs r1, #0 @ rem = -rem
- pop {pc}
- L_neg_both:
- push {lr}
- bl __aeabi_uidivmod
- rsbs r0, #0 @ quot = -quot
- rsbs r1, #0 @ rem = -rem
- pop {pc}
- L_num_pos_bis:
- cmp r1, #0
- bge __aeabi_uidivmod
- rsbs r1, #0 @ den = -den
- push {lr}
- bl __aeabi_uidivmod
- rsbs r0, #0 @ quot = -quot
- pop {pc}
- @ unsigned __aeabi_uidiv(unsigned num, unsigned denom)
- @
- @ Just an alias for __aeabi_uidivmod(), the remainder is ignored
- @
- .thumb_func
- .global __aeabi_uidiv
- __aeabi_uidiv:
- @ {unsigned quotient:r0, unsigned remainder:r1}
- @ __aeabi_uidivmod(unsigned numerator:r0, unsigned denominator:r1)
- @
- @ Divide r0 by r1 and return the quotient in r0 and the remainder in r1
- @
- .thumb_func
- .global __aeabi_uidivmod
- __aeabi_uidivmod:
- cmp r1, #0
- bne L_no_div0
- b __aeabi_idiv0
- L_no_div0:
- @ Shift left the denominator until it is greater than the numerator
- movs r2, #1 @ counter
- movs r3, #0 @ result
- cmp r0, r1
- bls L_sub_loop0
- adds r1, #0 @ dont shift if denominator would overflow
- bmi L_sub_loop0
- L_denom_shift_loop:
- lsls r2, #1
- lsls r1, #1
- bmi L_sub_loop0
- cmp r0, r1
- bhi L_denom_shift_loop
- L_sub_loop0:
- cmp r0, r1
- bcc L_dont_sub0 @ if (num>denom)
- subs r0, r1 @ numerator -= denom
- orrs r3, r2 @ result(r3) |= bitmask(r2)
- L_dont_sub0:
- lsrs r1, #1 @ denom(r1) >>= 1
- lsrs r2, #1 @ bitmask(r2) >>= 1
- bne L_sub_loop0
- mov r1, r0 @ remainder(r1) = numerator(r0)
- mov r0, r3 @ quotient(r0) = result(r3)
- bx lr
- __aeabi_idiv0:
- b __aeabi_idiv0
- .end
-
-
|