Skip to content

Commit 8e346fc

Browse files
committed
Fixed sleep and disabled semihosting on LPC11U35
I created 3 separate device.h headers for the three LPC11UXX targets, and disabled the features that the LPC11U35 board doesn't have like Semihosting and LocalFileSystem. I also made the call to mbed_interface_disconnect() require DEVICE_SEMIHOSTING, which prevents calls to sleep() from hanging the system on an LPC11U35.
1 parent b7a925e commit 8e346fc

File tree

4 files changed

+122
-0
lines changed

4 files changed

+122
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2006-2013 ARM Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#ifndef MBED_DEVICE_H
17+
#define MBED_DEVICE_H
18+
19+
#define DEVICE_PORTIN 1
20+
#define DEVICE_PORTOUT 1
21+
#define DEVICE_PORTINOUT 1
22+
23+
#define DEVICE_INTERRUPTIN 1
24+
25+
#define DEVICE_ANALOGIN 1
26+
#define DEVICE_ANALOGOUT 0
27+
28+
#define DEVICE_SERIAL 1
29+
30+
#define DEVICE_I2C 1
31+
#define DEVICE_I2CSLAVE 1
32+
33+
#define DEVICE_SPI 1
34+
#define DEVICE_SPISLAVE 1
35+
36+
#define DEVICE_CAN 0
37+
38+
#define DEVICE_RTC 0
39+
40+
#define DEVICE_ETHERNET 0
41+
42+
#define DEVICE_PWMOUT 1
43+
44+
#define DEVICE_SEMIHOST 1
45+
#define DEVICE_LOCALFILESYSTEM 1
46+
#define DEVICE_ID_LENGTH 32
47+
#define DEVICE_MAC_OFFSET 20
48+
49+
#define DEVICE_SLEEP 1
50+
51+
#define DEVICE_DEBUG_AWARENESS 0
52+
53+
#define DEVICE_STDIO_MESSAGES 1
54+
55+
#define DEVICE_ERROR_PATTERN 1
56+
57+
#include "objects.h"
58+
59+
#endif
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2006-2013 ARM Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#ifndef MBED_DEVICE_H
17+
#define MBED_DEVICE_H
18+
19+
#define DEVICE_PORTIN 1
20+
#define DEVICE_PORTOUT 1
21+
#define DEVICE_PORTINOUT 1
22+
23+
#define DEVICE_INTERRUPTIN 1
24+
25+
#define DEVICE_ANALOGIN 1
26+
#define DEVICE_ANALOGOUT 0
27+
28+
#define DEVICE_SERIAL 1
29+
30+
#define DEVICE_I2C 1
31+
#define DEVICE_I2CSLAVE 1
32+
33+
#define DEVICE_SPI 1
34+
#define DEVICE_SPISLAVE 1
35+
36+
#define DEVICE_CAN 0
37+
38+
#define DEVICE_RTC 0
39+
40+
#define DEVICE_ETHERNET 0
41+
42+
#define DEVICE_PWMOUT 1
43+
44+
#define DEVICE_SEMIHOST 0
45+
#define DEVICE_LOCALFILESYSTEM 0
46+
#define DEVICE_ID_LENGTH 32
47+
#define DEVICE_MAC_OFFSET 20
48+
49+
#define DEVICE_SLEEP 1
50+
51+
#define DEVICE_DEBUG_AWARENESS 0
52+
53+
#define DEVICE_STDIO_MESSAGES 0
54+
55+
#define DEVICE_ERROR_PATTERN 1
56+
57+
#include "objects.h"
58+
59+
#endif

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/sleep.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919

2020
void sleep(void) {
2121
// ensure debug is disconnected
22+
#if DEVICE_SEMIHOST
2223
mbed_interface_disconnect();
24+
#endif
2325

2426
// PCON[PD] set to sleep
2527
LPC_PMU->PCON = 0x0;
@@ -59,7 +61,9 @@ void sleep(void) {
5961

6062
void deepsleep(void) {
6163
// ensure debug is disconnected
64+
#if DEVICE_SEMIHOST
6265
mbed_interface_disconnect();
66+
#endif
6367

6468
// PCON[PD] set to deepsleep
6569
LPC_PMU->PCON = 0x1;

0 commit comments

Comments
 (0)