Skip to content

Commit 2e19991

Browse files
authored
Add stm32f072xb / stm32f072x8 HIC (#991)
Add stm32f072xb / stm32f072x8 HIC
2 parents 2e146c9 + 0e4ee2b commit 2e19991

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+71253
-0
lines changed

docs/hic/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,12 @@
1313
| [nrf52820](nrf52820.md) | M4 | 64 MHz | 32 KB | 256 KB | FS |
1414
| [sam3u2c](sam3u2c.md) | M3 | 96 MHz | 32 KB | 128 KB | HS |
1515
| [stm32f103xb](stm32f103xb.md) | M3 | 72 Mhz | 20 KB | 128 KB | FS |
16+
17+
## Experimental
18+
19+
Support for these HICs has been recently added.
20+
21+
| HIC | Core | Freq. | RAM | ROM | USB |
22+
|-------------------------------|:----:|--------:|-------:|-------:|:---:|
23+
| [stm32f072x8](stm32f072xx.md) | M0 | 48 Mhz | 16 KB | 64 KB | FS |
24+
| [stm32f072xb](stm32f072xx.md) | M0 | 48 Mhz | 16 KB | 128 KB | FS |

docs/hic/stm32f072xx.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# stm32f072x8 / stm32f072xb HIC
2+
3+
Based on STM32F072C8T6 chip ([Datasheet](https://www.st.com/resource/en/datasheet/stm32f072c8.pdf)) and STM32F072CBT6 chip ([Datasheet](https://www.st.com/resource/en/datasheet/stm32f072cb.pdf)).
4+
5+
- Cortex-M0 48 Mhz
6+
- 64 KB (stm32f072x8) / 128 KB (stm32f072xb) Flash
7+
- 16 KB RAM
8+
- Full-speed USB 2.0 device controller: up to 8 bi-directional endpoints.
9+
- UFQFPN48 packaging
10+
11+
## Memory Map
12+
13+
### stm32f072x8
14+
15+
| Region | Size | Start | End |
16+
|----------|--------|-------------|-------------|
17+
| Flash | 64 KB | 0x0000_0000 | 0x0001_0000 |
18+
| SRAM | 16 KB | 0x2000_0000 | 0x2000_4000 |
19+
20+
### stm32f072xb
21+
22+
| Region | Size | Start | End |
23+
|----------|--------|-------------|-------------|
24+
| Flash | 128 KB | 0x0000_0000 | 0x0002_0000 |
25+
| SRAM | 16 KB | 0x2000_0000 | 0x2000_4000 |
26+
27+
Bootloader size is 48 KB
28+
29+
## DAPLink default pin assignment
30+
31+
Default pin-out is compatible with [J-Link-OB-STM32F072](https://www.segger.com/downloads/jlink/UM08024_JLinkOBSTM32F072.pdf).
32+
33+
| Signal | I/O | Symbol | Pin |
34+
|-------------|:---:|---------|:---:|
35+
| SWD |
36+
| SWCLK | O | PA2 | 12 |
37+
| SWDIO | I/O | PA4 | 14 |
38+
| SWO | I | PA3 | 13 |
39+
| nRESET | O | PA1 | 11 |
40+
| UART |
41+
| UART TX | O | PA9 | 30 |
42+
| UART RX | I | PA10 | 31 |
43+
| Button |
44+
| F-RST But. | I | PB6 | |
45+
| LEDs |
46+
| Connect. LED| O | PA0 | |
47+
| HID LED | O | PA0 | |
48+
| CDC LED | O | PA0 | |
49+
| MSC LED | O | PA0 | |

projects.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ module:
9797
- records/rtos/rtos-cm3.yaml
9898
- records/hic_hal/sam3u2c.yaml
9999
- records/usb/usb-hid.yaml
100+
hic_stm32f072xb: &module_hic_stm32f072xb
101+
- records/rtos/rtos-cm0.yaml
102+
- records/hic_hal/stm32f072xb.yaml
103+
- records/usb/usb-hid.yaml
104+
hic_stm32f072x8: &module_hic_stm32f072x8
105+
- records/rtos/rtos-cm0.yaml
106+
- records/hic_hal/stm32f072x8.yaml
107+
- records/usb/usb-hid.yaml
100108
hic_stm32f103xb: &module_hic_stm32f103xb
101109
- records/rtos/rtos-cm3.yaml
102110
- records/hic_hal/stm32f103xb.yaml
@@ -195,6 +203,14 @@ projects:
195203
- *module_if
196204
- *module_hic_sam3u2c
197205
- records/family/all_family.yaml
206+
stm32f072x8_if:
207+
- *module_if
208+
- *module_hic_stm32f072x8
209+
- records/usb/usb-bulk.yaml
210+
stm32f072xb_if:
211+
- *module_if
212+
- *module_hic_stm32f072xb
213+
- records/usb/usb-bulk.yaml
198214
stm32f103xb_bl:
199215
- *module_bl
200216
- records/hic_hal/stm32f103xb.yaml
@@ -610,3 +626,15 @@ projects:
610626
- *module_hic_lpc55s69
611627
- records/board/lpc55s69_nrf52840dk.yaml
612628
- records/board/mcu_link.yaml
629+
stm32f072xb_disco_test_if:
630+
- *module_if
631+
- *module_hic_stm32f072xb
632+
- records/family/all_family.yaml
633+
- records/usb/usb-bulk.yaml
634+
- records/board/stm32f072b_disco.yaml
635+
stm32f072x8_disco_test_if:
636+
- *module_if
637+
- *module_hic_stm32f072x8
638+
- records/family/all_family.yaml
639+
- records/usb/usb-bulk.yaml
640+
- records/board/stm32f072b_disco.yaml
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
common:
2+
macros:
3+
- IO_CONFIG_OVERRIDE
4+
includes:
5+
- source/board/override_stm32f072b_disco

records/hic_hal/stm32f072x8.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
common:
2+
target:
3+
- stm32f072cb
4+
core:
5+
- Cortex-M0
6+
macros:
7+
- INTERFACE_STM32F072X8
8+
- USE_HAL_DRIVER
9+
- STM32F072xB
10+
- DAPLINK_HIC_ID=0x530F0728 # DAPLINK_HIC_ID_STM32F072X8
11+
- __packed=__packed # Prevent redefinition of __packed with ARMCC
12+
- DAPLINK_NO_ASSERT_FILENAMES
13+
- OS_CLOCK=48000000
14+
includes:
15+
- source/hic_hal/stm32/stm32f072xx
16+
- source/hic_hal/stm32/stm32f072xx/cmsis
17+
- source/hic_hal/stm32/hal/STM32F0xx_HAL_Driver/Inc
18+
19+
sources:
20+
hic_hal:
21+
- source/hic_hal/stm32/stm32f072xx
22+
- source/hic_hal/stm32/stm32f072xx/cmsis
23+
- source/hic_hal/stm32/hal/STM32F0xx_HAL_Driver/Src
24+
25+
tool_specific:
26+
uvision:
27+
misc:
28+
ld_flags:
29+
- --predefine="-I..\..\..\source\hic_hal\stm32\stm32f072xx"
30+
sources:
31+
hic_hal:
32+
- source/hic_hal/stm32/stm32f072xx/armcc
33+
armcc:
34+
sources:
35+
hic_hal:
36+
- source/hic_hal/stm32/stm32f072xx/armcc
37+
armclang:
38+
sources:
39+
hic_hal:
40+
- source/hic_hal/stm32/stm32f072xx/armcc
41+
gcc_arm:
42+
sources:
43+
hic_hal:
44+
- source/hic_hal/stm32/stm32f072xx/gcc

records/hic_hal/stm32f072xb.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
common:
2+
target:
3+
- stm32f072cb
4+
core:
5+
- Cortex-M0
6+
macros:
7+
- INTERFACE_STM32F072XB
8+
- USE_HAL_DRIVER
9+
- STM32F072xB
10+
- DAPLINK_HIC_ID=0x530F072B # DAPLINK_HIC_ID_STM32F072XB
11+
- __packed=__packed # Prevent redefinition of __packed with ARMCC
12+
- DAPLINK_NO_ASSERT_FILENAMES
13+
- OS_CLOCK=48000000
14+
includes:
15+
- source/hic_hal/stm32/stm32f072xx
16+
- source/hic_hal/stm32/stm32f072xx/cmsis
17+
- source/hic_hal/stm32/hal/STM32F0xx_HAL_Driver/Inc
18+
19+
sources:
20+
hic_hal:
21+
- source/hic_hal/stm32/stm32f072xx
22+
- source/hic_hal/stm32/stm32f072xx/cmsis
23+
- source/hic_hal/stm32/hal/STM32F0xx_HAL_Driver/Src
24+
25+
tool_specific:
26+
uvision:
27+
misc:
28+
ld_flags:
29+
- --predefine="-I..\..\..\source\hic_hal\stm32\stm32f072xx"
30+
sources:
31+
hic_hal:
32+
- source/hic_hal/stm32/stm32f072xx/armcc
33+
armcc:
34+
sources:
35+
hic_hal:
36+
- source/hic_hal/stm32/stm32f072xx/armcc
37+
armclang:
38+
sources:
39+
hic_hal:
40+
- source/hic_hal/stm32/stm32f072xx/armcc
41+
gcc_arm:
42+
sources:
43+
hic_hal:
44+
- source/hic_hal/stm32/stm32f072xx/gcc
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
/**
2+
* @file IO_Config_Override.c
3+
* @brief Alternative IO for STM32F02CB based Hardware Interface Circuit
4+
*
5+
* DAPLink Interface Firmware
6+
* Copyright (c) 2009-2021, ARM Limited, All Rights Reserved
7+
* SPDX-License-Identifier: Apache-2.0
8+
*
9+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
10+
* not use this file except in compliance with the License.
11+
* You may obtain a copy of the License at
12+
*
13+
* http://www.apache.org/licenses/LICENSE-2.0
14+
*
15+
* Unless required by applicable law or agreed to in writing, software
16+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
* See the License for the specific language governing permissions and
19+
* limitations under the License.
20+
*/
21+
22+
#ifndef __IO_CONFIG_H__
23+
#define __IO_CONFIG_H__
24+
25+
#include "stm32f0xx.h"
26+
#include "compiler.h"
27+
#include "daplink.h"
28+
29+
// This GPIO configuration is only valid for the STM32F072XX HIC
30+
COMPILER_ASSERT((DAPLINK_HIC_ID == DAPLINK_HIC_ID_STM32F072XB) ||
31+
(DAPLINK_HIC_ID == DAPLINK_HIC_ID_STM32F072X8));
32+
33+
#define __HAL_RCC_USB_GPIO_CLK_ENABLE __HAL_RCC_GPIOA_CLK_ENABLE
34+
35+
/*
36+
* - #RESET (PA1 / Pin 11) -
37+
* - SWCLK (PA2 / Pin 12) = PA5
38+
* - SWO (PA3 / Pin 13) = PA15
39+
* - SWDIO (PA4 / Pin 14) -
40+
* - TXD (PA9 / Pin 30) -
41+
* - RXD (PA10 / Pin 31) -
42+
* - CTS (PA7 / Pin 17) X
43+
* - RTS (PA6 / Pin 16) X
44+
*/
45+
46+
// LED_RED / LD3 : PC6
47+
// LED_ORANGE / LD4 : PC8
48+
// LED_GREEN / LD5 : PC9
49+
// LED_BLUE / LD6 : PC7
50+
51+
#define USER_BUTTON_PIN GPIO_PIN_0 /* PA0 */
52+
#define USER_BUTTON_GPIO_PORT GPIOA
53+
#define USER_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
54+
#define USER_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
55+
#define USER_BUTTON_EXTI_IRQn EXTI0_1_IRQn
56+
57+
#define LED3_PIN GPIO_PIN_6
58+
#define LED3_GPIO_PORT GPIOC
59+
#define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
60+
#define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
61+
62+
#define LED4_PIN GPIO_PIN_8
63+
#define LED4_GPIO_PORT GPIOC
64+
#define LED4_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
65+
#define LED4_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
66+
67+
#define LED5_PIN GPIO_PIN_9
68+
#define LED5_GPIO_PORT GPIOC
69+
#define LED5_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
70+
#define LED5_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
71+
72+
#define LED6_PIN GPIO_PIN_7
73+
#define LED6_GPIO_PORT GPIOC
74+
#define LED6_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
75+
#define LED6_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
76+
77+
//==============================================================================
78+
// Debug Port I/O Pins
79+
//==============================================================================
80+
/* led pin: PA0 */
81+
#define HID_LED_PORT GPIOA
82+
#define HID_LED_PIN GPIO_PIN_0
83+
84+
#define CDC_LED_PORT GPIOA
85+
#define CDC_LED_PIN GPIO_PIN_0
86+
87+
#define MSC_LED_PORT GPIOA
88+
#define MSC_LED_PIN GPIO_PIN_0
89+
90+
#define __HAL_RCC_LED_GPIO_CLK_ENABLE __HAL_RCC_GPIOA_CLK_ENABLE
91+
92+
#define LED_CONNECTED_PORT GPIOA
93+
#define LED_CONNECTED_PIN GPIO_PIN_0
94+
#define LED_CONNECTED_OUT(__bit) \
95+
do \
96+
{ \
97+
if (__bit) \
98+
LED_CONNECTED_PORT->BRR = LED_CONNECTED_PIN; \
99+
else \
100+
LED_CONNECTED_PORT->BSRR = LED_CONNECTED_PIN; \
101+
} while (0)
102+
103+
#define LED_RUNNING_PORT GPIOA
104+
#define LED_RUNNING_PIN GPIO_PIN_0
105+
#define LED_RUNNING_OUT(__bit) \
106+
do \
107+
{ \
108+
if (__bit) \
109+
LED_RUNNING_PORT->BRR = LED_RUNNING_PIN; \
110+
else \
111+
LED_RUNNING_PORT->BSRR = LED_RUNNING_PIN; \
112+
} while (0)
113+
114+
/* SWD_DAT pin: PA4 */
115+
#define SWDIO_TMS_PORT GPIOA
116+
#define SWDIO_TMS_PIN GPIO_PIN_4
117+
118+
/* SWD_CLK pin: PA2 */
119+
#define SWCLK_TCK_PORT GPIOA
120+
#define SWCLK_TCK_PIN GPIO_PIN_2
121+
122+
/* SWD_NRST pin: PA1 */
123+
#define nRESET_PORT GPIOA
124+
#define nRESET_PIN GPIO_PIN_1
125+
126+
/* SWD_SWO pin: PA3 */
127+
#define SWSWO_PORT GPIOA
128+
#define SWSWO_PIN GPIO_PIN_3
129+
130+
/* SWD_SWO pin: PA3 */
131+
#define SWSWO_PORT GPIOA
132+
#define SWSWO_PIN GPIO_PIN_3
133+
134+
#define __HAL_RCC_DAP_GPIO_CLK_ENABLE() \
135+
do \
136+
{ \
137+
__HAL_RCC_GPIOA_CLK_ENABLE(); \
138+
__HAL_RCC_GPIOC_CLK_ENABLE(); \
139+
} while (0)
140+
141+
//==============================================================================
142+
// GOBtl Button GPIO Pin
143+
//==============================================================================
144+
#define __HAL_RCC_BTN_BTL_CLK_ENABLE __HAL_RCC_GPIOB_CLK_ENABLE
145+
#define __HAL_RCC_BTN_BTL_CLK_DISABLE __HAL_RCC_GPIOB_CLK_DISABLE
146+
#define BTN_BTL_PORT GPIOB
147+
#define BTN_BTL_PIN GPIO_PIN_6
148+
149+
//==============================================================================
150+
// USART Port I/O Pins
151+
//==============================================================================
152+
#define USART_PORT USART1
153+
#define USART_GPIO GPIOA
154+
#define USART_RTS_PIN GPIO_PIN_6
155+
#define USART_CTS_PIN GPIO_PIN_7
156+
#define USART_DTR_PIN GPIO_PIN_8
157+
#define USART_TX_PIN GPIO_PIN_9
158+
#define USART_RX_PIN GPIO_PIN_10
159+
#define USART_IRQn USART1_IRQn
160+
161+
#endif

source/daplink/daplink.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ COMPILER_ASSERT(DAPLINK_RAM_SHARED_START + DAPLINK_RAM_SHARED_SIZE == DAPLINK_RA
6464
#define DAPLINK_HIC_ID_KL27Z 0x9796990B
6565
#define DAPLINK_HIC_ID_LPC54606 0x9796990C // reserving for future use
6666
#define DAPLINK_HIC_ID_STM32F723IE 0x9796990D // reserving for future use
67+
#define DAPLINK_HIC_ID_STM32F072X8 0x530F0728 // 'S\x0F\x07\x28'
68+
#define DAPLINK_HIC_ID_STM32F072XB 0x530F072B // 'S\x0F\x07\x2B'
6769
#define DAPLINK_HIC_ID_LPC55XX 0x4C504355 // 'LPC\x55'
6870
#define DAPLINK_HIC_ID_M48SSIDAE 0x97969921
6971
#define DAPLINK_HIC_ID_PSOC5 0x2E127069

source/hic_hal/device.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
#include "max32625.h"
3939
#elif defined (INTERFACE_SAM3U2C)
4040
#include "sam3u2c.h"
41+
#elif defined (INTERFACE_STM32F072XB) || defined (INTERFACE_STM32F072X8)
42+
#include "stm32f072xb.h"
4143
#elif defined (INTERFACE_STM32F103XB)
4244
#include "stm32f1xx.h"
4345
#elif defined (INTERFACE_M48SSIDAE)

0 commit comments

Comments
 (0)