Skip to content

Commit d713571

Browse files
authored
Merge pull request hathach#2217 from hathach/add-lpc43s67
Add lpc43s67
2 parents ba40d66 + f2f005c commit d713571

File tree

15 files changed

+660
-207
lines changed

15 files changed

+660
-207
lines changed

.github/workflows/build_iar.yml

Lines changed: 1 addition & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
# Alphabetical order
3333
# Note: bundle multiple families into a matrix since there is only one self-hosted instance can
3434
# run IAR build. Too many matrix can hurt due to setup/teardown overhead.
35-
- 'stm32f0 stm32f1 stm32f4 stm32f7 stm32g0 stm32g4 stm32h7 stm32l4'
35+
- 'lpc43 stm32f0 stm32f1 stm32f4 stm32f7 stm32g0 stm32g4 stm32h7 stm32l4'
3636
steps:
3737
- name: Clean workspace
3838
run: |
@@ -52,82 +52,3 @@ jobs:
5252
- name: Test on actual hardware (hardware in the loop)
5353
run: |
5454
python3 test/hil/hil_test.py hil_hfp.json
55-
56-
# # Upload binaries for hardware test with self-hosted
57-
# - name: Prepare stm32l412nucleo Artifacts
58-
# if: contains(matrix.family, 'stm32l4')
59-
# working-directory: ${{github.workspace}}/cmake-build/cmake-build-stm32l412nucleo
60-
# run: |
61-
# find device/ -name "*.elf" -exec mv {} ../../ \;
62-
#
63-
# - name: Upload Artifacts for stm32l412nucleo
64-
# if: contains(matrix.family, 'stm32l4') && github.repository_owner == 'hathach'
65-
# uses: actions/upload-artifact@v3
66-
# with:
67-
# name: stm32l4
68-
# path: |
69-
# *.elf
70-
71-
# ---------------------------------------
72-
# Hardware in the loop (HIL)
73-
# Current self-hosted instance is running on an EPYC 7232 server hosted by HiFiPhile user
74-
# ---------------------------------------
75-
# hw-stm32l412nucleo-test:
76-
# needs: cmake
77-
# runs-on: [self-hosted, Linux, X64, hifiphile]
78-
#
79-
# steps:
80-
# - name: Clean workspace
81-
# run: |
82-
# echo "Cleaning up previous run"
83-
# rm -rf "${{ github.workspace }}"
84-
# mkdir -p "${{ github.workspace }}"
85-
#
86-
# - name: Download stm32l4 Artifacts
87-
# uses: actions/download-artifact@v3
88-
# with:
89-
# name: stm32l4
90-
#
91-
# - name: Create flash.sh
92-
# run: |
93-
# echo > flash.sh 'echo halt > flash.jlink'
94-
# echo >> flash.sh 'echo r >> flash.jlink'
95-
# echo >> flash.sh 'echo loadfile $1 >> flash.jlink'
96-
# echo >> flash.sh 'echo r >> flash.jlink'
97-
# echo >> flash.sh 'echo go >> flash.jlink'
98-
# echo >> flash.sh 'echo exit >> flash.jlink'
99-
# echo >> flash.sh 'cmdout=$(JLinkExe -USB 774470029 -device stm32l412kb -if swd -JTAGConf -1,-1 -speed auto -NoGui 1 -ExitOnError 1 -CommandFile flash.jlink)'
100-
# echo >> flash.sh 'if (( $? )) ; then echo $cmdout ; fi'
101-
# chmod +x flash.sh
102-
#
103-
# - name: Test cdc_dual_ports
104-
# run: |
105-
# ./flash.sh cdc_dual_ports.elf
106-
# while (! ([ -e /dev/ttyACM1 ] && [ -e /dev/ttyACM2 ])) && [ $SECONDS -le 10 ]; do :; done
107-
# test -e /dev/ttyACM1 && echo "ttyACM1 exists"
108-
# test -e /dev/ttyACM2 && echo "ttyACM2 exists"
109-
#
110-
# # Debian does not auto mount usb drive. skip this test for now
111-
# - name: Test cdc_msc
112-
# if: false
113-
# run: |
114-
# ./flash.sh cdc_msc.elf
115-
# readme='/media/pi/TinyUSB MSC/README.TXT'
116-
# while (! ([ -e /dev/ttyACM1 ] && [ -f "$readme" ])) && [ $SECONDS -le 10 ]; do :; done
117-
# test -e /dev/ttyACM1 && echo "ttyACM1 exists"
118-
# test -f "$readme" && echo "$readme exists"
119-
# cat "$readme"
120-
#
121-
# - name: Test dfu
122-
# run: |
123-
# ./flash.sh dfu.elf
124-
# while (! (dfu-util -l | grep "Found DFU")) && [ $SECONDS -le 10 ]; do :; done
125-
# dfu-util -d cafe -a 0 -U dfu0
126-
# dfu-util -d cafe -a 1 -U dfu1
127-
# grep "TinyUSB DFU! - Partition 0" dfu0
128-
# grep "TinyUSB DFU! - Partition 1" dfu1
129-
#
130-
# - name: Test dfu_runtime
131-
# run: |
132-
# ./flash.sh dfu_runtime.elf
133-
# while (! (dfu-util -l | grep "Found Runtime")) && [ $SECONDS -le 10 ]; do :; done

