Skip to content

Commit bd51e4e

Browse files
committed
Merge pull request #123 from bcostm/master
[NUCLEO_F103RB] Add I2C master, code cleanup, ...
2 parents 0c77429 + 2310b4c commit bd51e4e

File tree

11 files changed

+415
-298
lines changed

11 files changed

+415
-298
lines changed

libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F103RB/TOOLCHAIN_ARM_MICRO/startup_stm32f10x_md.s

Lines changed: 9 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1-
;******************** (C) COPYRIGHT 2011 STMicroelectronics ********************
1+
;*******************************************************************************
22
;* File Name : startup_stm32f10x_md.s
3-
;* Author : MCD Application Team
4-
;* Version : V3.5.0
5-
;* Date : 11-March-2011
63
;* Description : STM32F10x Medium Density Devices vector table for MDK-ARM
7-
;* toolchain.
8-
;* This module performs:
9-
;* - Set the initial SP
10-
;* - Set the initial PC == Reset_Handler
11-
;* - Set the vector table entries with the exceptions ISR address
12-
;* - Configure the clock system
13-
;* - Branches to __main in the C library (which eventually
14-
;* calls main()).
15-
;* After Reset the CortexM3 processor is in Thread mode,
16-
;* priority is Privileged, and the Stack is set to Main.
4+
;* toolchain + ARM_MICRO compiler
175
;* <<< Use Configuration Wizard in Context Menu >>>
186
;*******************************************************************************
197
; THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
@@ -33,6 +21,8 @@
3321
Stack_Size EQU 0x00000400
3422

3523
AREA STACK, NOINIT, READWRITE, ALIGN=3
24+
EXPORT __initial_sp
25+
3626
Stack_Mem SPACE Stack_Size
3727
__initial_sp EQU 0x20005000 ; Top of RAM
3828

@@ -41,9 +31,12 @@ __initial_sp EQU 0x20005000 ; Top of RAM
4131
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
4232
; </h>
4333

44-
Heap_Size EQU 0x00000200
34+
Heap_Size EQU 0x00000000
4535

4636
AREA HEAP, NOINIT, READWRITE, ALIGN=3
37+
EXPORT __heap_base
38+
EXPORT __heap_limit
39+
4740
__heap_base
4841
Heap_Mem SPACE Heap_Size
4942
__heap_limit
@@ -275,33 +268,4 @@ USBWakeUp_IRQHandler
275268
ENDP
276269

277270
ALIGN
278-
279-
;*******************************************************************************
280-
; User Stack and Heap initialization
281-
;*******************************************************************************
282-
IF :DEF:__MICROLIB
283-
284-
EXPORT __initial_sp
285-
EXPORT __heap_base
286-
EXPORT __heap_limit
287-
288-
ELSE
289-
290-
IMPORT __use_two_region_memory
291-
EXPORT __user_initial_stackheap
292-
293-
__user_initial_stackheap
294-
295-
LDR R0, = Heap_Mem
296-
LDR R1, =(Stack_Mem + Stack_Size)
297-
LDR R2, = (Heap_Mem + Heap_Size)
298-
LDR R3, = Stack_Mem
299-
BX LR
300-
301-
ALIGN
302-
303-
ENDIF
304-
305-
END
306-
307-
;******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE*****
271+
END

libraries/mbed/targets/cmsis/TARGET_STM/TARGET_NUCLEO_F103RB/TOOLCHAIN_ARM_STD/startup_stm32f10x_md.s

Lines changed: 3 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1-
;******************** (C) COPYRIGHT 2011 STMicroelectronics ********************
1+
;*******************************************************************************
22
;* File Name : startup_stm32f10x_md.s
3-
;* Author : MCD Application Team
4-
;* Version : V3.5.0
5-
;* Date : 11-March-2011
63
;* Description : STM32F10x Medium Density Devices vector table for MDK-ARM
7-
;* toolchain.
8-
;* This module performs:
9-
;* - Set the initial SP
10-
;* - Set the initial PC == Reset_Handler
11-
;* - Set the vector table entries with the exceptions ISR address
12-
;* - Configure the clock system
13-
;* - Branches to __main in the C library (which eventually
14-
;* calls main()).
15-
;* After Reset the CortexM3 processor is in Thread mode,
16-
;* priority is Privileged, and the Stack is set to Main.
4+
;* toolchain + ARM_STD compiler
175
;* <<< Use Configuration Wizard in Context Menu >>>
186
;*******************************************************************************
197
; THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
@@ -24,30 +12,8 @@
2412
; INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
2513
;*******************************************************************************
2614

27-
; Amount of memory (in bytes) allocated for Stack
28-
; Tailor this value to your application needs
29-
; <h> Stack Configuration
30-
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
31-
; </h>
32-
33-
Stack_Size EQU 0x00000400
34-
35-
AREA STACK, NOINIT, READWRITE, ALIGN=3
36-
Stack_Mem SPACE Stack_Size
3715
__initial_sp EQU 0x20005000 ; Top of RAM
3816

