summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-05-14 18:34:57 +0700
committerhathach <[email protected]>2019-05-14 18:34:57 +0700
commit2e07a09b0d0a5a108b34597ee3624553b1a7e1cb (patch)
tree6ee96bf2a3d36eb13bb4301e798d115230f58448
parentb55c34564e598077f712c49c08e0828895595d40 (diff)
add makefile support for lpcxpresso1347
-rw-r--r--examples/device/cdc_msc_hid/ses/lpc13xx/lpc13xx.emProject1
-rw-r--r--hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c25
-rw-r--r--hw/bsp/lpcxpresso1347/board.mk39
-rw-r--r--hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c84
-rw-r--r--hw/bsp/lpcxpresso1347/cr_startup_lpc13xx.c473
-rw-r--r--hw/bsp/lpcxpresso1347/lpc1347.ld225
-rw-r--r--tools/build_all.py2
7 files changed, 772 insertions, 77 deletions
diff --git a/examples/device/cdc_msc_hid/ses/lpc13xx/lpc13xx.emProject b/examples/device/cdc_msc_hid/ses/lpc13xx/lpc13xx.emProject
index a3a59af71..791944a16 100644
--- a/examples/device/cdc_msc_hid/ses/lpc13xx/lpc13xx.emProject
+++ b/examples/device/cdc_msc_hid/ses/lpc13xx/lpc13xx.emProject
@@ -81,7 +81,6 @@
<file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc_chip_13xx/src/gpio_13xx_1.c" />
<file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc_chip_13xx/src/sysctl_13xx.c" />
<file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc_chip_13xx/src/sysinit_13xx.c" />
- <file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc_chip_13xx/src/uart_13xx.c" />
<file file_name="../../../../../hw/mcu/nxp/lpcopen/lpc_chip_13xx/src/iocon_13xx.c" />
</folder>
</folder>
diff --git a/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c b/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c
index 98f259459..1a154215b 100644
--- a/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c
+++ b/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c
@@ -75,20 +75,18 @@ void board_init(void)
// LED
Chip_GPIO_SetPinDIROutput(LPC_GPIO, LED_PORT, LED_PIN);
- // BUTTON
+ // Button
Chip_GPIO_SetPinDIRInput(LPC_GPIO, BUTTON_PORT, BUTTON_PIN);
- // USB
- Chip_USB_Init(); // Setup PLL clock, and power
+ // USB: Setup PLL clock, and power
+ Chip_USB_Init();
}
-/*------------------------------------------------------------------*/
-/* TUSB HAL MILLISECOND
- *------------------------------------------------------------------*/
+//--------------------------------------------------------------------+
+// Board porting API
+//--------------------------------------------------------------------+
#if CFG_TUSB_OS == OPT_OS_NONE
-
volatile uint32_t system_ticks = 0;
-
void SysTick_Handler (void)
{
system_ticks++;
@@ -98,29 +96,20 @@ uint32_t board_millis(void)
{
return system_ticks;
}
-
#endif
-//--------------------------------------------------------------------+
-// LEDS
-//--------------------------------------------------------------------+
+
void board_led_write(bool state)
{
Chip_GPIO_SetPinState(LPC_GPIO, LED_PORT, LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
}
-//--------------------------------------------------------------------+
-// Buttons
-//--------------------------------------------------------------------+
uint32_t board_button_read(void)
{
// active low
return Chip_GPIO_GetPinState(LPC_GPIO, BUTTON_PORT, BUTTON_PIN) ? 0 : 1;
}
-//--------------------------------------------------------------------+
-// UART
-//--------------------------------------------------------------------+
int board_uart_read(uint8_t* buf, int len)
{
(void) buf;
diff --git a/hw/bsp/lpcxpresso1347/board.mk b/hw/bsp/lpcxpresso1347/board.mk
new file mode 100644
index 000000000..09e4f4a4a
--- /dev/null
+++ b/hw/bsp/lpcxpresso1347/board.mk
@@ -0,0 +1,39 @@
+CFLAGS += \
+ -mthumb \
+ -mabi=aapcs \
+ -mcpu=cortex-m3 \
+ -nostdlib \
+ -DCORE_M3 \
+ -D__VTOR_PRESENT=0 \
+ -DCFG_TUSB_MCU=OPT_MCU_LPC13XX \
+ -D__USE_LPCOPEN \
+ -DCFG_TUSB_MEM_SECTION='__attribute__((section(".data.$$RAM3")))' \
+ -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))'
+
+# All source paths should be relative to the top level.
+LD_FILE = hw/bsp/lpcxpresso1347/lpc1347.ld
+
+SRC_C += \
+ hw/mcu/nxp/lpcopen/lpc_chip_13xx/src/chip_13xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_13xx/src/clock_13xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_13xx/src/gpio_13xx_1.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_13xx/src/iocon_13xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_13xx/src/sysctl_13xx.c \
+ hw/mcu/nxp/lpcopen/lpc_chip_13xx/src/sysinit_13xx.c
+
+INC += \
+ $(TOP)/hw/mcu/nxp/lpcopen/lpc_chip_13xx/inc
+
+# For TinyUSB port source
+VENDOR = nxp
+CHIP_FAMILY = lpc11_13_15
+
+# For freeRTOS port source
+FREERTOS_PORT = ARM_CM3
+
+# For flash-jlink target
+JLINK_DEVICE = LPC1347
+JLINK_IF = swd
+
+# flash using jlink
+flash: flash-jlink
diff --git a/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c b/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c
index 0435acf19..f0b4c4226 100644
--- a/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c
+++ b/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c
@@ -27,26 +27,25 @@
#include "chip.h"
#include "../board.h"
-#define LED_PORT 0
-#define LED_PIN 7
+#define LED_PORT 0
+#define LED_PIN 7
-static const struct {
- uint8_t port;
- uint8_t pin;
-} buttons[] =
-{
- {1, 22 }, // Joystick up
- {1, 20 }, // Joystick down
- {1, 23 }, // Joystick left
- {1, 21 }, // Joystick right
- {1, 19 }, // Joystick press
- {0, 1 }, // SW3
-// {1, 4 }, // SW4 (require to remove J28)
-};
+// Joytick UP if connected to LPCXpresso Base board
+#define BUTTON_PORT 1
+#define BUTTON_PIN 22
-enum {
- BOARD_BUTTON_COUNT = sizeof(buttons) / sizeof(buttons[0])
-};
+//static const struct {
+// uint8_t port;
+// uint8_t pin;
+//} buttons[] =
+//{
+// {1, 22 }, // Joystick up
+// {1, 20 }, // Joystick down
+// {1, 23 }, // Joystick left
+// {1, 21 }, // Joystick right
+// {1, 19 }, // Joystick press
+// {0, 1 }, // SW3
+//};
/* System oscillator rate and RTC oscillator rate */
const uint32_t OscRateIn = 12000000;
@@ -91,26 +90,21 @@ void board_init(void)
Chip_GPIO_Init(LPC_GPIO_PORT);
- //------------- LED -------------//
+ // LED
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, LED_PORT, LED_PIN);
- //------------- BUTTON -------------//
-// for(uint8_t i=0; i<BOARD_BUTTON_COUNT; i++) GPIOSetDir(buttons[i].port, TU_BIT(buttons[i].pin), 0);
+ // Button
+ Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, BUTTON_PORT, BUTTON_PIN);
- //------------- UART -------------//
- //UARTInit(CFG_UART_BAUDRATE);
-
- // USB
- Chip_USB_Init(); // Setup PLL clock, and power
+ // USB: Setup PLL clock, and power
+ Chip_USB_Init();
}
-/*------------------------------------------------------------------*/
-/* TUSB HAL MILLISECOND
- *------------------------------------------------------------------*/
+//--------------------------------------------------------------------+
+// Board porting API
+//--------------------------------------------------------------------+
#if CFG_TUSB_OS == OPT_OS_NONE
-
volatile uint32_t system_ticks = 0;
-
void SysTick_Handler (void)
{
system_ticks++;
@@ -120,42 +114,19 @@ uint32_t board_millis(void)
{
return system_ticks;
}
-
#endif
-//--------------------------------------------------------------------+
-// LEDS
-//--------------------------------------------------------------------+
void board_led_write(bool state)
{
Chip_GPIO_SetPinState(LPC_GPIO_PORT, LED_PORT, LED_PIN, state);
}
-
-//--------------------------------------------------------------------+
-// BUTTONS
-//--------------------------------------------------------------------+
-#if 0
-static bool button_read(uint8_t id)
-{
- (void) id;
-// return !GPIOGetPinValue(buttons[id].port, buttons[id].pin); // button is active low
- return 0;
-}
-#endif
-
uint32_t board_button_read(void)
{
- uint32_t result = 0;
-
-// for(uint8_t i=0; i<BOARD_BUTTON_COUNT; i++) result |= (button_read(i) ? TU_BIT(i) : 0);
-
- return result;
+ // active low
+ return Chip_GPIO_GetPinState(LPC_GPIO_PORT, BUTTON_PORT, BUTTON_PIN) ? 0 : 1;
}
-//--------------------------------------------------------------------+
-// UART
-//--------------------------------------------------------------------+
int board_uart_read(uint8_t* buf, int len)
{
(void) buf;
@@ -165,7 +136,6 @@ int board_uart_read(uint8_t* buf, int len)
int board_uart_write(void const * buf, int len)
{
-// UARTSend(&c, 1);
(void) buf;
(void) len;
return 0;
diff --git a/hw/bsp/lpcxpresso1347/cr_startup_lpc13xx.c b/hw/bsp/lpcxpresso1347/cr_startup_lpc13xx.c
new file mode 100644
index 000000000..6b6c634c2
--- /dev/null
+++ b/hw/bsp/lpcxpresso1347/cr_startup_lpc13xx.c
@@ -0,0 +1,473 @@
+//*****************************************************************************
+// +--+
+// | ++----+
+// +-++ |
+// | |
+// +-+--+ |
+// | +--+--+
+// +----+ Copyright (c) 2011-12 Code Red Technologies Ltd.
+//
+// Microcontroller Startup code for use with Red Suite
+//
+// Version : 120126
+//
+// Software License Agreement
+//
+// The software is owned by Code Red Technologies and/or its suppliers, and is
+// protected under applicable copyright laws. All rights are reserved. Any
+// use in violation of the foregoing restrictions may subject the user to criminal
+// sanctions under applicable laws, as well as to civil liability for the breach
+// of the terms and conditions of this license.
+//
+// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
+// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
+// USE OF THIS SOFTWARE FOR COMMERCIAL DEVELOPMENT AND/OR EDUCATION IS SUBJECT
+// TO A CURRENT END USER LICENSE AGREEMENT (COMMERCIAL OR EDUCATIONAL) WITH
+// CODE RED TECHNOLOGIES LTD.
+//
+//*****************************************************************************
+#if defined (__cplusplus)
+#ifdef __REDLIB__
+#error Redlib does not support C++
+#else
+//*****************************************************************************
+//
+// The entry point for the C++ library startup
+//
+//*****************************************************************************
+extern "C" {
+ extern void __libc_init_array(void);
+}
+#endif
+#endif
+
+#define WEAK __attribute__ ((weak))
+#define ALIAS(f) __attribute__ ((weak, alias (#f)))
+/* Include sys_config.h to get the CHIP_11* device identifier */
+#include "sys_config.h"
+
+// Code Red - if CMSIS is being used, then SystemInit() routine
+// will be called by startup code rather than in application's main()
+extern void SystemInit(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+//*****************************************************************************
+//
+// Forward declaration of the default handlers. These are aliased.
+// When the application defines a handler (with the same name), this will
+// automatically take precedence over these weak definitions
+//
+//*****************************************************************************
+void ResetISR(void);
+WEAK void NMI_Handler(void);
+WEAK void HardFault_Handler(void);
+WEAK void SVC_Handler(void);
+WEAK void PendSV_Handler(void);
+WEAK void SysTick_Handler(void);
+WEAK void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// Forward declaration of the specific IRQ handlers. These are aliased
+// to the IntDefaultHandler, which is a 'forever' loop. When the application
+// defines a handler (with the same name), this will automatically take
+// precedence over these weak definitions
+//
+//*****************************************************************************
+
+#if defined(CHIP_LPC1343)
+void WAKEUP_IRQHandler (void) ALIAS(IntDefaultHandler);
+void I2C_IRQHandler (void) ALIAS(IntDefaultHandler);
+void TIMER16_0_IRQHandler (void) ALIAS(IntDefaultHandler);
+void TIMER16_1_IRQHandler (void) ALIAS(IntDefaultHandler);
+void TIMER32_0_IRQHandler (void) ALIAS(IntDefaultHandler);
+void TIMER32_1_IRQHandler (void) ALIAS(IntDefaultHandler);
+void SSP0_IRQHandler (void) ALIAS(IntDefaultHandler);
+void UART_IRQHandler (void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler (void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler (void) ALIAS(IntDefaultHandler);
+void ADC_IRQHandler (void) ALIAS(IntDefaultHandler);
+void WDT_IRQHandler (void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler (void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler (void) ALIAS(IntDefaultHandler);
+void PIOINT3_IRQHandler (void) ALIAS(IntDefaultHandler);
+void PIOINT2_IRQHandler (void) ALIAS(IntDefaultHandler);
+void PIOINT1_IRQHandler (void) ALIAS(IntDefaultHandler);
+void PIOINT0_IRQHandler (void) ALIAS(IntDefaultHandler);
+
+#elif defined(CHIP_LPC1347)
+void PIN_INT0_IRQHandler (void) ALIAS(IntDefaultHandler);
+void PIN_INT1_IRQHandler (void) ALIAS(IntDefaultHandler);
+void PIN_INT2_IRQHandler (void) ALIAS(IntDefaultHandler);
+void PIN_INT3_IRQHandler (void) ALIAS(IntDefaultHandler);
+void PIN_INT4_IRQHandler (void) ALIAS(IntDefaultHandler);
+void PIN_INT5_IRQHandler (void) ALIAS(IntDefaultHandler);
+void PIN_INT6_IRQHandler (void) ALIAS(IntDefaultHandler);
+void PIN_INT7_IRQHandler (void) ALIAS(IntDefaultHandler);
+void GINT0_IRQHandler (void) ALIAS(IntDefaultHandler);
+void GINT1_IRQHandler (void) ALIAS(IntDefaultHandler);
+void RIT_IRQHandler (void) ALIAS(IntDefaultHandler);
+void SSP1_IRQHandler (void) ALIAS(IntDefaultHandler);
+void I2C_IRQHandler (void) ALIAS(IntDefaultHandler);
+void TIMER16_0_IRQHandler (void) ALIAS(IntDefaultHandler);
+void TIMER16_1_IRQHandler (void) ALIAS(IntDefaultHandler);
+void TIMER32_0_IRQHandler (void) ALIAS(IntDefaultHandler);
+void TIMER32_1_IRQHandler (void) ALIAS(IntDefaultHandler);
+void SSP0_IRQHandler (void) ALIAS(IntDefaultHandler);
+void UART_IRQHandler (void) ALIAS(IntDefaultHandler);
+void USB_IRQHandler (void) ALIAS(IntDefaultHandler);
+void USB_FIQHandler (void) ALIAS(IntDefaultHandler);
+void ADC_IRQHandler (void) ALIAS(IntDefaultHandler);
+void WDT_IRQHandler (void) ALIAS(IntDefaultHandler);
+void BOD_IRQHandler (void) ALIAS(IntDefaultHandler);
+void FMC_IRQHandler (void) ALIAS(IntDefaultHandler);
+void OSCFAIL_IRQHandler (void) ALIAS(IntDefaultHandler);
+void PVTCIRCUIT_IRQHandler (void) ALIAS(IntDefaultHandler);
+void USBWakeup_IRQHandler (void) ALIAS(IntDefaultHandler);
+
+#else
+#error No CHIP_134* device defined
+#endif
+
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for redlib based applications
+// main() is the entry point for newlib based applications
+//
+//*****************************************************************************
+//
+// The entry point for the application.
+// __main() is the entry point for Redlib based applications
+// main() is the entry point for Newlib based applications
+//
+//*****************************************************************************
+#if defined (__REDLIB__)
+extern void __main(void);
+#endif
+extern int main(void);
+//*****************************************************************************
+//
+// External declaration for the pointer to the stack top from the Linker Script
+//
+//*****************************************************************************
+extern void _vStackTop(void);
+
+//*****************************************************************************
+#if defined (__cplusplus)
+} // extern "C"
+#endif
+
+//*****************************************************************************
+//
+// The vector table. Note that the proper constructs must be placed on this to
+// ensure that it ends up at physical address 0x0000.0000.
+//
+//*****************************************************************************
+extern void (* const g_pfnVectors[])(void);
+__attribute__ ((section(".isr_vector"))) __attribute__ ((used))
+void (* const g_pfnVectors[])(void) = {
+ &_vStackTop, // The initial stack pointer
+ ResetISR, // The reset handler
+ NMI_Handler, // The NMI handler
+ HardFault_Handler, // The hard fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ SVC_Handler, // SVCall handler
+ 0, // Reserved
+ 0, // Reserved
+ PendSV_Handler, // The PendSV handler
+ SysTick_Handler, // The SysTick handler
+
+#if defined(CHIP_LPC1343)
+ WAKEUP_IRQHandler, // Wakeup PIO0.0
+ WAKEUP_IRQHandler, // Wakeup PIO0.1
+ WAKEUP_IRQHandler, // Wakeup PIO0.2
+ WAKEUP_IRQHandler, // Wakeup PIO0.3
+ WAKEUP_IRQHandler, // Wakeup PIO0.4
+ WAKEUP_IRQHandler, // Wakeup PIO0.5
+ WAKEUP_IRQHandler, // Wakeup PIO0.6
+ WAKEUP_IRQHandler, // Wakeup PIO0.7
+ WAKEUP_IRQHandler, // Wakeup PIO0.8
+ WAKEUP_IRQHandler, // Wakeup PIO0.9
+ WAKEUP_IRQHandler, // Wakeup PIO0.10
+ WAKEUP_IRQHandler, // Wakeup PIO0.11
+ WAKEUP_IRQHandler, // Wakeup PIO1.0
+ WAKEUP_IRQHandler, // Wakeup PIO1.1
+ WAKEUP_IRQHandler, // Wakeup PIO1.2
+ WAKEUP_IRQHandler, // Wakeup PIO1.3
+ WAKEUP_IRQHandler, // Wakeup PIO1.4
+ WAKEUP_IRQHandler, // Wakeup PIO1.5
+ WAKEUP_IRQHandler, // Wakeup PIO1.6
+ WAKEUP_IRQHandler, // Wakeup PIO1.7
+ WAKEUP_IRQHandler, // Wakeup PIO1.8
+ WAKEUP_IRQHandler, // Wakeup PIO1.9
+ WAKEUP_IRQHandler, // Wakeup PIO1.10
+ WAKEUP_IRQHandler, // Wakeup PIO1.11
+ WAKEUP_IRQHandler, // Wakeup PIO2.0
+ WAKEUP_IRQHandler, // Wakeup PIO2.1
+ WAKEUP_IRQHandler, // Wakeup PIO2.2
+ WAKEUP_IRQHandler, // Wakeup PIO2.3
+ WAKEUP_IRQHandler, // Wakeup PIO2.4
+ WAKEUP_IRQHandler, // Wakeup PIO2.5
+ WAKEUP_IRQHandler, // Wakeup PIO2.6
+ WAKEUP_IRQHandler, // Wakeup PIO2.7
+ WAKEUP_IRQHandler, // Wakeup PIO2.8
+ WAKEUP_IRQHandler, // Wakeup PIO2.9
+ WAKEUP_IRQHandler, // Wakeup PIO2.10
+ WAKEUP_IRQHandler, // Wakeup PIO2.11
+ WAKEUP_IRQHandler, // Wakeup PIO3.0
+ WAKEUP_IRQHandler, // Wakeup PIO3.1
+ WAKEUP_IRQHandler, // Wakeup PIO3.2
+ WAKEUP_IRQHandler, // Wakeup PIO3.3
+ I2C_IRQHandler, // I2C
+ TIMER16_0_IRQHandler, // 16-bit Counter-Timer 0
+ TIMER16_1_IRQHandler, // 16-bit Counter-Timer 1
+ TIMER32_0_IRQHandler, // 32-bit Counter-Timer 0
+ TIMER32_1_IRQHandler, // 32-bit Counter-Timer 1
+ SSP0_IRQHandler, // SSP0
+ UART_IRQHandler, // UART
+ USB_IRQHandler, // USB IRQ
+ USB_FIQHandler, // USB FIQ
+ ADC_IRQHandler, // A/D Converter
+ WDT_IRQHandler, // Watchdog Timer
+ BOD_IRQHandler, // Brown Out Detect
+ FMC_IRQHandler, // IP2111 Flash Memory Controller
+ PIOINT3_IRQHandler, // PIO INT3
+ PIOINT2_IRQHandler, // PIO INT2
+ PIOINT1_IRQHandler, // PIO INT1
+ PIOINT0_IRQHandler, // PIO INT0
+
+#elif defined(CHIP_LPC1347)
+ PIN_INT0_IRQHandler, // All GPIO pin can be routed to PIN_INTx
+ PIN_INT1_IRQHandler,
+ PIN_INT2_IRQHandler,
+ PIN_INT3_IRQHandler,
+ PIN_INT4_IRQHandler,
+ PIN_INT5_IRQHandler,
+ PIN_INT6_IRQHandler,
+ PIN_INT7_IRQHandler,
+ GINT0_IRQHandler,
+ GINT1_IRQHandler, // PIO0 (0:7)
+ 0,
+ 0,
+ RIT_IRQHandler,
+ 0,
+ SSP1_IRQHandler, // SSP1
+ I2C_IRQHandler, // I2C
+ TIMER16_0_IRQHandler, // 16-bit Counter-Timer 0
+ TIMER16_1_IRQHandler, // 16-bit Counter-Timer 1
+ TIMER32_0_IRQHandler, // 32-bit Counter-Timer 0
+ TIMER32_1_IRQHandler, // 32-bit Counter-Timer 1
+ SSP0_IRQHandler, // SSP0
+ UART_IRQHandler, // UART
+ USB_IRQHandler, // USB IRQ
+ USB_FIQHandler, // USB FIQ
+ ADC_IRQHandler, // A/D Converter
+ WDT_IRQHandler, // Watchdog Timer
+ BOD_IRQHandler, // Brown Out Detect
+ FMC_IRQHandler, // IP2111 Flash Memory Controller
+ OSCFAIL_IRQHandler, // OSC FAIL
+ PVTCIRCUIT_IRQHandler, // PVT CIRCUIT
+ USBWakeup_IRQHandler, // USB wake up
+ 0,
+
+#else
+#error No CHIP_13* device defined
+#endif
+};
+
+//*****************************************************************************
+// Functions to carry out the initialization of RW and BSS data sections. These
+// are written as separate functions rather than being inlined within the
+// ResetISR() function in order to cope with MCUs with multiple banks of
+// memory.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void data_init(unsigned int romstart, unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int *pulSrc = (unsigned int*) romstart;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = *pulSrc++;
+}
+
+__attribute__ ((section(".after_vectors")))
+void bss_init(unsigned int start, unsigned int len) {
+ unsigned int *pulDest = (unsigned int*) start;
+ unsigned int loop;
+ for (loop = 0; loop < len; loop = loop + 4)
+ *pulDest++ = 0;
+}
+
+#ifndef USE_OLD_STYLE_DATA_BSS_INIT
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the location of various points in the "Global Section Table". This table is
+// created by the linker via the Code Red managed linker script mechanism. It
+// contains the load address, execution address and length of each RW data
+// section and the execution and length of each BSS (zero initialized) section.
+//*****************************************************************************
+extern unsigned int __data_section_table;
+extern unsigned int __data_section_table_end;
+extern unsigned int __bss_section_table;
+extern unsigned int __bss_section_table_end;
+#else
+//*****************************************************************************
+// The following symbols are constructs generated by the linker, indicating
+// the load address, execution address and length of the RW data section and
+// the execution and length of the BSS (zero initialized) section.
+// Note that these symbols are not normally used by the managed linker script
+// mechanism in Red Suite/LPCXpresso 3.6 (Windows) and LPCXpresso 3.8 (Linux).
+// They are provide here simply so this startup code can be used with earlier
+// versions of Red Suite which do not support the more advanced managed linker
+// script mechanism introduced in the above version. To enable their use,
+// define "USE_OLD_STYLE_DATA_BSS_INIT".
+//*****************************************************************************
+extern unsigned int _etext;
+extern unsigned int _data;
+extern unsigned int _edata;
+extern unsigned int _bss;
+extern unsigned int _ebss;
+#endif
+
+
+//*****************************************************************************
+// Reset entry point for your code.
+// Sets up a simple runtime environment and initializes the C/C++
+// library.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void
+ResetISR(void) {
+
+#ifndef USE_OLD_STYLE_DATA_BSS_INIT
+ //
+ // Copy the data sections from flash to SRAM.
+ //
+ unsigned int LoadAddr, ExeAddr, SectionLen;
+ unsigned int *SectionTableAddr;
+
+ // Load base address of Global Section Table
+ SectionTableAddr = &__data_section_table;
+
+ // Copy the data sections from flash to SRAM.
+ while (SectionTableAddr < &__data_section_table_end) {
+ LoadAddr = *SectionTableAddr++;
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ data_init(LoadAddr, ExeAddr, SectionLen);
+ }
+ // At this point, SectionTableAddr = &__bss_section_table;
+ // Zero fill the bss segment
+ while (SectionTableAddr < &__bss_section_table_end) {
+ ExeAddr = *SectionTableAddr++;
+ SectionLen = *SectionTableAddr++;
+ bss_init(ExeAddr, SectionLen);
+ }
+#else
+ // Use Old Style Data and BSS section initialization.
+ // This will only initialize a single RAM bank.
+ unsigned int * LoadAddr, *ExeAddr, *EndAddr, SectionLen;
+
+ // Copy the data segment from flash to SRAM.
+ LoadAddr = &_etext;
+ ExeAddr = &_data;
+ EndAddr = &_edata;
+ SectionLen = (void*)EndAddr - (void*)ExeAddr;
+ data_init((unsigned int)LoadAddr, (unsigned int)ExeAddr, SectionLen);
+ // Zero fill the bss segment
+ ExeAddr = &_bss;
+ EndAddr = &_ebss;
+ SectionLen = (void*)EndAddr - (void*)ExeAddr;
+ bss_init ((unsigned int)ExeAddr, SectionLen);
+#endif
+
+// extern void SystemInit(void);
+ SystemInit();
+
+#if defined (__cplusplus)
+ //
+ // Call C++ library initialisation
+ //
+ __libc_init_array();
+#endif
+
+#if defined (__REDLIB__)
+ // Call the Redlib library, which in turn calls main()
+ __main() ;
+#else
+ main();
+#endif
+ //
+ // main() shouldn't return, but if it does, we'll just enter an infinite loop
+ //
+ while (1) {
+ ;
+ }
+}
+
+//*****************************************************************************
+// Default exception handlers. Override the ones here by defining your own
+// handler routines in your application code.
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void NMI_Handler(void)
+{
+ while(1)
+ {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void HardFault_Handler(void)
+{
+ while(1)
+ {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void SVC_Handler(void)
+{
+ while(1)
+ {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void PendSV_Handler(void)
+{
+ while(1)
+ {
+ }
+}
+__attribute__ ((section(".after_vectors")))
+void SysTick_Handler(void)
+{
+ while(1)
+ {
+ }
+}
+
+//*****************************************************************************
+//
+// Processor ends up here if an unexpected interrupt occurs or a specific
+// handler is not present in the application code.
+//
+//*****************************************************************************
+__attribute__ ((section(".after_vectors")))
+void IntDefaultHandler(void)
+{
+ while(1)
+ {
+ }
+}
+
diff --git a/hw/bsp/lpcxpresso1347/lpc1347.ld b/hw/bsp/lpcxpresso1347/lpc1347.ld
new file mode 100644
index 000000000..42a4bb25c
--- /dev/null
+++ b/hw/bsp/lpcxpresso1347/lpc1347.ld
@@ -0,0 +1,225 @@
+/*
+ * GENERATED FILE - DO NOT EDIT
+ * (c) Code Red Technologies Ltd, 2008-2013
+ * (c) NXP Semiconductors 2013-2019
+ * Generated linker script file for LPC1347
+ * Created from linkscript.ldt by FMCreateLinkLibraries
+ * Using Freemarker v2.3.23
+ * MCUXpresso IDE v10.2.1 [Build 795] [2018-07-25] on May 14, 2019 6:01:58 PM
+ */
+
+MEMORY
+{
+ /* Define each memory region */
+ MFlash64 (rx) : ORIGIN = 0x0, LENGTH = 0x10000 /* 64K bytes (alias Flash) */
+ RamLoc8 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x2000 /* 8K bytes (alias RAM) */
+ RamUsb2 (rwx) : ORIGIN = 0x20004000, LENGTH = 0x800 /* 2K bytes (alias RAM2) */
+ RamPeriph2 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x800 /* 2K bytes (alias RAM3) */
+}
+
+ /* Define a symbol for the top of each memory region */
+ __base_MFlash64 = 0x0 ; /* MFlash64 */
+ __base_Flash = 0x0 ; /* Flash */
+ __top_MFlash64 = 0x0 + 0x10000 ; /* 64K bytes */
+ __top_Flash = 0x0 + 0x10000 ; /* 64K bytes */
+ __base_RamLoc8 = 0x10000000 ; /* RamLoc8 */
+ __base_RAM = 0x10000000 ; /* RAM */
+ __top_RamLoc8 = 0x10000000 + 0x2000 ; /* 8K bytes */
+ __top_RAM = 0x10000000 + 0x2000 ; /* 8K bytes */
+ __base_RamUsb2 = 0x20004000 ; /* RamUsb2 */
+ __base_RAM2 = 0x20004000 ; /* RAM2 */
+ __top_RamUsb2 = 0x20004000 + 0x800 ; /* 2K bytes */
+ __top_RAM2 = 0x20004000 + 0x800 ; /* 2K bytes */
+ __base_RamPeriph2 = 0x20000000 ; /* RamPeriph2 */
+ __base_RAM3 = 0x20000000 ; /* RAM3 */
+ __top_RamPeriph2 = 0x20000000 + 0x800 ; /* 2K bytes */
+ __top_RAM3 = 0x20000000 + 0x800 ; /* 2K bytes */
+
+ENTRY(ResetISR)
+
+SECTIONS
+{
+ /* MAIN TEXT SECTION */
+ .text : ALIGN(4)
+ {
+ FILL(0xff)
+ __vectors_start__ = ABSOLUTE(.) ;
+ KEEP(*(.isr_vector))
+ /* Global Section Table */
+ . = ALIGN(4) ;
+ __section_table_start = .;
+ __data_section_table = .;
+ LONG(LOADADDR(.data));
+ LONG( ADDR(.data));
+ LONG( SIZEOF(.data));
+ LONG(LOADADDR(.data_RAM2));
+ LONG( ADDR(.data_RAM2));
+ LONG( SIZEOF(.data_RAM2));
+ LONG(LOADADDR(.data_RAM3));
+ LONG( ADDR(.data_RAM3));
+ LONG( SIZEOF(.data_RAM3));
+ __data_section_table_end = .;
+ __bss_section_table = .;
+ LONG( ADDR(.bss));
+ LONG( SIZEOF(.bss));
+ LONG( ADDR(.bss_RAM2));
+ LONG( SIZEOF(.bss_RAM2));
+ LONG( ADDR(.bss_RAM3));
+ LONG( SIZEOF(.bss_RAM3));
+ __bss_section_table_end = .;
+ __section_table_end = . ;
+ /* End of Global Section Table */
+
+ *(.after_vectors*)
+
+ } > MFlash64
+
+ .text : ALIGN(4)
+ {
+ *(.text*)
+ *(.rodata .rodata.* .constdata .constdata.*)
+ . = ALIGN(4);
+ } > MFlash64
+ /*
+ * for exception handling/unwind - some Newlib functions (in common
+ * with C++ and STDC++) use this.
+ */
+ .ARM.extab : ALIGN(4)
+ {
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ } > MFlash64
+
+ __exidx_start = .;
+
+ .ARM.exidx : ALIGN(4)
+ {
+ *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+ } > MFlash64
+ __exidx_end = .;
+
+ _etext = .;
+
+ /* DATA section for RamUsb2 */
+
+ .data_RAM2 : ALIGN(4)
+ {
+ FILL(0xff)
+ PROVIDE(__start_data_RAM2 = .) ;
+ *(.ramfunc.$RAM2)
+ *(.ramfunc.$RamUsb2)
+ *(.data.$RAM2*)
+ *(.data.$RamUsb2*)
+ . = ALIGN(4) ;
+ PROVIDE(__end_data_RAM2 = .) ;
+ } > RamUsb2 AT>MFlash64
+ /* DATA section for RamPeriph2 */
+
+ .data_RAM3 : ALIGN(4)
+ {
+ FILL(0xff)
+ PROVIDE(__start_data_RAM3 = .) ;
+ *(.ramfunc.$RAM3)
+ *(.ramfunc.$RamPeriph2)
+ *(.data.$RAM3*)
+ *(.data.$RamPeriph2*)
+ . = ALIGN(4) ;
+ PROVIDE(__end_data_RAM3 = .) ;
+ } > RamPeriph2 AT>MFlash64
+ /* MAIN DATA SECTION */
+ .uninit_RESERVED : ALIGN(4)
+ {
+ KEEP(*(.bss.$RESERVED*))
+ . = ALIGN(4) ;
+ _end_uninit_RESERVED = .;
+ } > RamLoc8
+
+ /* Main DATA section (RamLoc8) */
+ .data : ALIGN(4)
+ {
+ FILL(0xff)
+ _data = . ;
+ *(vtable)
+ *(.ramfunc*)
+ *(.data*)
+ . = ALIGN(4) ;
+ _edata = . ;
+ } > RamLoc8 AT>MFlash64
+
+ /* BSS section for RamUsb2 */
+ .bss_RAM2 : ALIGN(4)
+ {
+ PROVIDE(__start_bss_RAM2 = .) ;
+ *(.bss.$RAM2*)
+ *(.bss.$RamUsb2*)
+ . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
+ PROVIDE(__end_bss_RAM2 = .) ;
+ } > RamUsb2
+
+ /* BSS section for RamPeriph2 */
+ .bss_RAM3 : ALIGN(4)
+ {
+ PROVIDE(__start_bss_RAM3 = .) ;
+ *(.bss.$RAM3*)
+ *(.bss.$RamPeriph2*)
+ . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
+ PROVIDE(__end_bss_RAM3 = .) ;
+ } > RamPeriph2
+
+ /* MAIN BSS SECTION */
+ .bss : ALIGN(4)
+ {
+ _bss = .;
+ *(.bss*)
+ *(COMMON)
+ . = ALIGN(4) ;
+ _ebss = .;
+ PROVIDE(end = .);
+ } > RamLoc8
+
+ /* NOINIT section for RamUsb2 */
+ .noinit_RAM2 (NOLOAD) : ALIGN(4)
+ {
+ *(.noinit.$RAM2*)
+ *(.noinit.$RamUsb2*)
+ . = ALIGN(4) ;
+ } > RamUsb2
+
+ /* NOINIT section for RamPeriph2 */
+ .noinit_RAM3 (NOLOAD) : ALIGN(4)
+ {
+ *(.noinit.$RAM3*)
+ *(.noinit.$RamPeriph2*)
+ . = ALIGN(4) ;
+ } > RamPeriph2
+
+ /* DEFAULT NOINIT SECTION */
+ .noinit (NOLOAD): ALIGN(4)
+ {
+ _noinit = .;
+ *(.noinit*)
+ . = ALIGN(4) ;
+ _end_noinit = .;
+ } > RamLoc8
+ PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);
+ PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc8 - 0);
+
+ /* ## Create checksum value (used in startup) ## */
+ PROVIDE(__valid_user_code_checksum = 0 -
+ (_vStackTop
+ + (ResetISR + 1)
+ + (NMI_Handler + 1)
+ + (HardFault_Handler + 1)
+ + (( DEFINED(MemManage_Handler) ? MemManage_Handler : 0 ) + 1) /* MemManage_Handler may not be defined */
+ + (( DEFINED(BusFault_Handler) ? BusFault_Handler : 0 ) + 1) /* BusFault_Handler may not be defined */
+ + (( DEFINED(UsageFault_Handler) ? UsageFault_Handler : 0 ) + 1) /* UsageFault_Handler may not be defined */
+ ) );
+
+ /* Provide basic symbols giving location and size of main text
+ * block, including initial values of RW data sections. Note that
+ * these will need extending to give a complete picture with
+ * complex images (e.g multiple Flash banks).
+ */
+ _image_start = LOADADDR(.text);
+ _image_end = LOADADDR(.data) + SIZEOF(.data);
+ _image_size = _image_end - _image_start;
+} \ No newline at end of file
diff --git a/tools/build_all.py b/tools/build_all.py
index 53a854486..606ed0a69 100644
--- a/tools/build_all.py
+++ b/tools/build_all.py
@@ -13,7 +13,7 @@ fail_count = 0
exit_status = 0
all_device_example = ["cdc_msc_hid", "msc_dual_lun", "hid_generic_inout"]
-all_boards = ["metro_m0_express", "metro_m4_express", "pca10056", "feather_nrf52840_express", "stm32f407g_disc1", "lpcxpresso11u68"]
+all_boards = ["metro_m0_express", "metro_m4_express", "pca10056", "feather_nrf52840_express", "stm32f407g_disc1", "lpcxpresso11u68", "lpcxpresso1347"]
def build_example(example, board):
subprocess.run("make -C examples/device/{} BOARD={} clean".format(example, board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)