-
-
Notifications
You must be signed in to change notification settings - Fork 212
/
Copy path0045-RP2040-add-Raspberry-Pico-target.patch
155 lines (152 loc) · 5.36 KB
/
0045-RP2040-add-Raspberry-Pico-target.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
From e5cff643110403433a38fd26bbeffd42dab29f4e Mon Sep 17 00:00:00 2001
From: Martino Facchin <m.facchin@arduino.cc>
Date: Mon, 15 Mar 2021 15:28:08 +0100
Subject: [PATCH 045/204] RP2040: add Raspberry Pico target
---
.../TARGET_RASPBERRY_PI_PICO/PinNames.h | 70 +++++++++++++++++++
.../TARGET_RASPBERRY_PI_PICO/board.c | 3 +
.../bs2_default_padded_checksummed.S | 23 ++++++
targets/targets.json | 11 +++
4 files changed, 107 insertions(+)
create mode 100644 targets/TARGET_RASPBERRYPI/TARGET_RP2040/TARGET_RASPBERRY_PI_PICO/PinNames.h
create mode 100644 targets/TARGET_RASPBERRYPI/TARGET_RP2040/TARGET_RASPBERRY_PI_PICO/board.c
create mode 100644 targets/TARGET_RASPBERRYPI/TARGET_RP2040/TARGET_RASPBERRY_PI_PICO/bs2_default_padded_checksummed.S
diff --git a/targets/TARGET_RASPBERRYPI/TARGET_RP2040/TARGET_RASPBERRY_PI_PICO/PinNames.h b/targets/TARGET_RASPBERRYPI/TARGET_RP2040/TARGET_RASPBERRY_PI_PICO/PinNames.h
new file mode 100644
index 0000000000..6a47df933a
--- /dev/null
+++ b/targets/TARGET_RASPBERRYPI/TARGET_RP2040/TARGET_RASPBERRY_PI_PICO/PinNames.h
@@ -0,0 +1,70 @@
+#ifndef MBED_PINNAMES_H
+#define MBED_PINNAMES_H
+
+#include "PeripheralNames.h"
+#include "boards/pico.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ p0 = 0,
+ p1 = 1,
+ p2 = 2,
+ p3 = 3,
+ p4 = 4,
+ p5 = 5,
+ p6 = 6,
+ p7 = 7,
+ p8 = 8,
+ p9 = 9,
+ p10 = 10,
+ p11 = 11,
+ p12 = 12,
+ p13 = 13,
+ p14 = 14,
+ p15 = 15,
+ p16 = 16,
+ p17 = 17,
+ p18 = 18,
+ p19 = 19,
+ p20 = 20,
+ p21 = 21,
+ p22 = 22,
+ p23 = 23,
+ p24 = 24,
+ p25 = 25,
+ p26 = 26,
+ p27 = 27,
+ p28 = 28,
+ p29 = 29,
+
+ // ADC internal channels
+ ADC_TEMP = 0xF0,
+ ADC_VREF = 0xF1,
+
+#ifndef ARDUINO_ARCH_MBED
+ A0 = 26,
+ A1 = 27,
+ A2 = 28,
+ A3 = 29,
+#endif
+
+ USBTX = p0,
+ USBRX = p1,
+
+ LED1 = p25,
+ LED2 = p25,
+ LED3 = p25,
+ LED4 = p25,
+
+ // Not connected
+ NC = (int)0xFFFFFFFF
+} PinName;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/targets/TARGET_RASPBERRYPI/TARGET_RP2040/TARGET_RASPBERRY_PI_PICO/board.c b/targets/TARGET_RASPBERRYPI/TARGET_RP2040/TARGET_RASPBERRY_PI_PICO/board.c
new file mode 100644
index 0000000000..1f775638f9
--- /dev/null
+++ b/targets/TARGET_RASPBERRYPI/TARGET_RP2040/TARGET_RASPBERRY_PI_PICO/board.c
@@ -0,0 +1,3 @@
+#include "PinNames.h"
+
+uint32_t SystemCoreClock = 120000000;
\ No newline at end of file
diff --git a/targets/TARGET_RASPBERRYPI/TARGET_RP2040/TARGET_RASPBERRY_PI_PICO/bs2_default_padded_checksummed.S b/targets/TARGET_RASPBERRYPI/TARGET_RP2040/TARGET_RASPBERRY_PI_PICO/bs2_default_padded_checksummed.S
new file mode 100644
index 0000000000..fc6bea7df6
--- /dev/null
+++ b/targets/TARGET_RASPBERRYPI/TARGET_RP2040/TARGET_RASPBERRY_PI_PICO/bs2_default_padded_checksummed.S
@@ -0,0 +1,23 @@
+// Padded and checksummed version of: /ssd/rp2040/pico-examples/build/pico-sdk/src/rp2_common/boot_stage2/bs2_default.bin
+
+.cpu cortex-m0plus
+.thumb
+
+.section .boot2, "ax"
+
+.byte 0x00, 0xb5, 0x32, 0x4b, 0x21, 0x20, 0x58, 0x60, 0x98, 0x68, 0x02, 0x21, 0x88, 0x43, 0x98, 0x60
+.byte 0xd8, 0x60, 0x18, 0x61, 0x58, 0x61, 0x2e, 0x4b, 0x00, 0x21, 0x99, 0x60, 0x02, 0x21, 0x59, 0x61
+.byte 0x01, 0x21, 0xf0, 0x22, 0x99, 0x50, 0x2b, 0x49, 0x19, 0x60, 0x01, 0x21, 0x99, 0x60, 0x35, 0x20
+.byte 0x00, 0xf0, 0x44, 0xf8, 0x02, 0x22, 0x90, 0x42, 0x14, 0xd0, 0x06, 0x21, 0x19, 0x66, 0x00, 0xf0
+.byte 0x34, 0xf8, 0x19, 0x6e, 0x01, 0x21, 0x19, 0x66, 0x00, 0x20, 0x18, 0x66, 0x1a, 0x66, 0x00, 0xf0
+.byte 0x2c, 0xf8, 0x19, 0x6e, 0x19, 0x6e, 0x19, 0x6e, 0x05, 0x20, 0x00, 0xf0, 0x2f, 0xf8, 0x01, 0x21
+.byte 0x08, 0x42, 0xf9, 0xd1, 0x00, 0x21, 0x99, 0x60, 0x1b, 0x49, 0x19, 0x60, 0x00, 0x21, 0x59, 0x60
+.byte 0x1a, 0x49, 0x1b, 0x48, 0x01, 0x60, 0x01, 0x21, 0x99, 0x60, 0xeb, 0x21, 0x19, 0x66, 0xa0, 0x21
+.byte 0x19, 0x66, 0x00, 0xf0, 0x12, 0xf8, 0x00, 0x21, 0x99, 0x60, 0x16, 0x49, 0x14, 0x48, 0x01, 0x60
+.byte 0x01, 0x21, 0x99, 0x60, 0x01, 0xbc, 0x00, 0x28, 0x00, 0xd0, 0x00, 0x47, 0x12, 0x48, 0x13, 0x49
+.byte 0x08, 0x60, 0x03, 0xc8, 0x80, 0xf3, 0x08, 0x88, 0x08, 0x47, 0x03, 0xb5, 0x99, 0x6a, 0x04, 0x20
+.byte 0x01, 0x42, 0xfb, 0xd0, 0x01, 0x20, 0x01, 0x42, 0xf8, 0xd1, 0x03, 0xbd, 0x02, 0xb5, 0x18, 0x66
+.byte 0x18, 0x66, 0xff, 0xf7, 0xf2, 0xff, 0x18, 0x6e, 0x18, 0x6e, 0x02, 0xbd, 0x00, 0x00, 0x02, 0x40
+.byte 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x07, 0x00, 0x00, 0x03, 0x5f, 0x00, 0x21, 0x22, 0x00, 0x00
+.byte 0xf4, 0x00, 0x00, 0x18, 0x22, 0x20, 0x00, 0xa0, 0x00, 0x01, 0x00, 0x10, 0x08, 0xed, 0x00, 0xe0
+.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0xb2, 0x4e, 0x7a
diff --git a/targets/targets.json b/targets/targets.json
index f0deb6c2f4..5e2aa5baaa 100644
--- a/targets/targets.json
+++ b/targets/targets.json
@@ -9446,6 +9446,17 @@
"PICO_UART_ENABLE_CRLF_SUPPORT=0"
]
},
+ "RASPBERRY_PI_PICO": {
+ "inherits": ["RP2040"],
+ "macros_add": [
+ "PICO_RP2040_USB_DEVICE_ENUMERATION_FIX=1",
+ "PICO_NO_BINARY_INFO=1",
+ "MBED_MPU_CUSTOM",
+ "PICO_TIME_DEFAULT_ALARM_POOL_DISABLED",
+ "PICO_ON_DEVICE=1",
+ "PICO_UART_ENABLE_CRLF_SUPPORT=0"
+ ]
+ },
"__build_tools_metadata__": {
"version": "1",
"public": false
--
2.39.1