39-
40-
; <h> Heap Configuration
41-
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
42-
; </h>
43-
44-
Heap_Size EQU 0x00000200
45-
46-
AREA HEAP, NOINIT, READWRITE, ALIGN=3
47-
__heap_base
48-
Heap_Mem SPACE Heap_Size
49-
__heap_limit
50-
5117
PRESERVE8
5218
THUMB
5319

@@ -275,33 +241,4 @@ USBWakeUp_IRQHandler
275241
ENDP
276242

277243
ALIGN
278-
279-
;*******************************************************************************
280-
; User Stack and Heap initialization
281-
;*******************************************************************************
282-
IF :DEF:__MICROLIB
283-
284-
EXPORT __initial_sp
285-
EXPORT __heap_base
286-
EXPORT __heap_limit
287-
288-
ELSE
289-
290-
IMPORT __use_two_region_memory
291-
EXPORT __user_initial_stackheap
292-
293-
__user_initial_stackheap
294-
295-
LDR R0, = Heap_Mem
296-
LDR R1, =(Stack_Mem + Stack_Size)
297-
LDR R2, = (Heap_Mem + Heap_Size)
298-
LDR R3, = Stack_Mem
299-
BX LR
300-
301-
ALIGN
302-
303-
ENDIF
304-
305-
END
306-
307-
;******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE*****
244+
END

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/PeripheralNames.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ typedef enum {
3232
UART_2 = (int)USART2_BASE
3333
} UARTName;
3434

35-
#define STDIO_UART_TX UART_TX
36-
#define STDIO_UART_RX UART_RX
35+
#define STDIO_UART_TX PA_2
36+
#define STDIO_UART_RX PA_3
3737
#define STDIO_UART UART_2
3838

3939
typedef enum {

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/PinNames.h

Lines changed: 15 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -88,45 +88,10 @@ typedef enum {
8888
PC_14 = 0x2E,
8989
PC_15 = 0x2F,
9090

91-
PD_0 = 0x30,
92-
PD_1 = 0x31,
9391
PD_2 = 0x32,
94-
PD_3 = 0x33,
95-
PD_4 = 0x34,
96-
PD_5 = 0x35,
97-
PD_6 = 0x36,
98-
PD_7 = 0x37,
9992
PD_8 = 0x38,
100-
PD_9 = 0x39,
101-
PD_10 = 0x3A,
102-
PD_11 = 0x3B,
103-
PD_12 = 0x3C,
104-
PD_13 = 0x3D,
105-
PD_14 = 0x3E,
106-
PD_15 = 0x3F,
10793

108-
PE_0 = 0x40,
109-
PE_1 = 0x41,
110-
PE_2 = 0x42,
111-
PE_3 = 0x43,
112-
PE_4 = 0x44,
113-
PE_5 = 0x45,
114-
PE_6 = 0x46,
115-
PE_7 = 0x47,
116-
PE_8 = 0x48,
117-
PE_9 = 0x49,
118-
PE_10 = 0x4A,
119-
PE_11 = 0x4B,
120-
PE_12 = 0x4C,
121-
PE_13 = 0x4D,
122-
PE_14 = 0x4E,
123-
PE_15 = 0x4F,
124-
125-
//--------------------
126-
// NUCLEO_F103RB board
127-
//--------------------
128-
129-
// Arduino connectors
94+
// Arduino connector namings
13095
A0 = PA_0,
13196
A1 = PA_1,
13297
A2 = PA_4,
@@ -150,15 +115,21 @@ typedef enum {
150115
D14 = PB_9,
151116
D15 = PB_8,
152117

118+
// Generic signals namings
119+
LED1 = PA_5,
120+
LED2 = PA_5,
121+
LED3 = PA_5,
122+
LED4 = PA_5,
153123
USER_BUTTON = PC_13,
154-
UART_TX = PA_2,
155-
UART_RX = PA_3,
156-
157-
// mbed mandatory namings
158-
LED1 = PA_5,
159-
LED2 = PA_5,
160-
LED3 = PA_5,
161-
LED4 = PA_5,
124+
SERIAL_TX = PA_2,
125+
SERIAL_RX = PA_3,
126+
I2C_SCL = PB_8,
127+
I2C_SDA = PB_9,
128+
SPI_MOSI = PA_7,
129+
SPI_MISO = PA_6,
130+
SPI_SCK = PA_5,
131+
SPI_CS = PB_6,
132+
PWM_OUT = PB_3,
162133

163134
// Not connected
164135
NC = (int)0xFFFFFFFF

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/analogin_api.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
//==============================================================================
17-
// STM32F103
18-
//==============================================================================
1916
#include "analogin_api.h"
2017
#include "wait_api.h"
2118

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#define DEVICE_SERIAL 1
2929

30-
#define DEVICE_I2C 0
30+
#define DEVICE_I2C 1
3131
#define DEVICE_I2CSLAVE 0
3232

3333
#define DEVICE_SPI 1

0 commit comments

Comments
 (0)