Skip to content

Commit 4ba0016

Browse files
add LPCXresso LPC1769 target (#435)
* add basic target files and cmakelists * added copyright header * fix emac test and add define for usb test * add JLink upload method * resolve rebase merge conflict * fix rebase conflict * fix upload JLink * Implement 120MHz clocking * Fix #if * Fix common tickers test * License fixes * Pin name fixes, add EEPROM component * Few more tweaks --------- Co-authored-by: Jamie Smith <[email protected]>
1 parent 9ce9f38 commit 4ba0016

Some content is hidden

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

64 files changed

+500
-124
lines changed

connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_LPCTarget/lpc17_emac.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,9 @@ struct lpc_enetdata {
120120
uint32_t lpc_reserved_tx_num; /**< Number of reserved TX descriptors, zero-copy mode */
121121
};
122122

123-
#if defined(TARGET_LPC1768)
124-
/** \brief Group LPC17xx processors into one definition
125-
*/
126-
#define TARGET_LPC17XX
127-
#endif
128-
129123
#if defined(TARGET_LPC17XX)
130124
# if defined(TOOLCHAIN_GCC_ARM) || defined(TOOLCHAIN_ARM)
131-
# define ETHMEM_SECTION __attribute__((section("AHBSRAM"),aligned))
125+
# define ETHMEM_SECTION __attribute__((section("AHBSRAM"), aligned(32)))
132126
# endif
133127
#endif
134128

@@ -385,9 +379,9 @@ int32_t LPC17_EMAC::lpc_packet_addr_notsafe(void *addr)
385379
/* Check for legal address ranges */
386380
#if defined(TARGET_LPC17XX)
387381
if ((((uint32_t) addr >= 0x2007C000) && ((uint32_t) addr < 0x20083FFF))) {
388-
#endif
389382
return 0;
390383
}
384+
#endif
391385
return 1;
392386
}
393387

connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_LPCTarget/lpc17xx_emac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*
1111
* Copyright(C) 2010, NXP Semiconductor
1212
* All rights reserved.
13+
* SPDX-License-Identifier: Apache-2.0
1314
*
1415
***********************************************************************
1516
* Software that is described herein is for illustrative purposes only

connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_LPCTarget/lpc_emac_config.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
* @version 1.0
77
* @date 20 Nov. 2011
88
* @author NXP MCU SW Application Team
9-
*
9+
*
1010
* Copyright(C) 2011, NXP Semiconductor
1111
* All rights reserved.
12+
* SPDX-License-Identifier: Apache-2.0
1213
*
1314
***********************************************************************
1415
* Software that is described herein is for illustrative purposes only
@@ -61,7 +62,7 @@
6162
*/
6263
#define PHY_USE_100MBS 1 /**< Sets data rate to 100Mbps. */
6364

64-
/**
65+
/**
6566
* @}
6667
*/
6768

@@ -95,7 +96,7 @@
9596
*/
9697
#define LPC_TX_PBUF_BOUNCE_EN 1
9798

98-
/**
99+
/**
99100
* @}
100101
*/
101102

connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_LPCTarget/lpc_phy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*
1010
* Copyright(C) 2011, NXP Semiconductor
1111
* All rights reserved.
12+
* SPDX-License-Identifier: Apache-2.0
1213
*
1314
***********************************************************************
1415
* Software that is described herein is for illustrative purposes only

connectivity/drivers/emac/TARGET_NXP_EMAC/TARGET_LPCTarget/lpc_phy_dp83848.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*
1010
* Copyright(C) 2011, NXP Semiconductor
1111
* All rights reserved.
12+
* SPDX-License-Identifier: Apache-2.0
1213
*
1314
***********************************************************************
1415
* Software that is described herein is for illustrative purposes only

connectivity/lwipstack/lwip-sys/arch/cc.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,8 @@ void trace_to_ascii_hex_dump(char* prefix, int len, char *data);
131131

132132
/* Define the memory area for the lwip's memory pools */
133133
#ifndef MEMP_SECTION
134-
#if defined(TARGET_LPC1768)
135-
# if defined (__ICCARM__)
136-
# define MEMP_SECTION
137-
# elif defined(TOOLCHAIN_GCC_CR)
138-
# define MEMP_SECTION __attribute__((section(".data.$RamPeriph32")))
139-
# else
140-
# define MEMP_SECTION __attribute__((section("AHBSRAM"),aligned))
141-
# endif
134+
#if defined(TARGET_LPC17XX)
135+
# define MEMP_SECTION __attribute__((section("AHBSRAM"),aligned))
142136
#endif
143137
#endif
144138

connectivity/lwipstack/lwip-sys/arch/lwip_sys_arch.c

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
1515
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1616
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17+
*
18+
* SPDX-License-Identifier: MIT
1719
*/
1820
#include <string.h>
1921

@@ -31,20 +33,10 @@
3133

