repo_id
stringlengths
5
115
size
int64
590
5.01M
file_path
stringlengths
4
212
content
stringlengths
590
5.01M
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/RCC/RCC_LSEOutput/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/RCC/RCC_HSEBypassOutput/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/RCC/RCC_HSEBypassOutput/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/RCC/RCC_HSEBypassOutput/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/RCC/RCC_HSIOutput/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/RCC/RCC_HSIOutput/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/RCC/RCC_HSIOutput/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/RCC/RCC_LSIOutput/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/RCC/RCC_LSIOutput/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/RCC/RCC_LSIOutput/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/ADC/ADC_SingleConversion_TriggerTimer_IT/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/ADC/ADC_SingleConversion_TriggerTimer_IT/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/ADC/ADC_SingleConversion_TriggerTimer_IT/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/ADC/ADC_MultichannelSwitch/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/ADC/ADC_MultichannelSwitch/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/ADC/ADC_MultichannelSwitch/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/ADC/ADC_TempSensor/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/ADC/ADC_TempSensor/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/ADC/ADC_TempSensor/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/ADC/ADC_VrefbufAndVrefint/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/ADC/ADC_VrefbufAndVrefint/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/ADC/ADC_VrefbufAndVrefint/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/ADC/ADC_StopForLowPower/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/ADC/ADC_StopForLowPower/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/ADC/ADC_StopForLowPower/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/ADC/ADC_VrefbufAndVre2P5/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/ADC/ADC_VrefbufAndVre2P5/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/ADC/ADC_VrefbufAndVre2P5/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/ADC/ADC_AnalogWatchdog/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/ADC/ADC_AnalogWatchdog/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/ADC/ADC_AnalogWatchdog/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/ADC/ADC_SingleConversion_TriggerSW_Polling/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/ADC/ADC_SingleConversion_TriggerSW_Polling/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/ADC/ADC_SingleConversion_TriggerSW_Polling/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/SPI/SPI_TwoBoards_FullDuplexMaster_Polling/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/SPI/SPI_TwoBoards_FullDuplexMaster_Polling/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/SPI/SPI_TwoBoards_FullDuplexMaster_Polling/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/SPI/SPI_TwoBoards_FullDuplexMaster_IT/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/SPI/SPI_TwoBoards_FullDuplexMaster_IT/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/SPI/SPI_TwoBoards_FullDuplexMaster_IT/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/SPI/SPI_TwoBoards_FullDuplexSlave_IT/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/SPI/SPI_TwoBoards_FullDuplexSlave_IT/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/SPI/SPI_TwoBoards_FullDuplexSlave_IT/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/SPI/SPI_TwoBoards_FullDuplexSlave_Polling/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/SPI/SPI_TwoBoards_FullDuplexSlave_Polling/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/SPI/SPI_TwoBoards_FullDuplexSlave_Polling/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/GPIO/GPIO_Toggle/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/GPIO/GPIO_Toggle/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/GPIO/GPIO_Toggle/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/GPIO/GPIO_FastIO/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/GPIO/GPIO_FastIO/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/GPIO/GPIO_FastIO/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/TIM/TIM1_OC_Toggle/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/TIM/TIM1_OC_Toggle/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/TIM/TIM1_OC_Toggle/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/TIM/TIM1_6Step/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/TIM/TIM1_6Step/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/TIM/TIM1_6Step/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/TIM/TIM1_Update_IT/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/TIM/TIM1_Update_IT/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/TIM/TIM1_Update_IT/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/TIM/TIM1_PWM/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/TIM/TIM1_PWM/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/TIM/TIM1_PWM/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/TIM/TIM1_InputCapture_XORCh1Ch2Ch3/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/TIM/TIM1_InputCapture_XORCh1Ch2Ch3/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/TIM/TIM1_InputCapture_XORCh1Ch2Ch3/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/TIM/TIM1_InputCapture/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/TIM/TIM1_InputCapture/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/TIM/TIM1_InputCapture/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/I2C/I2C_TwoBoard_CommunicationMaster_IT/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/I2C/I2C_TwoBoard_CommunicationMaster_IT/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/I2C/I2C_TwoBoard_CommunicationMaster_IT/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/I2C/I2C_TwoBoard_CommunicationSlave_IT/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/I2C/I2C_TwoBoard_CommunicationSlave_IT/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/I2C/I2C_TwoBoard_CommunicationSlave_IT/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/I2C/I2C_TwoBoard_CommunicationMaster_Polling/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/I2C/I2C_TwoBoard_CommunicationMaster_Polling/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/I2C/I2C_TwoBoard_CommunicationMaster_Polling/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/PWR/PWR_STOP_WFI/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/PWR/PWR_STOP_WFI/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/PWR/PWR_STOP_WFI/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/PWR/PWR_SLEEP_WFI/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/PWR/PWR_SLEEP_WFI/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/PWR/PWR_SLEEP_WFI/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/PWR/PWR_SLEEP_WFE/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/PWR/PWR_SLEEP_WFE/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/PWR/PWR_SLEEP_WFE/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
OpenPuya/PY32F002B_Firmware
8,946
Projects/PY32F002B-STK/Example/PWR/PWR_STOP_WFE/MDK-ARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for MDK-ARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == Reset_Handler ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* <<< Use Configuration Wizard in Context Menu >>> ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ; <h> Stack Configuration ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp ; <h> Heap Configuration ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; </h> Heap_Size EQU 0x00000000 AREA HEAP, NOINIT, READWRITE, ALIGN=3 __heap_base Heap_Mem SPACE Heap_Size __heap_limit PRESERVE8 THUMB ; Vector Table Mapped to Address 0 at Reset AREA RESET, DATA, READONLY EXPORT __Vectors EXPORT __Vectors_End EXPORT __Vectors_Size __Vectors DCD __initial_sp ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved __Vectors_End __Vectors_Size EQU __Vectors_End - __Vectors AREA |.text|, CODE, READONLY ; Reset Handler Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP ; Dummy Exception Handlers (infinite loops which can be modified) NMI_Handler PROC EXPORT NMI_Handler [WEAK] B . ENDP HardFault_Handler\ PROC EXPORT HardFault_Handler [WEAK] B . ENDP SVC_Handler PROC EXPORT SVC_Handler [WEAK] B . ENDP PendSV_Handler PROC EXPORT PendSV_Handler [WEAK] B . ENDP SysTick_Handler PROC EXPORT SysTick_Handler [WEAK] B . ENDP Default_Handler PROC EXPORT FLASH_IRQHandler [WEAK] EXPORT RCC_IRQHandler [WEAK] EXPORT EXTI0_1_IRQHandler [WEAK] EXPORT EXTI2_3_IRQHandler [WEAK] EXPORT EXTI4_15_IRQHandler [WEAK] EXPORT ADC_COMP_IRQHandler [WEAK] EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK] EXPORT TIM1_CC_IRQHandler [WEAK] EXPORT LPTIM1_IRQHandler [WEAK] EXPORT TIM14_IRQHandler [WEAK] EXPORT I2C1_IRQHandler [WEAK] EXPORT SPI1_IRQHandler [WEAK] EXPORT USART1_IRQHandler [WEAK] FLASH_IRQHandler RCC_IRQHandler EXTI0_1_IRQHandler EXTI2_3_IRQHandler EXTI4_15_IRQHandler ADC_COMP_IRQHandler TIM1_BRK_UP_TRG_COM_IRQHandler TIM1_CC_IRQHandler LPTIM1_IRQHandler TIM14_IRQHandler I2C1_IRQHandler SPI1_IRQHandler USART1_IRQHandler B . ENDP ALIGN ; User Initial Stack & Heap IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,258
Projects/PY32F002B-STK/Example/PWR/PWR_STOP_WFE/EWARM/startup_py32f002bxx.s
;****************************************************************************** ;* @file startup_py32f002bxx.s ;* @author MCU Application Team ;* @brief PY32F002Bxx devices vector table for EWARM toolchain. ;* This module performs: ;* - Set the initial SP ;* - Set the initial PC == __iar_program_start ;* - Set the vector table entries with the exceptions ISR address ;* - Branches to __main in the C library (which eventually ;* calls main()). ;* After Reset the CortexM0+ processor is in Thread mode, ;* priority is Privileged, and the Stack is set to Main. ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by Puya under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ;* @attention ;* ;* <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. ;* All rights reserved.</center></h2> ;* ;* This software component is licensed by ST under BSD 3-Clause license, ;* the "License"; You may not use this file except in compliance with the ;* License. You may obtain a copy of the License at: ;* opensource.org/licenses/BSD-3-Clause ;* ;****************************************************************************** ; ; The modules in this file are included in the libraries, and may be replaced ; by any user-defined modules that define the PUBLIC symbol _program_start or ; a user defined start symbol. ; To override the cstartup defined in the library, simply add your modified ; version to the workbench project. ; ; The vector table is normally located at address 0. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6. ; The name "__vector_table" has special meaning for C-SPY: ; it is where the SP start value is found, and the NVIC vector ; table register (VTOR) is initialized to this address if != 0. ; ; Cortex-M version ; MODULE ?cstartup ;; Forward declaration of sections. SECTION CSTACK:DATA:NOROOT(3) SECTION .intvec:CODE:NOROOT(2) EXTERN __iar_program_start EXTERN SystemInit PUBLIC __vector_table DATA __vector_table DCD sfe(CSTACK) ; Top of Stack DCD Reset_Handler ; Reset Handler DCD NMI_Handler ; NMI Handler DCD HardFault_Handler ; Hard Fault Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD 0 ; Reserved DCD SVC_Handler ; SVCall Handler DCD 0 ; Reserved DCD 0 ; Reserved DCD PendSV_Handler ; PendSV Handler DCD SysTick_Handler ; SysTick Handler ; External Interrupts DCD 0 ; 0Reserved DCD 0 ; 1Reserved DCD 0 ; 2Reserved DCD FLASH_IRQHandler ; 3FLASH DCD RCC_IRQHandler ; 4RCC DCD EXTI0_1_IRQHandler ; 5EXTI Line 0 and 1 DCD EXTI2_3_IRQHandler ; 6EXTI Line 2 and 3 DCD EXTI4_15_IRQHandler ; 7EXTI Line 4 to 15 DCD 0 ; 8Reserved DCD 0 ; 9Reserved DCD 0 ; 10Reserved DCD 0 ; 11Reserved DCD ADC_COMP_IRQHandler ; 12ADC&COMP1 DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; 13TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; 14TIM1 Capture Compare DCD 0 ; 15Reserved DCD 0 ; 16Reserved DCD LPTIM1_IRQHandler ; 17LPTIM1 DCD 0 ; 18Reserved DCD TIM14_IRQHandler ; 19TIM14 DCD 0 ; 20Reserved DCD 0 ; 21Reserved DCD 0 ; 22Reserved DCD I2C1_IRQHandler ; 23I2C1 DCD 0 ; 24Reserved DCD SPI1_IRQHandler ; 25SPI1 DCD 0 ; 26Reserved DCD USART1_IRQHandler ; 27USART1 DCD 0 ; 28Reserved DCD 0 ; 29Reserved DCD 0 ; 30Reserved DCD 0 ; 31Reserved ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Default interrupt handlers. ;; THUMB PUBWEAK Reset_Handler SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 LDR R0, =__iar_program_start BX R0 PUBWEAK NMI_Handler SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler PUBWEAK HardFault_Handler SECTION .text:CODE:REORDER:NOROOT(1) HardFault_Handler B HardFault_Handler PUBWEAK SVC_Handler SECTION .text:CODE:REORDER:NOROOT(1) SVC_Handler B SVC_Handler PUBWEAK PendSV_Handler SECTION .text:CODE:REORDER:NOROOT(1) PendSV_Handler B PendSV_Handler PUBWEAK SysTick_Handler SECTION .text:CODE:REORDER:NOROOT(1) SysTick_Handler B SysTick_Handler PUBWEAK FLASH_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) FLASH_IRQHandler B FLASH_IRQHandler PUBWEAK RCC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) RCC_IRQHandler B RCC_IRQHandler PUBWEAK EXTI0_1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI0_1_IRQHandler B EXTI0_1_IRQHandler PUBWEAK EXTI2_3_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI2_3_IRQHandler B EXTI2_3_IRQHandler PUBWEAK EXTI4_15_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) EXTI4_15_IRQHandler B EXTI4_15_IRQHandler PUBWEAK ADC_COMP_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) ADC_COMP_IRQHandler B ADC_COMP_IRQHandler PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_BRK_UP_TRG_COM_IRQHandler B TIM1_BRK_UP_TRG_COM_IRQHandler PUBWEAK TIM1_CC_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM1_CC_IRQHandler B TIM1_CC_IRQHandler PUBWEAK LPTIM1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) LPTIM1_IRQHandler B LPTIM1_IRQHandler PUBWEAK TIM14_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) TIM14_IRQHandler B TIM14_IRQHandler PUBWEAK I2C1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) I2C1_IRQHandler B I2C1_IRQHandler PUBWEAK SPI1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) SPI1_IRQHandler B SPI1_IRQHandler PUBWEAK USART1_IRQHandler SECTION .text:CODE:REORDER:NOROOT(1) USART1_IRQHandler B USART1_IRQHandler END ;************************ (C) COPYRIGHT Puya *****END OF FILE*******************
OpenPuya/PY32F002B_Firmware
8,776
Projects/PY32F002B-STK/Example/PWR/PWR_STOP_WFE/EIDE/startup_py32f002bxx.s
/** ****************************************************************************** * @file startup_py32f002bxx.s * @author MCD Application Team * @brief PY32F002Bxx devices vector table GCC toolchain. * This module performs: * - Set the initial SP * - Set the initial PC == Reset_Handler, * - Set the vector table entries with the exceptions ISR address * - Branches to main in the C library (which eventually * calls main()). * After Reset the Cortex-M0+ processor is in Thread mode, * priority is Privileged, and the Stack is set to Main. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co. * All rights reserved.</center></h2> * * This software component is licensed by Puya under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ .syntax unified .cpu cortex-m0plus .fpu softvfp .thumb .global g_pfnVectors .global Default_Handler /* start address for the initialization values of the .data section. defined in linker script */ .word _sidata /* start address for the .data section. defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata /* start address for the .bss section. defined in linker script */ .word _sbss /* end address for the .bss section. defined in linker script */ .word _ebss /** * @brief This is the code that gets called when the processor first * starts execution following a reset event. Only the absolutely * necessary set is performed, after which the application * supplied main() routine is called. * @param None * @retval None */ .section .text.Reset_Handler .weak Reset_Handler .type Reset_Handler, %function Reset_Handler: ldr r0, =_estack mov sp, r0 /* set stack pointer */ /* Call the clock system initialization function.*/ bl SystemInit /* Copy the data segment initializers from flash to SRAM */ ldr r0, =_sdata ldr r1, =_edata ldr r2, =_sidata movs r3, #0 b LoopCopyDataInit CopyDataInit: ldr r4, [r2, r3] str r4, [r0, r3] adds r3, r3, #4 LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss movs r3, #0 b LoopFillZerobss FillZerobss: str r3, [r2] adds r2, r2, #4 LoopFillZerobss: cmp r2, r4 bcc FillZerobss /* Call static constructors */ bl __libc_init_array /* Call the application s entry point.*/ bl main LoopForever: b LoopForever .size Reset_Handler, .-Reset_Handler /** * @brief This is the code that gets called when the processor receives an * unexpected interrupt. This simply enters an infinite loop, preserving * the system state for examination by a debugger. * * @param None * @retval None */ .section .text.Default_Handler,"ax",%progbits Default_Handler: Infinite_Loop: b Infinite_Loop .size Default_Handler, .-Default_Handler /****************************************************************************** * * The minimal vector table for a Cortex M0. Note that the proper constructs * must be placed on this to ensure that it ends up at physical address * 0x0000.0000. * ******************************************************************************/ .section .isr_vector,"a",%progbits .type g_pfnVectors, %object .size g_pfnVectors, .-g_pfnVectors g_pfnVectors: .word _estack .word Reset_Handler .word NMI_Handler .word HardFault_Handler .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word 0 .word SVC_Handler .word 0 .word 0 .word PendSV_Handler .word SysTick_Handler .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word FLASH_IRQHandler /* FLASH */ .word RCC_IRQHandler /* RCC */ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word ADC_COMP_IRQHandler /* ADC and COMP1 */ .word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */ .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */ .word 0 /* reserved */ .word 0 /* reserved */ .word LPTIM1_IRQHandler /* LPTIM1 */ .word 0 /* reserved */ .word TIM14_IRQHandler /* TIM14 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word I2C1_IRQHandler /* I2C1 */ .word 0 /* reserved */ .word SPI1_IRQHandler /* SPI1 */ .word 0 /* reserved */ .word USART1_IRQHandler /* USART1 */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ .word 0 /* reserved */ /******************************************************************************* * * Provide weak aliases for each Exception handler to the Default_Handler. * As they are weak aliases, any function with the same name will override * this definition. * *******************************************************************************/ .weak NMI_Handler .thumb_set NMI_Handler,Default_Handler .weak HardFault_Handler .thumb_set HardFault_Handler,Default_Handler .weak SVC_Handler .thumb_set SVC_Handler,Default_Handler .weak PendSV_Handler .thumb_set PendSV_Handler,Default_Handler .weak SysTick_Handler .thumb_set SysTick_Handler,Default_Handler .weak FLASH_IRQHandler .thumb_set FLASH_IRQHandler,Default_Handler .weak RCC_IRQHandler .thumb_set RCC_IRQHandler,Default_Handler .weak EXTI0_1_IRQHandler .thumb_set EXTI0_1_IRQHandler,Default_Handler .weak EXTI2_3_IRQHandler .thumb_set EXTI2_3_IRQHandler,Default_Handler .weak EXTI4_15_IRQHandler .thumb_set EXTI4_15_IRQHandler,Default_Handler .weak ADC_COMP_IRQHandler .thumb_set ADC_COMP_IRQHandler,Default_Handler .weak TIM1_BRK_UP_TRG_COM_IRQHandler .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler .weak TIM1_CC_IRQHandler .thumb_set TIM1_CC_IRQHandler,Default_Handler .weak LPTIM1_IRQHandler .thumb_set LPTIM1_IRQHandler,Default_Handler .weak TIM14_IRQHandler .thumb_set TIM14_IRQHandler,Default_Handler .weak I2C1_IRQHandler .thumb_set I2C1_IRQHandler,Default_Handler .weak SPI1_IRQHandler .thumb_set SPI1_IRQHandler,Default_Handler .weak USART1_IRQHandler .thumb_set USART1_IRQHandler,Default_Handler
opensource-apple/dyld
8,873
src/threadLocalHelpers.s
/* * Copyright (c) 2010-2013 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #include <System/machine/cpu_capabilities.h> // bool save_xxm = (*((uint32_t*)_COMM_PAGE_CPU_CAPABILITIES) & kHasAVX1_0) != 0; #if __x86_64__ #define RDI_SAVE_RBP -8 #define RSI_SAVE_RBP -16 #define RDX_SAVE_RBP -24 #define RCX_SAVE_RBP -32 #define RBX_SAVE_RBP -40 #define R8_SAVE_RBP -48 #define R9_SAVE_RBP -56 #define R10_SAVE_RBP -64 #define R11_SAVE_RBP -72 #define STATIC_STACK_SIZE 256 // extra padding to allow it to be 64-byte aligned #define XMM0_SAVE_RSP 0x00 #define XMM1_SAVE_RSP 0x10 #define XMM2_SAVE_RSP 0x20 #define XMM3_SAVE_RSP 0x30 #define XMM4_SAVE_RSP 0x40 #define XMM5_SAVE_RSP 0x50 #define XMM6_SAVE_RSP 0x60 #define XMM7_SAVE_RSP 0x70 // returns address of TLV in %rax, all other registers preserved .globl _tlv_get_addr .private_extern _tlv_get_addr _tlv_get_addr: movq 8(%rdi),%rax // get key from descriptor movq %gs:0x0(,%rax,8),%rax // get thread value testq %rax,%rax // if NULL, lazily allocate je LlazyAllocate addq 16(%rdi),%rax // add offset from descriptor ret LlazyAllocate: pushq %rbp movq %rsp,%rbp subq $STATIC_STACK_SIZE,%rsp movq %rdi,RDI_SAVE_RBP(%rbp) # save registers that might be used as parameters movq %rsi,RSI_SAVE_RBP(%rbp) movq %rdx,RDX_SAVE_RBP(%rbp) movq %rcx,RCX_SAVE_RBP(%rbp) movq %rbx,RBX_SAVE_RBP(%rbp) movq %r8, R8_SAVE_RBP(%rbp) movq %r9, R9_SAVE_RBP(%rbp) movq %r10,R10_SAVE_RBP(%rbp) movq %r11,R11_SAVE_RBP(%rbp) cmpl $0, _inited(%rip) jne Linited movl $0x01,%eax cpuid # get cpu features to check on xsave instruction support andl $0x08000000,%ecx # check OSXSAVE bit movl %ecx,_hasXSave(%rip) cmpl $0, %ecx jne LxsaveInfo movl $1, _inited(%rip) jmp Lsse LxsaveInfo: movl $0x0D,%eax movl $0x00,%ecx cpuid # get xsave parameter info movl %eax,_features_lo32(%rip) movl %edx,_features_hi32(%rip) movl %ecx,_bufferSize32(%rip) movl $1, _inited(%rip) Linited: cmpl $0, _hasXSave(%rip) jne Lxsave Lsse: subq $128, %rsp movdqa %xmm0, XMM0_SAVE_RSP(%rsp) movdqa %xmm1, XMM1_SAVE_RSP(%rsp) movdqa %xmm2, XMM2_SAVE_RSP(%rsp) movdqa %xmm3, XMM3_SAVE_RSP(%rsp) movdqa %xmm4, XMM4_SAVE_RSP(%rsp) movdqa %xmm5, XMM5_SAVE_RSP(%rsp) movdqa %xmm6, XMM6_SAVE_RSP(%rsp) movdqa %xmm7, XMM7_SAVE_RSP(%rsp) jmp Lalloc Lxsave: movl _bufferSize32(%rip),%eax movq %rsp, %rdi subq %rax, %rdi # stack alloc buffer andq $-64, %rdi # 64-byte align stack movq %rdi, %rsp # xsave requires buffer to be zero'ed out movq $0, %rcx movq %rdi, %r8 movq %rdi, %r9 addq %rax, %r9 Lz: movq %rcx, (%r8) addq $8, %r8 cmpq %r8,%r9 ja Lz movl _features_lo32(%rip),%eax movl _features_hi32(%rip),%edx # call xsave with buffer on stack and eax:edx flag bits # note: do not use xsaveopt, it assumes you are using the same # buffer as previous xsaves, and this thread is on the same cpu. xsave (%rsp) Lalloc: movq RDI_SAVE_RBP(%rbp),%rdi movq 8(%rdi),%rdi // get key from descriptor call _tlv_allocate_and_initialize_for_key cmpl $0, _hasXSave(%rip) jne Lxrstror movdqa XMM0_SAVE_RSP(%rsp),%xmm0 movdqa XMM1_SAVE_RSP(%rsp),%xmm1 movdqa XMM2_SAVE_RSP(%rsp),%xmm2 movdqa XMM3_SAVE_RSP(%rsp),%xmm3 movdqa XMM4_SAVE_RSP(%rsp),%xmm4 movdqa XMM5_SAVE_RSP(%rsp),%xmm5 movdqa XMM6_SAVE_RSP(%rsp),%xmm6 movdqa XMM7_SAVE_RSP(%rsp),%xmm7 jmp Ldone Lxrstror: movq %rax,%r11 movl _features_lo32(%rip),%eax movl _features_hi32(%rip),%edx # call xsave with buffer on stack and eax:edx flag bits xrstor (%rsp) movq %r11,%rax Ldone: movq RDI_SAVE_RBP(%rbp),%rdi movq RSI_SAVE_RBP(%rbp),%rsi movq RDX_SAVE_RBP(%rbp),%rdx movq RCX_SAVE_RBP(%rbp),%rcx movq RBX_SAVE_RBP(%rbp),%rbx movq R8_SAVE_RBP(%rbp),%r8 movq R9_SAVE_RBP(%rbp),%r9 movq R10_SAVE_RBP(%rbp),%r10 movq R11_SAVE_RBP(%rbp),%r11 movq %rbp,%rsp popq %rbp addq 16(%rdi),%rax // result = buffer + offset ret .data # Cached info from cpuid. _inited: .long 0 _features_lo32: .long 0 _features_hi32: .long 0 _bufferSize32: .long 0 _hasXSave: .long 0 #endif #if __i386__ // returns address of TLV in %eax, all other registers (except %ecx) preserved .globl _tlv_get_addr .private_extern _tlv_get_addr _tlv_get_addr: movl 4(%eax),%ecx // get key from descriptor movl %gs:0x0(,%ecx,4),%ecx // get thread value testl %ecx,%ecx // if NULL, lazily allocate je LlazyAllocate movl 8(%eax),%eax // add offset from descriptor addl %ecx,%eax ret LlazyAllocate: pushl %ebp movl %esp,%ebp pushl %edx // save edx subl $548,%esp movl %eax,-8(%ebp) // save descriptor lea -528(%ebp),%ecx // get 512 byte buffer in frame and $-16, %ecx // 16-byte align buffer for fxsave fxsave (%ecx) movl 4(%eax),%ecx // get key from descriptor movl %ecx,(%esp) // push key parameter, also leaves stack aligned properly call _tlv_allocate_and_initialize_for_key movl -8(%ebp),%ecx // get descriptor movl 8(%ecx),%ecx // get offset from descriptor addl %ecx,%eax // add offset to buffer lea -528(%ebp),%ecx and $-16, %ecx // 16-byte align buffer for fxrstor fxrstor (%ecx) addl $548,%esp popl %edx // restore edx popl %ebp ret #endif #if __arm64__ // Parameters: X0 = descriptor // Result: X0 = address of TLV // Note: all registers except X0, x16, and x17 are preserved .align 2 .globl _tlv_get_addr .private_extern _tlv_get_addr _tlv_get_addr: ldr x16, [x0, #8] // get key from descriptor mrs x17, TPIDRRO_EL0 and x17, x17, #-8 // clear low 3 bits??? ldr x17, [x17, x16, lsl #3] // get thread allocation address for this key cbz x17, LlazyAllocate // if NULL, lazily allocate ldr x16, [x0, #16] // get offset from descriptor add x0, x17, x16 // return allocation+offset ret lr LlazyAllocate: stp fp, lr, [sp, #-16]! mov fp, sp sub sp, sp, #288 stp x1, x2, [sp, #-16]! // save all registers that C function might trash stp x3, x4, [sp, #-16]! stp x5, x6, [sp, #-16]! stp x7, x8, [sp, #-16]! stp x9, x10, [sp, #-16]! stp x11, x12, [sp, #-16]! stp x13, x14, [sp, #-16]! stp x15, x16, [sp, #-16]! stp q0, q1, [sp, #-32]! stp q2, q3, [sp, #-32]! stp q4, q5, [sp, #-32]! stp q6, q7, [sp, #-32]! stp x0, x17, [sp, #-16]! // save descriptor mov x0, x16 // use key from descriptor as parameter bl _tlv_allocate_and_initialize_for_key ldp x16, x17, [sp], #16 // pop descriptor ldr x16, [x16, #16] // get offset from descriptor add x0, x0, x16 // return allocation+offset ldp q6, q7, [sp], #32 ldp q4, q5, [sp], #32 ldp q2, q3, [sp], #32 ldp q0, q1, [sp], #32 ldp x15, x16, [sp], #16 ldp x13, x14, [sp], #16 ldp x11, x12, [sp], #16 ldp x9, x10, [sp], #16 ldp x7, x8, [sp], #16 ldp x5, x6, [sp], #16 ldp x3, x4, [sp], #16 ldp x1, x2, [sp], #16 mov sp, fp ldp fp, lr, [sp], #16 ret lr #endif #if __arm__ // returns address of TLV in r0, all other registers preserved .globl _tlv_get_addr .private_extern _tlv_get_addr _tlv_get_addr: push {r1,r2,r3,r7,lr} #if __ARM_ARCH_7K__ sub sp, sp, #12 // align stack to 16 bytes #endif mov r7, r0 // save descriptor in r7 ldr r0, [r7, #4] // get key from descriptor bl _pthread_getspecific // get thread value cmp r0, #0 bne L2 // if NULL, lazily allocate #if __ARM_ARCH_7K__ vpush {d0, d1, d2, d3, d4, d5, d6, d7} #endif ldr r0, [r7, #4] // get key from descriptor bl _tlv_allocate_and_initialize_for_key #if __ARM_ARCH_7K__ vpop {d0, d1, d2, d3, d4, d5, d6, d7} #endif L2: ldr r1, [r7, #8] // get offset from descriptor add r0, r1, r0 // add offset into allocation block #if __ARM_ARCH_7K__ add sp, sp, #12 #endif pop {r1,r2,r3,r7,pc} #endif .subsections_via_symbols
opensource-apple/dyld
7,125
src/stub_binding_helper.s
/* * Copyright (c) 1999-2006 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifdef __i386__ /* * This is the interface for the stub_binding_helper for i386: * The caller has pushed the address of the a lazy pointer to be filled in * and pushed the address of the the mach header this pointer comes from. * * sp+4 address of lazy pointer * sp+0 address of mach header * * Some inter-image function calls pass parameters in registers EAX, ECX, EDX, or XXM0-3, * Therefore those registers need to be preserved during the lazy binding. * * After the symbol has been resolved and the lazy pointer filled in, this jumps * to the target address. */ #define MH_PARAM_OUT 0 #define LP_PARAM_OUT 4 #define XMMM0_SAVE 16 /* 16-byte align */ #define XMMM1_SAVE 32 #define XMMM2_SAVE 48 #define XMMM3_SAVE 64 #define EAX_SAVE 84 #define ECX_SAVE 88 #define EDX_SAVE 92 #define LP_LOCAL 96 #define MH_LOCAL 100 #define STACK_SIZE 100 /* must be 4 mod 16 so that stack winds up 16-byte aliged */ #define LP_OLD_BP_SAVE 104 .text .align 4,0x90 .globl _stub_binding_helper_i386_old _stub_binding_helper_i386_old: pushl $0 .globl _stub_binding_helper .globl _misaligned_stack_error _stub_binding_helper: subl $STACK_SIZE,%esp # makes stack 16-byte aligned movl %eax,EAX_SAVE(%esp) movl LP_OLD_BP_SAVE(%esp),%eax # get lazy-pointer meta-parameter movl %eax,LP_LOCAL(%esp) movl %ebp,LP_OLD_BP_SAVE(%esp) # store epb back chain movl %esp,%ebp # set epb to be this frame add $LP_OLD_BP_SAVE,%ebp movl %ecx,ECX_SAVE(%esp) movl %edx,EDX_SAVE(%esp) .align 0,0x90 _misaligned_stack_error: movdqa %xmm0,XMMM0_SAVE(%esp) movdqa %xmm1,XMMM1_SAVE(%esp) movdqa %xmm2,XMMM2_SAVE(%esp) movdqa %xmm3,XMMM3_SAVE(%esp) _stub_binding_helper_interface2: movl MH_LOCAL(%esp),%eax # call dyld::bindLazySymbol(mh, lazy_ptr) movl %eax,MH_PARAM_OUT(%esp) movl LP_LOCAL(%esp),%eax movl %eax,LP_PARAM_OUT(%esp) call __ZN4dyld14bindLazySymbolEPK11mach_headerPm movdqa XMMM0_SAVE(%esp),%xmm0 # restore registers movdqa XMMM1_SAVE(%esp),%xmm1 movdqa XMMM2_SAVE(%esp),%xmm2 movdqa XMMM3_SAVE(%esp),%xmm3 movl ECX_SAVE(%esp),%ecx movl EDX_SAVE(%esp),%edx movl %eax,%ebp # move target address to epb movl EAX_SAVE(%esp),%eax # restore eaz addl $STACK_SIZE+4,%esp # cut back stack xchg %ebp, (%esp) # restore ebp and set target to top of stack ret # jump to target #endif /* __i386__ */ #if __x86_64__ /* * This is the interface for the stub_binding_helper for x86_64: * The caller has pushed the address of the a lazy pointer to be filled in with * the value for the defined symbol and pushed the address of the the mach * header this pointer comes from. * * sp+8 address of lazy pointer * sp+0 address of mach header * * All parameters registers must be preserved. * * After the symbol has been resolved and the pointer filled in this is to pop * these arguments off the stack and jump to the address of the defined symbol. */ #define MH_PARAM_BP 8 #define LP_PARAM_BP 16 #define RDI_SAVE 0 #define RSI_SAVE 8 #define RDX_SAVE 16 #define RCX_SAVE 24 #define R8_SAVE 32 #define R9_SAVE 40 #define RAX_SAVE 48 #define XMMM0_SAVE 64 /* 16-byte align */ #define XMMM1_SAVE 80 #define XMMM2_SAVE 96 #define XMMM3_SAVE 112 #define XMMM4_SAVE 128 #define XMMM5_SAVE 144 #define XMMM6_SAVE 160 #define XMMM7_SAVE 176 #define STACK_SIZE 192 /* (XMMM7_SAVE+16) must be 16 byte aligned too */ .text .align 2,0x90 .globl _stub_binding_helper _stub_binding_helper: pushq %rbp movq %rsp,%rbp subq $STACK_SIZE,%rsp # at this point stack is 16-byte aligned because two meta-parameters where pushed movq %rdi,RDI_SAVE(%rsp) # save registers that might be used as parameters movq %rsi,RSI_SAVE(%rsp) movq %rdx,RDX_SAVE(%rsp) movq %rcx,RCX_SAVE(%rsp) movq %r8,R8_SAVE(%rsp) movq %r9,R9_SAVE(%rsp) movq %rax,RAX_SAVE(%rsp) movdqa %xmm0,XMMM0_SAVE(%rsp) movdqa %xmm1,XMMM1_SAVE(%rsp) movdqa %xmm2,XMMM2_SAVE(%rsp) movdqa %xmm3,XMMM3_SAVE(%rsp) movdqa %xmm4,XMMM4_SAVE(%rsp) movdqa %xmm5,XMMM5_SAVE(%rsp) movdqa %xmm6,XMMM6_SAVE(%rsp) movdqa %xmm7,XMMM7_SAVE(%rsp) movq MH_PARAM_BP(%rbp),%rdi # call dyld::bindLazySymbol(mh, lazy_ptr) movq LP_PARAM_BP(%rbp),%rsi call __ZN4dyld14bindLazySymbolEPK11mach_headerPm movq %rax,%r11 # save target movdqa XMMM0_SAVE(%rsp),%xmm0 # restore registers movdqa XMMM1_SAVE(%rsp),%xmm1 movdqa XMMM2_SAVE(%rsp),%xmm2 movdqa XMMM3_SAVE(%rsp),%xmm3 movdqa XMMM4_SAVE(%rsp),%xmm4 movdqa XMMM5_SAVE(%rsp),%xmm5 movdqa XMMM6_SAVE(%rsp),%xmm6 movdqa XMMM7_SAVE(%rsp),%xmm7 movq RDI_SAVE(%rsp),%rdi movq RSI_SAVE(%rsp),%rsi movq RDX_SAVE(%rsp),%rdx movq RCX_SAVE(%rsp),%rcx movq R8_SAVE(%rsp),%r8 movq R9_SAVE(%rsp),%r9 movq RAX_SAVE(%rsp),%rax addq $STACK_SIZE,%rsp popq %rbp addq $16,%rsp # remove meta-parameters jmp *%r11 # jmp to target #endif #if __arm__ && !__ARM_ARCH_7K__ /* * This is the interface for the old stub_binding_helper for ARM: * The caller has pushed the address of the a lazy pointer to be filled in with * the value for the defined symbol and pushed the address of the the mach * header this pointer comes from. * * sp+4 address of lazy pointer * sp+0 address of mach header * * After the symbol has been resolved and the pointer filled in this is to pop * these arguments off the stack and jump to the address of the defined symbol. */ .text .align 2 .globl _stub_binding_helper _stub_binding_helper: stmfd sp!, {r0,r1,r2,r3,r7,lr} // save registers add r7, sp, #16 // point FP to previous FP ldr r0, [sp, #24] // move address of mach header to 1st parameter ldr r1, [sp, #28] // move address of lazy pointer to 2nd parameter // call dyld::bindLazySymbol(mh, lazy_symbol_pointer_address) bl __ZN4dyld14bindLazySymbolEPK11mach_headerPm mov ip, r0 // move the symbol`s address into ip ldmfd sp!, {r0,r1,r2,r3,r7,lr} // restore registers add sp, sp, #8 // remove meta-parameters bx ip // jump to the symbol`s address that was bound #endif /* __arm__ */
opensource-apple/dyld
10,313
src/dyldStartup.s
/* * Copyright (c) 1999-2011 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ /* * C runtime startup for interface to the dynamic linker. * This is the same as the entry point in crt0.o with the addition of the * address of the mach header passed as the an extra first argument. * * Kernel sets up stack frame to look like: * * | STRING AREA | * +-------------+ * | 0 | * +-------------+ * | apple[n] | * +-------------+ * : * +-------------+ * | apple[0] | * +-------------+ * | 0 | * +-------------+ * | env[n] | * +-------------+ * : * : * +-------------+ * | env[0] | * +-------------+ * | 0 | * +-------------+ * | arg[argc-1] | * +-------------+ * : * : * +-------------+ * | arg[0] | * +-------------+ * | argc | * +-------------+ * sp-> | mh | address of where the a.out's file offset 0 is in memory * +-------------+ * * Where arg[i] and env[i] point into the STRING AREA */ #include <TargetConditionals.h> .globl __dyld_start #ifdef __i386__ #if !TARGET_IPHONE_SIMULATOR .text .align 4, 0x90 .globl __dyld_start __dyld_start: popl %edx # edx = mh of app pushl $0 # push a zero for debugger end of frames marker movl %esp,%ebp # pointer to base of kernel frame andl $-16,%esp # force SSE alignment subl $32,%esp # room for locals and outgoing parameters call L__dyld_start_picbase L__dyld_start_picbase: popl %ebx # set %ebx to runtime value of picbase movl Lmh-L__dyld_start_picbase(%ebx), %ecx # ecx = prefered load address movl __dyld_start_static_picbase-L__dyld_start_picbase(%ebx), %eax subl %eax, %ebx # ebx = slide = L__dyld_start_picbase - [__dyld_start_static_picbase] addl %ebx, %ecx # ecx = actual load address # call dyldbootstrap::start(app_mh, argc, argv, slide, dyld_mh, &startGlue) movl %edx,(%esp) # param1 = app_mh movl 4(%ebp),%eax movl %eax,4(%esp) # param2 = argc lea 8(%ebp),%eax movl %eax,8(%esp) # param3 = argv movl %ebx,12(%esp) # param4 = slide movl %ecx,16(%esp) # param5 = actual load address lea 28(%esp),%eax movl %eax,20(%esp) # param6 = &startGlue call __ZN13dyldbootstrap5startEPK12macho_headeriPPKclS2_Pm movl 28(%esp),%edx cmpl $0,%edx jne Lnew # clean up stack and jump to "start" in main executable movl %ebp,%esp # restore the unaligned stack pointer addl $4,%esp # remove debugger end frame marker movl $0,%ebp # restore ebp back to zero jmp *%eax # jump to the entry point # LC_MAIN case, set up stack for call to main() Lnew: movl 4(%ebp),%ebx movl %ebx,(%esp) # main param1 = argc leal 8(%ebp),%ecx movl %ecx,4(%esp) # main param2 = argv leal 0x4(%ecx,%ebx,4),%ebx movl %ebx,8(%esp) # main param3 = env Lapple: movl (%ebx),%ecx # look for NULL ending env[] array add $4,%ebx testl %ecx,%ecx jne Lapple # once found, next pointer is "apple" parameter now in %ebx movl %ebx,12(%esp) # main param4 = apple pushl %edx # simulate return address into _start in libdyld jmp *%eax # jump to main(argc,argv,env,apple) with return address set to _start #endif #if !TARGET_IPHONE_SIMULATOR .data __dyld_start_static_picbase: .long L__dyld_start_picbase Lmh: .long ___dso_handle #endif #endif /* __i386__ */ #if __x86_64__ #if !TARGET_IPHONE_SIMULATOR .data .align 3 __dyld_start_static: .quad __dyld_start #endif #if !TARGET_IPHONE_SIMULATOR .text .align 2,0x90 .globl __dyld_start __dyld_start: popq %rdi # param1 = mh of app pushq $0 # push a zero for debugger end of frames marker movq %rsp,%rbp # pointer to base of kernel frame andq $-16,%rsp # force SSE alignment subq $16,%rsp # room for local variables # call dyldbootstrap::start(app_mh, argc, argv, slide, dyld_mh, &startGlue) movl 8(%rbp),%esi # param2 = argc into %esi leaq 16(%rbp),%rdx # param3 = &argv[0] into %rdx movq __dyld_start_static(%rip), %r8 leaq __dyld_start(%rip), %rcx subq %r8, %rcx # param4 = slide into %rcx leaq ___dso_handle(%rip),%r8 # param5 = dyldsMachHeader leaq -8(%rbp),%r9 call __ZN13dyldbootstrap5startEPK12macho_headeriPPKclS2_Pm movq -8(%rbp),%rdi cmpq $0,%rdi jne Lnew # clean up stack and jump to "start" in main executable movq %rbp,%rsp # restore the unaligned stack pointer addq $8,%rsp # remove the mh argument, and debugger end frame marker movq $0,%rbp # restore ebp back to zero jmp *%rax # jump to the entry point # LC_MAIN case, set up stack for call to main() Lnew: addq $16,%rsp # remove local variables pushq %rdi # simulate return address into _start in libdyld movq 8(%rbp),%rdi # main param1 = argc into %rdi leaq 16(%rbp),%rsi # main param2 = &argv[0] into %rsi leaq 0x8(%rsi,%rdi,8),%rdx # main param3 = &env[0] into %rdx movq %rdx,%rcx Lapple: movq (%rcx),%r8 add $8,%rcx testq %r8,%r8 # look for NULL ending env[] array jne Lapple # main param4 = apple into %rcx jmp *%rax # jump to main(argc,argv,env,apple) with return address set to _start #endif /* TARGET_IPHONE_SIMULATOR */ #endif /* __x86_64__ */ #if __arm__ .syntax unified .data .align 2 __dyld_start_static_picbase: .long L__dyld_start_picbase // Hack to make ___dso_handle work // Without this local symbol, assembler will error out about in subtraction expression // The real ___dso_handle (non-weak) sythesized by the linker // Since this one is weak, the linker will throw this one away and use the real one instead. .data .globl ___dso_handle .weak_definition ___dso_handle ___dso_handle: .long 0 .text .align 2 __dyld_start: mov r8, sp // save stack pointer sub sp, #16 // make room for outgoing parameters bic sp, sp, #15 // force 16-byte alignment // call dyldbootstrap::start(app_mh, argc, argv, slide, dyld_mh, &startGlue) ldr r3, L__dyld_start_picbase_ptr L__dyld_start_picbase: sub r0, pc, #8 // load actual PC ldr r3, [r0, r3] // load expected PC sub r3, r0, r3 // r3 = slide ldr r0, [r8] // r0 = mach_header ldr r1, [r8, #4] // r1 = argc add r2, r8, #8 // r2 = argv ldr r4, Lmh L3: add r4, r4, pc str r4, [sp, #0] // [sp] = dyld_mh add r4, sp, #12 str r4, [sp, #4] // [sp+4] = &startGlue bl __ZN13dyldbootstrap5startEPK12macho_headeriPPKclS2_Pm ldr r5, [sp, #12] cmp r5, #0 bne Lnew // traditional case, clean up stack and jump to result add sp, r8, #4 // remove the mach_header argument. bx r0 // jump to the program's entry point // LC_MAIN case, set up stack for call to main() Lnew: mov lr, r5 // simulate return address into _start in libdyld mov r5, r0 // save address of main() for later use ldr r0, [r8, #4] // main param1 = argc add r1, r8, #8 // main param2 = argv add r2, r1, r0, lsl #2 add r2, r2, #4 // main param3 = &env[0] mov r3, r2 Lapple: ldr r4, [r3] add r3, #4 cmp r4, #0 bne Lapple // main param4 = apple bx r5 .align 2 L__dyld_start_picbase_ptr: .long __dyld_start_static_picbase-L__dyld_start_picbase Lmh: .long ___dso_handle-L3-8 #endif /* __arm__ */ #if __arm64__ .data .align 3 __dso_static: .quad ___dso_handle .text .align 2 .globl __dyld_start __dyld_start: mov x28, sp and sp, x28, #~15 // force 16-byte alignment of stack mov x0, #0 mov x1, #0 stp x1, x0, [sp, #-16]! // make aligned terminating frame mov fp, sp // set up fp to point to terminating frame sub sp, sp, #16 // make room for local variables ldr x0, [x28] // get app's mh into x0 ldr x1, [x28, #8] // get argc into x1 (kernel passes 32-bit int argc as 64-bits on stack to keep alignment) add x2, x28, #16 // get argv into x2 adrp x4,___dso_handle@page add x4,x4,___dso_handle@pageoff // get dyld's mh in to x4 adrp x3,__dso_static@page ldr x3,[x3,__dso_static@pageoff] // get unslid start of dyld sub x3,x4,x3 // x3 now has slide of dyld mov x5,sp // x5 has &startGlue // call dyldbootstrap::start(app_mh, argc, argv, slide, dyld_mh, &startGlue) bl __ZN13dyldbootstrap5startEPK12macho_headeriPPKclS2_Pm mov x16,x0 // save entry point address in x16 ldr x1, [sp] cmp x1, #0 b.ne Lnew // LC_UNIXTHREAD way, clean up stack and jump to result add sp, x28, #8 // restore unaligned stack pointer without app mh br x16 // jump to the program's entry point // LC_MAIN case, set up stack for call to main() Lnew: mov lr, x1 // simulate return address into _start in libdyld.dylib ldr x0, [x28, #8] // main param1 = argc add x1, x28, #16 // main param2 = argv add x2, x1, x0, lsl #3 add x2, x2, #8 // main param3 = &env[0] mov x3, x2 Lapple: ldr x4, [x3] add x3, x3, #8 cmp x4, #0 b.ne Lapple // main param4 = apple br x16 #endif // __arm64__ /* * dyld calls this function to terminate a process. * It has a label so that CrashReporter can distinguish this * termination from a random crash. rdar://problem/4764143 */ .text .align 2 .globl _dyld_fatal_error _dyld_fatal_error: #if __arm__ trap nop #elif __x86_64__ || __i386__ int3 nop #elif __arm64__ brk #3 #else #error unknown architecture #endif #if __arm__ // work around for: <rdar://problem/6530727> gdb-1109: notifier in dyld does not work if it is in thumb .text .align 2 .globl _gdb_image_notifier .private_extern _gdb_image_notifier _gdb_image_notifier: bx lr #endif
opensource-apple/dyld
9,170
src/dyld_stub_binder.s
/* * Copyright (c) 2008-2013 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #include <TargetConditionals.h> #include <System/machine/cpu_capabilities.h> #ifdef __i386__ #define MH_PARAM_OUT 0 #define LP_PARAM_OUT 4 #define XMMM0_SAVE 16 /* 16-byte align */ #define XMMM1_SAVE 32 #define XMMM2_SAVE 48 #define XMMM3_SAVE 64 #define EAX_SAVE 84 #define ECX_SAVE 88 #define EDX_SAVE 92 #define LP_LOCAL 96 #define MH_LOCAL 100 #define STACK_SIZE 100 /* must be 4 mod 16 so that stack winds up 16-byte aliged */ #define LP_OLD_BP_SAVE 104 /* * sp+4 lazy binding info offset * sp+0 address of ImageLoader cache */ .text .align 4,0x90 .globl dyld_stub_binder .globl _misaligned_stack_error dyld_stub_binder: subl $STACK_SIZE,%esp # makes stack 16-byte aligned movl %eax,EAX_SAVE(%esp) movl LP_OLD_BP_SAVE(%esp),%eax # get lazy-pointer meta-parameter movl %eax,LP_LOCAL(%esp) movl %ebp,LP_OLD_BP_SAVE(%esp) # store epb back chain movl %esp,%ebp # set epb to be this frame add $LP_OLD_BP_SAVE,%ebp movl %ecx,ECX_SAVE(%esp) movl %edx,EDX_SAVE(%esp) .align 0,0x90 _misaligned_stack_error_: movdqa %xmm0,XMMM0_SAVE(%esp) movdqa %xmm1,XMMM1_SAVE(%esp) movdqa %xmm2,XMMM2_SAVE(%esp) movdqa %xmm3,XMMM3_SAVE(%esp) dyld_stub_binder_: movl MH_LOCAL(%esp),%eax # call dyld::fastBindLazySymbol(loadercache, lazyinfo) movl %eax,MH_PARAM_OUT(%esp) movl LP_LOCAL(%esp),%eax movl %eax,LP_PARAM_OUT(%esp) call __Z21_dyld_fast_stub_entryPvl movdqa XMMM0_SAVE(%esp),%xmm0 # restore registers movdqa XMMM1_SAVE(%esp),%xmm1 movdqa XMMM2_SAVE(%esp),%xmm2 movdqa XMMM3_SAVE(%esp),%xmm3 movl ECX_SAVE(%esp),%ecx movl EDX_SAVE(%esp),%edx movl %eax,%ebp # move target address to epb movl EAX_SAVE(%esp),%eax # restore eax addl $STACK_SIZE+4,%esp # cut back stack xchg %ebp, (%esp) # restore ebp and set target to top of stack ret # jump to target #endif /* __i386__ */ #if __x86_64__ #define RET_ADDR_RBP 24 #define LP_PARAM_RBP 16 #define MH_PARAM_RBP 8 #define OLD_RBP_RBP 0 #define RDI_SAVE_RBP -8 #define RSI_SAVE_RBP -16 #define RDX_SAVE_RBP -24 #define RCX_SAVE_RBP -32 #define RBX_SAVE_RBP -40 #define RAX_SAVE_RBP -48 #define R8_SAVE_RBP -56 #define R9_SAVE_RBP -64 #define STATIC_STACK_SIZE 256 // extra padding to allow it to be 64-byte aligned #define XMM0_SAVE_RSP 0x00 #define XMM1_SAVE_RSP 0x10 #define XMM2_SAVE_RSP 0x20 #define XMM3_SAVE_RSP 0x30 #define XMM4_SAVE_RSP 0x40 #define XMM5_SAVE_RSP 0x50 #define XMM6_SAVE_RSP 0x60 #define XMM7_SAVE_RSP 0x70 /* * sp+16 return address * sp+8 lazy binding info offset * sp+0 address of ImageLoader cache */ .align 2,0x90 .globl dyld_stub_binder dyld_stub_binder: pushq %rbp test $0xF,%rsp # at this point stack should be 16-byte aligned jne _stack_not_16_byte_aligned_error movq %rsp,%rbp subq $STATIC_STACK_SIZE,%rsp movq %rdi,RDI_SAVE_RBP(%rbp) # save registers that might be used as parameters movq %rsi,RSI_SAVE_RBP(%rbp) movq %rdx,RDX_SAVE_RBP(%rbp) movq %rcx,RCX_SAVE_RBP(%rbp) movq %rbx,RBX_SAVE_RBP(%rbp) movq %rax,RAX_SAVE_RBP(%rbp) movq %r8, R8_SAVE_RBP(%rbp) movq %r9, R9_SAVE_RBP(%rbp) cmpl $0, _inited(%rip) jne Linited movl $0x01,%eax cpuid # get cpu features to check on xsave instruction support andl $0x08000000,%ecx # check OSXSAVE bit movl %ecx,_hasXSave(%rip) cmpl $0, %ecx jne LxsaveInfo movl $1, _inited(%rip) jmp Lsse LxsaveInfo: movl $0x0D,%eax movl $0x00,%ecx cpuid # get xsave parameter info movl %eax,_features_lo32(%rip) movl %edx,_features_hi32(%rip) movl %ecx,_bufferSize32(%rip) movl $1, _inited(%rip) Linited: cmpl $0, _hasXSave(%rip) jne Lxsave Lsse: subq $128, %rsp movdqa %xmm0, XMM0_SAVE_RSP(%rsp) movdqa %xmm1, XMM1_SAVE_RSP(%rsp) movdqa %xmm2, XMM2_SAVE_RSP(%rsp) movdqa %xmm3, XMM3_SAVE_RSP(%rsp) movdqa %xmm4, XMM4_SAVE_RSP(%rsp) movdqa %xmm5, XMM5_SAVE_RSP(%rsp) movdqa %xmm6, XMM6_SAVE_RSP(%rsp) movdqa %xmm7, XMM7_SAVE_RSP(%rsp) jmp Lbind Lxsave: movl _bufferSize32(%rip),%eax movq %rsp, %rdi subq %rax, %rdi # stack alloc buffer andq $-64, %rdi # 64-byte align stack movq %rdi, %rsp # xsave requires buffer to be zero'ed out movq $0, %rcx movq %rdi, %r8 movq %rdi, %r9 addq %rax, %r9 Lz: movq %rcx, (%r8) addq $8, %r8 cmpq %r8,%r9 ja Lz movl _features_lo32(%rip),%eax movl _features_hi32(%rip),%edx # call xsave with buffer on stack and eax:edx flag bits # note: do not use xsaveopt, it assumes you are using the same # buffer as previous xsaves, and this thread is on the same cpu. xsave (%rsp) Lbind: movq MH_PARAM_RBP(%rbp),%rdi # call fastBindLazySymbol(loadercache, lazyinfo) movq LP_PARAM_RBP(%rbp),%rsi call __Z21_dyld_fast_stub_entryPvl movq %rax,%r11 # copy jump target cmpl $0, _hasXSave(%rip) jne Lxrstror movdqa XMM0_SAVE_RSP(%rsp),%xmm0 movdqa XMM1_SAVE_RSP(%rsp),%xmm1 movdqa XMM2_SAVE_RSP(%rsp),%xmm2 movdqa XMM3_SAVE_RSP(%rsp),%xmm3 movdqa XMM4_SAVE_RSP(%rsp),%xmm4 movdqa XMM5_SAVE_RSP(%rsp),%xmm5 movdqa XMM6_SAVE_RSP(%rsp),%xmm6 movdqa XMM7_SAVE_RSP(%rsp),%xmm7 jmp Ldone Lxrstror: movl _features_lo32(%rip),%eax movl _features_hi32(%rip),%edx # call xsave with buffer on stack and eax:edx flag bits xrstor (%rsp) Ldone: movq RDI_SAVE_RBP(%rbp),%rdi movq RSI_SAVE_RBP(%rbp),%rsi movq RDX_SAVE_RBP(%rbp),%rdx movq RCX_SAVE_RBP(%rbp),%rcx movq RBX_SAVE_RBP(%rbp),%rbx movq RAX_SAVE_RBP(%rbp),%rax movq R8_SAVE_RBP(%rbp),%r8 movq R9_SAVE_RBP(%rbp),%r9 movq %rbp,%rsp popq %rbp addq $16,%rsp # remove meta-parameters jmp *%r11 # jmp to target _stack_not_16_byte_aligned_error: movdqa %xmm0, 0(%rsp) int3 .data # Cached info from cpuid. These must be lazily evaluated. # You cannot initalize these from _dyld_initializer() because # that function is called from another dylib... _inited: .long 0 _features_lo32: .long 0 _features_hi32: .long 0 _bufferSize32: .long 0 _hasXSave: .long 0 #endif #if __arm__ /* * sp+4 lazy binding info offset * sp+0 address of ImageLoader cache */ .text .align 2 .globl dyld_stub_binder dyld_stub_binder: stmfd sp!, {r0,r1,r2,r3,r7,lr} // save registers add r7, sp, #16 // point FP to previous FP ldr r0, [sp, #24] // move address ImageLoader cache to 1st parameter ldr r1, [sp, #28] // move lazy info offset 2nd parameter #if __ARM_ARCH_7K__ vpush {d0, d1, d2, d3, d4, d5, d6, d7} sub sp, sp, #8 // Align stack to 16 bytes. #endif // call dyld::fastBindLazySymbol(loadercache, lazyinfo) bl __Z21_dyld_fast_stub_entryPvl mov ip, r0 // move the symbol`s address into ip #if __ARM_ARCH_7K__ add sp, sp, #8 vpop {d0, d1, d2, d3, d4, d5, d6, d7} #endif ldmfd sp!, {r0,r1,r2,r3,r7,lr} // restore registers add sp, sp, #8 // remove meta-parameters bx ip // jump to the symbol`s address that was bound #endif /* __arm__ */ #if __arm64__ /* * sp+0 lazy binding info offset * sp+8 address of ImageLoader cache */ .text .align 2 .globl dyld_stub_binder dyld_stub_binder: stp fp, lr, [sp, #-16]! mov fp, sp sub sp, sp, #240 stp x0,x1, [fp, #-16] ; x0-x7 are int parameter registers stp x2,x3, [fp, #-32] stp x4,x5, [fp, #-48] stp x6,x7, [fp, #-64] stp x8,x9, [fp, #-80] ; x8 is used for struct returns stp q0,q1, [fp, #-128] ; q0-q7 are vector/fp parameter registers stp q2,q3, [fp, #-160] stp q4,q5, [fp, #-192] stp q6,q7, [fp, #-224] ldr x0, [fp, #24] ; move address ImageLoader cache to 1st parameter ldr x1, [fp, #16] ; move lazy info offset 2nd parameter ; call dyld::fastBindLazySymbol(loadercache, lazyinfo) bl __Z21_dyld_fast_stub_entryPvl mov x16,x0 ; save target function address in lr ; restore parameter registers ldp x0,x1, [fp, #-16] ldp x2,x3, [fp, #-32] ldp x4,x5, [fp, #-48] ldp x6,x7, [fp, #-64] ldp x8,x9, [fp, #-80] ldp q0,q1, [fp, #-128] ldp q2,q3, [fp, #-160] ldp q4,q5, [fp, #-192] ldp q6,q7, [fp, #-224] mov sp, fp ldp fp, lr, [sp], #16 add sp, sp, #16 ; remove meta-parameters br x16 #endif
opensource-apple/dyld
2,014
src/start_glue.s
/* * Copyright (c) 2011 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifdef __i386__ .align 2 .globl _start .private_extern _start _start: nop # <rdar://problem/10753356> backtraces of LC_MAIN binaries don't end in "start" Lstart: movl %eax,(%esp) # pass result from main() to exit() call _exit hlt #endif /* __i386__ */ #if __x86_64__ .align 2 .globl _start .private_extern _start _start: nop # <rdar://problem/10753356> backtraces of LC_MAIN binaries don't end in "start" Lstart: movl %eax,%edi # pass result from main() to exit() call _exit hlt #endif #if __arm__ .align 2 .code 16 .globl _start .private_extern _start .thumb_func _start _start: nop // <rdar://problem/10753356> backtraces of LC_MAIN binaries don't end in "start" Lstart: bl _exit // result in r0 already in param reg r0 trap #endif /* __arm__ */ #if __arm64__ .align 2 .globl _start .private_extern _start _start: nop Lstart: bl _exit // result in x0 already in param reg x0 brk #3 #endif /* __arm64__ */ .subsections_via_symbols
opensource-apple/IOKitUser
1,278
IOTrap.s
/* * Copyright (c) 2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #include <mach/machine/syscall_sw.h> #if defined(__i386__) #undef kernel_trap #define kernel_trap(trap_name,trap_number,number_args) \ LEAF(_##trap_name,0) ;\ movl $##trap_number,%eax ;\ int $(MACH_INT) ;\ END(_##trap_name) #endif /* defined(__i386__) */ kernel_trap(iokit_user_client_trap, -100, 8)
opensource-apple/objc4
11,707
runtime/a1a2-blocktramps-x86_64.s
/* * Copyright (c) 1999-2007 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifdef __x86_64__ #include <mach/vm_param.h> .text .private_extern __a1a2_tramphead .private_extern __a1a2_firsttramp .private_extern __a1a2_nexttramp .private_extern __a1a2_trampend .align PAGE_SHIFT __a1a2_tramphead: popq %r10 andq $0xFFFFFFFFFFFFFFF8, %r10 subq $ PAGE_SIZE, %r10 movq %rdi, %rsi // arg1 -> arg2 movq (%r10), %rdi // block -> arg1 jmp *16(%rdi) .macro TrampolineEntry callq __a1a2_tramphead nop nop nop .endmacro .align 5 __a1a2_firsttramp: TrampolineEntry __a1a2_nexttramp: TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry __a1a2_trampend: #endif
opensource-apple/objc4
11,792
runtime/a2a3-blocktramps-x86_64.s
/* * Copyright (c) 1999-2007 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifdef __x86_64__ #include <mach/vm_param.h> .text .private_extern __a2a3_tramphead .private_extern __a2a3_firsttramp .private_extern __a2a3_nexttramp .private_extern __a2a3_trampend .align PAGE_SHIFT __a2a3_tramphead: popq %r10 andq $0xFFFFFFFFFFFFFFF8, %r10 subq $ PAGE_SIZE, %r10 // %rdi -- first arg -- is address of return value's space. Don't mess with it. movq %rsi, %rdx // arg2 -> arg3 movq (%r10), %rsi // block -> arg2 jmp *16(%rsi) .macro TrampolineEntry callq __a2a3_tramphead nop nop nop .endmacro .align 5 __a2a3_firsttramp: TrampolineEntry __a2a3_nexttramp: TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry __a2a3_trampend: #endif
opensource-apple/objc4
11,843
runtime/a1a2-blocktramps-i386.s
/* * Copyright (c) 1999-2007 Apple Inc. All Rights Reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifdef __i386__ #include <mach/vm_param.h> .text .private_extern __a1a2_tramphead .private_extern __a1a2_firsttramp .private_extern __a1a2_nexttramp .private_extern __a1a2_trampend .align PAGE_SHIFT __a1a2_tramphead: popl %eax andl $0xFFFFFFF8, %eax subl $ PAGE_SIZE, %eax movl 4(%esp), %ecx // self -> ecx movl %ecx, 8(%esp) // ecx -> _cmd movl (%eax), %ecx // blockPtr -> ecx movl %ecx, 4(%esp) // ecx -> self jmp *12(%ecx) // tail to block->invoke .macro TrampolineEntry call __a1a2_tramphead nop nop nop .endmacro .align 5 __a1a2_firsttramp: TrampolineEntry __a1a2_nexttramp: // used to calculate size of each trampoline TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry TrampolineEntry __a1a2_trampend: #endif