Skip to content

Commit d3ae38c

Browse files
committed
[NUCLEO_F042K6] add nucleo_f042k6 support
1 parent f7ce4ed commit d3ae38c

Some content is hidden

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

45 files changed

+14231
-9
lines changed

libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F0/Release_Notes_stm32f0xx_hal.html

Lines changed: 34 additions & 3 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
;******************** (C) COPYRIGHT 2015 STMicroelectronics ********************
2+
;* File Name : startup_stm32f042x6.s
3+
;* Author : MCD Application Team
4+
;* Version : V2.2.2
5+
;* Date : 26-June-2015
6+
;* Description : STM32F042x4/STM32F042x6 devices vector table for MDK-ARM toolchain.
7+
;* This module performs:
8+
;* - Set the initial SP
9+
;* - Set the initial PC == Reset_Handler
10+
;* - Set the vector table entries with the exceptions ISR address
11+
;* - Branches to __main in the C library (which eventually
12+
;* calls main()).
13+
;* After Reset the CortexM0 processor is in Thread mode,
14+
;* priority is Privileged, and the Stack is set to Main.
15+
;* <<< Use Configuration Wizard in Context Menu >>>
16+
;*******************************************************************************
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+
; Amount of memory (in bytes) allocated for Stack
43+
; Tailor this value to your application needs
44+
; <h> Stack Configuration
45+
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
46+
; </h>
47+
48+
Stack_Size EQU 0x00000400
49+
50+
AREA STACK, NOINIT, READWRITE, ALIGN=3
51+
EXPORT __initial_sp
52+
53+
Stack_Mem SPACE Stack_Size
54+
__initial_sp EQU 0x20001800 ; Top of RAM
55+
56+
57+
; <h> Heap Configuration
58+
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
59+
; </h>
60+
61+
Heap_Size EQU 0x00000200
62+
63+
AREA HEAP, NOINIT, READWRITE, ALIGN=3
64+
EXPORT __heap_base
65+
EXPORT __heap_limit
66+
67+
__heap_base
68+
Heap_Mem SPACE Heap_Size
69+
__heap_limit EQU (__initial_sp - Stack_Size)
70+
71+
PRESERVE8
72+
THUMB
73+
74+
75+
; Vector Table Mapped to Address 0 at Reset
76+
AREA RESET, DATA, READONLY
77+
EXPORT __Vectors
78+
EXPORT __Vectors_End
79+
EXPORT __Vectors_Size
80+
81+
__Vectors DCD __initial_sp ; Top of Stack
82+
DCD Reset_Handler ; Reset Handler
83+
DCD NMI_Handler ; NMI Handler
84+
DCD HardFault_Handler ; Hard Fault Handler
85+
DCD 0 ; Reserved
86+
DCD 0 ; Reserved
87+
DCD 0 ; Reserved
88+
DCD 0 ; Reserved
89+
DCD 0 ; Reserved
90+
DCD 0 ; Reserved
91+
DCD 0 ; Reserved
92+
DCD SVC_Handler ; SVCall Handler
93+
DCD 0 ; Reserved
94+
DCD 0 ; Reserved
95+
DCD PendSV_Handler ; PendSV Handler
96+
DCD SysTick_Handler ; SysTick Handler
97+
98+
; External Interrupts
99+
DCD WWDG_IRQHandler ; Window Watchdog
100+
DCD PVD_VDDIO2_IRQHandler ; PVD through EXTI Line detect
101+
DCD RTC_IRQHandler ; RTC through EXTI Line
102+
DCD FLASH_IRQHandler ; FLASH
103+
DCD RCC_CRS_IRQHandler ; RCC and CRS
104+
DCD EXTI0_1_IRQHandler ; EXTI Line 0 and 1
105+
DCD EXTI2_3_IRQHandler ; EXTI Line 2 and 3
106+
DCD EXTI4_15_IRQHandler ; EXTI Line 4 to 15
107+
DCD TSC_IRQHandler ; TS
108+
DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
109+
DCD DMA1_Channel2_3_IRQHandler ; DMA1 Channel 2 and Channel 3
110+
DCD DMA1_Channel4_5_IRQHandler ; DMA1 Channel 4 and Channel 5
111+
DCD ADC1_IRQHandler ; ADC1
112+
DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; TIM1 Break, Update, Trigger and Commutation
113+
DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
114+
DCD TIM2_IRQHandler ; TIM2
115+
DCD TIM3_IRQHandler ; TIM3
116+
DCD 0 ; Reserved
117+
DCD 0 ; Reserved
118+
DCD TIM14_IRQHandler ; TIM14
119+
DCD 0 ; Reserved
120+
DCD TIM16_IRQHandler ; TIM16
121+
DCD TIM17_IRQHandler ; TIM17
122+
DCD I2C1_IRQHandler ; I2C1
123+
DCD 0 ; Reserved
124+
DCD SPI1_IRQHandler ; SPI1
125+
DCD SPI2_IRQHandler ; SPI2
126+
DCD USART1_IRQHandler ; USART1
127+
DCD USART2_IRQHandler ; USART2
128+
DCD 0 ; Reserved
129+
DCD CEC_CAN_IRQHandler ; CEC and CAN
130+
DCD USB_IRQHandler ; USB
131+
132+
__Vectors_End
133+
134+
__Vectors_Size EQU __Vectors_End - __Vectors
135+
136+
AREA |.text|, CODE, READONLY
137+
138+
; Reset handler routine
139+
Reset_Handler PROC
140+
EXPORT Reset_Handler [WEAK]
141+
IMPORT __main
142+
IMPORT SystemInit
143+
144+
145+
146+
LDR R0, =__initial_sp ; set stack pointer
147+
MSR MSP, R0
148+
149+
;;Check if boot space corresponds to test memory
150+
151+
LDR R0,=0x00000004
152+
LDR R1, [R0]
153+
LSRS R1, R1, #24
154+
LDR R2,=0x1F
155+
CMP R1, R2
156+
157+
BNE ApplicationStart
158+
159+
;; SYSCFG clock enable
160+
161+
LDR R0,=0x40021018
162+
LDR R1,=0x00000001
163+
STR R1, [R0]
164+
165+
;; Set CFGR1 register with flash memory remap at address 0
166+
167+
LDR R0,=0x40010000
168+
LDR R1,=0x00000000
169+
STR R1, [R0]
170+
ApplicationStart
171+
LDR R0, =SystemInit
172+
BLX R0
173+
LDR R0, =__main
174+
BX R0
175+
ENDP
176+
177+
; Dummy Exception Handlers (infinite loops which can be modified)
178+
179+
NMI_Handler PROC
180+
EXPORT NMI_Handler [WEAK]
181+
B .
182+
ENDP
183+
HardFault_Handler\
184+
PROC
185+
EXPORT HardFault_Handler [WEAK]
186+
B .
187+
ENDP
188+
SVC_Handler PROC
189+
EXPORT SVC_Handler [WEAK]
190+
B .
191+
ENDP
192+
PendSV_Handler PROC
193+
EXPORT PendSV_Handler [WEAK]
194+
B .
195+
ENDP
196+
SysTick_Handler PROC
197+
EXPORT SysTick_Handler [WEAK]
198+
B .
199+
ENDP
200+
201+
Default_Handler PROC
202+
203+
EXPORT WWDG_IRQHandler [WEAK]
204+
EXPORT PVD_VDDIO2_IRQHandler [WEAK]
205+
EXPORT RTC_IRQHandler [WEAK]
206+
EXPORT FLASH_IRQHandler [WEAK]
207+
EXPORT RCC_CRS_IRQHandler [WEAK]
208+
EXPORT EXTI0_1_IRQHandler [WEAK]
209+
EXPORT EXTI2_3_IRQHandler [WEAK]
210+
EXPORT EXTI4_15_IRQHandler [WEAK]
211+
EXPORT TSC_IRQHandler [WEAK]
212+
EXPORT DMA1_Channel1_IRQHandler [WEAK]
213+
EXPORT DMA1_Channel2_3_IRQHandler [WEAK]
214+
EXPORT DMA1_Channel4_5_IRQHandler [WEAK]
215+
EXPORT ADC1_IRQHandler [WEAK]
216+
EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK]
217+
EXPORT TIM1_CC_IRQHandler [WEAK]
218+
EXPORT TIM2_IRQHandler [WEAK]
219+
EXPORT TIM3_IRQHandler [WEAK]
220+
EXPORT TIM14_IRQHandler [WEAK]
221+
EXPORT TIM16_IRQHandler [WEAK]
222+
EXPORT TIM17_IRQHandler [WEAK]
223+
EXPORT I2C1_IRQHandler [WEAK]
224+
EXPORT SPI1_IRQHandler [WEAK]
225+
EXPORT SPI2_IRQHandler [WEAK]
226+
EXPORT USART1_IRQHandler [WEAK]
227+
EXPORT USART2_IRQHandler [WEAK]
228+
EXPORT CEC_CAN_IRQHandler [WEAK]
229+
EXPORT USB_IRQHandler [WEAK]
230+
231+
232+
WWDG_IRQHandler
233+
PVD_VDDIO2_IRQHandler
234+
RTC_IRQHandler
235+
FLASH_IRQHandler
236+
RCC_CRS_IRQHandler
237+
EXTI0_1_IRQHandler
238+
EXTI2_3_IRQHandler
239+
EXTI4_15_IRQHandler
240+
TSC_IRQHandler
241+
DMA1_Channel1_IRQHandler
242+
DMA1_Channel2_3_IRQHandler
243+
DMA1_Channel4_5_IRQHandler
244+
ADC1_IRQHandler
245+
TIM1_BRK_UP_TRG_COM_IRQHandler
246+
TIM1_CC_IRQHandler
247+
TIM2_IRQHandler
248+
TIM3_IRQHandler
249+
TIM14_IRQHandler
250+
TIM16_IRQHandler
251+
TIM17_IRQHandler
252+
I2C1_IRQHandler
253+
SPI1_IRQHandler
254+
SPI2_IRQHandler
255+
USART1_IRQHandler
256+
USART2_IRQHandler
257+
CEC_CAN_IRQHandler
258+
USB_IRQHandler
259+
260+
B .
261+
262+
ENDP
263+
264+
ALIGN
265+
END
266+
267+
;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
; Scatter-Loading Description File
2+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3+
; Copyright (c) 2014, STMicroelectronics
4+
; All rights reserved.
5+
;
6+
; Redistribution and use in source and binary forms, with or without
7+
; modification, are permitted provided that the following conditions are met:
8+
;
9+
; 1. Redistributions of source code must retain the above copyright notice,
10+
; this list of conditions and the following disclaimer.
11+
; 2. Redistributions in binary form must reproduce the above copyright notice,
12+
; this list of conditions and the following disclaimer in the documentation
13+
; and/or other materials provided with the distribution.
14+
; 3. Neither the name of STMicroelectronics nor the names of its contributors
15+
; may be used to endorse or promote products derived from this software
16+
; without specific prior written permission.
17+
;
18+
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29+
30+
; 32KB FLASH (0x8000) + 6KB RAM (0x1800)
31+
32+
LR_IROM1 0x08000000 0x8000 { ; load region size_region
33+
ER_IROM1 0x08000000 0x8000 { ; load address = execution address
34+
*.o (RESET, +First)
35+
*(InRoot$$Sections)
36+
.ANY (+RO)
37+
}
38+
39+
; 48 vectors = 192 bytes (0xC0) to be reserved in RAM
40+
RW_IRAM1 (0x20000000+0xC0) (0x1800-0xC0) { ; RW data
41+
.ANY (+RW +ZI)
42+
}
43+
44+
}
45+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/* mbed Microcontroller Library - stackheap
2+
* Setup a fixed single stack/heap memory model,
3+
* between the top of the RW/ZI region and the stackpointer
4+
*******************************************************************************
5+
* Copyright (c) 2014, STMicroelectronics
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 are met:
10+
*
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+
#ifdef __cplusplus
34+
extern "C" {
35+
#endif
36+
37+
#include <rt_misc.h>
38+
#include <stdint.h>
39+
40+
extern char Image$$RW_IRAM1$$ZI$$Limit[];
41+
42+
extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
43+
uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
44+
uint32_t sp_limit = __current_sp();
45+
46+
zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned
47+
48+
struct __initial_stackheap r;
49+
r.heap_base = zi_limit;
50+
r.heap_limit = sp_limit;
51+
return r;
52+
}
53+
54+
#ifdef __cplusplus
55+
}
56+
#endif

0 commit comments

Comments
 (0)