Skip to content

Commit 210fc7d

Browse files
committed
add etm trace pinmux for 4088 quickstart
1 parent ef49b93 commit 210fc7d

File tree

3 files changed

+311
-74
lines changed

3 files changed

+311
-74
lines changed

hw/bsp/lpc40/boards/ea4088_quickstart/board.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,41 @@
3131
extern "C" {
3232
#endif
3333

34+
#define LED_PORT 2
35+
#define LED_PIN 19
36+
37+
#define BUTTON_PORT 2
38+
#define BUTTON_PIN 10
39+
#define BUTTON_ACTIV_STATE 0
40+
41+
/* System oscillator rate and RTC oscillator rate */
42+
const uint32_t OscRateIn = 12000000;
43+
const uint32_t RTCOscRateIn = 32768;
44+
45+
/* Pin muxing configuration */
46+
static const PINMUX_GRP_T pinmuxing[] = {
47+
// LED
48+
{ 2, 19, (IOCON_FUNC0 | IOCON_MODE_INACT) },
49+
50+
// Button
51+
{ 2, 10, (IOCON_FUNC0 | IOCON_MODE_INACT | IOCON_MODE_PULLUP) },
52+
53+
// USB1 as Host
54+
{ 0, 29, (IOCON_FUNC1 | IOCON_MODE_INACT) }, // D+1
55+
{ 0, 30, (IOCON_FUNC1 | IOCON_MODE_INACT) }, // D-1
56+
{ 1, 18, (IOCON_FUNC1 | IOCON_MODE_INACT) }, // UP LED1
57+
{ 1, 19, (IOCON_FUNC2 | IOCON_MODE_INACT) }, // PPWR1
58+
// {2, 14, (IOCON_FUNC2 | IOCON_MODE_INACT)}, // VBUS1
59+
// {2, 15, (IOCON_FUNC2 | IOCON_MODE_INACT)}, // OVRCR1
60+
61+
// USB2 as Device
62+
{ 0, 31, (IOCON_FUNC1 | IOCON_MODE_INACT) }, // D+2
63+
{ 0, 13, (IOCON_FUNC1 | IOCON_MODE_INACT) }, // UP LED
64+
{ 0, 14, (IOCON_FUNC3 | IOCON_MODE_INACT) }, // CONNECT2
65+
66+
/* VBUS is not connected on this board, so leave the pin at default setting. */
67+
/*Chip_IOCON_PinMux(LPC_IOCON, 1, 30, IOCON_MODE_INACT, IOCON_FUNC2);*/ /* USB VBUS */
68+
};
3469

3570
#ifdef __cplusplus
3671
}
Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
2+
/*********************************************************************
3+
*
4+
* OnProjectLoad
5+
*
6+
* Function description
7+
* Project load routine. Required.
8+
*
9+
**********************************************************************
10+
*/
11+
void OnProjectLoad (void) {
12+
Edit.SysVar (VAR_POWER_SAMPLING_SPEED, FREQ_100_KHZ);
13+
Project.AddSvdFile ("$(InstallDir)/Config/CPU/Cortex-M4F.svd");
14+
Project.AddSvdFile ("../../../../../../../cmsis-svd/data/NXP/LPC408x_7x_v0.7.svd");
15+
16+
Project.SetDevice ("LPC4088");
17+
Project.SetHostIF ("USB", "");
18+
Project.SetTargetIF ("SWD");
19+
Project.SetTIFSpeed ("50 MHz");
20+
Project.SetTraceSource ("Trace Pins");
21+
Project.SetTracePortWidth (4);
22+
23+
// User settings
24+
File.Open ("../../../../../../examples/device/cdc_msc/cmake-build-ea4088-quickstart/cdc_msc.elf");
25+
}
26+
27+
/*********************************************************************
28+
*
29+
* TargetReset
30+
*
31+
* Function description
32+
* Replaces the default target device reset routine. Optional.
33+
*
34+
* Notes
35+
* This example demonstrates the usage when
36+
* debugging a RAM program on a Cortex-M target device
37+
*
38+
**********************************************************************
39+
*/
40+
//void TargetReset (void) {
41+
//
42+
// unsigned int SP;
43+
// unsigned int PC;
44+
// unsigned int VectorTableAddr;
45+
//
46+
// Exec.Reset();
47+
//
48+
// VectorTableAddr = Elf.GetBaseAddr();
49+
//
50+
// if (VectorTableAddr != 0xFFFFFFFF) {
51+
//
52+
// Util.Log("Resetting Program.");
53+
//
54+
// SP = Target.ReadU32(VectorTableAddr);
55+
// Target.SetReg("SP", SP);
56+
//
57+
// PC = Target.ReadU32(VectorTableAddr + 4);
58+
// Target.SetReg("PC", PC);
59+
// }
60+
//}
61+
62+
/*********************************************************************
63+
*
64+
* BeforeTargetReset
65+
*
66+
* Function description
67+
* Event handler routine. Optional.
68+
*
69+
**********************************************************************
70+
*/
71+
//void BeforeTargetReset (void) {
72+
//}
73+
74+
/*********************************************************************
75+
*
76+
* AfterTargetReset
77+
*
78+
* Function description
79+
* Event handler routine.
80+
* - Sets the PC register to program reset value.
81+
* - Sets the SP register to program reset value on Cortex-M.
82+
*
83+
**********************************************************************
84+
*/
85+
void AfterTargetReset (void) {
86+
unsigned int SP;
87+
unsigned int PC;
88+
unsigned int VectorTableAddr;
89+
90+
VectorTableAddr = Elf.GetBaseAddr();
91+
92+
if (VectorTableAddr == 0xFFFFFFFF) {
93+
Util.Log("Project file error: failed to get program base");
94+
} else {
95+
SP = Target.ReadU32(VectorTableAddr);
96+
Target.SetReg("SP", SP);
97+
98+
PC = Target.ReadU32(VectorTableAddr + 4);
99+
Target.SetReg("PC", PC);
100+
}
101+
}
102+
103+
/*********************************************************************
104+
*
105+
* DebugStart
106+
*
107+
* Function description
108+
* Replaces the default debug session startup routine. Optional.
109+
*
110+
**********************************************************************
111+
*/
112+
//void DebugStart (void) {
113+
//}
114+
115+
/*********************************************************************
116+
*
117+
* TargetConnect
118+
*
119+
* Function description
120+
* Replaces the default target IF connection routine. Optional.
121+
*
122+
**********************************************************************
123+
*/
124+
//void TargetConnect (void) {
125+
//}
126+
127+
/*********************************************************************
128+
*
129+
* BeforeTargetConnect
130+
*
131+
* Function description
132+
* Event handler routine. Optional.
133+
*
134+
**********************************************************************
135+
*/
136+
void BeforeTargetConnect (void) {
137+
}
138+
139+
/*********************************************************************
140+
*
141+
* AfterTargetConnect
142+
*
143+
* Function description
144+
* Event handler routine. Optional.
145+
*
146+
**********************************************************************
147+
*/
148+
//void AfterTargetConnect (void) {
149+
//}
150+
151+
/*********************************************************************
152+
*
153+
* TargetDownload
154+
*
155+
* Function description
156+
* Replaces the default program download routine. Optional.
157+
*
158+
**********************************************************************
159+
*/
160+
//void TargetDownload (void) {
161+
//}
162+
163+
/*********************************************************************
164+
*
165+
* BeforeTargetDownload
166+
*
167+
* Function description
168+
* Event handler routine. Optional.
169+
*
170+
**********************************************************************
171+
*/
172+
//void BeforeTargetDownload (void) {
173+
//}
174+
175+
/*********************************************************************
176+
*
177+
* AfterTargetDownload
178+
*
179+
* Function description
180+
* Event handler routine.
181+
* - Sets the PC register to program reset value.
182+
* - Sets the SP register to program reset value on Cortex-M.
183+
*
184+
**********************************************************************
185+
*/
186+
void AfterTargetDownload (void) {
187+
unsigned int SP;
188+
unsigned int PC;
189+
unsigned int VectorTableAddr;
190+
191+
VectorTableAddr = Elf.GetBaseAddr();
192+
193+
if (VectorTableAddr == 0xFFFFFFFF) {
194+
Util.Log("Project file error: failed to get program base");
195+
} else {
196+
SP = Target.ReadU32(VectorTableAddr);
197+
Target.SetReg("SP", SP);
198+
199+
PC = Target.ReadU32(VectorTableAddr + 4);
200+
Target.SetReg("PC", PC);
201+
}
202+
}
203+
204+
/*********************************************************************
205+
*
206+
* BeforeTargetDisconnect
207+
*
208+
* Function description
209+
* Event handler routine. Optional.
210+
*
211+
**********************************************************************
212+
*/
213+
//void BeforeTargetDisconnect (void) {
214+
//}
215+
216+
/*********************************************************************
217+
*
218+
* AfterTargetDisconnect
219+
*
220+
* Function description
221+
* Event handler routine. Optional.
222+
*
223+
**********************************************************************
224+
*/
225+
//void AfterTargetDisconnect (void) {
226+
//}
227+
228+
/*********************************************************************
229+
*
230+
* AfterTargetHalt
231+
*
232+
* Function description
233+
* Event handler routine. Optional.
234+
*
235+
**********************************************************************
236+
*/
237+
//void AfterTargetHalt (void) {
238+
//}

0 commit comments

Comments
 (0)