Skip to content

Commit

Permalink
use common base TARGET_LPC17XX
Browse files Browse the repository at this point in the history
  • Loading branch information
JojoS62 committed Feb 13, 2025
1 parent bb8daf8 commit d0de758
Show file tree
Hide file tree
Showing 54 changed files with 137 additions and 155 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,6 @@ struct lpc_enetdata {
uint32_t lpc_reserved_tx_num; /**< Number of reserved TX descriptors, zero-copy mode */
};

#if defined(TARGET_LPC1768)
/** \brief Group LPC17xx processors into one definition
*/
#define TARGET_LPC17XX
#endif

#if defined(TARGET_LPC17XX)
# if defined(TOOLCHAIN_GCC_ARM) || defined(TOOLCHAIN_ARM)
# define ETHMEM_SECTION __attribute__((section("AHBSRAM"), aligned(32)))
Expand Down Expand Up @@ -384,9 +378,9 @@ int32_t LPC17_EMAC::lpc_packet_addr_notsafe(void *addr)
/* Check for legal address ranges */
#if defined(TARGET_LPC17XX)
if ((((uint32_t) addr >= 0x2007C000) && ((uint32_t) addr < 0x20083FFF))) {
#endif
return 0;
}
#endif
return 1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @version 1.0
* @date 20 Nov. 2011
* @author NXP MCU SW Application Team
*
*
* Copyright(C) 2011, NXP Semiconductor
* All rights reserved.
*
Expand Down Expand Up @@ -61,7 +61,7 @@
*/
#define PHY_USE_100MBS 1 /**< Sets data rate to 100Mbps. */

/**
/**
* @}
*/

Expand Down Expand Up @@ -95,7 +95,7 @@
*/
#define LPC_TX_PBUF_BOUNCE_EN 1

/**
/**
* @}
*/

Expand Down
10 changes: 2 additions & 8 deletions connectivity/lwipstack/lwip-sys/arch/cc.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,8 @@ void trace_to_ascii_hex_dump(char* prefix, int len, char *data);

/* Define the memory area for the lwip's memory pools */
#ifndef MEMP_SECTION
#if defined(TARGET_LPC1768)
# if defined (__ICCARM__)
# define MEMP_SECTION
# elif defined(TOOLCHAIN_GCC_CR)
# define MEMP_SECTION __attribute__((section(".data.$RamPeriph32")))
# else
# define MEMP_SECTION __attribute__((section("AHBSRAM1"),aligned))
# endif
#if defined(TARGET_LPC17XX)
# define MEMP_SECTION __attribute__((section("AHBSRAM"),aligned))
#endif
#endif

Expand Down
31 changes: 9 additions & 22 deletions connectivity/lwipstack/lwip-sys/arch/lwip_sys_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,10 @@

/* Define the heap ourselves to give us section placement control */
#ifndef ETHMEM_SECTION
#if defined(TARGET_LPC1768)
# if defined (__ICCARM__)
# define ETHMEM_SECTION
# elif defined(TOOLCHAIN_GCC_CR)
# define ETHMEM_SECTION __attribute__((section(".data.$RamPeriph32")))
# else
# define ETHMEM_SECTION __attribute__((section("AHBSRAM"),aligned))
# endif
#if defined(TARGET_LPC17XX)
# define ETHMEM_SECTION __attribute__((section("AHBSRAM"),aligned))
#elif defined(TARGET_STM32H7)
# if defined (__ICCARM__)
# define ETHMEM_SECTION
# else
# define ETHMEM_SECTION __attribute__((section(".ethusbram")))
# endif
# define ETHMEM_SECTION __attribute__((section(".ethusbram")))
#else
#define ETHMEM_SECTION
#endif
Expand All @@ -65,9 +55,6 @@ struct mem {
#define SIZEOF_STRUCT_MEM LWIP_MEM_ALIGN_SIZE(sizeof(struct mem))
#define MEM_SIZE_ALIGNED LWIP_MEM_ALIGN_SIZE(MEM_SIZE)

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

#if NO_SYS==1
Expand Down Expand Up @@ -320,7 +307,7 @@ err_t sys_sem_new(sys_sem_t *sem, u8_t count) {
sem->id = osSemaphoreNew(UINT16_MAX, count, &sem->attr);
if (sem->id == NULL)
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_NETWORK_STACK, MBED_ERROR_CODE_FAILED_OPERATION), "sys_sem_new create error\n", (u32_t)sem);

