├── .cproject
├── .gitignore
├── .mxproject
├── .project
├── Drivers
├── CMSIS
│ ├── Device
│ │ └── ST
│ │ │ └── STM32F1xx
│ │ │ └── Include
│ │ │ ├── stm32f103xb.h
│ │ │ ├── stm32f1xx.h
│ │ │ └── system_stm32f1xx.h
│ └── Include
│ │ ├── arm_common_tables.h
│ │ ├── arm_const_structs.h
│ │ ├── arm_math.h
│ │ ├── cmsis_armcc.h
│ │ ├── cmsis_armcc_V6.h
│ │ ├── cmsis_gcc.h
│ │ ├── core_cm0.h
│ │ ├── core_cm0plus.h
│ │ ├── core_cm3.h
│ │ ├── core_cm4.h
│ │ ├── core_cm7.h
│ │ ├── core_cmFunc.h
│ │ ├── core_cmInstr.h
│ │ ├── core_cmSimd.h
│ │ ├── core_sc000.h
│ │ └── core_sc300.h
└── STM32F1xx_HAL_Driver
│ ├── Inc
│ ├── Legacy
│ │ └── stm32_hal_legacy.h
│ ├── stm32f1xx_hal.h
│ ├── stm32f1xx_hal_cortex.h
│ ├── stm32f1xx_hal_def.h
│ ├── stm32f1xx_hal_dma.h
│ ├── stm32f1xx_hal_dma_ex.h
│ ├── stm32f1xx_hal_flash.h
│ ├── stm32f1xx_hal_flash_ex.h
│ ├── stm32f1xx_hal_gpio.h
│ ├── stm32f1xx_hal_gpio_ex.h
│ ├── stm32f1xx_hal_pcd.h
│ ├── stm32f1xx_hal_pcd_ex.h
│ ├── stm32f1xx_hal_pwr.h
│ ├── stm32f1xx_hal_rcc.h
│ ├── stm32f1xx_hal_rcc_ex.h
│ ├── stm32f1xx_hal_rtc.h
│ ├── stm32f1xx_hal_rtc_ex.h
│ ├── stm32f1xx_hal_tim.h
│ ├── stm32f1xx_hal_tim_ex.h
│ ├── stm32f1xx_hal_uart.h
│ └── stm32f1xx_ll_usb.h
│ └── Src
│ ├── stm32f1xx_hal.c
│ ├── stm32f1xx_hal_cortex.c
│ ├── stm32f1xx_hal_dma.c
│ ├── stm32f1xx_hal_flash.c
│ ├── stm32f1xx_hal_flash_ex.c
│ ├── stm32f1xx_hal_gpio.c
│ ├── stm32f1xx_hal_gpio_ex.c
│ ├── stm32f1xx_hal_pcd.c
│ ├── stm32f1xx_hal_pcd_ex.c
│ ├── stm32f1xx_hal_pwr.c
│ ├── stm32f1xx_hal_rcc.c
│ ├── stm32f1xx_hal_rcc_ex.c
│ ├── stm32f1xx_hal_rtc.c
│ ├── stm32f1xx_hal_rtc_ex.c
│ ├── stm32f1xx_hal_tim.c
│ ├── stm32f1xx_hal_tim_ex.c
│ ├── stm32f1xx_hal_uart.c
│ └── stm32f1xx_ll_usb.c
├── Inc
├── commandline.h
├── gpio.h
├── main.h
├── stm32f1xx_hal_conf.h
├── stm32f1xx_it.h
├── sump.h
├── syscall.h
├── uart.h
├── usb_device.h
├── usbd_cdc_if.h
├── usbd_conf.h
└── usbd_desc.h
├── Makefile
├── Middlewares
└── ST
│ └── STM32_USB_Device_Library
│ ├── Class
│ └── CDC
│ │ ├── Inc
│ │ └── usbd_cdc.h
│ │ └── Src
│ │ └── usbd_cdc.c
│ └── Core
│ ├── Inc
│ ├── usbd_core.h
│ ├── usbd_ctlreq.h
│ ├── usbd_def.h
│ └── usbd_ioreq.h
│ └── Src
│ ├── usbd_core.c
│ ├── usbd_ctlreq.c
│ └── usbd_ioreq.c
├── README.md
├── STM32F103C8Tx_FLASH.ld
├── Src
├── commandline.c
├── gpio.c
├── main.c
├── read256.c
├── stm32f1xx_hal_msp.c
├── stm32f1xx_it.c
├── sump.c
├── syscall.c
├── system_stm32f1xx.c
├── uart.c
├── usb_device.c
├── usbd_cdc_if.c
├── usbd_conf.c
└── usbd_desc.c
├── ols.profile-stm32f103.cfg
├── openocd.cfg
├── startup
└── startup_stm32f103xb.s
├── sump.ioc
└── sump.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | .dep
2 | build/
3 |
--------------------------------------------------------------------------------
/.mxproject:
--------------------------------------------------------------------------------
1 | [PreviousGenFiles]
2 | HeaderPath=/home/abob/stm32/sump/Inc
3 | HeaderFiles=usb_device.h;usbd_conf.h;usbd_desc.h;usbd_cdc_if.h;stm32f1xx_it.h;stm32f1xx_hal_conf.h;main.h;
4 | SourcePath=/home/abob/stm32/sump/Src
5 | SourceFiles=usb_device.h;usbd_conf.h;usbd_desc.h;usbd_cdc_if.h;stm32f1xx_it.h;stm32f1xx_hal_conf.h;main.h;usb_device.c;usbd_conf.c;usbd_desc.c;usbd_cdc_if.c;stm32f1xx_it.c;stm32f1xx_hal_msp.c;main.c;
6 |
7 | [PreviousLibFiles]
8 | LibFiles=Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pcd.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pcd_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usb.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rtc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rtc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_core.h;Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h;Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_def.h;Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h;Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c;Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Drivers/CMSIS/Include/arm_common_tables.h;Drivers/CMSIS/Include/arm_const_structs.h;Drivers/CMSIS/Include/arm_math.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_armcc_V6.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cmFunc.h;Drivers/CMSIS/Include/core_cmInstr.h;Drivers/CMSIS/Include/core_cmSimd.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h;
9 |
10 | [PreviousUsedRideFiles]
11 | SourceFiles=../Src/main.c;../Src/usb_device.c;../Src/usbd_conf.c;../Src/usbd_desc.c;../Src/usbd_cdc_if.c;../Src/stm32f1xx_it.c;../Src/stm32f1xx_hal_msp.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c;../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xb.s;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c;../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c;
12 | HeaderPath=..\Drivers\STM32F1xx_HAL_Driver\Inc;..\Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;..\Middlewares\ST\STM32_USB_Device_Library\Core\Inc;..\Middlewares\ST\STM32_USB_Device_Library\Class\CDC\Inc;..\Drivers\CMSIS\Device\ST\STM32F1xx\Include;..\Drivers\CMSIS\Include;
13 |
14 | [PreviousUsedSW4STM32Files]
15 | SourceFiles=../Src/main.c;../Src/usb_device.c;../Src/usbd_conf.c;../Src/usbd_desc.c;../Src/usbd_cdc_if.c;../Src/stm32f1xx_it.c;../Src/stm32f1xx_hal_msp.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c;../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xb.s;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c;../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c;
16 | HeaderPath=../Drivers/STM32F1xx_HAL_Driver/Inc;../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy;../Middlewares/ST/STM32_USB_Device_Library/Core/Inc;../Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc;../Drivers/CMSIS/Device/ST/STM32F1xx/Include;../Drivers/CMSIS/Include;
17 | CDefines=__weak="__attribute__((weak))";__packed="__attribute__((__packed__))";
18 |
19 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | sump
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | fr.ac6.mcu.ide.core.MCUProjectNature
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddrown/stm32-sump/d521510b0162b0658f4b179d854636b052e4a5e8/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ddrown/stm32-sump/d521510b0162b0658f4b179d854636b052e4a5e8/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file system_stm32f10x.h
4 | * @author MCD Application Team
5 | * @version V4.1.0
6 | * @date 29-April-2016
7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | *
© COPYRIGHT(c) 2016 STMicroelectronics
12 | *
13 | * Redistribution and use in source and binary forms, with or without modification,
14 | * are permitted provided that the following conditions are met:
15 | * 1. Redistributions of source code must retain the above copyright notice,
16 | * this list of conditions and the following disclaimer.
17 | * 2. Redistributions in binary form must reproduce the above copyright notice,
18 | * this list of conditions and the following disclaimer in the documentation
19 | * and/or other materials provided with the distribution.
20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 | * may be used to endorse or promote products derived from this software
22 | * without specific prior written permission.
23 | *
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 | *
35 | ******************************************************************************
36 | */
37 |
38 | /** @addtogroup CMSIS
39 | * @{
40 | */
41 |
42 | /** @addtogroup stm32f10x_system
43 | * @{
44 | */
45 |
46 | /**
47 | * @brief Define to prevent recursive inclusion
48 | */
49 | #ifndef __SYSTEM_STM32F10X_H
50 | #define __SYSTEM_STM32F10X_H
51 |
52 | #ifdef __cplusplus
53 | extern "C" {
54 | #endif
55 |
56 | /** @addtogroup STM32F10x_System_Includes
57 | * @{
58 | */
59 |
60 | /**
61 | * @}
62 | */
63 |
64 |
65 | /** @addtogroup STM32F10x_System_Exported_types
66 | * @{
67 | */
68 |
69 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
70 | extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
71 | extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */
72 |
73 | /**
74 | * @}
75 | */
76 |
77 | /** @addtogroup STM32F10x_System_Exported_Constants
78 | * @{
79 | */
80 |
81 | /**
82 | * @}
83 | */
84 |
85 | /** @addtogroup STM32F10x_System_Exported_Macros
86 | * @{
87 | */
88 |
89 | /**
90 | * @}
91 | */
92 |
93 | /** @addtogroup STM32F10x_System_Exported_Functions
94 | * @{
95 | */
96 |
97 | extern void SystemInit(void);
98 | extern void SystemCoreClockUpdate(void);
99 | /**
100 | * @}
101 | */
102 |
103 | #ifdef __cplusplus
104 | }
105 | #endif
106 |
107 | #endif /*__SYSTEM_STM32F10X_H */
108 |
109 | /**
110 | * @}
111 | */
112 |
113 | /**
114 | * @}
115 | */
116 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
117 |
--------------------------------------------------------------------------------
/Drivers/CMSIS/Include/arm_common_tables.h:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------
2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
3 | *
4 | * $Date: 19. October 2015
5 | * $Revision: V.1.4.5 a
6 | *
7 | * Project: CMSIS DSP Library
8 | * Title: arm_common_tables.h
9 | *
10 | * Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions
11 | *
12 | * Target Processor: Cortex-M4/Cortex-M3
13 | *
14 | * Redistribution and use in source and binary forms, with or without
15 | * modification, are permitted provided that the following conditions
16 | * are met:
17 | * - Redistributions of source code must retain the above copyright
18 | * notice, this list of conditions and the following disclaimer.
19 | * - Redistributions in binary form must reproduce the above copyright
20 | * notice, this list of conditions and the following disclaimer in
21 | * the documentation and/or other materials provided with the
22 | * distribution.
23 | * - Neither the name of ARM LIMITED nor the names of its contributors
24 | * may be used to endorse or promote products derived from this
25 | * software without specific prior written permission.
26 | *
27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 | * POSSIBILITY OF SUCH DAMAGE.
39 | * -------------------------------------------------------------------- */
40 |
41 | #ifndef _ARM_COMMON_TABLES_H
42 | #define _ARM_COMMON_TABLES_H
43 |
44 | #include "arm_math.h"
45 |
46 | extern const uint16_t armBitRevTable[1024];
47 | extern const q15_t armRecipTableQ15[64];
48 | extern const q31_t armRecipTableQ31[64];
49 | /* extern const q31_t realCoefAQ31[1024]; */
50 | /* extern const q31_t realCoefBQ31[1024]; */
51 | extern const float32_t twiddleCoef_16[32];
52 | extern const float32_t twiddleCoef_32[64];
53 | extern const float32_t twiddleCoef_64[128];
54 | extern const float32_t twiddleCoef_128[256];
55 | extern const float32_t twiddleCoef_256[512];
56 | extern const float32_t twiddleCoef_512[1024];
57 | extern const float32_t twiddleCoef_1024[2048];
58 | extern const float32_t twiddleCoef_2048[4096];
59 | extern const float32_t twiddleCoef_4096[8192];
60 | #define twiddleCoef twiddleCoef_4096
61 | extern const q31_t twiddleCoef_16_q31[24];
62 | extern const q31_t twiddleCoef_32_q31[48];
63 | extern const q31_t twiddleCoef_64_q31[96];
64 | extern const q31_t twiddleCoef_128_q31[192];
65 | extern const q31_t twiddleCoef_256_q31[384];
66 | extern const q31_t twiddleCoef_512_q31[768];
67 | extern const q31_t twiddleCoef_1024_q31[1536];
68 | extern const q31_t twiddleCoef_2048_q31[3072];
69 | extern const q31_t twiddleCoef_4096_q31[6144];
70 | extern const q15_t twiddleCoef_16_q15[24];
71 | extern const q15_t twiddleCoef_32_q15[48];
72 | extern const q15_t twiddleCoef_64_q15[96];
73 | extern const q15_t twiddleCoef_128_q15[192];
74 | extern const q15_t twiddleCoef_256_q15[384];
75 | extern const q15_t twiddleCoef_512_q15[768];
76 | extern const q15_t twiddleCoef_1024_q15[1536];
77 | extern const q15_t twiddleCoef_2048_q15[3072];
78 | extern const q15_t twiddleCoef_4096_q15[6144];
79 | extern const float32_t twiddleCoef_rfft_32[32];
80 | extern const float32_t twiddleCoef_rfft_64[64];
81 | extern const float32_t twiddleCoef_rfft_128[128];
82 | extern const float32_t twiddleCoef_rfft_256[256];
83 | extern const float32_t twiddleCoef_rfft_512[512];
84 | extern const float32_t twiddleCoef_rfft_1024[1024];
85 | extern const float32_t twiddleCoef_rfft_2048[2048];
86 | extern const float32_t twiddleCoef_rfft_4096[4096];
87 |
88 |
89 | /* floating-point bit reversal tables */
90 | #define ARMBITREVINDEXTABLE__16_TABLE_LENGTH ((uint16_t)20 )
91 | #define ARMBITREVINDEXTABLE__32_TABLE_LENGTH ((uint16_t)48 )
92 | #define ARMBITREVINDEXTABLE__64_TABLE_LENGTH ((uint16_t)56 )
93 | #define ARMBITREVINDEXTABLE_128_TABLE_LENGTH ((uint16_t)208 )
94 | #define ARMBITREVINDEXTABLE_256_TABLE_LENGTH ((uint16_t)440 )
95 | #define ARMBITREVINDEXTABLE_512_TABLE_LENGTH ((uint16_t)448 )
96 | #define ARMBITREVINDEXTABLE1024_TABLE_LENGTH ((uint16_t)1800)
97 | #define ARMBITREVINDEXTABLE2048_TABLE_LENGTH ((uint16_t)3808)
98 | #define ARMBITREVINDEXTABLE4096_TABLE_LENGTH ((uint16_t)4032)
99 |
100 | extern const uint16_t armBitRevIndexTable16[ARMBITREVINDEXTABLE__16_TABLE_LENGTH];
101 | extern const uint16_t armBitRevIndexTable32[ARMBITREVINDEXTABLE__32_TABLE_LENGTH];
102 | extern const uint16_t armBitRevIndexTable64[ARMBITREVINDEXTABLE__64_TABLE_LENGTH];
103 | extern const uint16_t armBitRevIndexTable128[ARMBITREVINDEXTABLE_128_TABLE_LENGTH];
104 | extern const uint16_t armBitRevIndexTable256[ARMBITREVINDEXTABLE_256_TABLE_LENGTH];
105 | extern const uint16_t armBitRevIndexTable512[ARMBITREVINDEXTABLE_512_TABLE_LENGTH];
106 | extern const uint16_t armBitRevIndexTable1024[ARMBITREVINDEXTABLE1024_TABLE_LENGTH];
107 | extern const uint16_t armBitRevIndexTable2048[ARMBITREVINDEXTABLE2048_TABLE_LENGTH];
108 | extern const uint16_t armBitRevIndexTable4096[ARMBITREVINDEXTABLE4096_TABLE_LENGTH];
109 |
110 | /* fixed-point bit reversal tables */
111 | #define ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH ((uint16_t)12 )
112 | #define ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH ((uint16_t)24 )
113 | #define ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH ((uint16_t)56 )
114 | #define ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH ((uint16_t)112 )
115 | #define ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH ((uint16_t)240 )
116 | #define ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH ((uint16_t)480 )
117 | #define ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH ((uint16_t)992 )
118 | #define ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH ((uint16_t)1984)
119 | #define ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH ((uint16_t)4032)
120 |
121 | extern const uint16_t armBitRevIndexTable_fixed_16[ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH];
122 | extern const uint16_t armBitRevIndexTable_fixed_32[ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH];
123 | extern const uint16_t armBitRevIndexTable_fixed_64[ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH];
124 | extern const uint16_t armBitRevIndexTable_fixed_128[ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH];
125 | extern const uint16_t armBitRevIndexTable_fixed_256[ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH];
126 | extern const uint16_t armBitRevIndexTable_fixed_512[ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH];
127 | extern const uint16_t armBitRevIndexTable_fixed_1024[ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH];
128 | extern const uint16_t armBitRevIndexTable_fixed_2048[ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH];
129 | extern const uint16_t armBitRevIndexTable_fixed_4096[ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH];
130 |
131 | /* Tables for Fast Math Sine and Cosine */
132 | extern const float32_t sinTable_f32[FAST_MATH_TABLE_SIZE + 1];
133 | extern const q31_t sinTable_q31[FAST_MATH_TABLE_SIZE + 1];
134 | extern const q15_t sinTable_q15[FAST_MATH_TABLE_SIZE + 1];
135 |
136 | #endif /* ARM_COMMON_TABLES_H */
137 |
--------------------------------------------------------------------------------
/Drivers/CMSIS/Include/arm_const_structs.h:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------
2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
3 | *
4 | * $Date: 19. March 2015
5 | * $Revision: V.1.4.5
6 | *
7 | * Project: CMSIS DSP Library
8 | * Title: arm_const_structs.h
9 | *
10 | * Description: This file has constant structs that are initialized for
11 | * user convenience. For example, some can be given as
12 | * arguments to the arm_cfft_f32() function.
13 | *
14 | * Target Processor: Cortex-M4/Cortex-M3
15 | *
16 | * Redistribution and use in source and binary forms, with or without
17 | * modification, are permitted provided that the following conditions
18 | * are met:
19 | * - Redistributions of source code must retain the above copyright
20 | * notice, this list of conditions and the following disclaimer.
21 | * - Redistributions in binary form must reproduce the above copyright
22 | * notice, this list of conditions and the following disclaimer in
23 | * the documentation and/or other materials provided with the
24 | * distribution.
25 | * - Neither the name of ARM LIMITED nor the names of its contributors
26 | * may be used to endorse or promote products derived from this
27 | * software without specific prior written permission.
28 | *
29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
32 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
33 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
34 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
35 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
37 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
39 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40 | * POSSIBILITY OF SUCH DAMAGE.
41 | * -------------------------------------------------------------------- */
42 |
43 | #ifndef _ARM_CONST_STRUCTS_H
44 | #define _ARM_CONST_STRUCTS_H
45 |
46 | #include "arm_math.h"
47 | #include "arm_common_tables.h"
48 |
49 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len16;
50 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len32;
51 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len64;
52 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len128;
53 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len256;
54 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len512;
55 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024;
56 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048;
57 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096;
58 |
59 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len16;
60 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len32;
61 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len64;
62 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len128;
63 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len256;
64 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len512;
65 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len1024;
66 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len2048;
67 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len4096;
68 |
69 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len16;
70 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len32;
71 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len64;
72 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len128;
73 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len256;
74 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len512;
75 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len1024;
76 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len2048;
77 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len4096;
78 |
79 | #endif
80 |
--------------------------------------------------------------------------------
/Drivers/CMSIS/Include/core_cmFunc.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | * @file core_cmFunc.h
3 | * @brief CMSIS Cortex-M Core Function Access Header File
4 | * @version V4.30
5 | * @date 20. October 2015
6 | ******************************************************************************/
7 | /* Copyright (c) 2009 - 2015 ARM LIMITED
8 |
9 | All rights reserved.
10 | Redistribution and use in source and binary forms, with or without
11 | modification, are permitted provided that the following conditions are met:
12 | - Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 | - Redistributions in binary form must reproduce the above copyright
15 | notice, this list of conditions and the following disclaimer in the
16 | documentation and/or other materials provided with the distribution.
17 | - Neither the name of ARM nor the names of its contributors may be used
18 | to endorse or promote products derived from this software without
19 | specific prior written permission.
20 | *
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 | POSSIBILITY OF SUCH DAMAGE.
32 | ---------------------------------------------------------------------------*/
33 |
34 |
35 | #if defined ( __ICCARM__ )
36 | #pragma system_include /* treat file as system include file for MISRA check */
37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
38 | #pragma clang system_header /* treat file as system include file */
39 | #endif
40 |
41 | #ifndef __CORE_CMFUNC_H
42 | #define __CORE_CMFUNC_H
43 |
44 |
45 | /* ########################### Core Function Access ########################### */
46 | /** \ingroup CMSIS_Core_FunctionInterface
47 | \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
48 | @{
49 | */
50 |
51 | /*------------------ RealView Compiler -----------------*/
52 | #if defined ( __CC_ARM )
53 | #include "cmsis_armcc.h"
54 |
55 | /*------------------ ARM Compiler V6 -------------------*/
56 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
57 | #include "cmsis_armcc_V6.h"
58 |
59 | /*------------------ GNU Compiler ----------------------*/
60 | #elif defined ( __GNUC__ )
61 | #include "cmsis_gcc.h"
62 |
63 | /*------------------ ICC Compiler ----------------------*/
64 | #elif defined ( __ICCARM__ )
65 | #include
66 |
67 | /*------------------ TI CCS Compiler -------------------*/
68 | #elif defined ( __TMS470__ )
69 | #include
70 |
71 | /*------------------ TASKING Compiler ------------------*/
72 | #elif defined ( __TASKING__ )
73 | /*
74 | * The CMSIS functions have been implemented as intrinsics in the compiler.
75 | * Please use "carm -?i" to get an up to date list of all intrinsics,
76 | * Including the CMSIS ones.
77 | */
78 |
79 | /*------------------ COSMIC Compiler -------------------*/
80 | #elif defined ( __CSMC__ )
81 | #include
82 |
83 | #endif
84 |
85 | /*@} end of CMSIS_Core_RegAccFunctions */
86 |
87 | #endif /* __CORE_CMFUNC_H */
88 |
--------------------------------------------------------------------------------
/Drivers/CMSIS/Include/core_cmInstr.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | * @file core_cmInstr.h
3 | * @brief CMSIS Cortex-M Core Instruction Access Header File
4 | * @version V4.30
5 | * @date 20. October 2015
6 | ******************************************************************************/
7 | /* Copyright (c) 2009 - 2015 ARM LIMITED
8 |
9 | All rights reserved.
10 | Redistribution and use in source and binary forms, with or without
11 | modification, are permitted provided that the following conditions are met:
12 | - Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 | - Redistributions in binary form must reproduce the above copyright
15 | notice, this list of conditions and the following disclaimer in the
16 | documentation and/or other materials provided with the distribution.
17 | - Neither the name of ARM nor the names of its contributors may be used
18 | to endorse or promote products derived from this software without
19 | specific prior written permission.
20 | *
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 | POSSIBILITY OF SUCH DAMAGE.
32 | ---------------------------------------------------------------------------*/
33 |
34 |
35 | #if defined ( __ICCARM__ )
36 | #pragma system_include /* treat file as system include file for MISRA check */
37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
38 | #pragma clang system_header /* treat file as system include file */
39 | #endif
40 |
41 | #ifndef __CORE_CMINSTR_H
42 | #define __CORE_CMINSTR_H
43 |
44 |
45 | /* ########################## Core Instruction Access ######################### */
46 | /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
47 | Access to dedicated instructions
48 | @{
49 | */
50 |
51 | /*------------------ RealView Compiler -----------------*/
52 | #if defined ( __CC_ARM )
53 | #include "cmsis_armcc.h"
54 |
55 | /*------------------ ARM Compiler V6 -------------------*/
56 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
57 | #include "cmsis_armcc_V6.h"
58 |
59 | /*------------------ GNU Compiler ----------------------*/
60 | #elif defined ( __GNUC__ )
61 | #include "cmsis_gcc.h"
62 |
63 | /*------------------ ICC Compiler ----------------------*/
64 | #elif defined ( __ICCARM__ )
65 | #include
66 |
67 | /*------------------ TI CCS Compiler -------------------*/
68 | #elif defined ( __TMS470__ )
69 | #include
70 |
71 | /*------------------ TASKING Compiler ------------------*/
72 | #elif defined ( __TASKING__ )
73 | /*
74 | * The CMSIS functions have been implemented as intrinsics in the compiler.
75 | * Please use "carm -?i" to get an up to date list of all intrinsics,
76 | * Including the CMSIS ones.
77 | */
78 |
79 | /*------------------ COSMIC Compiler -------------------*/
80 | #elif defined ( __CSMC__ )
81 | #include
82 |
83 | #endif
84 |
85 | /*@}*/ /* end of group CMSIS_Core_InstructionInterface */
86 |
87 | #endif /* __CORE_CMINSTR_H */
88 |
--------------------------------------------------------------------------------
/Drivers/CMSIS/Include/core_cmSimd.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | * @file core_cmSimd.h
3 | * @brief CMSIS Cortex-M SIMD Header File
4 | * @version V4.30
5 | * @date 20. October 2015
6 | ******************************************************************************/
7 | /* Copyright (c) 2009 - 2015 ARM LIMITED
8 |
9 | All rights reserved.
10 | Redistribution and use in source and binary forms, with or without
11 | modification, are permitted provided that the following conditions are met:
12 | - Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 | - Redistributions in binary form must reproduce the above copyright
15 | notice, this list of conditions and the following disclaimer in the
16 | documentation and/or other materials provided with the distribution.
17 | - Neither the name of ARM nor the names of its contributors may be used
18 | to endorse or promote products derived from this software without
19 | specific prior written permission.
20 | *
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 | POSSIBILITY OF SUCH DAMAGE.
32 | ---------------------------------------------------------------------------*/
33 |
34 |
35 | #if defined ( __ICCARM__ )
36 | #pragma system_include /* treat file as system include file for MISRA check */
37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
38 | #pragma clang system_header /* treat file as system include file */
39 | #endif
40 |
41 | #ifndef __CORE_CMSIMD_H
42 | #define __CORE_CMSIMD_H
43 |
44 | #ifdef __cplusplus
45 | extern "C" {
46 | #endif
47 |
48 |
49 | /* ################### Compiler specific Intrinsics ########################### */
50 | /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
51 | Access to dedicated SIMD instructions
52 | @{
53 | */
54 |
55 | /*------------------ RealView Compiler -----------------*/
56 | #if defined ( __CC_ARM )
57 | #include "cmsis_armcc.h"
58 |
59 | /*------------------ ARM Compiler V6 -------------------*/
60 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
61 | #include "cmsis_armcc_V6.h"
62 |
63 | /*------------------ GNU Compiler ----------------------*/
64 | #elif defined ( __GNUC__ )
65 | #include "cmsis_gcc.h"
66 |
67 | /*------------------ ICC Compiler ----------------------*/
68 | #elif defined ( __ICCARM__ )
69 | #include
70 |
71 | /*------------------ TI CCS Compiler -------------------*/
72 | #elif defined ( __TMS470__ )
73 | #include
74 |
75 | /*------------------ TASKING Compiler ------------------*/
76 | #elif defined ( __TASKING__ )
77 | /*
78 | * The CMSIS functions have been implemented as intrinsics in the compiler.
79 | * Please use "carm -?i" to get an up to date list of all intrinsics,
80 | * Including the CMSIS ones.
81 | */
82 |
83 | /*------------------ COSMIC Compiler -------------------*/
84 | #elif defined ( __CSMC__ )
85 | #include
86 |
87 | #endif
88 |
89 | /*@} end of group CMSIS_SIMD_intrinsics */
90 |
91 |
92 | #ifdef __cplusplus
93 | }
94 | #endif
95 |
96 | #endif /* __CORE_CMSIMD_H */
97 |
--------------------------------------------------------------------------------
/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f1xx_hal_def.h
4 | * @author MCD Application Team
5 | * @version V1.0.4
6 | * @date 29-April-2016
7 | * @brief This file contains HAL common defines, enumeration, macros and
8 | * structures definitions.
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * © COPYRIGHT(c) 2016 STMicroelectronics
13 | *
14 | * Redistribution and use in source and binary forms, with or without modification,
15 | * are permitted provided that the following conditions are met:
16 | * 1. Redistributions of source code must retain the above copyright notice,
17 | * this list of conditions and the following disclaimer.
18 | * 2. Redistributions in binary form must reproduce the above copyright notice,
19 | * this list of conditions and the following disclaimer in the documentation
20 | * and/or other materials provided with the distribution.
21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
22 | * may be used to endorse or promote products derived from this software
23 | * without specific prior written permission.
24 | *
25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 | *
36 | ******************************************************************************
37 | */
38 |
39 | /* Define to prevent recursive inclusion -------------------------------------*/
40 | #ifndef __STM32F1xx_HAL_DEF
41 | #define __STM32F1xx_HAL_DEF
42 |
43 | #ifdef __cplusplus
44 | extern "C" {
45 | #endif
46 |
47 | /* Includes ------------------------------------------------------------------*/
48 | #include "stm32f1xx.h"
49 | #include "Legacy/stm32_hal_legacy.h"
50 | #include
51 |
52 | /* Exported types ------------------------------------------------------------*/
53 |
54 | /**
55 | * @brief HAL Status structures definition
56 | */
57 | typedef enum
58 | {
59 | HAL_OK = 0x00,
60 | HAL_ERROR = 0x01,
61 | HAL_BUSY = 0x02,
62 | HAL_TIMEOUT = 0x03
63 | } HAL_StatusTypeDef;
64 |
65 | /**
66 | * @brief HAL Lock structures definition
67 | */
68 | typedef enum
69 | {
70 | HAL_UNLOCKED = 0x00,
71 | HAL_LOCKED = 0x01
72 | } HAL_LockTypeDef;
73 |
74 | /* Exported macro ------------------------------------------------------------*/
75 |
76 | #define HAL_MAX_DELAY 0xFFFFFFFF
77 |
78 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
79 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET)
80 |
81 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_) \
82 | do{ \
83 | (__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \
84 | (__DMA_HANDLE_).Parent = (__HANDLE__); \
85 | } while(0)
86 |
87 | #define UNUSED(x) ((void)(x))
88 |
89 | /** @brief Reset the Handle's State field.
90 | * @param __HANDLE__: specifies the Peripheral Handle.
91 | * @note This macro can be used for the following purpose:
92 | * - When the Handle is declared as local variable; before passing it as parameter
93 | * to HAL_PPP_Init() for the first time, it is mandatory to use this macro
94 | * to set to 0 the Handle's "State" field.
95 | * Otherwise, "State" field may have any random value and the first time the function
96 | * HAL_PPP_Init() is called, the low level hardware initialization will be missed
97 | * (i.e. HAL_PPP_MspInit() will not be executed).
98 | * - When there is a need to reconfigure the low level hardware: instead of calling
99 | * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init().
100 | * In this later function, when the Handle's "State" field is set to 0, it will execute the function
101 | * HAL_PPP_MspInit() which will reconfigure the low level hardware.
102 | * @retval None
103 | */
104 | #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0)
105 |
106 | #if (USE_RTOS == 1)
107 | #error " USE_RTOS should be 0 in the current HAL release "
108 | #else
109 | #define __HAL_LOCK(__HANDLE__) \
110 | do{ \
111 | if((__HANDLE__)->Lock == HAL_LOCKED) \
112 | { \
113 | return HAL_BUSY; \
114 | } \
115 | else \
116 | { \
117 | (__HANDLE__)->Lock = HAL_LOCKED; \
118 | } \
119 | }while (0)
120 |
121 | #define __HAL_UNLOCK(__HANDLE__) \
122 | do{ \
123 | (__HANDLE__)->Lock = HAL_UNLOCKED; \
124 | }while (0)
125 | #endif /* USE_RTOS */
126 |
127 | #if defined ( __GNUC__ )
128 | #ifndef __weak
129 | #define __weak __attribute__((weak))
130 | #endif /* __weak */
131 | #ifndef __packed
132 | #define __packed __attribute__((__packed__))
133 | #endif /* __packed */
134 | #endif /* __GNUC__ */
135 |
136 |
137 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
138 | #if defined (__GNUC__) /* GNU Compiler */
139 | #ifndef __ALIGN_END
140 | #define __ALIGN_END __attribute__ ((aligned (4)))
141 | #endif /* __ALIGN_END */
142 | #ifndef __ALIGN_BEGIN
143 | #define __ALIGN_BEGIN
144 | #endif /* __ALIGN_BEGIN */
145 | #else
146 | #ifndef __ALIGN_END
147 | #define __ALIGN_END
148 | #endif /* __ALIGN_END */
149 | #ifndef __ALIGN_BEGIN
150 | #if defined (__CC_ARM) /* ARM Compiler */
151 | #define __ALIGN_BEGIN __align(4)
152 | #elif defined (__ICCARM__) /* IAR Compiler */
153 | #define __ALIGN_BEGIN
154 | #endif /* __CC_ARM */
155 | #endif /* __ALIGN_BEGIN */
156 | #endif /* __GNUC__ */
157 |
158 | /**
159 | * @brief __RAM_FUNC definition
160 | */
161 | #if defined ( __CC_ARM )
162 | /* ARM Compiler
163 | ------------
164 | RAM functions are defined using the toolchain options.
165 | Functions that are executed in RAM should reside in a separate source module.
166 | Using the 'Options for File' dialog you can simply change the 'Code / Const'
167 | area of a module to a memory space in physical RAM.
168 | Available memory areas are declared in the 'Target' tab of the 'Options for Target'
169 | dialog.
170 | */
171 | #define __RAM_FUNC HAL_StatusTypeDef
172 |
173 | #elif defined ( __ICCARM__ )
174 | /* ICCARM Compiler
175 | ---------------
176 | RAM functions are defined using a specific toolchain keyword "__ramfunc".
177 | */
178 | #define __RAM_FUNC __ramfunc HAL_StatusTypeDef
179 |
180 | #elif defined ( __GNUC__ )
181 | /* GNU Compiler
182 | ------------
183 | RAM functions are defined using a specific toolchain attribute
184 | "__attribute__((section(".RamFunc")))".
185 | */
186 | #define __RAM_FUNC HAL_StatusTypeDef __attribute__((section(".RamFunc")))
187 |
188 | #endif
189 |
190 | /**
191 | * @brief __NOINLINE definition
192 | */
193 | #if defined ( __CC_ARM ) || defined ( __GNUC__ )
194 | /* ARM & GNUCompiler
195 | ----------------
196 | */
197 | #define __NOINLINE __attribute__ ( (noinline) )
198 |
199 | #elif defined ( __ICCARM__ )
200 | /* ICCARM Compiler
201 | ---------------
202 | */
203 | #define __NOINLINE _Pragma("optimize = no_inline")
204 |
205 | #endif
206 |
207 |
208 | #ifdef __cplusplus
209 | }
210 | #endif
211 |
212 | #endif /* ___STM32F1xx_HAL_DEF */
213 |
214 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
215 |
--------------------------------------------------------------------------------
/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f1xx_hal_flash.h
4 | * @author MCD Application Team
5 | * @version V1.0.4
6 | * @date 29-April-2016
7 | * @brief Header file of Flash HAL module.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT(c) 2016 STMicroelectronics
12 | *
13 | * Redistribution and use in source and binary forms, with or without modification,
14 | * are permitted provided that the following conditions are met:
15 | * 1. Redistributions of source code must retain the above copyright notice,
16 | * this list of conditions and the following disclaimer.
17 | * 2. Redistributions in binary form must reproduce the above copyright notice,
18 | * this list of conditions and the following disclaimer in the documentation
19 | * and/or other materials provided with the distribution.
20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 | * may be used to endorse or promote products derived from this software
22 | * without specific prior written permission.
23 | *
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 | *
35 | ******************************************************************************
36 | */
37 |
38 | /* Define to prevent recursive inclusion -------------------------------------*/
39 | #ifndef __STM32F1xx_HAL_FLASH_H
40 | #define __STM32F1xx_HAL_FLASH_H
41 |
42 | #ifdef __cplusplus
43 | extern "C" {
44 | #endif
45 |
46 | /* Includes ------------------------------------------------------------------*/
47 | #include "stm32f1xx_hal_def.h"
48 |
49 | /** @addtogroup STM32F1xx_HAL_Driver
50 | * @{
51 | */
52 |
53 | /** @addtogroup FLASH
54 | * @{
55 | */
56 |
57 | /** @addtogroup FLASH_Private_Constants
58 | * @{
59 | */
60 | #define FLASH_TIMEOUT_VALUE ((uint32_t)50000)/* 50 s */
61 | /**
62 | * @}
63 | */
64 |
65 | /** @addtogroup FLASH_Private_Macros
66 | * @{
67 | */
68 |
69 | #define IS_FLASH_TYPEPROGRAM(VALUE) (((VALUE) == FLASH_TYPEPROGRAM_HALFWORD) || \
70 | ((VALUE) == FLASH_TYPEPROGRAM_WORD) || \
71 | ((VALUE) == FLASH_TYPEPROGRAM_DOUBLEWORD))
72 |
73 | #if defined(FLASH_ACR_LATENCY)
74 | #define IS_FLASH_LATENCY(__LATENCY__) (((__LATENCY__) == FLASH_LATENCY_0) || \
75 | ((__LATENCY__) == FLASH_LATENCY_1) || \
76 | ((__LATENCY__) == FLASH_LATENCY_2))
77 |
78 | #else
79 | #define IS_FLASH_LATENCY(__LATENCY__) ((__LATENCY__) == FLASH_LATENCY_0)
80 | #endif /* FLASH_ACR_LATENCY */
81 | /**
82 | * @}
83 | */
84 |
85 | /* Exported types ------------------------------------------------------------*/
86 | /** @defgroup FLASH_Exported_Types FLASH Exported Types
87 | * @{
88 | */
89 |
90 |
91 | /**
92 | * @brief FLASH Procedure structure definition
93 | */
94 | typedef enum
95 | {
96 | FLASH_PROC_NONE = 0,
97 | FLASH_PROC_PAGEERASE = 1,
98 | FLASH_PROC_MASSERASE = 2,
99 | FLASH_PROC_PROGRAMHALFWORD = 3,
100 | FLASH_PROC_PROGRAMWORD = 4,
101 | FLASH_PROC_PROGRAMDOUBLEWORD = 5
102 | } FLASH_ProcedureTypeDef;
103 |
104 | /**
105 | * @brief FLASH handle Structure definition
106 | */
107 | typedef struct
108 | {
109 | __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /*!< Internal variable to indicate which procedure is ongoing or not in IT context */
110 |
111 | __IO uint32_t DataRemaining; /*!< Internal variable to save the remaining pages to erase or half-word to program in IT context */
112 |
113 | __IO uint32_t Address; /*!< Internal variable to save address selected for program or erase */
114 |
115 | __IO uint64_t Data; /*!< Internal variable to save data to be programmed */
116 |
117 | HAL_LockTypeDef Lock; /*!< FLASH locking object */
118 |
119 | __IO uint32_t ErrorCode; /*!< FLASH error code
120 | This parameter can be a value of @ref FLASH_Error_Codes */
121 | } FLASH_ProcessTypeDef;
122 |
123 | /**
124 | * @}
125 | */
126 |
127 | /* Exported constants --------------------------------------------------------*/
128 | /** @defgroup FLASH_Exported_Constants FLASH Exported Constants
129 | * @{
130 | */
131 |
132 | /** @defgroup FLASH_Error_Codes FLASH Error Codes
133 | * @{
134 | */
135 |
136 | #define HAL_FLASH_ERROR_NONE ((uint32_t)0x00) /*!< No error */
137 | #define HAL_FLASH_ERROR_PROG ((uint32_t)0x01) /*!< Programming error */
138 | #define HAL_FLASH_ERROR_WRP ((uint32_t)0x02) /*!< Write protection error */
139 | #define HAL_FLASH_ERROR_OPTV ((uint32_t)0x04) /*!< Option validity error */
140 |
141 | /**
142 | * @}
143 | */
144 |
145 | /** @defgroup FLASH_Type_Program FLASH Type Program
146 | * @{
147 | */
148 | #define FLASH_TYPEPROGRAM_HALFWORD ((uint32_t)0x01) /*!ACR |= FLASH_ACR_HLFCYA)
202 |
203 | /**
204 | * @brief Disable the FLASH half cycle access.
205 | * @note half cycle access can only be used with a low-frequency clock of less than
206 | 8 MHz that can be obtained with the use of HSI or HSE but not of PLL.
207 | * @retval None
208 | */
209 | #define __HAL_FLASH_HALF_CYCLE_ACCESS_DISABLE() (FLASH->ACR &= (~FLASH_ACR_HLFCYA))
210 |
211 | /**
212 | * @}
213 | */
214 |
215 | #if defined(FLASH_ACR_LATENCY)
216 | /** @defgroup FLASH_EM_Latency FLASH Latency
217 | * @brief macros to handle FLASH Latency
218 | * @{
219 | */
220 |
221 | /**
222 | * @brief Set the FLASH Latency.
223 | * @param __LATENCY__ FLASH Latency
224 | * The value of this parameter depend on device used within the same series
225 | * @retval None
226 | */
227 | #define __HAL_FLASH_SET_LATENCY(__LATENCY__) (FLASH->ACR = (FLASH->ACR&(~FLASH_ACR_LATENCY)) | (__LATENCY__))
228 |
229 |
230 | /**
231 | * @brief Get the FLASH Latency.
232 | * @retval FLASH Latency
233 | * The value of this parameter depend on device used within the same series
234 | */
235 | #define __HAL_FLASH_GET_LATENCY() (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY))
236 |
237 | /**
238 | * @}
239 | */
240 |
241 | #endif /* FLASH_ACR_LATENCY */
242 | /** @defgroup FLASH_Prefetch FLASH Prefetch
243 | * @brief macros to handle FLASH Prefetch buffer
244 | * @{
245 | */
246 | /**
247 | * @brief Enable the FLASH prefetch buffer.
248 | * @retval None
249 | */
250 | #define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() (FLASH->ACR |= FLASH_ACR_PRFTBE)
251 |
252 | /**
253 | * @brief Disable the FLASH prefetch buffer.
254 | * @retval None
255 | */
256 | #define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() (FLASH->ACR &= (~FLASH_ACR_PRFTBE))
257 |
258 | /**
259 | * @}
260 | */
261 |
262 | /**
263 | * @}
264 | */
265 |
266 | /* Include FLASH HAL Extended module */
267 | #include "stm32f1xx_hal_flash_ex.h"
268 |
269 | /* Exported functions --------------------------------------------------------*/
270 | /** @addtogroup FLASH_Exported_Functions
271 | * @{
272 | */
273 |
274 | /** @addtogroup FLASH_Exported_Functions_Group1
275 | * @{
276 | */
277 | /* IO operation functions *****************************************************/
278 | HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
279 | HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
280 |
281 | /* FLASH IRQ handler function */
282 | void HAL_FLASH_IRQHandler(void);
283 | /* Callbacks in non blocking modes */
284 | void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue);
285 | void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue);
286 |
287 | /**
288 | * @}
289 | */
290 |
291 | /** @addtogroup FLASH_Exported_Functions_Group2
292 | * @{
293 | */
294 | /* Peripheral Control functions ***********************************************/
295 | HAL_StatusTypeDef HAL_FLASH_Unlock(void);
296 | HAL_StatusTypeDef HAL_FLASH_Lock(void);
297 | HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void);
298 | HAL_StatusTypeDef HAL_FLASH_OB_Lock(void);
299 | HAL_StatusTypeDef HAL_FLASH_OB_Launch(void);
300 |
301 | /**
302 | * @}
303 | */
304 |
305 | /** @addtogroup FLASH_Exported_Functions_Group3
306 | * @{
307 | */
308 | /* Peripheral State and Error functions ***************************************/
309 | uint32_t HAL_FLASH_GetError(void);
310 |
311 | /**
312 | * @}
313 | */
314 |
315 | /**
316 | * @}
317 | */
318 |
319 | /* Private function -------------------------------------------------*/
320 | /** @addtogroup FLASH_Private_Functions
321 | * @{
322 | */
323 | void FLASH_PageErase(uint32_t PageAddress);
324 | HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout);
325 | #if defined(FLASH_BANK2_END)
326 | HAL_StatusTypeDef FLASH_WaitForLastOperationBank2(uint32_t Timeout);
327 | #endif /* FLASH_BANK2_END */
328 |
329 | /**
330 | * @}
331 | */
332 |
333 | /**
334 | * @}
335 | */
336 |
337 | /**
338 | * @}
339 | */
340 |
341 | #ifdef __cplusplus
342 | }
343 | #endif
344 |
345 | #endif /* __STM32F1xx_HAL_FLASH_H */
346 |
347 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
348 |
349 |
--------------------------------------------------------------------------------
/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pcd_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f1xx_hal_pcd_ex.h
4 | * @author MCD Application Team
5 | * @version V1.0.4
6 | * @date 29-April-2016
7 | * @brief Header file of Extended PCD HAL module.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT(c) 2016 STMicroelectronics
12 | *
13 | * Redistribution and use in source and binary forms, with or without modification,
14 | * are permitted provided that the following conditions are met:
15 | * 1. Redistributions of source code must retain the above copyright notice,
16 | * this list of conditions and the following disclaimer.
17 | * 2. Redistributions in binary form must reproduce the above copyright notice,
18 | * this list of conditions and the following disclaimer in the documentation
19 | * and/or other materials provided with the distribution.
20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 | * may be used to endorse or promote products derived from this software
22 | * without specific prior written permission.
23 | *
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 | *
35 | ******************************************************************************
36 | */
37 |
38 | /* Define to prevent recursive inclusion -------------------------------------*/
39 | #ifndef __STM32F1xx_HAL_PCD_EX_H
40 | #define __STM32F1xx_HAL_PCD_EX_H
41 |
42 | #ifdef __cplusplus
43 | extern "C" {
44 | #endif
45 |
46 | #if defined(STM32F102x6) || defined(STM32F102xB) || \
47 | defined(STM32F103x6) || defined(STM32F103xB) || \
48 | defined(STM32F103xE) || defined(STM32F103xG) || \
49 | defined(STM32F105xC) || defined(STM32F107xC)
50 |
51 | /* Includes ------------------------------------------------------------------*/
52 | #include "stm32f1xx_hal_def.h"
53 |
54 | /** @addtogroup STM32F1xx_HAL_Driver
55 | * @{
56 | */
57 |
58 | /** @addtogroup PCDEx
59 | * @{
60 | */
61 |
62 | /* Exported types ------------------------------------------------------------*/
63 | /* Exported constants --------------------------------------------------------*/
64 | /* Exported macros -----------------------------------------------------------*/
65 | /* Exported functions --------------------------------------------------------*/
66 | /** @addtogroup PCDEx_Exported_Functions PCDEx Exported Functions
67 | * @{
68 | */
69 | /** @addtogroup PCDEx_Exported_Functions_Group1 Peripheral Control functions
70 | * @{
71 | */
72 | #if defined (USB_OTG_FS)
73 | HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size);
74 | HAL_StatusTypeDef HAL_PCDEx_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size);
75 | #endif /* USB_OTG_FS */
76 |
77 | #if defined (USB)
78 | HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd,
79 | uint16_t ep_addr,
80 | uint16_t ep_kind,
81 | uint32_t pmaadress);
82 | #endif /* USB */
83 | /**
84 | * @}
85 | */
86 |
87 | /** @addtogroup PCDEx_Exported_Functions_Group2 Peripheral State functions
88 | * @{
89 | */
90 | void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
91 | /**
92 | * @}
93 | */
94 | /**
95 | * @}
96 | */
97 | /**
98 | * @}
99 | */
100 |
101 | /**
102 | * @}
103 | */
104 | #endif /* STM32F102x6 || STM32F102xB || */
105 | /* STM32F103x6 || STM32F103xB || */
106 | /* STM32F103xE || STM32F103xG || */
107 | /* STM32F105xC || STM32F107xC */
108 |
109 | #ifdef __cplusplus
110 | }
111 | #endif
112 |
113 |
114 | #endif /* __STM32F1xx_HAL_PCD_EX_H */
115 |
116 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
117 |
--------------------------------------------------------------------------------
/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f1xx_hal_gpio_ex.c
4 | * @author MCD Application Team
5 | * @version V1.0.4
6 | * @date 29-April-2016
7 | * @brief GPIO Extension HAL module driver.
8 | * This file provides firmware functions to manage the following
9 | * functionalities of the General Purpose Input/Output (GPIO) extension peripheral.
10 | * + Extended features functions
11 | *
12 | @verbatim
13 | ==============================================================================
14 | ##### GPIO Peripheral extension features #####
15 | ==============================================================================
16 | [..] GPIO module on STM32F1 family, manage also the AFIO register:
17 | (+) Possibility to use the EVENTOUT Cortex feature
18 |
19 | ##### How to use this driver #####
20 | ==============================================================================
21 | [..] This driver provides functions to use EVENTOUT Cortex feature
22 | (#) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout()
23 | (#) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout()
24 | (#) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout()
25 |
26 | @endverbatim
27 | ******************************************************************************
28 | * @attention
29 | *
30 | * © COPYRIGHT(c) 2016 STMicroelectronics
31 | *
32 | * Redistribution and use in source and binary forms, with or without modification,
33 | * are permitted provided that the following conditions are met:
34 | * 1. Redistributions of source code must retain the above copyright notice,
35 | * this list of conditions and the following disclaimer.
36 | * 2. Redistributions in binary form must reproduce the above copyright notice,
37 | * this list of conditions and the following disclaimer in the documentation
38 | * and/or other materials provided with the distribution.
39 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
40 | * may be used to endorse or promote products derived from this software
41 | * without specific prior written permission.
42 | *
43 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
44 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
46 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
47 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
49 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
50 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
51 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53 | *
54 | ******************************************************************************
55 | */
56 |
57 | /* Includes ------------------------------------------------------------------*/
58 | #include "stm32f1xx_hal.h"
59 |
60 | /** @addtogroup STM32F1xx_HAL_Driver
61 | * @{
62 | */
63 |
64 | /** @defgroup GPIOEx GPIOEx
65 | * @brief GPIO HAL module driver
66 | * @{
67 | */
68 |
69 | #ifdef HAL_GPIO_MODULE_ENABLED
70 |
71 | /** @defgroup GPIOEx_Exported_Functions GPIOEx Exported Functions
72 | * @{
73 | */
74 |
75 | /** @defgroup GPIOEx_Exported_Functions_Group1 Extended features functions
76 | * @brief Extended features functions
77 | *
78 | @verbatim
79 | ==============================================================================
80 | ##### Extended features functions #####
81 | ==============================================================================
82 | [..] This section provides functions allowing to:
83 | (+) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout()
84 | (+) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout()
85 | (+) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout()
86 |
87 | @endverbatim
88 | * @{
89 | */
90 |
91 | /**
92 | * @brief Configures the port and pin on which the EVENTOUT Cortex signal will be connected.
93 | * @param GPIO_PortSource Select the port used to output the Cortex EVENTOUT signal.
94 | * This parameter can be a value of @ref GPIOEx_EVENTOUT_PORT.
95 | * @param GPIO_PinSource Select the pin used to output the Cortex EVENTOUT signal.
96 | * This parameter can be a value of @ref GPIOEx_EVENTOUT_PIN.
97 | * @retval None
98 | */
99 | void HAL_GPIOEx_ConfigEventout(uint32_t GPIO_PortSource, uint32_t GPIO_PinSource)
100 | {
101 | /* Verify the parameters */
102 | assert_param(IS_AFIO_EVENTOUT_PORT(GPIO_PortSource));
103 | assert_param(IS_AFIO_EVENTOUT_PIN(GPIO_PinSource));
104 |
105 | /* Apply the new configuration */
106 | MODIFY_REG(AFIO->EVCR, (AFIO_EVCR_PORT)|(AFIO_EVCR_PIN), (GPIO_PortSource)|(GPIO_PinSource));
107 | }
108 |
109 | /**
110 | * @brief Enables the Event Output.
111 | * @retval None
112 | */
113 | void HAL_GPIOEx_EnableEventout(void)
114 | {
115 | SET_BIT(AFIO->EVCR, AFIO_EVCR_EVOE);
116 | }
117 |
118 | /**
119 | * @brief Disables the Event Output.
120 | * @retval None
121 | */
122 | void HAL_GPIOEx_DisableEventout(void)
123 | {
124 | CLEAR_BIT(AFIO->EVCR, AFIO_EVCR_EVOE);
125 | }
126 |
127 | /**
128 | * @}
129 | */
130 |
131 | /**
132 | * @}
133 | */
134 |
135 | #endif /* HAL_GPIO_MODULE_ENABLED */
136 |
137 | /**
138 | * @}
139 | */
140 |
141 | /**
142 | * @}
143 | */
144 |
145 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
146 |
--------------------------------------------------------------------------------
/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f1xx_hal_pcd_ex.c
4 | * @author MCD Application Team
5 | * @version V1.0.4
6 | * @date 29-April-2016
7 | * @brief Extended PCD HAL module driver.
8 | * This file provides firmware functions to manage the following
9 | * functionalities of the USB Peripheral Controller:
10 | * + Extended features functions: Update FIFO configuration,
11 | * PMA configuration for EPs
12 | *
13 | ******************************************************************************
14 | * @attention
15 | *
16 | * © COPYRIGHT(c) 2016 STMicroelectronics
17 | *
18 | * Redistribution and use in source and binary forms, with or without modification,
19 | * are permitted provided that the following conditions are met:
20 | * 1. Redistributions of source code must retain the above copyright notice,
21 | * this list of conditions and the following disclaimer.
22 | * 2. Redistributions in binary form must reproduce the above copyright notice,
23 | * this list of conditions and the following disclaimer in the documentation
24 | * and/or other materials provided with the distribution.
25 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
26 | * may be used to endorse or promote products derived from this software
27 | * without specific prior written permission.
28 | *
29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
30 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
32 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
33 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
37 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 | *
40 | ******************************************************************************
41 | */
42 |
43 | /* Includes ------------------------------------------------------------------*/
44 | #include "stm32f1xx_hal.h"
45 |
46 | /** @addtogroup STM32F1xx_HAL_Driver
47 | * @{
48 | */
49 |
50 | #ifdef HAL_PCD_MODULE_ENABLED
51 |
52 | #if defined(STM32F102x6) || defined(STM32F102xB) || \
53 | defined(STM32F103x6) || defined(STM32F103xB) || \
54 | defined(STM32F103xE) || defined(STM32F103xG) || \
55 | defined(STM32F105xC) || defined(STM32F107xC)
56 |
57 |
58 | /** @defgroup PCDEx PCDEx
59 | * @brief PCD Extended HAL module driver
60 | * @{
61 | */
62 |
63 |
64 | /* Private types -------------------------------------------------------------*/
65 | /* Private variables ---------------------------------------------------------*/
66 | /* Private constants ---------------------------------------------------------*/
67 | /* Private macros ------------------------------------------------------------*/
68 | /* Private functions ---------------------------------------------------------*/
69 | /* Exported functions --------------------------------------------------------*/
70 | /** @defgroup PCDEx_Exported_Functions PCDEx Exported Functions
71 | * @{
72 | */
73 |
74 | /** @defgroup PCDEx_Exported_Functions_Group1 Peripheral Control functions
75 | * @brief PCDEx control functions
76 | *
77 | @verbatim
78 | ===============================================================================
79 | ##### Extended Peripheral Control functions #####
80 | ===============================================================================
81 | [..] This section provides functions allowing to:
82 | (+) Update FIFO (USB_OTG_FS)
83 | (+) Update PMA configuration (USB)
84 |
85 | @endverbatim
86 | * @{
87 | */
88 |
89 | #if defined (USB_OTG_FS)
90 | /**
91 | * @brief Set Tx FIFO
92 | * @param hpcd: PCD handle
93 | * @param fifo: The number of Tx fifo
94 | * @param size: Fifo size
95 | * @retval HAL status
96 | */
97 | HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size)
98 | {
99 | uint8_t index = 0;
100 | uint32_t Tx_Offset = 0;
101 |
102 | /* TXn min size = 16 words. (n : Transmit FIFO index)
103 | When a TxFIFO is not used, the Configuration should be as follows:
104 | case 1 : n > m and Txn is not used (n,m : Transmit FIFO indexes)
105 | --> Txm can use the space allocated for Txn.
106 | case2 : n < m and Txn is not used (n,m : Transmit FIFO indexes)
107 | --> Txn should be configured with the minimum space of 16 words
108 | The FIFO is used optimally when used TxFIFOs are allocated in the top
109 | of the FIFO.Ex: use EP1 and EP2 as IN instead of EP1 and EP3 as IN ones.
110 | When DMA is used 3n * FIFO locations should be reserved for internal DMA registers */
111 |
112 | Tx_Offset = hpcd->Instance->GRXFSIZ;
113 |
114 | if(fifo == 0)
115 | {
116 | hpcd->Instance->DIEPTXF0_HNPTXFSIZ = (size << 16) | Tx_Offset;
117 | }
118 | else
119 | {
120 | Tx_Offset += (hpcd->Instance->DIEPTXF0_HNPTXFSIZ) >> 16;
121 | for (index = 0; index < (fifo - 1); index++)
122 | {
123 | Tx_Offset += (hpcd->Instance->DIEPTXF[index] >> 16);
124 | }
125 |
126 | /* Multiply Tx_Size by 2 to get higher performance */
127 | hpcd->Instance->DIEPTXF[fifo - 1] = (size << 16) | Tx_Offset;
128 |
129 | }
130 |
131 | return HAL_OK;
132 | }
133 |
134 | /**
135 | * @brief Set Rx FIFO
136 | * @param hpcd: PCD handle
137 | * @param size: Size of Rx fifo
138 | * @retval HAL status
139 | */
140 | HAL_StatusTypeDef HAL_PCDEx_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size)
141 | {
142 | hpcd->Instance->GRXFSIZ = size;
143 | return HAL_OK;
144 | }
145 | #endif /* USB_OTG_FS */
146 |
147 | #if defined (USB)
148 | /**
149 | * @brief Configure PMA for EP
150 | * @param hpcd : Device instance
151 | * @param ep_addr: endpoint address
152 | * @param ep_kind: endpoint Kind
153 | * USB_SNG_BUF: Single Buffer used
154 | * USB_DBL_BUF: Double Buffer used
155 | * @param pmaadress: EP address in The PMA: In case of single buffer endpoint
156 | * this parameter is 16-bit value providing the address
157 | * in PMA allocated to endpoint.
158 | * In case of double buffer endpoint this parameter
159 | * is a 32-bit value providing the endpoint buffer 0 address
160 | * in the LSB part of 32-bit value and endpoint buffer 1 address
161 | * in the MSB part of 32-bit value.
162 | * @retval HAL status
163 | */
164 |
165 | HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd,
166 | uint16_t ep_addr,
167 | uint16_t ep_kind,
168 | uint32_t pmaadress)
169 |
170 | {
171 | PCD_EPTypeDef *ep = NULL;
172 |
173 | /* initialize ep structure*/
174 | if ((0x80 & ep_addr) == 0x80)
175 | {
176 | ep = &hpcd->IN_ep[ep_addr & 0x7F];
177 | }
178 | else
179 | {
180 | ep = &hpcd->OUT_ep[ep_addr];
181 | }
182 |
183 | /* Here we check if the endpoint is single or double Buffer*/
184 | if (ep_kind == PCD_SNG_BUF)
185 | {
186 | /*Single Buffer*/
187 | ep->doublebuffer = 0;
188 | /*Configure te PMA*/
189 | ep->pmaadress = (uint16_t)pmaadress;
190 | }
191 | else /*USB_DBL_BUF*/
192 | {
193 | /*Double Buffer Endpoint*/
194 | ep->doublebuffer = 1;
195 | /*Configure the PMA*/
196 | ep->pmaaddr0 = pmaadress & 0xFFFF;
197 | ep->pmaaddr1 = (pmaadress & 0xFFFF0000) >> 16;
198 | }
199 |
200 | return HAL_OK;
201 | }
202 | #endif /* USB */
203 | /**
204 | * @}
205 | */
206 |
207 | /** @defgroup PCDEx_Exported_Functions_Group2 Peripheral State functions
208 | * @brief Manage device connection state
209 | * @{
210 | */
211 | /**
212 | * @brief Software Device Connection,
213 | * this function is not required by USB OTG FS peripheral, it is used
214 | * only by USB Device FS peripheral.
215 | * @param hpcd: PCD handle
216 | * @param state: connection state (0 : disconnected / 1: connected)
217 | * @retval None
218 | */
219 | __weak void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state)
220 | {
221 | /* Prevent unused argument(s) compilation warning */
222 | UNUSED(hpcd);
223 | UNUSED(state);
224 | /* NOTE : This function Should not be modified, when the callback is needed,
225 | the HAL_PCDEx_SetConnectionState could be implemented in the user file
226 | */
227 | }
228 | /**
229 | * @}
230 | */
231 |
232 | /**
233 | * @}
234 | */
235 |
236 | /**
237 | * @}
238 | */
239 |
240 | #endif /* STM32F102x6 || STM32F102xB || */
241 | /* STM32F103x6 || STM32F103xB || */
242 | /* STM32F103xE || STM32F103xG || */
243 | /* STM32F105xC || STM32F107xC */
244 |
245 | #endif /* HAL_PCD_MODULE_ENABLED */
246 |
247 |
248 | /**
249 | * @}
250 | */
251 |
252 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
253 |
--------------------------------------------------------------------------------
/Inc/commandline.h:
--------------------------------------------------------------------------------
1 | #ifndef COMMANDLINE_H
2 | #define COMMANDLINE_H
3 |
4 | void cmdline_addchr(char c);
5 | void reprint_prompt();
6 | void cmdline_prompt();
7 |
8 | #endif // COMMANDLINE_H
9 |
--------------------------------------------------------------------------------
/Inc/gpio.h:
--------------------------------------------------------------------------------
1 | #ifndef GPIO_H
2 | #define GPIO_H
3 |
4 | #define GPIO_BUFFER_SIZE 10240
5 | extern uint8_t gpio_buffer[];
6 | void do_gpio_dma(uint32_t length, uint8_t trigger_mask, uint8_t trigger_values);
7 | void do_gpio_loop(uint32_t length, uint8_t trigger_mask, uint8_t trigger_values);
8 |
9 | extern TIM_HandleTypeDef htim1;
10 |
11 | #endif
12 |
--------------------------------------------------------------------------------
/Inc/main.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * File Name : main.h
4 | * Description : This file contains the common defines of the application
5 | ******************************************************************************
6 | *
7 | * Copyright (c) 2017 STMicroelectronics International N.V.
8 | * All rights reserved.
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted, provided that the following conditions are met:
12 | *
13 | * 1. Redistribution of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | * 2. Redistributions in binary form must reproduce the above copyright notice,
16 | * this list of conditions and the following disclaimer in the documentation
17 | * and/or other materials provided with the distribution.
18 | * 3. Neither the name of STMicroelectronics nor the names of other
19 | * contributors to this software may be used to endorse or promote products
20 | * derived from this software without specific written permission.
21 | * 4. This software, including modifications and/or derivative works of this
22 | * software, must execute solely and exclusively on microcontroller or
23 | * microprocessor devices manufactured by or for STMicroelectronics.
24 | * 5. Redistribution and use of this software other than as permitted under
25 | * this license is void and will automatically terminate your rights under
26 | * this license.
27 | *
28 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
29 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
31 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
32 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
33 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
34 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
36 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
37 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
38 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
39 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 | *
41 | ******************************************************************************
42 | */
43 | /* Define to prevent recursive inclusion -------------------------------------*/
44 | #ifndef __MAIN_H
45 | #define __MAIN_H
46 | /* Includes ------------------------------------------------------------------*/
47 |
48 | /* USER CODE BEGIN Includes */
49 |
50 | /* USER CODE END Includes */
51 |
52 | /* Private define ------------------------------------------------------------*/
53 |
54 | #define LED_Pin GPIO_PIN_13
55 | #define LED_GPIO_Port GPIOC
56 |
57 | /* USER CODE BEGIN Private defines */
58 | void Error_Handler(void);
59 | /* USER CODE END Private defines */
60 |
61 | /**
62 | * @}
63 | */
64 |
65 | /**
66 | * @}
67 | */
68 |
69 | #endif /* __MAIN_H */
70 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
71 |
--------------------------------------------------------------------------------
/Inc/stm32f1xx_it.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f1xx_it.h
4 | * @brief This file contains the headers of the interrupt handlers.
5 | ******************************************************************************
6 | *
7 | * COPYRIGHT(c) 2017 STMicroelectronics
8 | *
9 | * Redistribution and use in source and binary forms, with or without modification,
10 | * are permitted provided that the following conditions are met:
11 | * 1. Redistributions of source code must retain the above copyright notice,
12 | * this list of conditions and the following disclaimer.
13 | * 2. Redistributions in binary form must reproduce the above copyright notice,
14 | * this list of conditions and the following disclaimer in the documentation
15 | * and/or other materials provided with the distribution.
16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | ******************************************************************************
32 | */
33 |
34 | /* Define to prevent recursive inclusion -------------------------------------*/
35 | #ifndef __STM32F1xx_IT_H
36 | #define __STM32F1xx_IT_H
37 |
38 | #ifdef __cplusplus
39 | extern "C" {
40 | #endif
41 |
42 | /* Includes ------------------------------------------------------------------*/
43 | /* Exported types ------------------------------------------------------------*/
44 | /* Exported constants --------------------------------------------------------*/
45 | /* Exported macro ------------------------------------------------------------*/
46 | /* Exported functions ------------------------------------------------------- */
47 |
48 | void NMI_Handler(void);
49 | void HardFault_Handler(void);
50 | void MemManage_Handler(void);
51 | void BusFault_Handler(void);
52 | void UsageFault_Handler(void);
53 | void SVC_Handler(void);
54 | void DebugMon_Handler(void);
55 | void PendSV_Handler(void);
56 | void SysTick_Handler(void);
57 | void DMA1_Channel5_IRQHandler(void);
58 | void USB_HP_CAN1_TX_IRQHandler(void);
59 | void USB_LP_CAN1_RX0_IRQHandler(void);
60 |
61 | #ifdef __cplusplus
62 | }
63 | #endif
64 |
65 | #endif /* __STM32F1xx_IT_H */
66 |
67 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
68 |
--------------------------------------------------------------------------------
/Inc/sump.h:
--------------------------------------------------------------------------------
1 | #ifndef SUMP_H
2 | #define SUMP_H
3 |
4 | void sump_cmd(char c);
5 | void poll_sump();
6 |
7 | #endif
8 |
--------------------------------------------------------------------------------
/Inc/syscall.h:
--------------------------------------------------------------------------------
1 | #ifndef SYSCALL_H
2 | #define SYSCALL_H
3 |
4 | extern uint32_t timeouts;
5 | int _write(int fd, const void *buf, size_t count);
6 | caddr_t _sbrk(int incr);
7 | uint32_t heapsize();
8 | uint32_t heapmax();
9 | uint32_t stacksize();
10 | uint32_t stackmax();
11 |
12 | #endif // SYSCALL_H
13 |
--------------------------------------------------------------------------------
/Inc/uart.h:
--------------------------------------------------------------------------------
1 | #ifndef UART_H
2 | #define UART_H
3 |
4 | extern UART_HandleTypeDef huart1;
5 | #define UART_NAME huart1
6 |
7 | void write_uart_s(const char *s);
8 | void write_uart_u(uint32_t i);
9 | void write_uart_i(int32_t i);
10 |
11 | void start_rx_uart();
12 | int8_t uart_rx_ready();
13 | char uart_rx_data();
14 |
15 | #endif // UART_H
16 |
--------------------------------------------------------------------------------
/Inc/usb_device.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file : USB_DEVICE
4 | * @version : v2.0_Cube
5 | * @brief : Header for usb_device file.
6 | ******************************************************************************
7 | *
8 | * Copyright (c) 2017 STMicroelectronics International N.V.
9 | * All rights reserved.
10 | *
11 | * Redistribution and use in source and binary forms, with or without
12 | * modification, are permitted, provided that the following conditions are met:
13 | *
14 | * 1. Redistribution of source code must retain the above copyright notice,
15 | * this list of conditions and the following disclaimer.
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | * 3. Neither the name of STMicroelectronics nor the names of other
20 | * contributors to this software may be used to endorse or promote products
21 | * derived from this software without specific written permission.
22 | * 4. This software, including modifications and/or derivative works of this
23 | * software, must execute solely and exclusively on microcontroller or
24 | * microprocessor devices manufactured by or for STMicroelectronics.
25 | * 5. Redistribution and use of this software other than as permitted under
26 | * this license is void and will automatically terminate your rights under
27 | * this license.
28 | *
29 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
30 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
32 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
33 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
34 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
35 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
37 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
40 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 | *
42 | ******************************************************************************
43 | */
44 | /* Define to prevent recursive inclusion -------------------------------------*/
45 | #ifndef __usb_device_H
46 | #define __usb_device_H
47 | #ifdef __cplusplus
48 | extern "C" {
49 | #endif
50 |
51 | /* Includes ------------------------------------------------------------------*/
52 | #include "stm32f1xx.h"
53 | #include "stm32f1xx_hal.h"
54 | #include "usbd_def.h"
55 |
56 | extern USBD_HandleTypeDef hUsbDeviceFS;
57 |
58 | /* USB_Device init function */
59 | void MX_USB_DEVICE_Init(void);
60 |
61 | #ifdef __cplusplus
62 | }
63 | #endif
64 | #endif /*__usb_device_H */
65 |
66 | /**
67 | * @}
68 | */
69 |
70 | /**
71 | * @}
72 | */
73 |
74 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
75 |
--------------------------------------------------------------------------------
/Inc/usbd_cdc_if.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file : usbd_cdc_if.h
4 | * @brief : Header for usbd_cdc_if file.
5 | ******************************************************************************
6 | *
7 | * Copyright (c) 2017 STMicroelectronics International N.V.
8 | * All rights reserved.
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted, provided that the following conditions are met:
12 | *
13 | * 1. Redistribution of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | * 2. Redistributions in binary form must reproduce the above copyright notice,
16 | * this list of conditions and the following disclaimer in the documentation
17 | * and/or other materials provided with the distribution.
18 | * 3. Neither the name of STMicroelectronics nor the names of other
19 | * contributors to this software may be used to endorse or promote products
20 | * derived from this software without specific written permission.
21 | * 4. This software, including modifications and/or derivative works of this
22 | * software, must execute solely and exclusively on microcontroller or
23 | * microprocessor devices manufactured by or for STMicroelectronics.
24 | * 5. Redistribution and use of this software other than as permitted under
25 | * this license is void and will automatically terminate your rights under
26 | * this license.
27 | *
28 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
29 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
31 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
32 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
33 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
34 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
36 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
37 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
38 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
39 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 | *
41 | ******************************************************************************
42 | */
43 |
44 | /* Define to prevent recursive inclusion -------------------------------------*/
45 | #ifndef __USBD_CDC_IF_H
46 | #define __USBD_CDC_IF_H
47 |
48 | #ifdef __cplusplus
49 | extern "C" {
50 | #endif
51 | /* Includes ------------------------------------------------------------------*/
52 | #include "usbd_cdc.h"
53 | /* USER CODE BEGIN INCLUDE */
54 | /* USER CODE END INCLUDE */
55 |
56 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
57 | * @{
58 | */
59 |
60 | /** @defgroup USBD_CDC_IF
61 | * @brief header
62 | * @{
63 | */
64 |
65 | /** @defgroup USBD_CDC_IF_Exported_Defines
66 | * @{
67 | */
68 | /* USER CODE BEGIN EXPORTED_DEFINES */
69 | #define APP_RX_DATA_SIZE 64
70 | #define APP_TX_DATA_SIZE 1
71 | /* USER CODE END EXPORTED_DEFINES */
72 |
73 | /**
74 | * @}
75 | */
76 |
77 | /** @defgroup USBD_CDC_IF_Exported_Types
78 | * @{
79 | */
80 | /* USER CODE BEGIN EXPORTED_TYPES */
81 | /* USER CODE END EXPORTED_TYPES */
82 |
83 | /**
84 | * @}
85 | */
86 |
87 | /** @defgroup USBD_CDC_IF_Exported_Macros
88 | * @{
89 | */
90 | /* USER CODE BEGIN EXPORTED_MACRO */
91 | /* USER CODE END EXPORTED_MACRO */
92 |
93 | /**
94 | * @}
95 | */
96 |
97 | /** @defgroup USBD_AUDIO_IF_Exported_Variables
98 | * @{
99 | */
100 | extern USBD_CDC_ItfTypeDef USBD_Interface_fops_FS;
101 |
102 | /* USER CODE BEGIN EXPORTED_VARIABLES */
103 | extern uint8_t UserRxBufferFS[APP_RX_DATA_SIZE];
104 | /* USER CODE END EXPORTED_VARIABLES */
105 |
106 | /**
107 | * @}
108 | */
109 |
110 | /** @defgroup USBD_CDC_IF_Exported_FunctionsPrototype
111 | * @{
112 | */
113 | uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len);
114 |
115 | /* USER CODE BEGIN EXPORTED_FUNCTIONS */
116 | /* USER CODE END EXPORTED_FUNCTIONS */
117 | /**
118 | * @}
119 | */
120 |
121 | /**
122 | * @}
123 | */
124 |
125 | /**
126 | * @}
127 | */
128 |
129 | #ifdef __cplusplus
130 | }
131 | #endif
132 |
133 | #endif /* __USBD_CDC_IF_H */
134 |
135 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
136 |
--------------------------------------------------------------------------------
/Inc/usbd_conf.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file : usbd_conf.h
4 | * @version : v2.0_Cube
5 | * @brief : Header for usbd_conf file.
6 | ******************************************************************************
7 | *
8 | * Copyright (c) 2017 STMicroelectronics International N.V.
9 | * All rights reserved.
10 | *
11 | * Redistribution and use in source and binary forms, with or without
12 | * modification, are permitted, provided that the following conditions are met:
13 | *
14 | * 1. Redistribution of source code must retain the above copyright notice,
15 | * this list of conditions and the following disclaimer.
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | * 3. Neither the name of STMicroelectronics nor the names of other
20 | * contributors to this software may be used to endorse or promote products
21 | * derived from this software without specific written permission.
22 | * 4. This software, including modifications and/or derivative works of this
23 | * software, must execute solely and exclusively on microcontroller or
24 | * microprocessor devices manufactured by or for STMicroelectronics.
25 | * 5. Redistribution and use of this software other than as permitted under
26 | * this license is void and will automatically terminate your rights under
27 | * this license.
28 | *
29 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
30 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
32 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
33 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
34 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
35 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
37 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
40 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 | *
42 | ******************************************************************************
43 | */
44 | /* Define to prevent recursive inclusion -------------------------------------*/
45 | #ifndef __USBD_CONF__H__
46 | #define __USBD_CONF__H__
47 | #ifdef __cplusplus
48 | extern "C" {
49 | #endif
50 | /* Includes ------------------------------------------------------------------*/
51 | #include
52 | #include
53 | #include
54 | #include "stm32f1xx.h"
55 | #include "stm32f1xx_hal.h"
56 | #include "usbd_def.h"
57 |
58 | /** @addtogroup USBD_OTG_DRIVER
59 | * @{
60 | */
61 |
62 | /** @defgroup USBD_CONF
63 | * @brief usb otg low level driver configuration file
64 | * @{
65 | */
66 |
67 | /** @defgroup USBD_CONF_Exported_Defines
68 | * @{
69 | */
70 |
71 | /*---------- -----------*/
72 | #define USBD_MAX_NUM_INTERFACES 1
73 | /*---------- -----------*/
74 | #define USBD_MAX_NUM_CONFIGURATION 1
75 | /*---------- -----------*/
76 | #define USBD_MAX_STR_DESC_SIZ 512
77 | /*---------- -----------*/
78 | #define USBD_SUPPORT_USER_STRING 0
79 | /*---------- -----------*/
80 | #define USBD_DEBUG_LEVEL 0
81 | /*---------- -----------*/
82 | #define USBD_SELF_POWERED 1
83 | /*---------- -----------*/
84 | #define USBD_CDC_INTERVAL 1000
85 | /*---------- -----------*/
86 | #define MAX_STATIC_ALLOC_SIZE 512
87 | /****************************************/
88 | /* #define for FS and HS identification */
89 | #define DEVICE_FS 0
90 |
91 | /** @defgroup USBD_Exported_Macros
92 | * @{
93 | */
94 |
95 | /* Memory management macros */
96 | #define USBD_malloc (uint32_t *)USBD_static_malloc
97 | #define USBD_free USBD_static_free
98 | #define USBD_memset /* Not used */
99 | #define USBD_memcpy /* Not used */
100 |
101 | #define USBD_Delay HAL_Delay
102 |
103 | /* For footprint reasons and since only one allocation is handled in the HID class
104 | driver, the malloc/free is changed into a static allocation method */
105 | void *USBD_static_malloc(uint32_t size);
106 | void USBD_static_free(void *p);
107 |
108 | /* DEBUG macros */
109 | #if (USBD_DEBUG_LEVEL > 0)
110 | #define USBD_UsrLog(...) printf(__VA_ARGS__);\
111 | printf("\n");
112 | #else
113 | #define USBD_UsrLog(...)
114 | #endif
115 |
116 |
117 | #if (USBD_DEBUG_LEVEL > 1)
118 |
119 | #define USBD_ErrLog(...) printf("ERROR: ") ;\
120 | printf(__VA_ARGS__);\
121 | printf("\n");
122 | #else
123 | #define USBD_ErrLog(...)
124 | #endif
125 |
126 |
127 | #if (USBD_DEBUG_LEVEL > 2)
128 | #define USBD_DbgLog(...) printf("DEBUG : ") ;\
129 | printf(__VA_ARGS__);\
130 | printf("\n");
131 | #else
132 | #define USBD_DbgLog(...)
133 | #endif
134 |
135 | /**
136 | * @}
137 | */
138 |
139 |
140 |
141 | /**
142 | * @}
143 | */
144 |
145 | /** @defgroup USBD_CONF_Exported_Types
146 | * @{
147 | */
148 | /**
149 | * @}
150 | */
151 |
152 | /** @defgroup USBD_CONF_Exported_Macros
153 | * @{
154 | */
155 | /**
156 | * @}
157 | */
158 |
159 | /** @defgroup USBD_CONF_Exported_Variables
160 | * @{
161 | */
162 | /**
163 | * @}
164 | */
165 |
166 | /** @defgroup USBD_CONF_Exported_FunctionsPrototype
167 | * @{
168 | */
169 | /**
170 | * @}
171 | */
172 | #ifdef __cplusplus
173 | }
174 | #endif
175 |
176 | #endif /*__USBD_CONF__H__*/
177 |
178 | /**
179 | * @}
180 | */
181 |
182 | /**
183 | * @}
184 | */
185 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
186 |
187 |
--------------------------------------------------------------------------------
/Inc/usbd_desc.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file : usbd_desc.h
4 | * @version : v2.0_Cube
5 | * @brief : Header for usbd_desc file.
6 | ******************************************************************************
7 | *
8 | * Copyright (c) 2017 STMicroelectronics International N.V.
9 | * All rights reserved.
10 | *
11 | * Redistribution and use in source and binary forms, with or without
12 | * modification, are permitted, provided that the following conditions are met:
13 | *
14 | * 1. Redistribution of source code must retain the above copyright notice,
15 | * this list of conditions and the following disclaimer.
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | * 3. Neither the name of STMicroelectronics nor the names of other
20 | * contributors to this software may be used to endorse or promote products
21 | * derived from this software without specific written permission.
22 | * 4. This software, including modifications and/or derivative works of this
23 | * software, must execute solely and exclusively on microcontroller or
24 | * microprocessor devices manufactured by or for STMicroelectronics.
25 | * 5. Redistribution and use of this software other than as permitted under
26 | * this license is void and will automatically terminate your rights under
27 | * this license.
28 | *
29 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
30 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
32 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
33 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
34 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
35 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
37 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
40 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 | *
42 | ******************************************************************************
43 | */
44 |
45 | /* Define to prevent recursive inclusion -------------------------------------*/
46 | #ifndef __USBD_DESC__H__
47 | #define __USBD_DESC__H__
48 |
49 | #ifdef __cplusplus
50 | extern "C" {
51 | #endif
52 | /* Includes ------------------------------------------------------------------*/
53 | #include "usbd_def.h"
54 |
55 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
56 | * @{
57 | */
58 |
59 | /** @defgroup USB_DESC
60 | * @brief general defines for the usb device library file
61 | * @{
62 | */
63 |
64 | /** @defgroup USB_DESC_Exported_Defines
65 | * @{
66 | */
67 |
68 | /**
69 | * @}
70 | */
71 |
72 | /** @defgroup USBD_DESC_Exported_TypesDefinitions
73 | * @{
74 | */
75 | /**
76 | * @}
77 | */
78 |
79 | /** @defgroup USBD_DESC_Exported_Macros
80 | * @{
81 | */
82 | /**
83 | * @}
84 | */
85 |
86 | /** @defgroup USBD_DESC_Exported_Variables
87 | * @{
88 | */
89 | extern USBD_DescriptorsTypeDef FS_Desc;
90 | /**
91 | * @}
92 | */
93 |
94 | /** @defgroup USBD_DESC_Exported_FunctionsPrototype
95 | * @{
96 | */
97 |
98 | /**
99 | * @}
100 | */
101 | #ifdef __cplusplus
102 | }
103 | #endif
104 |
105 | #endif /* __USBD_DESC_H */
106 |
107 | /**
108 | * @}
109 | */
110 |
111 | /**
112 | * @}
113 | */
114 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
115 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | ######################################
2 | # Makefile by CubeMX2Makefile.py
3 | ######################################
4 |
5 | ######################################
6 | # target
7 | ######################################
8 | TARGET = sump
9 |
10 | ######################################
11 | # building variables
12 | ######################################
13 | # debug build?
14 | DEBUG = 1
15 | # optimization
16 | OPT = -Os
17 |
18 | #######################################
19 | # pathes
20 | #######################################
21 | # Build path
22 | BUILD_DIR = build
23 |
24 | ######################################
25 | # source
26 | ######################################
27 | C_SOURCES = \
28 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \
29 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \
30 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \
31 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \
32 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \
33 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \
34 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \
35 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c \
36 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c \
37 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \
38 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \
39 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \
40 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.c \
41 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.c \
42 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
43 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
44 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \
45 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c \
46 | Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c \
47 | Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c \
48 | Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c \
49 | Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \
50 | Src/main.c \
51 | Src/stm32f1xx_hal_msp.c \
52 | Src/stm32f1xx_it.c \
53 | Src/syscall.c \
54 | Src/system_stm32f1xx.c \
55 | Src/usbd_cdc_if.c \
56 | Src/usbd_conf.c \
57 | Src/usbd_desc.c \
58 | Src/usb_device.c \
59 | Src/gpio.c \
60 | Src/sump.c \
61 | Src/uart.c
62 | ASM_SOURCES = \
63 | startup/startup_stm32f103xb.s
64 |
65 | #######################################
66 | # binaries
67 | #######################################
68 | CC = arm-none-eabi-gcc
69 | AS = arm-none-eabi-gcc -x assembler-with-cpp
70 | CP = arm-none-eabi-objcopy
71 | AR = arm-none-eabi-ar
72 | SZ = arm-none-eabi-size
73 | HEX = $(CP) -O ihex
74 | BIN = $(CP) -O binary -S
75 |
76 | #######################################
77 | # CFLAGS
78 | #######################################
79 | # macros for gcc
80 | AS_DEFS =
81 | C_DEFS = -D__weak="__attribute__((weak))" -D__packed="__attribute__((__packed__))" -DUSE_HAL_DRIVER -DSTM32F103xB -D_GNU_SOURCE
82 | # includes for gcc
83 | AS_INCLUDES =
84 | C_INCLUDES = -IDrivers/CMSIS/Device/ST/STM32F1xx/Include
85 | C_INCLUDES += -IDrivers/CMSIS/Include
86 | C_INCLUDES += -IDrivers/STM32F1xx_HAL_Driver/Inc
87 | C_INCLUDES += -IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy
88 | C_INCLUDES += -IInc
89 | C_INCLUDES += -IMiddlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc
90 | C_INCLUDES += -IMiddlewares/ST/STM32_USB_Device_Library/Core/Inc
91 | # compile gcc flags
92 | ASFLAGS = -mthumb -mcpu=cortex-m3 $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
93 | CFLAGS = -mthumb -mcpu=cortex-m3 $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
94 | ifeq ($(DEBUG), 1)
95 | CFLAGS += -g -gdwarf-2
96 | endif
97 | # Generate dependency information
98 | CFLAGS += -std=gnu11 -MD -MP -MF .dep/$(@F).d
99 |
100 | #######################################
101 | # LDFLAGS
102 | #######################################
103 | # link script
104 | LDSCRIPT = STM32F103C8Tx_FLASH.ld
105 | # libraries
106 | LIBS = -lc -lm -lnosys
107 | LIBDIR =
108 | LDFLAGS = -mthumb -mcpu=cortex-m3 -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
109 |
110 | # default action: build all
111 | all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
112 |
113 | #######################################
114 | # build the application
115 | #######################################
116 | # list of objects
117 | OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
118 | vpath %.c $(sort $(dir $(C_SOURCES)))
119 | # list of ASM program objects
120 | OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
121 | vpath %.s $(sort $(dir $(ASM_SOURCES)))
122 |
123 | $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
124 | $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
125 |
126 | $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
127 | $(AS) -c $(CFLAGS) $< -o $@
128 |
129 | $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
130 | $(CC) $(OBJECTS) $(LDFLAGS) -o $@
131 | $(SZ) --format=sysv --radix=16 $@
132 | $(SZ) $@
133 |
134 | $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
135 | $(HEX) $< $@
136 |
137 | $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
138 | $(BIN) $< $@
139 |
140 | $(BUILD_DIR):
141 | mkdir -p $@
142 |
143 | flash: $(BUILD_DIR)/$(TARGET).bin
144 | openocd
145 |
146 | #######################################
147 | # clean up
148 | #######################################
149 | clean:
150 | -rm -fR .dep $(BUILD_DIR)
151 |
152 | #######################################
153 | # dependencies
154 | #######################################
155 | -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
156 |
157 | .PHONY: clean all flash
158 |
159 | # *** EOF ***
160 |
--------------------------------------------------------------------------------
/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_cdc.h
4 | * @author MCD Application Team
5 | * @version V2.4.2
6 | * @date 11-December-2015
7 | * @brief header file for the usbd_cdc.c file.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2015 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive inclusion -------------------------------------*/
29 | #ifndef __USB_CDC_H
30 | #define __USB_CDC_H
31 |
32 | #ifdef __cplusplus
33 | extern "C" {
34 | #endif
35 |
36 | /* Includes ------------------------------------------------------------------*/
37 | #include "usbd_ioreq.h"
38 |
39 | /** @addtogroup STM32_USB_DEVICE_LIBRARY
40 | * @{
41 | */
42 |
43 | /** @defgroup usbd_cdc
44 | * @brief This file is the Header file for usbd_cdc.c
45 | * @{
46 | */
47 |
48 |
49 | /** @defgroup usbd_cdc_Exported_Defines
50 | * @{
51 | */
52 | #define CDC_IN_EP 0x81 /* EP1 for data IN */
53 | #define CDC_OUT_EP 0x01 /* EP1 for data OUT */
54 | #define CDC_CMD_EP 0x82 /* EP2 for CDC commands */
55 |
56 | /* CDC Endpoints parameters: you can fine tune these values depending on the needed baudrates and performance. */
57 | #define CDC_DATA_HS_MAX_PACKET_SIZE 512 /* Endpoint IN & OUT Packet size */
58 | #define CDC_DATA_FS_MAX_PACKET_SIZE 64 /* Endpoint IN & OUT Packet size */
59 | #define CDC_CMD_PACKET_SIZE 8 /* Control Endpoint Packet size */
60 |
61 | #define USB_CDC_CONFIG_DESC_SIZ 67
62 | #define CDC_DATA_HS_IN_PACKET_SIZE CDC_DATA_HS_MAX_PACKET_SIZE
63 | #define CDC_DATA_HS_OUT_PACKET_SIZE CDC_DATA_HS_MAX_PACKET_SIZE
64 |
65 | #define CDC_DATA_FS_IN_PACKET_SIZE CDC_DATA_FS_MAX_PACKET_SIZE
66 | #define CDC_DATA_FS_OUT_PACKET_SIZE CDC_DATA_FS_MAX_PACKET_SIZE
67 |
68 | /*---------------------------------------------------------------------*/
69 | /* CDC definitions */
70 | /*---------------------------------------------------------------------*/
71 | #define CDC_SEND_ENCAPSULATED_COMMAND 0x00
72 | #define CDC_GET_ENCAPSULATED_RESPONSE 0x01
73 | #define CDC_SET_COMM_FEATURE 0x02
74 | #define CDC_GET_COMM_FEATURE 0x03
75 | #define CDC_CLEAR_COMM_FEATURE 0x04
76 | #define CDC_SET_LINE_CODING 0x20
77 | #define CDC_GET_LINE_CODING 0x21
78 | #define CDC_SET_CONTROL_LINE_STATE 0x22
79 | #define CDC_SEND_BREAK 0x23
80 |
81 | /**
82 | * @}
83 | */
84 |
85 |
86 | /** @defgroup USBD_CORE_Exported_TypesDefinitions
87 | * @{
88 | */
89 |
90 | /**
91 | * @}
92 | */
93 | typedef struct
94 | {
95 | uint32_t bitrate;
96 | uint8_t format;
97 | uint8_t paritytype;
98 | uint8_t datatype;
99 | }USBD_CDC_LineCodingTypeDef;
100 |
101 | typedef struct _USBD_CDC_Itf
102 | {
103 | int8_t (* Init) (void);
104 | int8_t (* DeInit) (void);
105 | int8_t (* Control) (uint8_t, uint8_t * , uint16_t);
106 | int8_t (* Receive) (uint8_t *, uint32_t *);
107 |
108 | }USBD_CDC_ItfTypeDef;
109 |
110 |
111 | typedef struct
112 | {
113 | uint32_t data[CDC_DATA_HS_MAX_PACKET_SIZE/4]; /* Force 32bits alignment */
114 | uint8_t CmdOpCode;
115 | uint8_t CmdLength;
116 | uint8_t *RxBuffer;
117 | uint8_t *TxBuffer;
118 | uint32_t RxLength;
119 | uint32_t TxLength;
120 |
121 | __IO uint32_t TxState;
122 | __IO uint32_t RxState;
123 | }
124 | USBD_CDC_HandleTypeDef;
125 |
126 |
127 |
128 | /** @defgroup USBD_CORE_Exported_Macros
129 | * @{
130 | */
131 |
132 | /**
133 | * @}
134 | */
135 |
136 | /** @defgroup USBD_CORE_Exported_Variables
137 | * @{
138 | */
139 |
140 | extern USBD_ClassTypeDef USBD_CDC;
141 | #define USBD_CDC_CLASS &USBD_CDC
142 | /**
143 | * @}
144 | */
145 |
146 | /** @defgroup USB_CORE_Exported_Functions
147 | * @{
148 | */
149 | uint8_t USBD_CDC_RegisterInterface (USBD_HandleTypeDef *pdev,
150 | USBD_CDC_ItfTypeDef *fops);
151 |
152 | uint8_t USBD_CDC_SetTxBuffer (USBD_HandleTypeDef *pdev,
153 | uint8_t *pbuff,
154 | uint16_t length);
155 |
156 | uint8_t USBD_CDC_SetRxBuffer (USBD_HandleTypeDef *pdev,
157 | uint8_t *pbuff);
158 |
159 | uint8_t USBD_CDC_ReceivePacket (USBD_HandleTypeDef *pdev);
160 |
161 | uint8_t USBD_CDC_TransmitPacket (USBD_HandleTypeDef *pdev);
162 | /**
163 | * @}
164 | */
165 |
166 | #ifdef __cplusplus
167 | }
168 | #endif
169 |
170 | #endif /* __USB_CDC_H */
171 | /**
172 | * @}
173 | */
174 |
175 | /**
176 | * @}
177 | */
178 |
179 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
180 |
--------------------------------------------------------------------------------
/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_core.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_core.h
4 | * @author MCD Application Team
5 | * @version V2.4.2
6 | * @date 11-December-2015
7 | * @brief Header file for usbd_core.c file
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2015 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive inclusion -------------------------------------*/
29 | #ifndef __USBD_CORE_H
30 | #define __USBD_CORE_H
31 |
32 | #ifdef __cplusplus
33 | extern "C" {
34 | #endif
35 |
36 | /* Includes ------------------------------------------------------------------*/
37 | #include "usbd_conf.h"
38 | #include "usbd_def.h"
39 | #include "usbd_ioreq.h"
40 | #include "usbd_ctlreq.h"
41 |
42 | /** @addtogroup STM32_USB_DEVICE_LIBRARY
43 | * @{
44 | */
45 |
46 | /** @defgroup USBD_CORE
47 | * @brief This file is the Header file for usbd_core.c file
48 | * @{
49 | */
50 |
51 |
52 | /** @defgroup USBD_CORE_Exported_Defines
53 | * @{
54 | */
55 |
56 | /**
57 | * @}
58 | */
59 |
60 |
61 | /** @defgroup USBD_CORE_Exported_TypesDefinitions
62 | * @{
63 | */
64 |
65 |
66 | /**
67 | * @}
68 | */
69 |
70 |
71 |
72 | /** @defgroup USBD_CORE_Exported_Macros
73 | * @{
74 | */
75 |
76 | /**
77 | * @}
78 | */
79 |
80 | /** @defgroup USBD_CORE_Exported_Variables
81 | * @{
82 | */
83 | #define USBD_SOF USBD_LL_SOF
84 | /**
85 | * @}
86 | */
87 |
88 | /** @defgroup USBD_CORE_Exported_FunctionsPrototype
89 | * @{
90 | */
91 | USBD_StatusTypeDef USBD_Init(USBD_HandleTypeDef *pdev, USBD_DescriptorsTypeDef *pdesc, uint8_t id);
92 | USBD_StatusTypeDef USBD_DeInit(USBD_HandleTypeDef *pdev);
93 | USBD_StatusTypeDef USBD_Start (USBD_HandleTypeDef *pdev);
94 | USBD_StatusTypeDef USBD_Stop (USBD_HandleTypeDef *pdev);
95 | USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass);
96 |
97 | USBD_StatusTypeDef USBD_RunTestMode (USBD_HandleTypeDef *pdev);
98 | USBD_StatusTypeDef USBD_SetClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx);
99 | USBD_StatusTypeDef USBD_ClrClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx);
100 |
101 | USBD_StatusTypeDef USBD_LL_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup);
102 | USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev , uint8_t epnum, uint8_t *pdata);
103 | USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev , uint8_t epnum, uint8_t *pdata);
104 |
105 | USBD_StatusTypeDef USBD_LL_Reset(USBD_HandleTypeDef *pdev);
106 | USBD_StatusTypeDef USBD_LL_SetSpeed(USBD_HandleTypeDef *pdev, USBD_SpeedTypeDef speed);
107 | USBD_StatusTypeDef USBD_LL_Suspend(USBD_HandleTypeDef *pdev);
108 | USBD_StatusTypeDef USBD_LL_Resume(USBD_HandleTypeDef *pdev);
109 |
110 | USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev);
111 | USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum);
112 | USBD_StatusTypeDef USBD_LL_IsoOUTIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum);
113 |
114 | USBD_StatusTypeDef USBD_LL_DevConnected(USBD_HandleTypeDef *pdev);
115 | USBD_StatusTypeDef USBD_LL_DevDisconnected(USBD_HandleTypeDef *pdev);
116 |
117 | /* USBD Low Level Driver */
118 | USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev);
119 | USBD_StatusTypeDef USBD_LL_DeInit (USBD_HandleTypeDef *pdev);
120 | USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev);
121 | USBD_StatusTypeDef USBD_LL_Stop (USBD_HandleTypeDef *pdev);
122 | USBD_StatusTypeDef USBD_LL_OpenEP (USBD_HandleTypeDef *pdev,
123 | uint8_t ep_addr,
124 | uint8_t ep_type,
125 | uint16_t ep_mps);
126 |
127 | USBD_StatusTypeDef USBD_LL_CloseEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
128 | USBD_StatusTypeDef USBD_LL_FlushEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
129 | USBD_StatusTypeDef USBD_LL_StallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
130 | USBD_StatusTypeDef USBD_LL_ClearStallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
131 | uint8_t USBD_LL_IsStallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
132 | USBD_StatusTypeDef USBD_LL_SetUSBAddress (USBD_HandleTypeDef *pdev, uint8_t dev_addr);
133 | USBD_StatusTypeDef USBD_LL_Transmit (USBD_HandleTypeDef *pdev,
134 | uint8_t ep_addr,
135 | uint8_t *pbuf,
136 | uint16_t size);
137 |
138 | USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev,
139 | uint8_t ep_addr,
140 | uint8_t *pbuf,
141 | uint16_t size);
142 |
143 | uint32_t USBD_LL_GetRxDataSize (USBD_HandleTypeDef *pdev, uint8_t ep_addr);
144 | void USBD_LL_Delay (uint32_t Delay);
145 |
146 | /**
147 | * @}
148 | */
149 |
150 | #ifdef __cplusplus
151 | }
152 | #endif
153 |
154 | #endif /* __USBD_CORE_H */
155 |
156 | /**
157 | * @}
158 | */
159 |
160 | /**
161 | * @}
162 | */
163 |
164 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
165 |
166 |
167 |
168 |
--------------------------------------------------------------------------------
/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_req.h
4 | * @author MCD Application Team
5 | * @version V2.4.2
6 | * @date 11-December-2015
7 | * @brief Header file for the usbd_req.c file
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2015 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive inclusion -------------------------------------*/
29 | #ifndef __USB_REQUEST_H
30 | #define __USB_REQUEST_H
31 |
32 | #ifdef __cplusplus
33 | extern "C" {
34 | #endif
35 |
36 | /* Includes ------------------------------------------------------------------*/
37 | #include "usbd_def.h"
38 |
39 |
40 | /** @addtogroup STM32_USB_DEVICE_LIBRARY
41 | * @{
42 | */
43 |
44 | /** @defgroup USBD_REQ
45 | * @brief header file for the usbd_req.c file
46 | * @{
47 | */
48 |
49 | /** @defgroup USBD_REQ_Exported_Defines
50 | * @{
51 | */
52 | /**
53 | * @}
54 | */
55 |
56 |
57 | /** @defgroup USBD_REQ_Exported_Types
58 | * @{
59 | */
60 | /**
61 | * @}
62 | */
63 |
64 |
65 |
66 | /** @defgroup USBD_REQ_Exported_Macros
67 | * @{
68 | */
69 | /**
70 | * @}
71 | */
72 |
73 | /** @defgroup USBD_REQ_Exported_Variables
74 | * @{
75 | */
76 | /**
77 | * @}
78 | */
79 |
80 | /** @defgroup USBD_REQ_Exported_FunctionsPrototype
81 | * @{
82 | */
83 |
84 | USBD_StatusTypeDef USBD_StdDevReq (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req);
85 | USBD_StatusTypeDef USBD_StdItfReq (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req);
86 | USBD_StatusTypeDef USBD_StdEPReq (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req);
87 |
88 |
89 | void USBD_CtlError (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req);
90 |
91 | void USBD_ParseSetupRequest (USBD_SetupReqTypedef *req, uint8_t *pdata);
92 |
93 | void USBD_GetString (uint8_t *desc, uint8_t *unicode, uint16_t *len);
94 | /**
95 | * @}
96 | */
97 |
98 | #ifdef __cplusplus
99 | }
100 | #endif
101 |
102 | #endif /* __USB_REQUEST_H */
103 |
104 | /**
105 | * @}
106 | */
107 |
108 | /**
109 | * @}
110 | */
111 |
112 |
113 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
114 |
--------------------------------------------------------------------------------
/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_ioreq.h
4 | * @author MCD Application Team
5 | * @version V2.4.2
6 | * @date 11-December-2015
7 | * @brief Header file for the usbd_ioreq.c file
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2015 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive inclusion -------------------------------------*/
29 | #ifndef __USBD_IOREQ_H
30 | #define __USBD_IOREQ_H
31 |
32 | #ifdef __cplusplus
33 | extern "C" {
34 | #endif
35 |
36 | /* Includes ------------------------------------------------------------------*/
37 | #include "usbd_def.h"
38 | #include "usbd_core.h"
39 |
40 | /** @addtogroup STM32_USB_DEVICE_LIBRARY
41 | * @{
42 | */
43 |
44 | /** @defgroup USBD_IOREQ
45 | * @brief header file for the usbd_ioreq.c file
46 | * @{
47 | */
48 |
49 | /** @defgroup USBD_IOREQ_Exported_Defines
50 | * @{
51 | */
52 | /**
53 | * @}
54 | */
55 |
56 |
57 | /** @defgroup USBD_IOREQ_Exported_Types
58 | * @{
59 | */
60 |
61 |
62 | /**
63 | * @}
64 | */
65 |
66 |
67 |
68 | /** @defgroup USBD_IOREQ_Exported_Macros
69 | * @{
70 | */
71 |
72 | /**
73 | * @}
74 | */
75 |
76 | /** @defgroup USBD_IOREQ_Exported_Variables
77 | * @{
78 | */
79 |
80 | /**
81 | * @}
82 | */
83 |
84 | /** @defgroup USBD_IOREQ_Exported_FunctionsPrototype
85 | * @{
86 | */
87 |
88 | USBD_StatusTypeDef USBD_CtlSendData (USBD_HandleTypeDef *pdev,
89 | uint8_t *buf,
90 | uint16_t len);
91 |
92 | USBD_StatusTypeDef USBD_CtlContinueSendData (USBD_HandleTypeDef *pdev,
93 | uint8_t *pbuf,
94 | uint16_t len);
95 |
96 | USBD_StatusTypeDef USBD_CtlPrepareRx (USBD_HandleTypeDef *pdev,
97 | uint8_t *pbuf,
98 | uint16_t len);
99 |
100 | USBD_StatusTypeDef USBD_CtlContinueRx (USBD_HandleTypeDef *pdev,
101 | uint8_t *pbuf,
102 | uint16_t len);
103 |
104 | USBD_StatusTypeDef USBD_CtlSendStatus (USBD_HandleTypeDef *pdev);
105 |
106 | USBD_StatusTypeDef USBD_CtlReceiveStatus (USBD_HandleTypeDef *pdev);
107 |
108 | uint16_t USBD_GetRxCount (USBD_HandleTypeDef *pdev ,
109 | uint8_t epnum);
110 |
111 | /**
112 | * @}
113 | */
114 |
115 | #ifdef __cplusplus
116 | }
117 | #endif
118 |
119 | #endif /* __USBD_IOREQ_H */
120 |
121 | /**
122 | * @}
123 | */
124 |
125 | /**
126 | * @}
127 | */
128 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
129 |
--------------------------------------------------------------------------------
/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_ioreq.c
4 | * @author MCD Application Team
5 | * @version V2.4.2
6 | * @date 11-December-2015
7 | * @brief This file provides the IO requests APIs for control endpoints.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2015 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "usbd_ioreq.h"
30 |
31 | /** @addtogroup STM32_USB_DEVICE_LIBRARY
32 | * @{
33 | */
34 |
35 |
36 | /** @defgroup USBD_IOREQ
37 | * @brief control I/O requests module
38 | * @{
39 | */
40 |
41 | /** @defgroup USBD_IOREQ_Private_TypesDefinitions
42 | * @{
43 | */
44 | /**
45 | * @}
46 | */
47 |
48 |
49 | /** @defgroup USBD_IOREQ_Private_Defines
50 | * @{
51 | */
52 |
53 | /**
54 | * @}
55 | */
56 |
57 |
58 | /** @defgroup USBD_IOREQ_Private_Macros
59 | * @{
60 | */
61 | /**
62 | * @}
63 | */
64 |
65 |
66 | /** @defgroup USBD_IOREQ_Private_Variables
67 | * @{
68 | */
69 |
70 | /**
71 | * @}
72 | */
73 |
74 |
75 | /** @defgroup USBD_IOREQ_Private_FunctionPrototypes
76 | * @{
77 | */
78 | /**
79 | * @}
80 | */
81 |
82 |
83 | /** @defgroup USBD_IOREQ_Private_Functions
84 | * @{
85 | */
86 |
87 | /**
88 | * @brief USBD_CtlSendData
89 | * send data on the ctl pipe
90 | * @param pdev: device instance
91 | * @param buff: pointer to data buffer
92 | * @param len: length of data to be sent
93 | * @retval status
94 | */
95 | USBD_StatusTypeDef USBD_CtlSendData (USBD_HandleTypeDef *pdev,
96 | uint8_t *pbuf,
97 | uint16_t len)
98 | {
99 | /* Set EP0 State */
100 | pdev->ep0_state = USBD_EP0_DATA_IN;
101 | pdev->ep_in[0].total_length = len;
102 | pdev->ep_in[0].rem_length = len;
103 | /* Start the transfer */
104 | USBD_LL_Transmit (pdev, 0x00, pbuf, len);
105 |
106 | return USBD_OK;
107 | }
108 |
109 | /**
110 | * @brief USBD_CtlContinueSendData
111 | * continue sending data on the ctl pipe
112 | * @param pdev: device instance
113 | * @param buff: pointer to data buffer
114 | * @param len: length of data to be sent
115 | * @retval status
116 | */
117 | USBD_StatusTypeDef USBD_CtlContinueSendData (USBD_HandleTypeDef *pdev,
118 | uint8_t *pbuf,
119 | uint16_t len)
120 | {
121 | /* Start the next transfer */
122 | USBD_LL_Transmit (pdev, 0x00, pbuf, len);
123 |
124 | return USBD_OK;
125 | }
126 |
127 | /**
128 | * @brief USBD_CtlPrepareRx
129 | * receive data on the ctl pipe
130 | * @param pdev: device instance
131 | * @param buff: pointer to data buffer
132 | * @param len: length of data to be received
133 | * @retval status
134 | */
135 | USBD_StatusTypeDef USBD_CtlPrepareRx (USBD_HandleTypeDef *pdev,
136 | uint8_t *pbuf,
137 | uint16_t len)
138 | {
139 | /* Set EP0 State */
140 | pdev->ep0_state = USBD_EP0_DATA_OUT;
141 | pdev->ep_out[0].total_length = len;
142 | pdev->ep_out[0].rem_length = len;
143 | /* Start the transfer */
144 | USBD_LL_PrepareReceive (pdev,
145 | 0,
146 | pbuf,
147 | len);
148 |
149 | return USBD_OK;
150 | }
151 |
152 | /**
153 | * @brief USBD_CtlContinueRx
154 | * continue receive data on the ctl pipe
155 | * @param pdev: device instance
156 | * @param buff: pointer to data buffer
157 | * @param len: length of data to be received
158 | * @retval status
159 | */
160 | USBD_StatusTypeDef USBD_CtlContinueRx (USBD_HandleTypeDef *pdev,
161 | uint8_t *pbuf,
162 | uint16_t len)
163 | {
164 |
165 | USBD_LL_PrepareReceive (pdev,
166 | 0,
167 | pbuf,
168 | len);
169 | return USBD_OK;
170 | }
171 | /**
172 | * @brief USBD_CtlSendStatus
173 | * send zero lzngth packet on the ctl pipe
174 | * @param pdev: device instance
175 | * @retval status
176 | */
177 | USBD_StatusTypeDef USBD_CtlSendStatus (USBD_HandleTypeDef *pdev)
178 | {
179 |
180 | /* Set EP0 State */
181 | pdev->ep0_state = USBD_EP0_STATUS_IN;
182 |
183 | /* Start the transfer */
184 | USBD_LL_Transmit (pdev, 0x00, NULL, 0);
185 |
186 | return USBD_OK;
187 | }
188 |
189 | /**
190 | * @brief USBD_CtlReceiveStatus
191 | * receive zero lzngth packet on the ctl pipe
192 | * @param pdev: device instance
193 | * @retval status
194 | */
195 | USBD_StatusTypeDef USBD_CtlReceiveStatus (USBD_HandleTypeDef *pdev)
196 | {
197 | /* Set EP0 State */
198 | pdev->ep0_state = USBD_EP0_STATUS_OUT;
199 |
200 | /* Start the transfer */
201 | USBD_LL_PrepareReceive ( pdev,
202 | 0,
203 | NULL,
204 | 0);
205 |
206 | return USBD_OK;
207 | }
208 |
209 |
210 | /**
211 | * @brief USBD_GetRxCount
212 | * returns the received data length
213 | * @param pdev: device instance
214 | * @param ep_addr: endpoint address
215 | * @retval Rx Data blength
216 | */
217 | uint16_t USBD_GetRxCount (USBD_HandleTypeDef *pdev , uint8_t ep_addr)
218 | {
219 | return USBD_LL_GetRxDataSize(pdev, ep_addr);
220 | }
221 |
222 | /**
223 | * @}
224 | */
225 |
226 |
227 | /**
228 | * @}
229 | */
230 |
231 |
232 | /**
233 | * @}
234 | */
235 |
236 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
237 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This logic analyzer polls pins PA0..PA7 at up to a 7.2MHz rate. Use a SUMP client: https://lxtreme.nl/projects/ols/
2 |
3 | Copy the file ols.profile-stm32f103.cfg to your ols plugins directory (there will be other ols.\*.cfg files there)
4 |
5 | When capturing, the device type is "STM32F103 Logic Analyzer"
6 |
7 | Largest capture size is 10KB
8 |
9 | This sump protocol code is based on https://github.com/gillham/logic\_analyzer/blob/master/logic\_analyzer.ino
10 |
11 | There is some debug output on uart1 PA9/PA10, but it's not needed to use this code.
12 |
13 | There's a 100KHz PWM setup on pin PB4 for testing
14 |
15 | Compiling requires make and arm-none-eabi-gcc in your path. newlib is recommended
16 |
--------------------------------------------------------------------------------
/STM32F103C8Tx_FLASH.ld:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************
3 | **
4 |
5 | ** File : LinkerScript.ld
6 | **
7 | ** Abstract : Linker script for STM32F103C8Tx Device with
8 | ** 64KByte FLASH, 20KByte RAM
9 | **
10 | ** Set heap size, stack size and stack location according
11 | ** to application requirements.
12 | **
13 | ** Set memory bank area and size if external memory is used.
14 | **
15 | ** Target : STMicroelectronics STM32
16 | **
17 | **
18 | ** Distribution: The file is distributed as is, without any warranty
19 | ** of any kind.
20 | **
21 | *****************************************************************************
22 | ** @attention
23 | **
24 | ** © COPYRIGHT(c) 2014 Ac6
25 | **
26 | ** Redistribution and use in source and binary forms, with or without modification,
27 | ** are permitted provided that the following conditions are met:
28 | ** 1. Redistributions of source code must retain the above copyright notice,
29 | ** this list of conditions and the following disclaimer.
30 | ** 2. Redistributions in binary form must reproduce the above copyright notice,
31 | ** this list of conditions and the following disclaimer in the documentation
32 | ** and/or other materials provided with the distribution.
33 | ** 3. Neither the name of Ac6 nor the names of its contributors
34 | ** may be used to endorse or promote products derived from this software
35 | ** without specific prior written permission.
36 | **
37 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
38 | ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39 | ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40 | ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
41 | ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
42 | ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
44 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45 | ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
46 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47 | **
48 | *****************************************************************************
49 | */
50 |
51 | /* Entry Point */
52 | ENTRY(Reset_Handler)
53 |
54 | /* Highest address of the user mode stack */
55 | _estack = 0x20005000; /* end of RAM */
56 | /* Generate a link error if heap and stack don't fit into RAM */
57 | _Min_Heap_Size = 0x0; /* required amount of heap */
58 | _Min_Stack_Size = 0x400; /* required amount of stack */
59 |
60 | /* Specify the memory areas */
61 | MEMORY
62 | {
63 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
64 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 64K
65 | }
66 |
67 | /* Define output sections */
68 | SECTIONS
69 | {
70 | /* The startup code goes first into FLASH */
71 | .isr_vector :
72 | {
73 | . = ALIGN(4);
74 | KEEP(*(.isr_vector)) /* Startup code */
75 | . = ALIGN(4);
76 | } >FLASH
77 |
78 | /* The program code and other data goes into FLASH */
79 | .text :
80 | {
81 | . = ALIGN(4);
82 | *(.text) /* .text sections (code) */
83 | *(.text*) /* .text* sections (code) */
84 | *(.glue_7) /* glue arm to thumb code */
85 | *(.glue_7t) /* glue thumb to arm code */
86 | *(.eh_frame)
87 |
88 | KEEP (*(.init))
89 | KEEP (*(.fini))
90 |
91 | . = ALIGN(4);
92 | _etext = .; /* define a global symbols at end of code */
93 | } >FLASH
94 |
95 | /* Constant data goes into FLASH */
96 | .rodata :
97 | {
98 | . = ALIGN(4);
99 | *(.rodata) /* .rodata sections (constants, strings, etc.) */
100 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
101 | . = ALIGN(4);
102 | } >FLASH
103 |
104 | .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
105 | .ARM : {
106 | __exidx_start = .;
107 | *(.ARM.exidx*)
108 | __exidx_end = .;
109 | } >FLASH
110 |
111 | .preinit_array :
112 | {
113 | PROVIDE_HIDDEN (__preinit_array_start = .);
114 | KEEP (*(.preinit_array*))
115 | PROVIDE_HIDDEN (__preinit_array_end = .);
116 | } >FLASH
117 | .init_array :
118 | {
119 | PROVIDE_HIDDEN (__init_array_start = .);
120 | KEEP (*(SORT(.init_array.*)))
121 | KEEP (*(.init_array*))
122 | PROVIDE_HIDDEN (__init_array_end = .);
123 | } >FLASH
124 | .fini_array :
125 | {
126 | PROVIDE_HIDDEN (__fini_array_start = .);
127 | KEEP (*(SORT(.fini_array.*)))
128 | KEEP (*(.fini_array*))
129 | PROVIDE_HIDDEN (__fini_array_end = .);
130 | } >FLASH
131 |
132 | /* used by the startup to initialize data */
133 | _sidata = LOADADDR(.data);
134 |
135 | /* Initialized data sections goes into RAM, load LMA copy after code */
136 | .data :
137 | {
138 | . = ALIGN(4);
139 | _sdata = .; /* create a global symbol at data start */
140 | *(.data) /* .data sections */
141 | *(.data*) /* .data* sections */
142 |
143 | . = ALIGN(4);
144 | _edata = .; /* define a global symbol at data end */
145 | } >RAM AT> FLASH
146 |
147 |
148 | /* Uninitialized data section */
149 | . = ALIGN(4);
150 | .bss :
151 | {
152 | /* This is used by the startup in order to initialize the .bss secion */
153 | _sbss = .; /* define a global symbol at bss start */
154 | __bss_start__ = _sbss;
155 | *(.bss)
156 | *(.bss*)
157 | *(COMMON)
158 |
159 | . = ALIGN(4);
160 | _ebss = .; /* define a global symbol at bss end */
161 | __bss_end__ = _ebss;
162 | } >RAM
163 |
164 | /* User_heap_stack section, used to check that there is enough RAM left */
165 | ._user_heap_stack :
166 | {
167 | . = ALIGN(8);
168 | PROVIDE ( end = . );
169 | PROVIDE ( _end = . );
170 | . = . + _Min_Heap_Size;
171 | . = . + _Min_Stack_Size;
172 | . = ALIGN(8);
173 | } >RAM
174 |
175 |
176 |
177 | /* Remove information from the standard libraries */
178 | /DISCARD/ :
179 | {
180 | libc.a ( * )
181 | libm.a ( * )
182 | libgcc.a ( * )
183 | }
184 |
185 | .ARM.attributes 0 : { *(.ARM.attributes) }
186 | }
187 |
188 |
189 |
--------------------------------------------------------------------------------
/Src/commandline.c:
--------------------------------------------------------------------------------
1 | #include "stm32f1xx_hal.h"
2 | #include "commandline.h"
3 | #include "syscall.h"
4 | #include "usbd_cdc_if.h"
5 | #include
6 | #include
7 |
8 | #include "gpio.h"
9 |
10 | static void command_memory() {
11 | printf("heap = %lu/%lu stacksize = %lu/%lu\n", heapsize(), heapmax(), stacksize(), stackmax());
12 | }
13 |
14 | static void command_serial() {
15 | printf("output timeouts = %lu input overruns = %lu\n", timeouts, overruns);
16 | }
17 |
18 | static void command_dump_gpio() {
19 | for(uint16_t i = 0; i < GPIO_BUFFER_SIZE; i++) {
20 | printf("%x", gpio_buffer[i] & 0x1);
21 | }
22 | printf("\n");
23 | }
24 |
25 | static void blink(const char *option) {
26 | if(strcmp(option, " on") == 0) {
27 | HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_RESET);
28 | } else if(strcmp(option, " off") == 0) {
29 | HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_SET);
30 | } else {
31 | HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
32 | }
33 | }
34 |
35 | static void print_help() {
36 | printf("commands:\n");
37 | printf("blink (on|off|toggle) - blink LED\n");
38 | printf("mem - show mem\n");
39 | printf("serial - show usb serial stats\n");
40 | printf("gpio - show gpio data\n");
41 | printf("poll - poll 1024 samples at 1MHz\n");
42 | }
43 |
44 | static void run_command(char *cmdline) {
45 | if(strncmp("blink", cmdline,5) == 0) {
46 | blink(cmdline+5);
47 | } else if(strcmp("mem", cmdline) == 0) {
48 | command_memory();
49 | } else if(strcmp("serial", cmdline) == 0) {
50 | command_serial();
51 | } else if(strcmp("gpio", cmdline) == 0) {
52 | command_dump_gpio();
53 | } else if(strcmp("poll", cmdline) == 0) {
54 | do_gpio_dma();
55 | command_dump_gpio();
56 | } else {
57 | print_help();
58 | }
59 | }
60 |
61 | void cmdline_prompt() {
62 | _write(0, "> ", 2);
63 | }
64 |
65 | static char cmdline[40];
66 | static uint32_t cmd_len = 0;
67 |
68 | void reprint_prompt() {
69 | _write(0, "> ", 2);
70 | if(cmd_len > 0) {
71 | _write(0, cmdline, cmd_len);
72 | }
73 | }
74 |
75 | void cmdline_addchr(char c) {
76 | switch(c) {
77 | case '\r':
78 | case '\n':
79 | _write(0, "\n", 1);
80 | run_command(cmdline);
81 | cmdline_prompt();
82 | cmdline[0] = '\0';
83 | cmd_len = 0;
84 | break;
85 | case '\b':
86 | case '\x7F':
87 | if(cmd_len > 0) {
88 | _write(0, "\x7F", 1);
89 | cmd_len--;
90 | cmdline[cmd_len] = '\0';
91 | }
92 | break;
93 | default:
94 | if(cmd_len < sizeof(cmdline)-1) {
95 | _write(0, &c, 1);
96 | cmdline[cmd_len] = c;
97 | cmdline[cmd_len+1] = '\0';
98 | cmd_len = cmd_len + 1;
99 | }
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/Src/gpio.c:
--------------------------------------------------------------------------------
1 | #include "stm32f1xx_hal.h"
2 | #include "gpio.h"
3 | #include "uart.h"
4 |
5 | uint8_t gpio_buffer[GPIO_BUFFER_SIZE];
6 |
7 | static inline void wait_for_trigger(uint8_t trigger_mask, uint8_t trigger_values) {
8 | if(trigger_mask) {
9 | while((GPIOA->IDR ^ trigger_values) & trigger_mask); // wait until trigger
10 | }
11 | }
12 |
13 | void do_gpio_dma(uint32_t length, uint8_t trigger_mask, uint8_t trigger_values) {
14 | if(length > sizeof(gpio_buffer)) {
15 | length = sizeof(gpio_buffer);
16 | }
17 |
18 | wait_for_trigger(trigger_mask, trigger_values); // TODO: switch this to watching the DMA values
19 |
20 | HAL_DMA_Start(htim1.hdma[TIM_DMA_ID_UPDATE], (uint32_t)&GPIOA->IDR, (uint32_t)&gpio_buffer, length);
21 | __HAL_TIM_ENABLE_DMA(&htim1, TIM_DMA_UPDATE);
22 | HAL_DMA_PollForTransfer(htim1.hdma[TIM_DMA_ID_UPDATE], HAL_DMA_FULL_TRANSFER, 100);
23 | __HAL_TIM_DISABLE_DMA(&htim1, TIM_DMA_UPDATE);
24 | }
25 |
26 | void do_gpio_loop(uint32_t length, uint8_t trigger_mask, uint8_t trigger_values) {
27 | uint8_t *buffer = gpio_buffer;
28 | uint8_t *ending;
29 |
30 | if(length > sizeof(gpio_buffer)) {
31 | length = sizeof(gpio_buffer);
32 | }
33 | ending = gpio_buffer+length;
34 |
35 | wait_for_trigger(trigger_mask, trigger_values);
36 |
37 | __disable_irq();
38 |
39 | // good for 7.2MHz
40 | // check Src/read256.c for a higher speed version (~12MHz) that uses more flash
41 | asm(
42 | "ldr r1, [%1]\n"
43 | "poll:"
44 | "strb r1, [%0, #0]\n"
45 | "adds %0, #1\n"
46 | "cmp %2, %0\n"
47 | "ldr r1, [%1]\n" // moving this before the cmp slows the loop down to 6MHz
48 | "bhi.n poll\n"
49 | : /* no outputs */
50 | : "r" (buffer), "r" (&GPIOA->IDR), "r" (ending)
51 | : "r1"
52 | );
53 |
54 | __enable_irq();
55 | }
56 |
--------------------------------------------------------------------------------
/Src/stm32f1xx_hal_msp.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * File Name : stm32f1xx_hal_msp.c
4 | * Description : This file provides code for the MSP Initialization
5 | * and de-Initialization codes.
6 | ******************************************************************************
7 | *
8 | * Copyright (c) 2017 STMicroelectronics International N.V.
9 | * All rights reserved.
10 | *
11 | * Redistribution and use in source and binary forms, with or without
12 | * modification, are permitted, provided that the following conditions are met:
13 | *
14 | * 1. Redistribution of source code must retain the above copyright notice,
15 | * this list of conditions and the following disclaimer.
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | * 3. Neither the name of STMicroelectronics nor the names of other
20 | * contributors to this software may be used to endorse or promote products
21 | * derived from this software without specific written permission.
22 | * 4. This software, including modifications and/or derivative works of this
23 | * software, must execute solely and exclusively on microcontroller or
24 | * microprocessor devices manufactured by or for STMicroelectronics.
25 | * 5. Redistribution and use of this software other than as permitted under
26 | * this license is void and will automatically terminate your rights under
27 | * this license.
28 | *
29 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
30 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
32 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
33 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
34 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
35 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
37 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
40 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 | *
42 | ******************************************************************************
43 | */
44 | /* Includes ------------------------------------------------------------------*/
45 | #include "stm32f1xx_hal.h"
46 |
47 | extern DMA_HandleTypeDef hdma_tim1_up;
48 |
49 | extern void Error_Handler(void);
50 | /* USER CODE BEGIN 0 */
51 |
52 | /* USER CODE END 0 */
53 | /**
54 | * Initializes the Global MSP.
55 | */
56 | void HAL_MspInit(void)
57 | {
58 | /* USER CODE BEGIN MspInit 0 */
59 |
60 | /* USER CODE END MspInit 0 */
61 |
62 | __HAL_RCC_AFIO_CLK_ENABLE();
63 |
64 | HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
65 |
66 | /* System interrupt init*/
67 | /* MemoryManagement_IRQn interrupt configuration */
68 | HAL_NVIC_SetPriority(MemoryManagement_IRQn, 0, 0);
69 | /* BusFault_IRQn interrupt configuration */
70 | HAL_NVIC_SetPriority(BusFault_IRQn, 0, 0);
71 | /* UsageFault_IRQn interrupt configuration */
72 | HAL_NVIC_SetPriority(UsageFault_IRQn, 0, 0);
73 | /* SVCall_IRQn interrupt configuration */
74 | HAL_NVIC_SetPriority(SVCall_IRQn, 0, 0);
75 | /* DebugMonitor_IRQn interrupt configuration */
76 | HAL_NVIC_SetPriority(DebugMonitor_IRQn, 0, 0);
77 | /* PendSV_IRQn interrupt configuration */
78 | HAL_NVIC_SetPriority(PendSV_IRQn, 0, 0);
79 | /* SysTick_IRQn interrupt configuration */
80 | HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
81 |
82 | /**NOJTAG: JTAG-DP Disabled and SW-DP Enabled
83 | */
84 | __HAL_AFIO_REMAP_SWJ_NOJTAG();
85 |
86 | /* USER CODE BEGIN MspInit 1 */
87 |
88 | /* USER CODE END MspInit 1 */
89 | }
90 |
91 | void HAL_RTC_MspInit(RTC_HandleTypeDef* hrtc)
92 | {
93 |
94 | if(hrtc->Instance==RTC)
95 | {
96 | /* USER CODE BEGIN RTC_MspInit 0 */
97 |
98 | /* USER CODE END RTC_MspInit 0 */
99 | HAL_PWR_EnableBkUpAccess();
100 | /* Enable BKP CLK enable for backup registers */
101 | __HAL_RCC_BKP_CLK_ENABLE();
102 | /* Peripheral clock enable */
103 | __HAL_RCC_RTC_ENABLE();
104 | /* USER CODE BEGIN RTC_MspInit 1 */
105 |
106 | /* USER CODE END RTC_MspInit 1 */
107 | }
108 |
109 | }
110 |
111 | void HAL_RTC_MspDeInit(RTC_HandleTypeDef* hrtc)
112 | {
113 |
114 | if(hrtc->Instance==RTC)
115 | {
116 | /* USER CODE BEGIN RTC_MspDeInit 0 */
117 |
118 | /* USER CODE END RTC_MspDeInit 0 */
119 | /* Peripheral clock disable */
120 | __HAL_RCC_RTC_DISABLE();
121 | }
122 | /* USER CODE BEGIN RTC_MspDeInit 1 */
123 |
124 | /* USER CODE END RTC_MspDeInit 1 */
125 |
126 | }
127 |
128 | void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
129 | {
130 |
131 | if(htim_base->Instance==TIM1)
132 | {
133 | /* USER CODE BEGIN TIM1_MspInit 0 */
134 |
135 | /* USER CODE END TIM1_MspInit 0 */
136 | /* Peripheral clock enable */
137 | __HAL_RCC_TIM1_CLK_ENABLE();
138 |
139 | /* Peripheral DMA init*/
140 |
141 | hdma_tim1_up.Instance = DMA1_Channel5;
142 | hdma_tim1_up.Init.Direction = DMA_PERIPH_TO_MEMORY;
143 | hdma_tim1_up.Init.PeriphInc = DMA_PINC_DISABLE;
144 | hdma_tim1_up.Init.MemInc = DMA_MINC_ENABLE;
145 | hdma_tim1_up.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
146 | hdma_tim1_up.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
147 | hdma_tim1_up.Init.Mode = DMA_NORMAL;
148 | hdma_tim1_up.Init.Priority = DMA_PRIORITY_VERY_HIGH;
149 | if (HAL_DMA_Init(&hdma_tim1_up) != HAL_OK)
150 | {
151 | Error_Handler();
152 | }
153 |
154 | __HAL_LINKDMA(htim_base,hdma[TIM_DMA_ID_UPDATE],hdma_tim1_up);
155 |
156 | /* USER CODE BEGIN TIM1_MspInit 1 */
157 |
158 | /* USER CODE END TIM1_MspInit 1 */
159 | }
160 | else if(htim_base->Instance==TIM3)
161 | {
162 | /* USER CODE BEGIN TIM3_MspInit 0 */
163 |
164 | /* USER CODE END TIM3_MspInit 0 */
165 | /* Peripheral clock enable */
166 | __HAL_RCC_TIM3_CLK_ENABLE();
167 | /* USER CODE BEGIN TIM3_MspInit 1 */
168 |
169 | /* USER CODE END TIM3_MspInit 1 */
170 | }
171 |
172 | }
173 |
174 | void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
175 | {
176 |
177 | GPIO_InitTypeDef GPIO_InitStruct;
178 | if(htim->Instance==TIM3)
179 | {
180 | /* USER CODE BEGIN TIM3_MspPostInit 0 */
181 |
182 | /* USER CODE END TIM3_MspPostInit 0 */
183 |
184 | /**TIM3 GPIO Configuration
185 | PB4 ------> TIM3_CH1
186 | */
187 | GPIO_InitStruct.Pin = GPIO_PIN_4;
188 | GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
189 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
190 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
191 |
192 | __HAL_AFIO_REMAP_TIM3_PARTIAL();
193 |
194 | /* USER CODE BEGIN TIM3_MspPostInit 1 */
195 |
196 | /* USER CODE END TIM3_MspPostInit 1 */
197 | }
198 |
199 | }
200 |
201 | void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
202 | {
203 |
204 | if(htim_base->Instance==TIM1)
205 | {
206 | /* USER CODE BEGIN TIM1_MspDeInit 0 */
207 |
208 | /* USER CODE END TIM1_MspDeInit 0 */
209 | /* Peripheral clock disable */
210 | __HAL_RCC_TIM1_CLK_DISABLE();
211 |
212 | /* Peripheral DMA DeInit*/
213 | HAL_DMA_DeInit(htim_base->hdma[TIM_DMA_ID_UPDATE]);
214 | /* USER CODE BEGIN TIM1_MspDeInit 1 */
215 |
216 | /* USER CODE END TIM1_MspDeInit 1 */
217 | }
218 | else if(htim_base->Instance==TIM3)
219 | {
220 | /* USER CODE BEGIN TIM3_MspDeInit 0 */
221 |
222 | /* USER CODE END TIM3_MspDeInit 0 */
223 | /* Peripheral clock disable */
224 | __HAL_RCC_TIM3_CLK_DISABLE();
225 | /* USER CODE BEGIN TIM3_MspDeInit 1 */
226 |
227 | /* USER CODE END TIM3_MspDeInit 1 */
228 | }
229 |
230 | }
231 |
232 | void HAL_UART_MspInit(UART_HandleTypeDef* huart)
233 | {
234 |
235 | GPIO_InitTypeDef GPIO_InitStruct;
236 | if(huart->Instance==USART1)
237 | {
238 | /* USER CODE BEGIN USART1_MspInit 0 */
239 |
240 | /* USER CODE END USART1_MspInit 0 */
241 | /* Peripheral clock enable */
242 | __HAL_RCC_USART1_CLK_ENABLE();
243 |
244 | /**USART1 GPIO Configuration
245 | PA9 ------> USART1_TX
246 | PA10 ------> USART1_RX
247 | */
248 | GPIO_InitStruct.Pin = GPIO_PIN_9;
249 | GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
250 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
251 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
252 |
253 | GPIO_InitStruct.Pin = GPIO_PIN_10;
254 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
255 | GPIO_InitStruct.Pull = GPIO_NOPULL;
256 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
257 |
258 | /* USER CODE BEGIN USART1_MspInit 1 */
259 |
260 | /* USER CODE END USART1_MspInit 1 */
261 | }
262 |
263 | }
264 |
265 | void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
266 | {
267 |
268 | if(huart->Instance==USART1)
269 | {
270 | /* USER CODE BEGIN USART1_MspDeInit 0 */
271 |
272 | /* USER CODE END USART1_MspDeInit 0 */
273 | /* Peripheral clock disable */
274 | __HAL_RCC_USART1_CLK_DISABLE();
275 |
276 | /**USART1 GPIO Configuration
277 | PA9 ------> USART1_TX
278 | PA10 ------> USART1_RX
279 | */
280 | HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10);
281 |
282 | }
283 | /* USER CODE BEGIN USART1_MspDeInit 1 */
284 |
285 | /* USER CODE END USART1_MspDeInit 1 */
286 |
287 | }
288 |
289 | /* USER CODE BEGIN 1 */
290 |
291 | /* USER CODE END 1 */
292 |
293 | /**
294 | * @}
295 | */
296 |
297 | /**
298 | * @}
299 | */
300 |
301 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
302 |
--------------------------------------------------------------------------------
/Src/stm32f1xx_it.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f1xx_it.c
4 | * @brief Interrupt Service Routines.
5 | ******************************************************************************
6 | *
7 | * COPYRIGHT(c) 2017 STMicroelectronics
8 | *
9 | * Redistribution and use in source and binary forms, with or without modification,
10 | * are permitted provided that the following conditions are met:
11 | * 1. Redistributions of source code must retain the above copyright notice,
12 | * this list of conditions and the following disclaimer.
13 | * 2. Redistributions in binary form must reproduce the above copyright notice,
14 | * this list of conditions and the following disclaimer in the documentation
15 | * and/or other materials provided with the distribution.
16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | ******************************************************************************
32 | */
33 | /* Includes ------------------------------------------------------------------*/
34 | #include "stm32f1xx_hal.h"
35 | #include "stm32f1xx.h"
36 | #include "stm32f1xx_it.h"
37 |
38 | /* USER CODE BEGIN 0 */
39 |
40 | /* USER CODE END 0 */
41 |
42 | /* External variables --------------------------------------------------------*/
43 | extern PCD_HandleTypeDef hpcd_USB_FS;
44 | extern DMA_HandleTypeDef hdma_tim1_up;
45 |
46 | /******************************************************************************/
47 | /* Cortex-M3 Processor Interruption and Exception Handlers */
48 | /******************************************************************************/
49 |
50 | /**
51 | * @brief This function handles Non maskable interrupt.
52 | */
53 | void NMI_Handler(void)
54 | {
55 | /* USER CODE BEGIN NonMaskableInt_IRQn 0 */
56 |
57 | /* USER CODE END NonMaskableInt_IRQn 0 */
58 | /* USER CODE BEGIN NonMaskableInt_IRQn 1 */
59 |
60 | /* USER CODE END NonMaskableInt_IRQn 1 */
61 | }
62 |
63 | /**
64 | * @brief This function handles Hard fault interrupt.
65 | */
66 | void HardFault_Handler(void)
67 | {
68 | /* USER CODE BEGIN HardFault_IRQn 0 */
69 |
70 | /* USER CODE END HardFault_IRQn 0 */
71 | while (1)
72 | {
73 | }
74 | /* USER CODE BEGIN HardFault_IRQn 1 */
75 |
76 | /* USER CODE END HardFault_IRQn 1 */
77 | }
78 |
79 | /**
80 | * @brief This function handles Memory management fault.
81 | */
82 | void MemManage_Handler(void)
83 | {
84 | /* USER CODE BEGIN MemoryManagement_IRQn 0 */
85 |
86 | /* USER CODE END MemoryManagement_IRQn 0 */
87 | while (1)
88 | {
89 | }
90 | /* USER CODE BEGIN MemoryManagement_IRQn 1 */
91 |
92 | /* USER CODE END MemoryManagement_IRQn 1 */
93 | }
94 |
95 | /**
96 | * @brief This function handles Prefetch fault, memory access fault.
97 | */
98 | void BusFault_Handler(void)
99 | {
100 | /* USER CODE BEGIN BusFault_IRQn 0 */
101 |
102 | /* USER CODE END BusFault_IRQn 0 */
103 | while (1)
104 | {
105 | }
106 | /* USER CODE BEGIN BusFault_IRQn 1 */
107 |
108 | /* USER CODE END BusFault_IRQn 1 */
109 | }
110 |
111 | /**
112 | * @brief This function handles Undefined instruction or illegal state.
113 | */
114 | void UsageFault_Handler(void)
115 | {
116 | /* USER CODE BEGIN UsageFault_IRQn 0 */
117 |
118 | /* USER CODE END UsageFault_IRQn 0 */
119 | while (1)
120 | {
121 | }
122 | /* USER CODE BEGIN UsageFault_IRQn 1 */
123 |
124 | /* USER CODE END UsageFault_IRQn 1 */
125 | }
126 |
127 | /**
128 | * @brief This function handles System service call via SWI instruction.
129 | */
130 | void SVC_Handler(void)
131 | {
132 | /* USER CODE BEGIN SVCall_IRQn 0 */
133 |
134 | /* USER CODE END SVCall_IRQn 0 */
135 | /* USER CODE BEGIN SVCall_IRQn 1 */
136 |
137 | /* USER CODE END SVCall_IRQn 1 */
138 | }
139 |
140 | /**
141 | * @brief This function handles Debug monitor.
142 | */
143 | void DebugMon_Handler(void)
144 | {
145 | /* USER CODE BEGIN DebugMonitor_IRQn 0 */
146 |
147 | /* USER CODE END DebugMonitor_IRQn 0 */
148 | /* USER CODE BEGIN DebugMonitor_IRQn 1 */
149 |
150 | /* USER CODE END DebugMonitor_IRQn 1 */
151 | }
152 |
153 | /**
154 | * @brief This function handles Pendable request for system service.
155 | */
156 | void PendSV_Handler(void)
157 | {
158 | /* USER CODE BEGIN PendSV_IRQn 0 */
159 |
160 | /* USER CODE END PendSV_IRQn 0 */
161 | /* USER CODE BEGIN PendSV_IRQn 1 */
162 |
163 | /* USER CODE END PendSV_IRQn 1 */
164 | }
165 |
166 | /**
167 | * @brief This function handles System tick timer.
168 | */
169 | void SysTick_Handler(void)
170 | {
171 | /* USER CODE BEGIN SysTick_IRQn 0 */
172 |
173 | /* USER CODE END SysTick_IRQn 0 */
174 | HAL_IncTick();
175 | HAL_SYSTICK_IRQHandler();
176 | /* USER CODE BEGIN SysTick_IRQn 1 */
177 |
178 | /* USER CODE END SysTick_IRQn 1 */
179 | }
180 |
181 | /******************************************************************************/
182 | /* STM32F1xx Peripheral Interrupt Handlers */
183 | /* Add here the Interrupt Handlers for the used peripherals. */
184 | /* For the available peripheral interrupt handler names, */
185 | /* please refer to the startup file (startup_stm32f1xx.s). */
186 | /******************************************************************************/
187 |
188 | /**
189 | * @brief This function handles DMA1 channel5 global interrupt.
190 | */
191 | void DMA1_Channel5_IRQHandler(void)
192 | {
193 | /* USER CODE BEGIN DMA1_Channel5_IRQn 0 */
194 |
195 | /* USER CODE END DMA1_Channel5_IRQn 0 */
196 | HAL_DMA_IRQHandler(&hdma_tim1_up);
197 | /* USER CODE BEGIN DMA1_Channel5_IRQn 1 */
198 |
199 | /* USER CODE END DMA1_Channel5_IRQn 1 */
200 | }
201 |
202 | /**
203 | * @brief This function handles USB high priority or CAN TX interrupts.
204 | */
205 | void USB_HP_CAN1_TX_IRQHandler(void)
206 | {
207 | /* USER CODE BEGIN USB_HP_CAN1_TX_IRQn 0 */
208 |
209 | /* USER CODE END USB_HP_CAN1_TX_IRQn 0 */
210 | HAL_PCD_IRQHandler(&hpcd_USB_FS);
211 | /* USER CODE BEGIN USB_HP_CAN1_TX_IRQn 1 */
212 |
213 | /* USER CODE END USB_HP_CAN1_TX_IRQn 1 */
214 | }
215 |
216 | /**
217 | * @brief This function handles USB low priority or CAN RX0 interrupts.
218 | */
219 | void USB_LP_CAN1_RX0_IRQHandler(void)
220 | {
221 | /* USER CODE BEGIN USB_LP_CAN1_RX0_IRQn 0 */
222 |
223 | /* USER CODE END USB_LP_CAN1_RX0_IRQn 0 */
224 | HAL_PCD_IRQHandler(&hpcd_USB_FS);
225 | /* USER CODE BEGIN USB_LP_CAN1_RX0_IRQn 1 */
226 |
227 | /* USER CODE END USB_LP_CAN1_RX0_IRQn 1 */
228 | }
229 |
230 | /* USER CODE BEGIN 1 */
231 |
232 | /* USER CODE END 1 */
233 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
234 |
--------------------------------------------------------------------------------
/Src/sump.c:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * SUMP Protocol Implementation for Arduino boards.
4 | *
5 | * Copyright (c) 2011,2012,2013,2014,2015 Andrew Gillham
6 | * All rights reserved.
7 | *
8 | * Redistribution and use in source and binary forms, with or without
9 | * modification, are permitted provided that the following conditions
10 | * are met:
11 | * 1. Redistributions of source code must retain the above copyright
12 | * notice, this list of conditions and the following disclaimer.
13 | * 2. Redistributions in binary form must reproduce the above copyright
14 | * notice, this list of conditions and the following disclaimer in the
15 | * documentation and/or other materials provided with the distribution.
16 | *
17 | * THIS SOFTWARE IS PROVIDED BY ANDREW GILLHAM ``AS IS'' AND ANY EXPRESS OR
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 | * IN NO EVENT SHALL ANDREW GILLHAM BE LIABLE FOR ANY DIRECT, INDIRECT,
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | *
28 | *
29 | */
30 |
31 | // this code is based on:
32 | // https://github.com/gillham/logic_analyzer/blob/master/logic_analyzer.ino
33 | // modified to work under stm32 HAL
34 |
35 | #include "stm32f1xx_hal.h"
36 | #include "sump.h"
37 | #include "gpio.h"
38 | #include "uart.h"
39 | #include "usbd_cdc_if.h"
40 |
41 | #include
42 | #include
43 |
44 | #define SUMP_RESET 0x00
45 | #define SUMP_ARM 0x01
46 | #define SUMP_QUERY 0x02
47 | #define SUMP_XON 0x11
48 | #define SUMP_XOFF 0x13
49 |
50 | /* mask & values used, config ignored. only stage0 supported */
51 | #define SUMP_TRIGGER_MASK 0xC0
52 | #define SUMP_TRIGGER_VALUES 0xC1
53 | #define SUMP_TRIGGER_CONFIG 0xC2
54 |
55 | /* Most flags (except RLE) are ignored. */
56 | #define SUMP_SET_DIVIDER 0x80
57 | #define SUMP_SET_READ_DELAY_COUNT 0x81
58 | #define SUMP_SET_FLAGS 0x82
59 | #define SUMP_SET_RLE 0x0100
60 |
61 | /* extended commands -- self-test unsupported, but metadata is returned. */
62 | #define SUMP_SELF_TEST 0x03
63 | #define SUMP_GET_METADATA 0x04
64 |
65 | typedef enum {
66 | STATE_READ4 = 0,
67 | STATE_READ3 = 1,
68 | STATE_READ2 = 2,
69 | STATE_READ1 = 3,
70 | STATE_EXTENDED_CMD = 4,
71 | STATE_CMD = 5
72 | } sump_cmd_state;
73 |
74 | static uint8_t run_gpio = 0;
75 |
76 | static void setupDelay(uint32_t divider) {
77 | if(divider >= 11 && divider < 65536) {
78 | HAL_TIM_Base_Stop(&htim1);
79 | htim1.Init.Period = divider;
80 | if (HAL_TIM_Base_Init(&htim1) != HAL_OK) {
81 | Error_Handler();
82 | }
83 | HAL_TIM_Base_Start(&htim1);
84 | } else {
85 | write_uart_s("invalid divider for sample clock: ");
86 | write_uart_u(divider);
87 | write_uart_s("\n");
88 | }
89 | }
90 |
91 | const static uint8_t metadata[] = {
92 | 0x01, 'A', 'G', 'L', 'A', 'S', 'v', '0', 0, // device name
93 | 0x02, '0', '.', '1', '3', 0, // firmware version
94 | 0x21, 0, 0, 40, 0, // sample memory = 40*256 = 10240 bytes
95 | 0x23, 0, 0x5B, 0x8D, 0x80, // sample rate (6MHz)
96 | 0x40, 8, // number of probes = 8
97 | 0x41, 2, // protocol version 2
98 | 0 // end of data
99 | };
100 |
101 | static void get_metadata() {
102 | write(0, metadata, sizeof(metadata));
103 | }
104 |
105 | static uint8_t trigger, trigger_values, rleEnabled;
106 | static uint32_t readCount, delayCount, divider = 11;
107 |
108 | void extended_sump_command(char last_cmd, uint8_t *extended_cmd_arg) {
109 | /*
110 | write_uart_s("e ");
111 | write_uart_u(last_cmd);
112 | write_uart_s(", ");
113 | write_uart_u(extended_cmd_arg[0]);
114 | write_uart_s(", ");
115 | write_uart_u(extended_cmd_arg[1]);
116 | write_uart_s(", ");
117 | write_uart_u(extended_cmd_arg[2]);
118 | write_uart_s(", ");
119 | write_uart_u(extended_cmd_arg[3]);
120 | write_uart_s("\n");
121 | */
122 |
123 | switch (last_cmd) {
124 | case SUMP_TRIGGER_MASK:
125 | /*
126 | * the trigger mask byte has a '1' for each enabled trigger so
127 | * we can just use it directly as our trigger mask.
128 | */
129 | trigger = extended_cmd_arg[0];
130 | write_uart_s("trigger ");
131 | write_uart_u(trigger);
132 | write_uart_s("\n");
133 | break;
134 | case SUMP_TRIGGER_VALUES:
135 | /*
136 | * trigger_values can be used directly as the value of each bit
137 | * defines whether we're looking for it to be high or low.
138 | */
139 | trigger_values = extended_cmd_arg[0];
140 | write_uart_s("t_values ");
141 | write_uart_u(trigger_values);
142 | write_uart_s("\n");
143 | break;
144 | case SUMP_TRIGGER_CONFIG:
145 | write_uart_s("t_config = ?\n");
146 | /* read the rest of the command bytes, but ignore them. */
147 | break;
148 | case SUMP_SET_DIVIDER:
149 | /*
150 | * the shifting needs to be done on the 32bit unsigned long variable
151 | * so that << 16 doesn't end up as zero.
152 | */
153 | divider = extended_cmd_arg[2];
154 | divider = divider << 8;
155 | divider += extended_cmd_arg[1];
156 | divider = divider << 8;
157 | divider += extended_cmd_arg[0];
158 | write_uart_s("divider ");
159 | write_uart_u(divider);
160 | write_uart_s("\n");
161 | setupDelay(divider);
162 | break;
163 | case SUMP_SET_READ_DELAY_COUNT:
164 | /*
165 | * this just sets up how many samples there should be before
166 | * and after the trigger fires. The readCount is total samples
167 | * to return and delayCount number of samples after the trigger.
168 | * this sets the buffer splits like 0/100, 25/75, 50/50
169 | * for example if readCount == delayCount then we should
170 | * return all samples starting from the trigger point.
171 | * if delayCount < readCount we return (readCount - delayCount) of
172 | * samples from before the trigger fired.
173 | */
174 | readCount = 4 * (((extended_cmd_arg[1] << 8) | extended_cmd_arg[0]) + 1);
175 | if (readCount > GPIO_BUFFER_SIZE)
176 | readCount = GPIO_BUFFER_SIZE;
177 | write_uart_s("read# ");
178 | write_uart_u(readCount);
179 | write_uart_s("\n");
180 | delayCount = 4 * (((extended_cmd_arg[3] << 8) | extended_cmd_arg[2]) + 1);
181 | if (delayCount > GPIO_BUFFER_SIZE)
182 | delayCount = GPIO_BUFFER_SIZE;
183 | write_uart_s("delay# ");
184 | write_uart_u(delayCount);
185 | write_uart_s("\n");
186 | break; // TODO
187 | case SUMP_SET_FLAGS:
188 | /* read the rest of the command bytes and check if RLE is enabled. */
189 | rleEnabled = ((extended_cmd_arg[1] & 0b1000000) != 0);
190 | write_uart_s("rle ");
191 | write_uart_u(rleEnabled);
192 | write_uart_s("\n");
193 | break; // TODO
194 | }
195 | }
196 |
197 | void sump_read_command(sump_cmd_state *read_state, char c) {
198 | /*
199 | write_uart_s("c ");
200 | write_uart_u(c);
201 | write_uart_s("\n");
202 | */
203 | switch (c) {
204 | case SUMP_RESET:
205 | /*
206 | * We don't do anything here as some unsupported extended commands have
207 | * zero bytes and are mistaken as resets. This can trigger false resets
208 | * so we don't erase the data or do anything for a reset.
209 | */
210 | break;
211 | case SUMP_QUERY:
212 | /* return the expected bytes. */
213 | write(0, "1ALS", 4);
214 | break;
215 | case SUMP_ARM:
216 | /*
217 | * Zero out any previous samples before arming.
218 | * Done here instead via reset due to spurious resets.
219 | */
220 | memset(gpio_buffer, '\0', GPIO_BUFFER_SIZE);
221 | run_gpio = 1;
222 | break;
223 | case SUMP_TRIGGER_MASK:
224 | case SUMP_TRIGGER_VALUES:
225 | case SUMP_TRIGGER_CONFIG:
226 | case SUMP_SET_DIVIDER:
227 | case SUMP_SET_READ_DELAY_COUNT:
228 | case SUMP_SET_FLAGS:
229 | // extended commands have a 4 byte argument
230 | *read_state = STATE_READ4;
231 | break;
232 | case SUMP_GET_METADATA:
233 | /*
234 | * We return a description of our capabilities.
235 | * Check the function's comments below.
236 | */
237 | get_metadata();
238 | break;
239 | case SUMP_SELF_TEST:
240 | /* ignored. */
241 | break;
242 | default:
243 | /* ignore any unrecognized bytes. */
244 | break;
245 | }
246 | }
247 |
248 | void sump_cmd(char c) {
249 | static sump_cmd_state read_state = STATE_CMD;
250 | static char last_cmd = 0;
251 | static uint8_t extended_cmd_arg[4];
252 |
253 | if(read_state == STATE_CMD) {
254 | last_cmd = c;
255 | sump_read_command(&read_state, c);
256 | } else if(read_state >= STATE_READ4 && read_state <= STATE_READ1) {
257 | extended_cmd_arg[read_state] = c;
258 | read_state = read_state + 1;
259 | if(read_state == STATE_EXTENDED_CMD) {
260 | extended_sump_command(last_cmd, extended_cmd_arg);
261 | read_state = STATE_CMD;
262 | }
263 | } else {
264 | write_uart_s("unknown state ");
265 | write_uart_u(read_state);
266 | write_uart_s("\n");
267 | }
268 | }
269 |
270 | void poll_sump() {
271 | if(run_gpio) {
272 | run_gpio = 0;
273 | if(divider < 11) {
274 | write_uart_s("using gpio_loop\n");
275 | do_gpio_loop(readCount, trigger, trigger_values);
276 | } else {
277 | do_gpio_dma(readCount, trigger, trigger_values);
278 | }
279 | int status = CDC_Transmit_FS(gpio_buffer, readCount);
280 | if(status != USBD_OK) {
281 | write_uart_s("USB TX state: ");
282 | write_uart_u(status);
283 | write_uart_s("\n");
284 | }
285 | }
286 | }
287 |
--------------------------------------------------------------------------------
/Src/syscall.c:
--------------------------------------------------------------------------------
1 | #include "stm32f1xx_hal.h"
2 | #include "usbd_cdc_if.h"
3 | #include "syscall.h"
4 | #include
5 | #include
6 |
7 | extern USBD_HandleTypeDef hUsbDeviceFS;
8 | extern uint32_t SystemCoreClock;
9 |
10 | uint32_t timeouts = 0;
11 |
12 | int _write(int fd, const void *buf, size_t count) {
13 | uint32_t cycles = 0;
14 | USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*) hUsbDeviceFS.pClassData;
15 | while(hcdc->TxState == 1) {
16 | if(cycles++ > SystemCoreClock/130) { // ~100ms
17 | timeouts++;
18 | return count; // don't retry
19 | }
20 | }
21 | CDC_Transmit_FS((uint8_t *)buf, count);
22 |
23 | return count;
24 | }
25 |
26 | /* memory functions
27 | *******************************************
28 | */
29 | static char heap_start[1024];
30 |
31 | /* sbrk - Increase program data space.
32 | * newlib's malloc and related functions depend on this (like printf)
33 | */
34 | caddr_t _sbrk(int incr) {
35 | static char *heap_end;
36 | char *prev_heap_end;
37 |
38 | if (heap_end == 0) {
39 | heap_end = heap_start;
40 | }
41 | if(incr == 0) {
42 | return (caddr_t) heap_end;
43 | }
44 | prev_heap_end = heap_end;
45 |
46 | if ((heap_end + incr) >= (heap_start + sizeof(heap_start))) {
47 | errno = ENOMEM;
48 | return (caddr_t) -1;
49 | //abort ();
50 | }
51 |
52 | heap_end += incr;
53 | return (caddr_t) prev_heap_end;
54 | }
55 |
56 | uint32_t heapsize() {
57 | return _sbrk(0) - heap_start;
58 | }
59 |
60 | uint32_t heapmax() {
61 | return sizeof(heap_start);
62 | }
63 |
64 | // value for stm32f103c8 (20KB)
65 | #define STACK_BOTTOM 0x20005000
66 |
67 | uint32_t stacksize() {
68 | char *stack_top = (char *)__get_MSP();
69 | char *stack_bottom = (char *)STACK_BOTTOM;
70 | return stack_bottom - stack_top;
71 | }
72 |
73 | uint32_t stackmax() {
74 | extern char _ebss; // top of heap from linker
75 | char *stack_bottom = (char *)STACK_BOTTOM;
76 | return stack_bottom - &_ebss;
77 | }
78 |
--------------------------------------------------------------------------------
/Src/uart.c:
--------------------------------------------------------------------------------
1 | #include "stm32f1xx_hal.h"
2 |
3 | #include
4 | #include
5 |
6 | #include "uart.h"
7 |
8 | void write_uart_s(const char *s) {
9 | HAL_UART_Transmit(&UART_NAME, (uint8_t *)s, strlen(s), 500);
10 | }
11 |
12 | void write_uart_u(uint32_t i) {
13 | char buffer[12];
14 | utoa(i, buffer, 10);
15 | write_uart_s(buffer);
16 | }
17 |
18 | void write_uart_i(int32_t i) {
19 | char buffer[12];
20 | itoa(i, buffer, 10);
21 | write_uart_s(buffer);
22 | }
23 |
24 | uint8_t uartData;
25 | char uartBuffer[10];
26 | uint8_t start = 0, end = 0, overrun = 0;
27 |
28 | void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
29 | uint8_t newEnd = (end + 1) % sizeof(uartBuffer);
30 | if(newEnd == start) { // no space left in uartBuffer
31 | overrun = 1;
32 | } else {
33 | end = newEnd;
34 | uartBuffer[end] = uartData;
35 | }
36 | HAL_UART_Receive_IT(huart, &uartData, 1); // TODO: is there a race condition here?
37 | }
38 |
39 | void start_rx_uart() {
40 | HAL_UART_Receive_IT(&UART_NAME, &uartData, 1);
41 | }
42 |
43 | int8_t uart_rx_ready() {
44 | if(overrun) { // software buffer overrun
45 | overrun = 0;
46 | }
47 | #ifdef STM32F0
48 | if(__HAL_UART_GET_FLAG(&UART_NAME, UART_CLEAR_OREF) != RESET) { // hardware buffer overrun
49 | __HAL_UART_CLEAR_FLAG(&UART_NAME, UART_CLEAR_OREF);
50 | }
51 | #endif
52 | HAL_UART_Receive_IT(&UART_NAME, &uartData, 1);
53 | return start != end;
54 | }
55 |
56 | char uart_rx_data() {
57 | if(start == end) {
58 | return '\0';
59 | }
60 | start = (start + 1) % sizeof(uartBuffer);
61 | return uartBuffer[start];
62 | }
63 |
--------------------------------------------------------------------------------
/Src/usb_device.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file : USB_DEVICE
4 | * @version : v2.0_Cube
5 | * @brief : This file implements the USB Device
6 | ******************************************************************************
7 | *
8 | * Copyright (c) 2017 STMicroelectronics International N.V.
9 | * All rights reserved.
10 | *
11 | * Redistribution and use in source and binary forms, with or without
12 | * modification, are permitted, provided that the following conditions are met:
13 | *
14 | * 1. Redistribution of source code must retain the above copyright notice,
15 | * this list of conditions and the following disclaimer.
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | * 3. Neither the name of STMicroelectronics nor the names of other
20 | * contributors to this software may be used to endorse or promote products
21 | * derived from this software without specific written permission.
22 | * 4. This software, including modifications and/or derivative works of this
23 | * software, must execute solely and exclusively on microcontroller or
24 | * microprocessor devices manufactured by or for STMicroelectronics.
25 | * 5. Redistribution and use of this software other than as permitted under
26 | * this license is void and will automatically terminate your rights under
27 | * this license.
28 | *
29 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
30 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
32 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
33 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
34 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
35 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
37 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
40 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 | *
42 | ******************************************************************************
43 | */
44 |
45 | /* Includes ------------------------------------------------------------------*/
46 |
47 | #include "usb_device.h"
48 | #include "usbd_core.h"
49 | #include "usbd_desc.h"
50 | #include "usbd_cdc.h"
51 | #include "usbd_cdc_if.h"
52 |
53 | /* USB Device Core handle declaration */
54 | USBD_HandleTypeDef hUsbDeviceFS;
55 |
56 | // partially from leaflabs stm32duino-bootloader
57 | // force a USB disconnect to restart the negotiation
58 | void disconnect_usb() {
59 | GPIO_InitTypeDef GPIO_InitStruct;
60 |
61 | GPIO_InitStruct.Pin = GPIO_PIN_12;
62 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
63 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
64 | GPIO_InitStruct.Pull = GPIO_NOPULL;
65 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
66 |
67 | // set PA12 to low to simulate a disconnect
68 | HAL_GPIO_WritePin(GPIOA, 12, GPIO_PIN_RESET);
69 |
70 | volatile unsigned int delay;
71 | for(delay = 0;delay<512;delay++);
72 |
73 | GPIO_InitStruct.Pin = GPIO_PIN_12;
74 | GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
75 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
76 | GPIO_InitStruct.Pull = GPIO_NOPULL;
77 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
78 | }
79 |
80 | /* init function */
81 | void MX_USB_DEVICE_Init(void)
82 | {
83 | disconnect_usb();
84 |
85 | /* Init Device Library,Add Supported Class and Start the library*/
86 | USBD_Init(&hUsbDeviceFS, &FS_Desc, DEVICE_FS);
87 |
88 | USBD_RegisterClass(&hUsbDeviceFS, &USBD_CDC);
89 |
90 | USBD_CDC_RegisterInterface(&hUsbDeviceFS, &USBD_Interface_fops_FS);
91 |
92 | USBD_Start(&hUsbDeviceFS);
93 |
94 | }
95 | /**
96 | * @}
97 | */
98 |
99 | /**
100 | * @}
101 | */
102 |
103 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
104 |
--------------------------------------------------------------------------------
/Src/usbd_cdc_if.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file : usbd_cdc_if.c
4 | * @brief :
5 | ******************************************************************************
6 | *
7 | * Copyright (c) 2017 STMicroelectronics International N.V.
8 | * All rights reserved.
9 | *
10 | * Redistribution and use in source and binary forms, with or without
11 | * modification, are permitted, provided that the following conditions are met:
12 | *
13 | * 1. Redistribution of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | * 2. Redistributions in binary form must reproduce the above copyright notice,
16 | * this list of conditions and the following disclaimer in the documentation
17 | * and/or other materials provided with the distribution.
18 | * 3. Neither the name of STMicroelectronics nor the names of other
19 | * contributors to this software may be used to endorse or promote products
20 | * derived from this software without specific written permission.
21 | * 4. This software, including modifications and/or derivative works of this
22 | * software, must execute solely and exclusively on microcontroller or
23 | * microprocessor devices manufactured by or for STMicroelectronics.
24 | * 5. Redistribution and use of this software other than as permitted under
25 | * this license is void and will automatically terminate your rights under
26 | * this license.
27 | *
28 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
29 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
31 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
32 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
33 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
34 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
36 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
37 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
38 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
39 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 | *
41 | ******************************************************************************
42 | */
43 |
44 | /* Includes ------------------------------------------------------------------*/
45 | #include "usbd_cdc_if.h"
46 | /* USER CODE BEGIN INCLUDE */
47 | #include "sump.h"
48 | #include "uart.h"
49 | /* USER CODE END INCLUDE */
50 |
51 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
52 | * @{
53 | */
54 |
55 | /** @defgroup USBD_CDC
56 | * @brief usbd core module
57 | * @{
58 | */
59 |
60 | /** @defgroup USBD_CDC_Private_TypesDefinitions
61 | * @{
62 | */
63 | /* USER CODE BEGIN PRIVATE_TYPES */
64 | /* USER CODE END PRIVATE_TYPES */
65 | /**
66 | * @}
67 | */
68 |
69 | /** @defgroup USBD_CDC_Private_Defines
70 | * @{
71 | */
72 | /* USER CODE BEGIN PRIVATE_DEFINES */
73 | /* USER CODE END PRIVATE_DEFINES */
74 | /**
75 | * @}
76 | */
77 |
78 | /** @defgroup USBD_CDC_Private_Macros
79 | * @{
80 | */
81 | /* USER CODE BEGIN PRIVATE_MACRO */
82 | /* USER CODE END PRIVATE_MACRO */
83 |
84 | /**
85 | * @}
86 | */
87 |
88 | /** @defgroup USBD_CDC_Private_Variables
89 | * @{
90 | */
91 | /* Create buffer for reception and transmission */
92 | /* It's up to user to redefine and/or remove those define */
93 | /* Received Data over USB are stored in this buffer */
94 | uint8_t UserRxBufferFS[APP_RX_DATA_SIZE];
95 |
96 | /* Send Data over USB CDC are stored in this buffer */
97 | uint8_t UserTxBufferFS[APP_TX_DATA_SIZE];
98 |
99 | /* USER CODE BEGIN PRIVATE_VARIABLES */
100 | /* USER CODE END PRIVATE_VARIABLES */
101 |
102 | /**
103 | * @}
104 | */
105 |
106 | /** @defgroup USBD_CDC_IF_Exported_Variables
107 | * @{
108 | */
109 | extern USBD_HandleTypeDef hUsbDeviceFS;
110 | /* USER CODE BEGIN EXPORTED_VARIABLES */
111 | /* USER CODE END EXPORTED_VARIABLES */
112 |
113 | /**
114 | * @}
115 | */
116 |
117 | /** @defgroup USBD_CDC_Private_FunctionPrototypes
118 | * @{
119 | */
120 | static int8_t CDC_Init_FS (void);
121 | static int8_t CDC_DeInit_FS (void);
122 | static int8_t CDC_Control_FS (uint8_t cmd, uint8_t* pbuf, uint16_t length);
123 | static int8_t CDC_Receive_FS (uint8_t* pbuf, uint32_t *Len);
124 |
125 | /* USER CODE BEGIN PRIVATE_FUNCTIONS_DECLARATION */
126 | /* USER CODE END PRIVATE_FUNCTIONS_DECLARATION */
127 |
128 | /**
129 | * @}
130 | */
131 |
132 | USBD_CDC_ItfTypeDef USBD_Interface_fops_FS =
133 | {
134 | CDC_Init_FS,
135 | CDC_DeInit_FS,
136 | CDC_Control_FS,
137 | CDC_Receive_FS
138 | };
139 |
140 | /* Private functions ---------------------------------------------------------*/
141 | /**
142 | * @brief CDC_Init_FS
143 | * Initializes the CDC media low layer over the FS USB IP
144 | * @param None
145 | * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
146 | */
147 | static int8_t CDC_Init_FS(void)
148 | {
149 | /* USER CODE BEGIN 3 */
150 | /* Set Application Buffers */
151 | USBD_CDC_SetTxBuffer(&hUsbDeviceFS, UserTxBufferFS, 0);
152 | USBD_CDC_SetRxBuffer(&hUsbDeviceFS, (uint8_t *)UserRxBufferFS);
153 | return (USBD_OK);
154 | /* USER CODE END 3 */
155 | }
156 |
157 | /**
158 | * @brief CDC_DeInit_FS
159 | * DeInitializes the CDC media low layer
160 | * @param None
161 | * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
162 | */
163 | static int8_t CDC_DeInit_FS(void)
164 | {
165 | /* USER CODE BEGIN 4 */
166 | return (USBD_OK);
167 | /* USER CODE END 4 */
168 | }
169 |
170 | /**
171 | * @brief CDC_Control_FS
172 | * Manage the CDC class requests
173 | * @param cmd: Command code
174 | * @param pbuf: Buffer containing command data (request parameters)
175 | * @param length: Number of data to be sent (in bytes)
176 | * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
177 | */
178 | static int8_t CDC_Control_FS (uint8_t cmd, uint8_t* pbuf, uint16_t length)
179 | {
180 | /* USER CODE BEGIN 5 */
181 | switch (cmd)
182 | {
183 | case CDC_SEND_ENCAPSULATED_COMMAND:
184 |
185 | break;
186 |
187 | case CDC_GET_ENCAPSULATED_RESPONSE:
188 |
189 | break;
190 |
191 | case CDC_SET_COMM_FEATURE:
192 |
193 | break;
194 |
195 | case CDC_GET_COMM_FEATURE:
196 |
197 | break;
198 |
199 | case CDC_CLEAR_COMM_FEATURE:
200 |
201 | break;
202 |
203 | /*******************************************************************************/
204 | /* Line Coding Structure */
205 | /*-----------------------------------------------------------------------------*/
206 | /* Offset | Field | Size | Value | Description */
207 | /* 0 | dwDTERate | 4 | Number |Data terminal rate, in bits per second*/
208 | /* 4 | bCharFormat | 1 | Number | Stop bits */
209 | /* 0 - 1 Stop bit */
210 | /* 1 - 1.5 Stop bits */
211 | /* 2 - 2 Stop bits */
212 | /* 5 | bParityType | 1 | Number | Parity */
213 | /* 0 - None */
214 | /* 1 - Odd */
215 | /* 2 - Even */
216 | /* 3 - Mark */
217 | /* 4 - Space */
218 | /* 6 | bDataBits | 1 | Number Data bits (5, 6, 7, 8 or 16). */
219 | /*******************************************************************************/
220 | case CDC_SET_LINE_CODING:
221 |
222 | break;
223 |
224 | case CDC_GET_LINE_CODING:
225 |
226 | break;
227 |
228 | case CDC_SET_CONTROL_LINE_STATE:
229 |
230 | break;
231 |
232 | case CDC_SEND_BREAK:
233 |
234 | break;
235 |
236 | default:
237 | break;
238 | }
239 |
240 | return (USBD_OK);
241 | /* USER CODE END 5 */
242 | }
243 |
244 | /**
245 | * @brief CDC_Receive_FS
246 | * Data received over USB OUT endpoint are sent over CDC interface
247 | * through this function.
248 | *
249 | * @note
250 | * This function will block any OUT packet reception on USB endpoint
251 | * untill exiting this function. If you exit this function before transfer
252 | * is complete on CDC interface (ie. using DMA controller) it will result
253 | * in receiving more data while previous ones are still not sent.
254 | *
255 | * @param Buf: Buffer of data to be received
256 | * @param Len: Number of data received (in bytes)
257 | * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
258 | */
259 | static int8_t CDC_Receive_FS (uint8_t* Buf, uint32_t *Len)
260 | {
261 | /* USER CODE BEGIN 6 */
262 | /*
263 | write_uart_s("U ");
264 | write_uart_u(*Len);
265 | write_uart_s("\n");
266 | */
267 | for(uint32_t i = 0; i < *Len; i++) {
268 | sump_cmd(UserRxBufferFS[i]);
269 | }
270 |
271 | USBD_CDC_SetRxBuffer(&hUsbDeviceFS, (uint8_t *)UserRxBufferFS);
272 | USBD_CDC_ReceivePacket(&hUsbDeviceFS);
273 |
274 | return (USBD_OK);
275 | /* USER CODE END 6 */
276 | }
277 |
278 | /**
279 | * @brief CDC_Transmit_FS
280 | * Data send over USB IN endpoint are sent over CDC interface
281 | * through this function.
282 | * @note
283 | *
284 | *
285 | * @param Buf: Buffer of data to be send
286 | * @param Len: Number of data to be send (in bytes)
287 | * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL or USBD_BUSY
288 | */
289 | uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)
290 | {
291 | uint8_t result = USBD_OK;
292 | /* USER CODE BEGIN 7 */
293 | USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*)hUsbDeviceFS.pClassData;
294 | if (hcdc->TxState != 0){
295 | return USBD_BUSY;
296 | }
297 | USBD_CDC_SetTxBuffer(&hUsbDeviceFS, Buf, Len);
298 | result = USBD_CDC_TransmitPacket(&hUsbDeviceFS);
299 | /* USER CODE END 7 */
300 | return result;
301 | }
302 |
303 | /* USER CODE BEGIN PRIVATE_FUNCTIONS_IMPLEMENTATION */
304 | /* USER CODE END PRIVATE_FUNCTIONS_IMPLEMENTATION */
305 |
306 | /**
307 | * @}
308 | */
309 |
310 | /**
311 | * @}
312 | */
313 |
314 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
315 |
316 |
--------------------------------------------------------------------------------
/Src/usbd_desc.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file : usbd_desc.c
4 | * @version : v2.0_Cube
5 | * @brief : This file implements the USB Device descriptors
6 | ******************************************************************************
7 | *
8 | * Copyright (c) 2017 STMicroelectronics International N.V.
9 | * All rights reserved.
10 | *
11 | * Redistribution and use in source and binary forms, with or without
12 | * modification, are permitted, provided that the following conditions are met:
13 | *
14 | * 1. Redistribution of source code must retain the above copyright notice,
15 | * this list of conditions and the following disclaimer.
16 | * 2. Redistributions in binary form must reproduce the above copyright notice,
17 | * this list of conditions and the following disclaimer in the documentation
18 | * and/or other materials provided with the distribution.
19 | * 3. Neither the name of STMicroelectronics nor the names of other
20 | * contributors to this software may be used to endorse or promote products
21 | * derived from this software without specific written permission.
22 | * 4. This software, including modifications and/or derivative works of this
23 | * software, must execute solely and exclusively on microcontroller or
24 | * microprocessor devices manufactured by or for STMicroelectronics.
25 | * 5. Redistribution and use of this software other than as permitted under
26 | * this license is void and will automatically terminate your rights under
27 | * this license.
28 | *
29 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
30 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
32 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
33 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
34 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
35 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
37 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
40 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 | *
42 | ******************************************************************************
43 | */
44 |
45 | /* Includes ------------------------------------------------------------------*/
46 | #include "usbd_core.h"
47 | #include "usbd_desc.h"
48 | #include "usbd_conf.h"
49 |
50 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
51 | * @{
52 | */
53 |
54 | /** @defgroup USBD_DESC
55 | * @brief USBD descriptors module
56 | * @{
57 | */
58 |
59 | /** @defgroup USBD_DESC_Private_TypesDefinitions
60 | * @{
61 | */
62 | /**
63 | * @}
64 | */
65 |
66 | /** @defgroup USBD_DESC_Private_Defines
67 | * @{
68 | */
69 | #define USBD_VID 1155
70 | #define USBD_LANGID_STRING 1033
71 | #define USBD_MANUFACTURER_STRING "STMicroelectronics"
72 | #define USBD_PID_FS 22336
73 | #define USBD_PRODUCT_STRING_FS "STM32 Virtual ComPort"
74 | #define USBD_SERIALNUMBER_STRING_FS "00000000001A"
75 | #define USBD_CONFIGURATION_STRING_FS "CDC Config"
76 | #define USBD_INTERFACE_STRING_FS "CDC Interface"
77 |
78 | /* USER CODE BEGIN 0 */
79 |
80 | /* USER CODE END 0*/
81 | /**
82 | * @}
83 | */
84 |
85 | /** @defgroup USBD_DESC_Private_Macros
86 | * @{
87 | */
88 | /**
89 | * @}
90 | */
91 |
92 | /** @defgroup USBD_DESC_Private_Variables
93 | * @{
94 | */
95 | uint8_t * USBD_FS_DeviceDescriptor( USBD_SpeedTypeDef speed , uint16_t *length);
96 | uint8_t * USBD_FS_LangIDStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length);
97 | uint8_t * USBD_FS_ManufacturerStrDescriptor ( USBD_SpeedTypeDef speed , uint16_t *length);
98 | uint8_t * USBD_FS_ProductStrDescriptor ( USBD_SpeedTypeDef speed , uint16_t *length);
99 | uint8_t * USBD_FS_SerialStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length);
100 | uint8_t * USBD_FS_ConfigStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length);
101 | uint8_t * USBD_FS_InterfaceStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length);
102 |
103 | #ifdef USB_SUPPORT_USER_STRING_DESC
104 | uint8_t * USBD_FS_USRStringDesc (USBD_SpeedTypeDef speed, uint8_t idx , uint16_t *length);
105 | #endif /* USB_SUPPORT_USER_STRING_DESC */
106 |
107 | USBD_DescriptorsTypeDef FS_Desc =
108 | {
109 | USBD_FS_DeviceDescriptor,
110 | USBD_FS_LangIDStrDescriptor,
111 | USBD_FS_ManufacturerStrDescriptor,
112 | USBD_FS_ProductStrDescriptor,
113 | USBD_FS_SerialStrDescriptor,
114 | USBD_FS_ConfigStrDescriptor,
115 | USBD_FS_InterfaceStrDescriptor,
116 | };
117 |
118 | #if defined ( __ICCARM__ ) /*!< IAR Compiler */
119 | #pragma data_alignment=4
120 | #endif
121 | /* USB Standard Device Descriptor */
122 | __ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
123 | {
124 | 0x12, /*bLength */
125 | USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
126 | 0x00, /* bcdUSB */
127 | 0x02,
128 | 0x02, /*bDeviceClass*/
129 | 0x02, /*bDeviceSubClass*/
130 | 0x00, /*bDeviceProtocol*/
131 | USB_MAX_EP0_SIZE, /*bMaxPacketSize*/
132 | LOBYTE(USBD_VID), /*idVendor*/
133 | HIBYTE(USBD_VID), /*idVendor*/
134 | LOBYTE(USBD_PID_FS), /*idVendor*/
135 | HIBYTE(USBD_PID_FS), /*idVendor*/
136 | 0x00, /*bcdDevice rel. 2.00*/
137 | 0x02,
138 | USBD_IDX_MFC_STR, /*Index of manufacturer string*/
139 | USBD_IDX_PRODUCT_STR, /*Index of product string*/
140 | USBD_IDX_SERIAL_STR, /*Index of serial number string*/
141 | USBD_MAX_NUM_CONFIGURATION /*bNumConfigurations*/
142 | } ;
143 | /* USB_DeviceDescriptor */
144 |
145 | #if defined ( __ICCARM__ ) /*!< IAR Compiler */
146 | #pragma data_alignment=4
147 | #endif
148 |
149 | /* USB Standard Device Descriptor */
150 | __ALIGN_BEGIN uint8_t USBD_LangIDDesc[USB_LEN_LANGID_STR_DESC] __ALIGN_END =
151 | {
152 | USB_LEN_LANGID_STR_DESC,
153 | USB_DESC_TYPE_STRING,
154 | LOBYTE(USBD_LANGID_STRING),
155 | HIBYTE(USBD_LANGID_STRING),
156 | };
157 |
158 | #if defined ( __ICCARM__ ) /*!< IAR Compiler */
159 | #pragma data_alignment=4
160 | #endif
161 | __ALIGN_BEGIN uint8_t USBD_StrDesc[USBD_MAX_STR_DESC_SIZ] __ALIGN_END;
162 | /**
163 | * @}
164 | */
165 |
166 | /** @defgroup USBD_DESC_Private_FunctionPrototypes
167 | * @{
168 | */
169 | /**
170 | * @}
171 | */
172 |
173 | /** @defgroup USBD_DESC_Private_Functions
174 | * @{
175 | */
176 |
177 | /**
178 | * @brief USBD_FS_DeviceDescriptor
179 | * return the device descriptor
180 | * @param speed : current device speed
181 | * @param length : pointer to data length variable
182 | * @retval pointer to descriptor buffer
183 | */
184 | uint8_t * USBD_FS_DeviceDescriptor( USBD_SpeedTypeDef speed , uint16_t *length)
185 | {
186 | *length = sizeof(USBD_FS_DeviceDesc);
187 | return USBD_FS_DeviceDesc;
188 | }
189 |
190 | /**
191 | * @brief USBD_FS_LangIDStrDescriptor
192 | * return the LangID string descriptor
193 | * @param speed : current device speed
194 | * @param length : pointer to data length variable
195 | * @retval pointer to descriptor buffer
196 | */
197 | uint8_t * USBD_FS_LangIDStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length)
198 | {
199 | *length = sizeof(USBD_LangIDDesc);
200 | return USBD_LangIDDesc;
201 | }
202 |
203 | /**
204 | * @brief USBD_FS_ProductStrDescriptor
205 | * return the product string descriptor
206 | * @param speed : current device speed
207 | * @param length : pointer to data length variable
208 | * @retval pointer to descriptor buffer
209 | */
210 | uint8_t * USBD_FS_ProductStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length)
211 | {
212 | if(speed == 0)
213 | {
214 | USBD_GetString ((uint8_t*)USBD_PRODUCT_STRING_FS, USBD_StrDesc, length);
215 | }
216 | else
217 | {
218 | USBD_GetString ((uint8_t*)USBD_PRODUCT_STRING_FS, USBD_StrDesc, length);
219 | }
220 | return USBD_StrDesc;
221 | }
222 |
223 | /**
224 | * @brief USBD_FS_ManufacturerStrDescriptor
225 | * return the manufacturer string descriptor
226 | * @param speed : current device speed
227 | * @param length : pointer to data length variable
228 | * @retval pointer to descriptor buffer
229 | */
230 | uint8_t * USBD_FS_ManufacturerStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length)
231 | {
232 | USBD_GetString ((uint8_t*)USBD_MANUFACTURER_STRING, USBD_StrDesc, length);
233 | return USBD_StrDesc;
234 | }
235 |
236 | /**
237 | * @brief USBD_FS_SerialStrDescriptor
238 | * return the serial number string descriptor
239 | * @param speed : current device speed
240 | * @param length : pointer to data length variable
241 | * @retval pointer to descriptor buffer
242 | */
243 | uint8_t * USBD_FS_SerialStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length)
244 | {
245 | if(speed == USBD_SPEED_HIGH)
246 | {
247 | USBD_GetString ((uint8_t*)USBD_SERIALNUMBER_STRING_FS, USBD_StrDesc, length);
248 | }
249 | else
250 | {
251 | USBD_GetString ((uint8_t*)USBD_SERIALNUMBER_STRING_FS, USBD_StrDesc, length);
252 | }
253 | return USBD_StrDesc;
254 | }
255 |
256 | /**
257 | * @brief USBD_FS_ConfigStrDescriptor
258 | * return the configuration string descriptor
259 | * @param speed : current device speed
260 | * @param length : pointer to data length variable
261 | * @retval pointer to descriptor buffer
262 | */
263 | uint8_t * USBD_FS_ConfigStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length)
264 | {
265 | if(speed == USBD_SPEED_HIGH)
266 | {
267 | USBD_GetString ((uint8_t*)USBD_CONFIGURATION_STRING_FS, USBD_StrDesc, length);
268 | }
269 | else
270 | {
271 | USBD_GetString ((uint8_t*)USBD_CONFIGURATION_STRING_FS, USBD_StrDesc, length);
272 | }
273 | return USBD_StrDesc;
274 | }
275 |
276 | /**
277 | * @brief USBD_HS_InterfaceStrDescriptor
278 | * return the interface string descriptor
279 | * @param speed : current device speed
280 | * @param length : pointer to data length variable
281 | * @retval pointer to descriptor buffer
282 | */
283 | uint8_t * USBD_FS_InterfaceStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length)
284 | {
285 | if(speed == 0)
286 | {
287 | USBD_GetString ((uint8_t*)USBD_INTERFACE_STRING_FS, USBD_StrDesc, length);
288 | }
289 | else
290 | {
291 | USBD_GetString ((uint8_t*)USBD_INTERFACE_STRING_FS, USBD_StrDesc, length);
292 | }
293 | return USBD_StrDesc;
294 | }
295 | /**
296 | * @}
297 | */
298 |
299 | /**
300 | * @}
301 | */
302 |
303 | /**
304 | * @}
305 | */
306 |
307 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
308 |
--------------------------------------------------------------------------------
/ols.profile-stm32f103.cfg:
--------------------------------------------------------------------------------
1 | # Configuration for Arduino Mega Logic Analyzer profile
2 |
3 | # The short (single word) type of the device described in this profile
4 | device.type = AGLAS
5 | # A longer description of the device
6 | device.description = STM32F103 Logic Analyzer
7 | # The device interface, SERIAL only
8 | device.interface = SERIAL
9 | # The device's native clockspeed, in Hertz.
10 | device.clockspeed = 72000000
11 | # The clockspeed used in the divider calculation, in Hertz.
12 | device.dividerClockspeed = 72000000
13 | # Whether or not double-data-rate is supported by the device (also known as the "demux"-mode).
14 | device.supports_ddr = false
15 | # Supported sample rates in Hertz, separated by comma's
16 | device.samplerates = 100000, 200000, 500000, 1000000, 2000000, 4000000, 6000000, 7200000
17 | # What capture clocks are supported
18 | device.captureclock = INTERNAL
19 | # The supported capture sizes, in bytes
20 | device.capturesizes = 64, 128, 256, 512, 1024, 2048, 4096, 7168, 10240
21 | # Whether or not the noise filter is supported
22 | device.feature.noisefilter = false
23 | # Whether or not Run-Length encoding is supported
24 | device.feature.rle = false
25 | # Whether or not a testing mode is supported
26 | device.feature.testmode = false
27 | # Whether or not triggers are supported
28 | device.feature.triggers = true
29 | # The number of trigger stages
30 | device.trigger.stages = 1
31 | # Whether or not "complex" triggers are supported
32 | device.trigger.complex = false
33 |
34 | # The total number of channels usable for capturing
35 | device.channel.count = 8
36 | # The number of channels groups, together with the channel count determines the channels per group
37 | device.channel.groups = 1
38 | # Whether the capture size is limited by the enabled channel groups
39 | device.capturesize.bound = false
40 | # Which numbering does the device support
41 | device.channel.numberingschemes = DEFAULT
42 |
43 | # Is a delay after opening the port and device detection needed? (0 = no delay, >0 = delay in milliseconds)
44 | device.open.portdelay = 0
45 | # The receive timeout for the device (in milliseconds, 100 = default, <=0 = no timeout)
46 | device.receive.timeout = 100
47 | # Does the device need a high or low DTR-line to operate correctly? (high = true, low = false)
48 | device.open.portdtr = false
49 | # Which metadata keys correspond to this device profile? Value is a comma-separated list of (double quoted) names...
50 | device.metadata.keys = "AGLASv0"
51 |
52 | # In which order are samples sent back from the device? false = last sample first, true = first sample first
53 | device.samples.reverseOrder = true
54 |
55 | ###EOF###
56 |
--------------------------------------------------------------------------------
/openocd.cfg:
--------------------------------------------------------------------------------
1 | source [find interface/stlink-v2-1.cfg]
2 |
3 | transport select hla_swd
4 |
5 | #set WORKAREASIZE 0x2000
6 | adapter_nsrst_delay 100
7 | adapter_nsrst_assert_width 100
8 | source [find target/stm32f1x.cfg]
9 |
10 | reset_config trst_only
11 |
12 | init
13 | targets
14 | reset
15 | halt
16 | flash write_image erase build/sump.bin 0x8000000
17 | verify_image build/sump.bin 0x8000000
18 | reset run
19 | shutdown
20 |
--------------------------------------------------------------------------------
/sump.ioc:
--------------------------------------------------------------------------------
1 | #MicroXplorer Configuration settings - do not modify
2 | Dma.Request0=TIM1_UP
3 | Dma.RequestsNb=1
4 | Dma.TIM1_UP.0.Direction=DMA_PERIPH_TO_MEMORY
5 | Dma.TIM1_UP.0.Instance=DMA1_Channel5
6 | Dma.TIM1_UP.0.MemDataAlignment=DMA_MDATAALIGN_BYTE
7 | Dma.TIM1_UP.0.MemInc=DMA_MINC_ENABLE
8 | Dma.TIM1_UP.0.Mode=DMA_NORMAL
9 | Dma.TIM1_UP.0.PeriphDataAlignment=DMA_PDATAALIGN_WORD
10 | Dma.TIM1_UP.0.PeriphInc=DMA_PINC_DISABLE
11 | Dma.TIM1_UP.0.Priority=DMA_PRIORITY_VERY_HIGH
12 | Dma.TIM1_UP.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
13 | File.Version=6
14 | KeepUserPlacement=false
15 | Mcu.Family=STM32F1
16 | Mcu.IP0=DMA
17 | Mcu.IP1=NVIC
18 | Mcu.IP2=RCC
19 | Mcu.IP3=RTC
20 | Mcu.IP4=SYS
21 | Mcu.IP5=TIM1
22 | Mcu.IP6=TIM3
23 | Mcu.IP7=USART1
24 | Mcu.IP8=USB
25 | Mcu.IP9=USB_DEVICE
26 | Mcu.IPNb=10
27 | Mcu.Name=STM32F103C(8-B)Tx
28 | Mcu.Package=LQFP48
29 | Mcu.Pin0=PC13-TAMPER-RTC
30 | Mcu.Pin1=PC14-OSC32_IN
31 | Mcu.Pin10=PA5
32 | Mcu.Pin11=PA6
33 | Mcu.Pin12=PA7
34 | Mcu.Pin13=PA9
35 | Mcu.Pin14=PA10
36 | Mcu.Pin15=PA11
37 | Mcu.Pin16=PA12
38 | Mcu.Pin17=PA13
39 | Mcu.Pin18=PA14
40 | Mcu.Pin19=PB4
41 | Mcu.Pin2=PC15-OSC32_OUT
42 | Mcu.Pin20=VP_RTC_VS_RTC_Activate
43 | Mcu.Pin21=VP_SYS_VS_Systick
44 | Mcu.Pin22=VP_TIM1_VS_ClockSourceINT
45 | Mcu.Pin23=VP_TIM3_VS_ClockSourceINT
46 | Mcu.Pin24=VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS
47 | Mcu.Pin3=PD0-OSC_IN
48 | Mcu.Pin4=PD1-OSC_OUT
49 | Mcu.Pin5=PA0-WKUP
50 | Mcu.Pin6=PA1
51 | Mcu.Pin7=PA2
52 | Mcu.Pin8=PA3
53 | Mcu.Pin9=PA4
54 | Mcu.PinsNb=25
55 | Mcu.UserConstants=
56 | Mcu.UserName=STM32F103C8Tx
57 | MxCube.Version=4.20.0
58 | MxDb.Version=DB.4.0.200
59 | NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true
60 | NVIC.DMA1_Channel5_IRQn=true\:0\:0\:false\:false\:true
61 | NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true
62 | NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true
63 | NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true
64 | NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true
65 | NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true
66 | NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
67 | NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true
68 | NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true
69 | NVIC.USB_HP_CAN1_TX_IRQn=true\:1\:0\:true\:false\:true
70 | NVIC.USB_LP_CAN1_RX0_IRQn=true\:2\:0\:true\:false\:true
71 | NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true
72 | PA0-WKUP.Locked=true
73 | PA0-WKUP.Signal=GPIO_Input
74 | PA1.Locked=true
75 | PA1.Signal=GPIO_Input
76 | PA10.Mode=Asynchronous
77 | PA10.Signal=USART1_RX
78 | PA11.Mode=Device
79 | PA11.Signal=USB_DM
80 | PA12.Mode=Device
81 | PA12.Signal=USB_DP
82 | PA13.Mode=Serial_Wire
83 | PA13.Signal=SYS_JTMS-SWDIO
84 | PA14.Mode=Serial_Wire
85 | PA14.Signal=SYS_JTCK-SWCLK
86 | PA2.Locked=true
87 | PA2.Signal=GPIO_Input
88 | PA3.Locked=true
89 | PA3.Signal=GPIO_Input
90 | PA4.Locked=true
91 | PA4.Signal=GPIO_Input
92 | PA5.Locked=true
93 | PA5.Signal=GPIO_Input
94 | PA6.Locked=true
95 | PA6.Signal=GPIO_Input
96 | PA7.Locked=true
97 | PA7.Signal=GPIO_Input
98 | PA9.Mode=Asynchronous
99 | PA9.Signal=USART1_TX
100 | PB4.Locked=true
101 | PB4.Signal=S_TIM3_CH1
102 | PC13-TAMPER-RTC.GPIOParameters=GPIO_Label,GPIO_ModeDefaultOutputPP
103 | PC13-TAMPER-RTC.GPIO_Label=LED
104 | PC13-TAMPER-RTC.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_OD
105 | PC13-TAMPER-RTC.Locked=true
106 | PC13-TAMPER-RTC.Signal=GPIO_Output
107 | PC14-OSC32_IN.Mode=LSE-External-Oscillator
108 | PC14-OSC32_IN.Signal=RCC_OSC32_IN
109 | PC15-OSC32_OUT.Mode=LSE-External-Oscillator
110 | PC15-OSC32_OUT.Signal=RCC_OSC32_OUT
111 | PCC.Checker=false
112 | PCC.Line=STM32F103
113 | PCC.MCU=STM32F103C(8-B)Tx
114 | PCC.MXVersion=4.20.0
115 | PCC.PartNumber=STM32F103C8Tx
116 | PCC.Seq0=0
117 | PCC.Series=STM32F1
118 | PCC.Temperature=25
119 | PCC.Vdd=3.3
120 | PD0-OSC_IN.Mode=HSE-External-Oscillator
121 | PD0-OSC_IN.Signal=RCC_OSC_IN
122 | PD1-OSC_OUT.Mode=HSE-External-Oscillator
123 | PD1-OSC_OUT.Signal=RCC_OSC_OUT
124 | ProjectManager.AskForMigrate=true
125 | ProjectManager.BackupPrevious=false
126 | ProjectManager.CompilerOptimize=2
127 | ProjectManager.ComputerToolchain=false
128 | ProjectManager.CoupleFile=false
129 | ProjectManager.CustomerFirmwarePackage=
130 | ProjectManager.DefaultFWLocation=true
131 | ProjectManager.DeletePrevious=true
132 | ProjectManager.DeviceId=STM32F103C8Tx
133 | ProjectManager.FirmwarePackage=STM32Cube FW_F1 V1.4.0
134 | ProjectManager.FreePins=false
135 | ProjectManager.HalAssertFull=false
136 | ProjectManager.HeapSize=0x0
137 | ProjectManager.KeepUserCode=true
138 | ProjectManager.LastFirmware=true
139 | ProjectManager.LibraryCopy=1
140 | ProjectManager.PreviousToolchain=SW4STM32
141 | ProjectManager.ProjectBuild=false
142 | ProjectManager.ProjectFileName=sump.ioc
143 | ProjectManager.ProjectName=sump
144 | ProjectManager.StackSize=0x400
145 | ProjectManager.TargetToolchain=SW4STM32
146 | ProjectManager.ToolChainLocation=
147 | ProjectManager.UnderRoot=true
148 | ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL,2-MX_DMA_Init-DMA-false-HAL,3-MX_USB_DEVICE_Init-USB_DEVICE-false-HAL,4-SystemClock_Config-RCC-false-HAL,5-MX_RTC_Init-RTC-false-HAL,6-MX_USART1_UART_Init-USART1-false-HAL,7-MX_TIM1_Init-TIM1-false-HAL,8-MX_TIM3_Init-TIM3-false-HAL
149 | RCC.ADCFreqValue=36000000
150 | RCC.AHBFreq_Value=72000000
151 | RCC.APB1CLKDivider=RCC_HCLK_DIV2
152 | RCC.APB1Freq_Value=36000000
153 | RCC.APB1TimFreq_Value=72000000
154 | RCC.APB2Freq_Value=72000000
155 | RCC.APB2TimFreq_Value=72000000
156 | RCC.ClockTypeHCLK=RCC_CLOCKTYPE_HCLK
157 | RCC.ClockTypePCLK1=RCC_CLOCKTYPE_PCLK1
158 | RCC.ClockTypePCLK2=RCC_CLOCKTYPE_PCLK2
159 | RCC.EnableHSE=true
160 | RCC.EnableHSERTCDevisor=true
161 | RCC.EnableLSE=true
162 | RCC.EnableLSERTC=true
163 | RCC.EnableMCOMultDivisor=false
164 | RCC.FCLKCortexFreq_Value=72000000
165 | RCC.FamilyName=M
166 | RCC.HCLKFreq_Value=72000000
167 | RCC.HSEState=RCC_HSE_ON
168 | RCC.HSIState=RCC_HSI_ON
169 | RCC.IPParameters=ADCFreqValue,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,ClockTypeHCLK,ClockTypePCLK1,ClockTypePCLK2,EnableHSE,EnableHSERTCDevisor,EnableLSE,EnableLSERTC,EnableMCOMultDivisor,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSEState,HSIState,IWDGEnable,LSEState,LSIState,MCOEnable,MCOFreq_Value,OscillatorTypeHSE,OscillatorTypeLSE,OscillatorTypeLSI,PLLCLKFreq_Value,PLLMCOFreq_Value,PLLMUL,PLLSource,PLLSourceVirtual,PLLState,RCC_PERIPHCLK_RTCVar,RTCClockSelection,RTCEnable,RTCFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,TimSysFreq_Value,USBFreq_Value,USBPrescaler,VCOOutput2Freq_Value
170 | RCC.IWDGEnable=false
171 | RCC.LSEState=RCC_LSE_ON
172 | RCC.LSIState=RCC_LSI_OFF
173 | RCC.MCOEnable=false
174 | RCC.MCOFreq_Value=72000000
175 | RCC.OscillatorTypeHSE=RCC_OSCILLATORTYPE_HSE
176 | RCC.OscillatorTypeLSE=RCC_OSCILLATORTYPE_LSE
177 | RCC.OscillatorTypeLSI=
178 | RCC.PLLCLKFreq_Value=72000000
179 | RCC.PLLMCOFreq_Value=36000000
180 | RCC.PLLMUL=RCC_PLL_MUL9
181 | RCC.PLLSource=RCC_PLLSOURCE_HSE
182 | RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE
183 | RCC.PLLState=RCC_PLL_ON
184 | RCC.RCC_PERIPHCLK_RTCVar=RCC_PERIPHCLK_RTC
185 | RCC.RTCClockSelection=RCC_RTCCLKSOURCE_LSE
186 | RCC.RTCEnable=true
187 | RCC.RTCFreq_Value=32768
188 | RCC.SYSCLKFreq_VALUE=72000000
189 | RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
190 | RCC.TimSysFreq_Value=72000000
191 | RCC.USBFreq_Value=48000000
192 | RCC.USBPrescaler=RCC_USBCLKSOURCE_PLL_DIV1_5
193 | RCC.VCOOutput2Freq_Value=8000000
194 | RTC.IPParameters=OutPut
195 | RTC.OutPut=RTC_OUTPUTSOURCE_ALARM
196 | SH.S_TIM3_CH1.0=TIM3_CH1,PWM Generation1 CH1
197 | SH.S_TIM3_CH1.ConfNb=1
198 | TIM1.IPParameters=Prescaler,Period
199 | TIM1.Period=11
200 | TIM1.Prescaler=0
201 | TIM3.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
202 | TIM3.IPParameters=Channel-PWM Generation1 CH1,Period,Pulse-PWM Generation1 CH1
203 | TIM3.Period=719
204 | TIM3.Pulse-PWM\ Generation1\ CH1=360
205 | USART1.HwFlowCtl-Asynchronous=UART_HWCONTROL_NONE
206 | USART1.IPParameters=VirtualMode,HwFlowCtl-Asynchronous
207 | USART1.VirtualMode=VM_ASYNC
208 | USB.IPParameters=ep0_mps
209 | USB.ep0_mps=DEP0CTL_MPS_64
210 | USB_DEVICE.CLASS_NAME_FS=CDC
211 | USB_DEVICE.IPParameters=VirtualMode,VirtualModeFS,USBD_HandleTypeDef,CLASS_NAME_FS,USBD_HandleTypeDef_FS
212 | USB_DEVICE.USBD_HandleTypeDef=hUsbDeviceFS
213 | USB_DEVICE.USBD_HandleTypeDef_FS=hUsbDevice_USB_FS
214 | USB_DEVICE.VirtualMode=Cdc
215 | USB_DEVICE.VirtualModeFS=Cdc_FS
216 | VP_RTC_VS_RTC_Activate.Mode=RTC_Enabled
217 | VP_RTC_VS_RTC_Activate.Signal=RTC_VS_RTC_Activate
218 | VP_SYS_VS_Systick.Mode=SysTick
219 | VP_SYS_VS_Systick.Signal=SYS_VS_Systick
220 | VP_TIM1_VS_ClockSourceINT.Mode=Internal
221 | VP_TIM1_VS_ClockSourceINT.Signal=TIM1_VS_ClockSourceINT
222 | VP_TIM3_VS_ClockSourceINT.Mode=Internal
223 | VP_TIM3_VS_ClockSourceINT.Signal=TIM3_VS_ClockSourceINT
224 | VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS.Mode=CDC_FS
225 | VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS.Signal=USB_DEVICE_VS_USB_DEVICE_CDC_FS
226 | board=sump
227 |
--------------------------------------------------------------------------------
/sump.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | sump
5 | STM32F103C8Tx
6 | SWD
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------