Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1abfa9a

Browse filesBrowse files
committed
Merge branch 'hitl' into pr_hitl
2 parents 992e17f + b8b01c1 commit 1abfa9a
Copy full SHA for 1abfa9a

File tree

Expand file treeCollapse file tree

14 files changed

+526
-180
lines changed
Filter options
Expand file treeCollapse file tree

14 files changed

+526
-180
lines changed

‎.idea/cmake.xml

Copy file name to clipboardExpand all lines: .idea/cmake.xml
+3-1Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+59Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2021, Ha Thach (tinyusb.org)
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*
24+
* This file is part of the TinyUSB stack.
25+
*/
26+
27+
#ifndef BOARD_LPCXPRESSO54608_H_
28+
#define BOARD_LPCXPRESSO54608_H_
29+
30+
#ifdef __cplusplus
31+
extern "C" {
32+
#endif
33+
34+
// LED
35+
#define LED_PORT 2
36+
#define LED_PIN 2
37+
#define LED_STATE_ON 0
38+
39+
// WAKE button
40+
#define BUTTON_PORT 1
41+
#define BUTTON_PIN 1
42+
#define BUTTON_STATE_ACTIVE 0
43+
44+
// UART
45+
#define UART_DEV USART0
46+
#define UART_RX_PINMUX 0, 29, IOCON_PIO_DIG_FUNC1_EN
47+
#define UART_TX_PINMUX 0, 30, IOCON_PIO_DIG_FUNC1_EN
48+
49+
// USB0 VBUS
50+
#define USB0_VBUS_PINMUX 0, 22, IOCON_PIO_DIG_FUNC7_EN
51+
52+
// XTAL
53+
//#define XTAL0_CLK_HZ (16 * 1000 * 1000U)
54+
55+
#ifdef __cplusplus
56+
}
57+
#endif
58+
59+
#endif
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
MCU_VARIANT = LPC54608
2+
MCU_CORE = LPC54608
3+
4+
PORT ?= 1
5+
6+
CFLAGS += -DCPU_LPC54608J512ET180
7+
CFLAGS += -Wno-error=double-promotion
8+
9+
LD_FILE = $(MCU_DIR)/gcc/LPC54608J512_flash.ld
10+
11+
LIBS += $(TOP)/$(MCU_DIR)/gcc/libpower_hardabi.a
12+
13+
JLINK_DEVICE = LPC54608J512
14+
PYOCD_TARGET = LPC54608
15+
16+
#flash: flash-pyocd
17+
18+
flash: flash-jlink
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
set(MCU_VARIANT LPC54628)
2+
set(MCU_CORE LPC54628)
3+
4+
set(JLINK_DEVICE LPC54628J512)
5+
set(PYOCD_TARGET LPC54628)
6+
set(NXPLINK_DEVICE LPC54628:LPCXpresso54628)
7+
8+
set(LD_FILE_GNU ${SDK_DIR}/devices/${MCU_VARIANT}/gcc/LPC54628J512_flash.ld)
9+
10+
# Device port default to PORT1 Highspeed
11+
if (NOT DEFINED PORT)
12+
set(PORT 1)
13+
endif()
14+
15+
function(update_board TARGET)
16+
target_compile_definitions(${TARGET} PUBLIC
17+
CPU_LPC54628J512ET180
18+
)
19+
target_link_libraries(${TARGET} PUBLIC
20+
${SDK_DIR}/devices/${MCU_VARIANT}/gcc/libpower_hardabi.a
21+
)
22+
endfunction()

‎hw/bsp/lpc54/family.c