3234
/* Define the heap ourselves to give us section placement control */
3335
#ifndef ETHMEM_SECTION
34-
#if defined(TARGET_LPC1768)
35-
# if defined (__ICCARM__)
36-
# define ETHMEM_SECTION
37-
# elif defined(TOOLCHAIN_GCC_CR)
38-
# define ETHMEM_SECTION __attribute__((section(".data.$RamPeriph32")))
39-
# else
40-
# define ETHMEM_SECTION __attribute__((section("AHBSRAM"),aligned))
41-
# endif
36+
#if defined(TARGET_LPC17XX)
37+
# define ETHMEM_SECTION __attribute__((section("AHBSRAM"),aligned))
4238
#elif defined(TARGET_STM32H7)
43-
# if defined (__ICCARM__)
44-
# define ETHMEM_SECTION
45-
# else
46-
# define ETHMEM_SECTION __attribute__((section(".ethusbram")))
47-
# endif
39+
# define ETHMEM_SECTION __attribute__((section(".ethusbram")))
4840
#else
4941
#define ETHMEM_SECTION
5042
#endif
@@ -65,9 +57,6 @@ struct mem {
6557
#define SIZEOF_STRUCT_MEM LWIP_MEM_ALIGN_SIZE(sizeof(struct mem))
6658
#define MEM_SIZE_ALIGNED LWIP_MEM_ALIGN_SIZE(MEM_SIZE)
6759

68-
#if defined (__ICCARM__)
69-
#pragma location = ".ethusbram"
70-
#endif
7160
LWIP_DECLARE_MEMORY_ALIGNED(lwip_ram_heap, MEM_SIZE_ALIGNED + (2U*SIZEOF_STRUCT_MEM)) ETHMEM_SECTION;
7261

7362
#if NO_SYS==1
@@ -320,7 +309,7 @@ err_t sys_sem_new(sys_sem_t *sem, u8_t count) {
320309
sem->id = osSemaphoreNew(UINT16_MAX, count, &sem->attr);
321310
if (sem->id == NULL)
322311
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_NETWORK_STACK, MBED_ERROR_CODE_FAILED_OPERATION), "sys_sem_new create error\n", (u32_t)sem);
323-
312+
324313
return ERR_OK;
325314
}
326315

@@ -349,12 +338,12 @@ err_t sys_sem_new(sys_sem_t *sem, u8_t count) {
349338
*---------------------------------------------------------------------------*/
350339
u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout) {
351340
u32_t start = osKernelGetTickCount();
352-
341+
353342
if (osSemaphoreAcquire(sem->id, (timeout != 0)?(timeout):(osWaitForever)) != osOK) {
354343
MBED_WARNING1(MBED_MAKE_ERROR(MBED_MODULE_NETWORK_STACK, MBED_ERROR_CODE_TIME_OUT), "sys_arch_sem_wait time out\n", (u32_t)sem);
355344
return SYS_ARCH_TIMEOUT;
356345
}
357-
346+
358347
return osKernelGetTickCount() - start;
359348
}
360349

@@ -394,7 +383,7 @@ err_t sys_mutex_new(sys_mutex_t *mutex) {
394383
MBED_WARNING1(MBED_MAKE_ERROR(MBED_MODULE_NETWORK_STACK, MBED_ERROR_CODE_FAILED_OPERATION), "sys_mutex_new error\n", (u32_t)mutex);
395384
return ERR_MEM;
396385
}
397-
386+
398387
return ERR_OK;
399388
}
400389

@@ -521,7 +510,7 @@ static sys_thread_data_t thread_pool[SYS_THREAD_POOL_N];
521510
*---------------------------------------------------------------------------*/
522511
#ifndef MBED_TZ_DEFAULT_ACCESS
523512
#define MBED_TZ_DEFAULT_ACCESS 0
524-
#endif
513+
#endif
525514

526515
sys_thread_t sys_thread_new(const char *pcName,
527516
void (*thread)(void *arg),
@@ -547,7 +536,7 @@ static sys_thread_data_t thread_pool[SYS_THREAD_POOL_N];
547536
t->id = osThreadNew((osThreadFunc_t)thread, arg, &t->attr);
548537
if (t->id == NULL)
549538
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_NETWORK_STACK, MBED_ERROR_CODE_THREAD_CREATE_FAILED), "sys_thread_new create error\n");
550-
539+
551540
return t;
552541
}
553542

connectivity/lwipstack/mbed_lib.json5

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,7 @@
163163
"Freescale": {
164164
"mem-size": 33270
165165
},
166-
"LPC1768": {
167-
"mem-size": 16362
168-
},
169-
"ARCH_PRO": {
166+
"MCU_LPC17XX": {
170167
"mem-size": 16362
171168
},
172169
"LPC546XX": {

hal/tests/TESTS/mbed_hal/common_tickers/main.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,9 @@ void ticker_disable_test()
278278
intf->set_interrupt(intf->read() + ticksFor100us);
279279
intf->disable_interrupt();
280280

281-
// Verify that it does not fire
282-
wait_us(200);
281+
// Verify that it does not fire. Note that we cannot use wait_us here as it uses the us ticker
282+
// which is currently suspended.
283+
wait_ns(200000);
283284
TEST_ASSERT_EQUAL_INT(0, intFlag);
284285

285286
// Now reset the interrupt again.
@@ -289,11 +290,11 @@ void ticker_disable_test()
289290
TEST_ASSERT_EQUAL_INT_MESSAGE(0, intFlag, "Ticker fired during set_interrupt() while disabled! Check that set_interrupt() function clears pending timer compare.");
290291

291292
// Still not yet
292-
wait_us(20);
293+
wait_ns(20000);
293294
TEST_ASSERT_EQUAL_INT(0, intFlag);
294295

295296
// NOW it should have fired
296-
wait_us(170);
297+
wait_ns(170000);
297298
TEST_ASSERT_EQUAL_INT(1, intFlag);
298299
}
299300

targets/TARGET_NXP/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
add_subdirectory(TARGET_LPC11XX_11CXX EXCLUDE_FROM_ALL)
5-
add_subdirectory(TARGET_LPC176X EXCLUDE_FROM_ALL)
5+
add_subdirectory(TARGET_LPC17XX EXCLUDE_FROM_ALL)
66
add_subdirectory(TARGET_MCUXpresso_MCUS EXCLUDE_FROM_ALL)
77

88
add_library(mbed-nxp INTERFACE)

0 commit comments

Comments
 (0)