return ERR_OK;
}

Expand Down Expand Up @@ -349,12 +336,12 @@ err_t sys_sem_new(sys_sem_t *sem, u8_t count) {
*---------------------------------------------------------------------------*/
u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout) {
u32_t start = osKernelGetTickCount();

if (osSemaphoreAcquire(sem->id, (timeout != 0)?(timeout):(osWaitForever)) != osOK) {
MBED_WARNING1(MBED_MAKE_ERROR(MBED_MODULE_NETWORK_STACK, MBED_ERROR_CODE_TIME_OUT), "sys_arch_sem_wait time out\n", (u32_t)sem);
return SYS_ARCH_TIMEOUT;
}

return osKernelGetTickCount() - start;
}

Expand Down Expand Up @@ -394,7 +381,7 @@ err_t sys_mutex_new(sys_mutex_t *mutex) {
MBED_WARNING1(MBED_MAKE_ERROR(MBED_MODULE_NETWORK_STACK, MBED_ERROR_CODE_FAILED_OPERATION), "sys_mutex_new error\n", (u32_t)mutex);
return ERR_MEM;
}

return ERR_OK;
}

Expand Down Expand Up @@ -521,7 +508,7 @@ static sys_thread_data_t thread_pool[SYS_THREAD_POOL_N];
*---------------------------------------------------------------------------*/
#ifndef MBED_TZ_DEFAULT_ACCESS
#define MBED_TZ_DEFAULT_ACCESS 0
#endif
#endif

sys_thread_t sys_thread_new(const char *pcName,
void (*thread)(void *arg),
Expand All @@ -547,7 +534,7 @@ static sys_thread_data_t thread_pool[SYS_THREAD_POOL_N];
t->id = osThreadNew((osThreadFunc_t)thread, arg, &t->attr);
if (t->id == NULL)
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_NETWORK_STACK, MBED_ERROR_CODE_THREAD_CREATE_FAILED), "sys_thread_new create error\n");

return t;
}

Expand Down
3 changes: 3 additions & 0 deletions connectivity/lwipstack/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@
"LPC1768": {
"mem-size": 16362
},
"LPCXPRESSO_LPC1769": {
"mem-size": 16362
},
"ARCH_PRO": {
"mem-size": 16362
},
Expand Down
2 changes: 1 addition & 1 deletion targets/TARGET_NXP/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

add_subdirectory(TARGET_LPC11XX_11CXX EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_LPC176X EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_LPC17XX EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_MCUXpresso_MCUS EXCLUDE_FROM_ALL)