Copy file name to clipboardExpand all lines: hw/bsp/lpc54/family.c
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,11 @@
7070
//--------------------------------------------------------------------+
7171
// Forward USB interrupt events to TinyUSB IRQ Handler
7272
//--------------------------------------------------------------------+
73-
void USB0_IRQHandler(void)
74-
{
73+
void USB0_IRQHandler(void) {
7574
tud_int_handler(0);
7675
}
7776

78-
void USB1_IRQHandler(void)
79-
{
77+
void USB1_IRQHandler(void) {
8078
tud_int_handler(1);
8179
}
8280

‎hw/bsp/lpc54/family.cmake

Copy file name to clipboard
+158Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
include_guard()
2+
3+
if (NOT BOARD)
4+
message(FATAL_ERROR "BOARD not specified")
5+
endif ()
6+
7+
set(SDK_DIR ${TOP}/hw/mcu/nxp/mcux-sdk)
8+
set(CMSIS_DIR ${TOP}/lib/CMSIS_5)
9+
10+
# include board specific
11+
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
12+
13+
# toolchain set up
14+
set(CMAKE_SYSTEM_PROCESSOR cortex-m4 CACHE INTERNAL "System Processor")
15+
set(CMAKE_TOOLCHAIN_FILE ${TOP}/tools/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
16+
17+
set(FAMILY_MCUS LPC54 CACHE INTERNAL "")
18+
19+
if (NOT DEFINED PORT)
20+
set(PORT 0)
21+
endif()
22+
23+
# Host port will be the other port if available
24+
set(HOST_PORT $<NOT:${PORT}>)
25+
26+
#------------------------------------
27+
# BOARD_TARGET
28+
#------------------------------------
29+
# only need to be built ONCE for all examples
30+
function(add_board_target BOARD_TARGET)
31+
if (NOT TARGET ${BOARD_TARGET})
32+
add_library(${BOARD_TARGET} STATIC
33+
# driver
34+
${SDK_DIR}/drivers/lpc_gpio/fsl_gpio.c
35+
${SDK_DIR}/drivers/common/fsl_common_arm.c
36+
${SDK_DIR}/drivers/flexcomm/fsl_flexcomm.c
37+
${SDK_DIR}/drivers/flexcomm/fsl_usart.c
38+
# mcu
39+
${SDK_DIR}/devices/${MCU_VARIANT}/system_${MCU_CORE}.c
40+
${SDK_DIR}/devices/${MCU_VARIANT}/drivers/fsl_clock.c
41+
${SDK_DIR}/devices/${MCU_VARIANT}/drivers/fsl_power.c
42+
${SDK_DIR}/devices/${MCU_VARIANT}/drivers/fsl_reset.c
43+
)
44+
45+
target_compile_definitions(${BOARD_TARGET} PUBLIC
46+
CFG_TUSB_MEM_ALIGN=TU_ATTR_ALIGNED\(64\)
47+
BOARD_TUD_RHPORT=${PORT}
48+
BOARD_TUH_RHPORT=${HOST_PORT}
49+
)
50+
# Port 0 is Fullspeed, Port 1 is Highspeed. Port1 controller can only access USB_SRAM
51+
if (PORT EQUAL 1)
52+
target_compile_definitions(${BOARD_TARGET} PUBLIC
53+
BOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
54+
BOARD_TUH_MAX_SPEED=OPT_MODE_FULL_SPEED
55+
CFG_TUD_MEM_SECTION=__attribute__\(\(section\(\"m_usb_global\"\)\)\)
56+
)
57+
else ()
58+
target_compile_definitions(${BOARD_TARGET} PUBLIC
59+
BOARD_TUD_MAX_SPEED=OPT_MODE_FULL_SPEED
60+
BOARD_TUH_MAX_SPEED=OPT_MODE_HIGH_SPEED
61+
CFG_TUH_MEM_SECTION=__attribute__\(\(section\(\"m_usb_global\"\)\)\)
62+
#CFG_TUD_MEM_SECTION=__attribute__\(\(section\(\"m_usb_global\"\)\)\)
63+
)
64+
endif ()
65+
66+
target_include_directories(${BOARD_TARGET} PUBLIC
67+
${TOP}/lib/sct_neopixel
68+
# driver
69+
${SDK_DIR}/drivers/common
70+
${SDK_DIR}/drivers/flexcomm
71+
${SDK_DIR}/drivers/lpc_iocon
72+
${SDK_DIR}/drivers/lpc_gpio
73+
${SDK_DIR}/drivers/lpuart
74+
${SDK_DIR}/drivers/sctimer
75+
# mcu
76+
${CMSIS_DIR}/CMSIS/Core/Include
77+
${SDK_DIR}/devices/${MCU_VARIANT}
78+
${SDK_DIR}/devices/${MCU_VARIANT}/drivers
79+
)
80+
81+
update_board(${BOARD_TARGET})
82+
83+
if (NOT DEFINED LD_FILE_${CMAKE_C_COMPILER_ID})
84+
set(LD_FILE_GNU ${SDK_DIR}/devices/${MCU_VARIANT}/gcc/${MCU_CORE}_flash.ld)
85+
endif ()
86+
87+
if (NOT DEFINED STARTUP_FILE_${CMAKE_C_COMPILER_ID})
88+
set(STARTUP_FILE_GNU ${SDK_DIR}/devices/${MCU_VARIANT}/gcc/startup_${MCU_CORE}.S)
89+
endif ()
90+
91+
target_sources(${BOARD_TARGET} PUBLIC
92+
${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}
93+
)
94+
95+
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
96+
target_link_options(${BOARD_TARGET} PUBLIC
97+
# linker file
98+
"LINKER:--script=${LD_FILE_GNU}"
99+
# nanolib
100+
--specs=nosys.specs
101+
--specs=nano.specs
102+
)
103+
elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
104+
target_link_options(${BOARD_TARGET} PUBLIC
105+
"LINKER:--config=${LD_FILE_IAR}"
106+
)
107+
endif ()
108+
endif ()
109+
endfunction()
110+
111+
112+
#------------------------------------
113+
# Functions
114+
#------------------------------------
115+
function(family_configure_example TARGET RTOS)
116+
family_configure_common(${TARGET} ${RTOS})
117+
118+
# Board target
119+
add_board_target(board_${BOARD})
120+
121+
#---------- Port Specific ----------
122+
# These files are built for each example since it depends on example's tusb_config.h
123+
target_sources(${TARGET} PUBLIC
124+
# BSP
125+
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
126+
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
127+
# external driver
128+
${TOP}/lib/sct_neopixel/sct_neopixel.c
129+
)
130+
131+
# https://github.com/gsteiert/sct_neopixel/pull/1
132+
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
133+
set_source_files_properties(${TOP}/lib/sct_neopixel/sct_neopixel.c PROPERTIES
134+
COMPILE_FLAGS "-Wno-unused-parameter")
135+
endif ()
136+
137+
target_include_directories(${TARGET} PUBLIC
138+
# family, hw, board
139+
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
140+
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../
141+
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
142+
)
143+
144+
# Add TinyUSB target and port source
145+
family_add_tinyusb(${TARGET} OPT_MCU_LPC54 ${RTOS})
146+
target_sources(${TARGET}-tinyusb PUBLIC
147+
${TOP}/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c
148+
)
149+
target_link_libraries(${TARGET}-tinyusb PUBLIC board_${BOARD})
150+
151+
# Link dependencies
152+
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
153+
154+
# Flashing
155+
family_flash_jlink(${TARGET})
156+
#family_flash_nxplink(${TARGET})
157+
#family_flash_pyocd(${TARGET})
158+
endfunction()

‎hw/bsp/lpc55/boards/double_m33_express/board.cmake

Copy file name to clipboardExpand all lines: hw/bsp/lpc55/boards/double_m33_express/board.cmake
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ set(NXPLINK_DEVICE LPC55S69:LPCXpresso55S69)
77

88
set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/LPC55S69_cm33_core0_uf2.ld)
99

10+
# Device port default to PORT1 Highspeed
11+
if (NOT DEFINED PORT)
12+
set(PORT 1)
13+
endif()
14+
1015
function(update_board TARGET)
1116
target_compile_definitions(${TARGET} PUBLIC
1217
CPU_LPC55S69JBD100_cm33_core0
13-
# port 1 is highspeed
14-
BOARD_TUD_RHPORT=1
1518
)
1619
endfunction()

‎hw/bsp/lpc55/boards/lpcxpresso55s28/board.cmake

Copy file name to clipboardExpand all lines: hw/bsp/lpc55/boards/lpcxpresso55s28/board.cmake
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ set(JLINK_DEVICE LPC55S28)
55
set(PYOCD_TARGET LPC55S28)
66
set(NXPLINK_DEVICE LPC55S28:LPCXpresso55S28)
77

8+
# Device port default to PORT1 Highspeed
9+
if (NOT DEFINED PORT)
10+
set(PORT 1)
11+
endif()
12+
813
function(update_board TARGET)
914
target_compile_definitions(${TARGET} PUBLIC
1015
CPU_LPC55S28JBD100

‎hw/bsp/lpc55/boards/lpcxpresso55s69/board.cmake

Copy file name to clipboardExpand all lines: hw/bsp/lpc55/boards/lpcxpresso55s69/board.cmake
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ set(JLINK_DEVICE LPC55S69)
55
set(PYOCD_TARGET LPC55S69)
66
set(NXPLINK_DEVICE LPC55S69:LPCXpresso55S69)
77

8+
# Device port default to PORT1 Highspeed
9+
if (NOT DEFINED PORT)
10+
set(PORT 1)
11+
endif()
12+
813
function(update_board TARGET)
914
target_compile_definitions(${TARGET} PUBLIC
1015
CPU_LPC55S69JBD100_cm33_core0
11-
# port 1 is highspeed
12-
# BOARD_TUD_RHPORT=1
1316
)
1417
endfunction()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.