examples/host/cdc_msc_hid/src/hid_app.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ static void process_kbd_report(hid_keyboard_report_t const *report)
160160
putchar(ch);
161161
if ( ch == '\r' ) putchar('\n'); // added new line for enter key
162162

163+
#ifndef __ICCARM__ // TODO IAR doesn't support stream control ?
163164
fflush(stdout); // flush right away, else nanolib will wait for newline
165+
#endif
164166
}
165167
}
166168
// TODO example skips key released

examples/host/msc_file_explorer/CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ target_sources(${PROJECT} PUBLIC
2222
)
2323

2424
# Suppress warnings on fatfs
25-
set_source_files_properties(
26-
${TOP}/lib/fatfs/source/ff.c
27-
PROPERTIES
28-
COMPILE_FLAGS "-Wno-conversion -Wno-cast-qual"
29-
)
25+
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
26+
set_source_files_properties(
27+
${TOP}/lib/fatfs/source/ff.c
28+
PROPERTIES
29+
COMPILE_FLAGS "-Wno-conversion -Wno-cast-qual"
30+
)
31+
endif ()
3032

3133
# Example include
3234
target_include_directories(${PROJECT} PUBLIC

examples/host/msc_file_explorer/src/msc_app.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ bool msc_app_init(void)
6666
for(size_t i=0; i<CFG_TUH_DEVICE_MAX; i++) _disk_busy[i] = false;
6767

6868
// disable stdout buffered for echoing typing command
69+
#ifndef __ICCARM__ // TODO IAR doesn't support stream control ?
6970
setbuf(stdout, NULL);
71+
#endif
72+
7073
cli_init();
7174

7275
return true;

hw/bsp/lpc18/boards/lpcxpresso18s37/board.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ static inline void board_lpc18_pinmux(void)
6262
// USB0
6363
//{ 0x6, 3, SCU_MODE_PULLUP | SCU_MODE_INBUFF_EN | SCU_MODE_FUNC1 }, // P6_3 USB0_PWR_EN, USB0 VBus function
6464

65+
// USB1
6566
//{ 0x9, 5, SCU_MODE_PULLUP | SCU_MODE_INBUFF_EN | SCU_MODE_FUNC2 }, // P9_5 USB1_VBUS_EN, USB1 VBus function
6667
//{ 0x2, 5, SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC2 }, // P2_5 USB1_VBUS, MUST CONFIGURE THIS SIGNAL FOR USB1 NORMAL OPERATION
6768
{0x2, 5, SCU_MODE_INBUFF_EN | SCU_MODE_PULLUP | SCU_MODE_FUNC4 },

hw/bsp/lpc43/boards/ea4357/board.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,51 @@ extern "C" {
3333

3434
#include "pca9532.h"
3535

36+
// P9_1 joystick down
37+
#define BUTTON_PORT 4
38+
#define BUTTON_PIN 13
39+
#define BUTTON_STATE_ACTIVE 0
40+
41+
#define UART_DEV LPC_USART0
42+
#define UART_PORT 0x0f
43+
#define UART_PIN_TX 10
44+
#define UART_PIN_RX 11
45+
46+
//static const struct {
47+
// uint8_t mux_port;
48+
// uint8_t mux_pin;
49+
//
50+
// uint8_t gpio_port;
51+
// uint8_t gpio_pin;
52+
//}buttons[] =
53+
//{
54+
// {0x0a, 3, 4, 10 }, // Joystick up
55+
// {0x09, 1, 4, 13 }, // Joystick down
56+
// {0x0a, 2, 4, 9 }, // Joystick left
57+
// {0x09, 0, 4, 12 }, // Joystick right
58+
// {0x0a, 1, 4, 8 }, // Joystick press
59+
// {0x02, 7, 0, 7 }, // SW6
60+
//};
61+
62+
static const PINMUX_GRP_T pinmuxing[] = {
63+
// Button ( Joystick down )
64+
{ 0x9, 1, SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0 | SCU_MODE_PULLUP },
65+
66+
// UART
67+
{ UART_PORT, UART_PIN_TX, SCU_MODE_PULLDOWN | SCU_MODE_FUNC1 },
68+
{ UART_PORT, UART_PIN_RX, SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC1 },
69+
70+
// USB
71+
};
72+
73+
/* Pin clock mux values, re-used structure, value in first index is meaningless */
74+
//static const PINMUX_GRP_T pinclockmuxing[] = {
75+
// { 0, 0, SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_HIGHSPEEDSLEW_EN | SCU_MODE_FUNC0 },
76+
// { 0, 1, SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_HIGHSPEEDSLEW_EN | SCU_MODE_FUNC0 },
77+
// { 0, 2, SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_HIGHSPEEDSLEW_EN | SCU_MODE_FUNC0 },
78+
// { 0, 3, SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_HIGHSPEEDSLEW_EN | SCU_MODE_FUNC0 },
79+
//};
80+
3681
#ifdef __cplusplus
3782
}
3883
#endif
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
set(MCU_VARIANT LPC43S67_M4)
2+
3+
set(JLINK_DEVICE LPC43S67_M4)
4+
set(PYOCD_TARGET LPC43S67)
5+
set(NXPLINK_DEVICE LPC43S67:LPCXPRESSO43S67)
6+
7+
set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/lpc4367.ld)
8+
9+
function(update_board TARGET)
10+
# nothing to do
11+
endfunction()
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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_LPCXPRESSO43S67_H_
28+
#define _BOARD_LPCXPRESSO43S67_H_
29+
30+
// Note: For USB Host demo, install JP4
31+
// WARNING: don't install JP4 when running as device
32+
33+
#ifdef __cplusplus
34+
extern "C" {
35+
#endif
36+
37+
// LED Red
38+
#define LED_PORT 3
39+
#define LED_PIN 7
40+
#define LED_STATE_ON 0
41+
42+
// ISP Button (SW2)
43+
#define BUTTON_PORT 0
44+
#define BUTTON_PIN 7
45+
#define BUTTON_STATE_ACTIVE 0
46+
47+
#define UART_DEV LPC_USART0
48+
49+
static const PINMUX_GRP_T pinmuxing[] = {
50+
// LEDs P6_11 as GPIO3[7]
51+
{ 0x6, 11, SCU_MODE_INBUFF_EN | SCU_MODE_PULLUP | SCU_MODE_FUNC0 },
52+
53+
// Button P2_7 as GPIO0[7]
54+
{ 0x2, 7, SCU_MODE_PULLUP | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC0 },
55+
56+
// UART
57+
{ 0x06, 4, SCU_MODE_PULLDOWN | SCU_MODE_FUNC2 },
58+
{ 0x02, 1, SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC1 },
59+
60+
// USB0
61+
//{ 0x6, 3, SCU_MODE_PULLUP | SCU_MODE_INBUFF_EN | SCU_MODE_FUNC1 }, // P6_3 USB0_PWR_EN, USB0 VBus function
62+
63+
// USB 1
64+
//{ 0x9, 5, SCU_MODE_PULLUP | SCU_MODE_INBUFF_EN | SCU_MODE_FUNC2 }, // P9_5 USB1_VBUS_EN, USB1 VBus function
65+
//{ 0x2, 5, SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC2 }, // P2_5 USB1_VBUS, MUST CONFIGURE THIS SIGNAL FOR USB1 NORMAL OPERATION
66+
{0x2, 5, SCU_MODE_INBUFF_EN | SCU_MODE_PULLUP | SCU_MODE_FUNC4 },
67+
};
68+
69+
#ifdef __cplusplus
70+
}
71+
#endif
72+
73+
#endif
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
LD_FILE = $(BOARD_PATH)/lpc4367.ld
2+
3+
# For flash-jlink target
4+
JLINK_DEVICE = LPC43S67_M4
5+
6+
flash: flash-jlink

0 commit comments

Comments
 (0)