add_library(mbed-nxp INTERFACE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ add_subdirectory(TARGET_ARCH_PRO EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_MBED_LPC1768 EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_LPCXPRESSO_LPC1769 EXCLUDE_FROM_ALL)

add_library(mbed-lpc176x INTERFACE)
add_library(mbed-lpc17xx INTERFACE)

if(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(STARTUP_FILE device/TOOLCHAIN_ARM_STD/startup_LPC17xx.S)
Expand All @@ -15,13 +15,13 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
set(LINKER_FILE device/TOOLCHAIN_GCC_ARM/LPC1768.ld)
endif()

target_include_directories(mbed-lpc176x
target_include_directories(mbed-lpc17xx
INTERFACE
.
device
)

target_sources(mbed-lpc176x
target_sources(mbed-lpc17xx
INTERFACE
analogin_api.c
analogout_api.c
Expand All @@ -46,8 +46,10 @@ target_sources(mbed-lpc176x
${STARTUP_FILE}
)

target_link_libraries(mbed-lpc176x INTERFACE mbed-nxp)
target_link_libraries(mbed-lpc17xx INTERFACE mbed-nxp)

mbed_set_linker_script(mbed-arch-pro ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
mbed_set_linker_script(mbed-lpc1768 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
mbed_set_linker_script(mbed-lpcxpresso-lpc1769 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
mbed_set_linker_script(mbed-lpc17xx ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

# mbed_set_linker_script(mbed-arch-pro ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
# mbed_set_linker_script(mbed-lpc1768 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
# mbed_set_linker_script(mbed-lpcxpresso-lpc1769 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ target_include_directories(mbed-arch-pro
.
)

target_link_libraries(mbed-arch-pro INTERFACE mbed-lpc176x)
target_link_libraries(mbed-arch-pro INTERFACE mbed-lpc17xx)

mbed_post_build_lpc_patch_vtable("ARCH_PRO")
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ target_include_directories(mbed-lpcxpresso-lpc1769
.
)

target_link_libraries(mbed-lpcxpresso-lpc1769 INTERFACE mbed-lpc176x)
target_link_libraries(mbed-lpcxpresso-lpc1769 INTERFACE mbed-lpc17xx)

mbed_post_build_lpc_patch_vtable("LPC1768")
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@

include(mbed_set_post_build_nxp)

add_library(mbed-mbed-lpc1768 INTERFACE)
add_library(mbed-lpc1768 INTERFACE)

target_include_directories(mbed-mbed-lpc1768
target_include_directories(mbed-lpc1768
INTERFACE
.
)

target_link_libraries(mbed-mbed-lpc1768 INTERFACE mbed-lpc176x)

add_library(mbed-lpc1768 INTERFACE)

target_link_libraries(mbed-lpc1768 INTERFACE mbed-mbed-lpc1768)
target_link_libraries(mbed-lpc1768 INTERFACE mbed-lpc17xx)

mbed_post_build_lpc_patch_vtable("LPC1768")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion targets/TARGET_NXP/USBHAL_LPC17.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

#if defined(DEVICE_USBDEVICE) && DEVICE_USBDEVICE && \
(defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC2460) || defined(TARGET_LPC17XX))
(defined(TARGET_LPC17XX))

#include "USBEndpoints_LPC17_LPC23.h"
#include "USBPhyHw.h"
Expand Down
2 changes: 1 addition & 1 deletion targets/TARGET_NXP/mbed_rtx.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#define INITIAL_SP (0x10001000UL)
#endif

#elif defined(TARGET_LPC1768)
#elif defined(TARGET_LPC17XX)

#ifndef INITIAL_SP
#define INITIAL_SP (0x10008000UL)
Expand Down
89 changes: 88 additions & 1 deletion targets/cmsis_mcu_descriptions.json5
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,93 @@
"sub_family": "LPC176x",
"vendor": "NXP:11"
},
"LPC1769": {
"algorithms": [
{
"default": true,
"file_name": "Flash/LPC_IAP_512.FLM",
"ram_size": 4064,
"ram_start": 268435456,
"size": 524288,
"start": 0
}
],
"family": "LPC1700 Series",
"from_pack": {
"pack": "LPC1700_DFP",
"url": "http://www.keil.com/pack/",
"vendor": "Keil",
"version": "2.5.0"
},
"memories": {
"IRAM1": {
"access": {
"execute": false,
"non_secure": false,
"non_secure_callable": false,
"peripheral": false,
"read": true,
"secure": false,
"write": true
},
"default": true,
"size": 32768,
"start": 268435456,
"startup": false
},
"IRAM2": {
"access": {
"execute": false,
"non_secure": false,
"non_secure_callable": false,
"peripheral": false,
"read": true,
"secure": false,
"write": true
},
"default": true,
"size": 32768,
"start": 537378816,
"startup": false
},
"IROM1": {
"access": {
"execute": true,
"non_secure": false,
"non_secure_callable": false,
"peripheral": false,
"read": true,
"secure": false,
"write": false
},
"default": true,
"size": 524288,
"start": 0,
"startup": true
}
},
"name": "LPC1769",
"processor": {
"Symmetric": {
"core": "CortexM3",
"fpu": "None",
"mpu": "Present",
"units": 1
}
},
"sectors": [
[
0,
4096
],
[
65536,
32768
]
],
"sub_family": "LPC176x",
"vendor": "NXP:11"
},
"LPC54114J256BD64": {
"algorithms": [
{
Expand Down Expand Up @@ -14961,4 +15048,4 @@
},
"vendor": "Raspberry Pi:x"
}
}
}
Loading

0 comments on commit d0de758

Please sign in to comment.