summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-12-01 02:17:20 +0700
committerhathach <[email protected]>2018-12-01 02:17:20 +0700
commit102a761e8e213653a19a519b9a26738935a79d8e (patch)
treeae1489e9f09ad9d69295d9608817af29408f5b43
parenta157c7fdc948647bb5e4259d2b784bc14ffe4019 (diff)
able to build lpc11u68
-rw-r--r--examples/device/cdc_msc_hid/ses/cdc_msc_hid.emProject1
-rw-r--r--examples/device/cdc_msc_hid/ses/lpc11u6x/lpc11u6x.emProject110
-rw-r--r--hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c56
-rw-r--r--hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.h6
-rw-r--r--hw/bsp/lpcxpresso1347/board_lpcxpresso1347.h2
5 files changed, 127 insertions, 48 deletions
diff --git a/examples/device/cdc_msc_hid/ses/cdc_msc_hid.emProject b/examples/device/cdc_msc_hid/ses/cdc_msc_hid.emProject
index 6a7fed690..0be56bcfd 100644
--- a/examples/device/cdc_msc_hid/ses/cdc_msc_hid.emProject
+++ b/examples/device/cdc_msc_hid/ses/cdc_msc_hid.emProject
@@ -6,4 +6,5 @@
<import file_name="lpc43xx/lpc43xx.emProject" />
<import file_name="lpc175x_6x/lpc175x_6x.emProject" />
<import file_name="lpc13xx/lpc13xx.emProject" />
+ <import file_name="lpc11u6x/lpc11u6x.emProject" />
</solution>
diff --git a/examples/device/cdc_msc_hid/ses/lpc11u6x/lpc11u6x.emProject b/examples/device/cdc_msc_hid/ses/lpc11u6x/lpc11u6x.emProject
index d18e33e55..afe0f6de7 100644
--- a/examples/device/cdc_msc_hid/ses/lpc11u6x/lpc11u6x.emProject
+++ b/examples/device/cdc_msc_hid/ses/lpc11u6x/lpc11u6x.emProject
@@ -18,53 +18,103 @@
arm_target_debug_interface_type="ADIv5"
arm_target_device_name="LPC11U68"
arm_target_interface_type="SWD"
- c_preprocessor_definitions="__LPC11U68__;__LPC1100_FAMILY;__LPC11U00_SUBFAMILY;ARM_MATH_CM0PLUS;FLASH_PLACEMENT=1"
- c_user_include_directories="$(ProjectDir)/CMSIS_5/CMSIS/Include;$(ProjectDir)/LPC1100/CMSIS/Device/Include/LPC11Uxx"
+ c_preprocessor_definitions="__LPC11U68__;__LPC1100_FAMILY;__LPC11U00_SUBFAMILY;ARM_MATH_CM0PLUS;FLASH_PLACEMENT=1;CORE_M0PLUS;BOARD_LPCXPRESSO11U68;CFG_TUSB_MCU=OPT_MCU_LPC11UXX"
+ c_user_include_directories="../../src;$(rootDir)/hw;$(rootDir)/src;$(lpcDir)/inc"
debug_register_definition_file="$(ProjectDir)/LPC11U6x_Registers.xml"
debug_target_connection="J-Link"
gcc_entry_point="Reset_Handler"
linker_memory_map_file="$(ProjectDir)/LPC11U68_MemoryMap.xml"
linker_section_placement_file="$(ProjectDir)/flash_placement.xml"
- macros="DeviceHeaderFile=$(PackagesDir)/LPC1100/CMSIS/Device/Include/LPC11Uxx/LPC11U6x.h;DeviceLibraryIdentifier=M0l;DeviceSystemFile=$(PackagesDir)/LPC1100/CMSIS/Device/Source/system_LPC11U6x.c;DeviceVectorsFile=$(PackagesDir)/LPC1100/Source/LPC11U6x_Vectors.s;DeviceFamily=LPC1100;DeviceSubFamily=LPC11U00;Target=LPC11U68;Placement=Flash"
+ macros="DeviceFamily=LPC1100;DeviceSubFamily=LPC11U00;Target=LPC11U68;Placement=Flash;rootDir=../../../../..;lpcDir=../../../../../hw/mcu/nxp/lpc_chip_11u6x"
project_directory=""
project_type="Executable"
target_reset_script="Reset();"
target_script_file="$(ProjectDir)/LPC1100_Target.js"
target_trace_initialize_script="EnableTrace(&quot;$(TraceInterfaceType)&quot;)" />
- <folder Name="CMSIS Files">
- <file file_name="LPC1100/CMSIS/Device/Include/LPC11Uxx/LPC11U6x.h" />
- <file file_name="LPC1100/CMSIS/Device/Source/system_LPC11U6x.c">
- <configuration
- Name="Common"
- default_code_section=".init"
- default_const_section=".init_rodata" />
- </file>
- </folder>
- <folder Name="RTT Files">
- <file file_name="SEGGER_RTT.c" />
- <file file_name="SEGGER_RTT.h" />
- <file file_name="SEGGER_RTT_Conf.h" />
- <file file_name="SEGGER_RTT_SES.c" />
- </folder>
- <folder Name="Script Files">
- <file file_name="LPC1100/Scripts/LPC1100_Target.js">
- <configuration Name="Common" file_type="Reset Script" />
- </file>
- </folder>
- <folder Name="Source Files">
- <configuration Name="Common" filter="c;cpp;cxx;cc;h;s;asm;inc" />
- <file file_name="main.c" />
- </folder>
<folder Name="System Files">
<file file_name="thumb_crt0.s" />
- <file file_name="LPC1100/Source/LPC1100_Startup.s" />
- <file file_name="LPC1100/Source/LPC11U6x_Vectors.s">
+ <file file_name="LPC1100_Startup.s" />
+ <file file_name="LPC11U6x_Vectors.s">
<configuration Name="Common" file_type="Assembly" />
</file>
+ <file file_name="LPC1100_Target.js">
+ <configuration Name="Common" file_type="Reset Script" />
+ </file>
+ <file file_name="LPC11U68_MemoryMap.xml" />
+ <file file_name="flash_placement.xml" />
+ </folder>
+ <configuration
+ Name="LPCXpresso 11U68"
+ link_use_linker_script_file="No"
+ linker_section_placement_file="flash_placement.xml" />
+ <folder Name="hw">
+ <folder Name="bsp">
+ <file file_name="../../../../../hw/bsp/ansi_escape.h" />
+ <file file_name="../../../../../hw/bsp/board.h" />
+ <folder
+ Name="lpcxpresso11u68"
+ exclude=""
+ filter="*.*"
+ path="../../../../../hw/bsp/lpcxpresso11u68"
+ recurse="No" />
+ </folder>
+ <folder Name="mcu">
+ <folder Name="nxp">
+ <folder Name="lpc_chip_11u6x">
+ <folder Name="inc">
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/chip.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/clock_11u6x.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/cmsis.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/core_cm0.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/core_cm0plus.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/core_cm3.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/core_cm4.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/core_cm4_simd.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/core_cmFunc.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/core_cmInstr.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/error.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/gpio_11u6x.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/gpiogroup_11u6x.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/iocon_11u6x.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/lpc_types.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/sys_config.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/syscon_11u6x.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/uart_0_11u6x.h" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/inc/usbd_11u6x.h" />
+ </folder>
+ <folder Name="src">
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/src/chip_11u6x.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/src/clock_11u6x.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/src/gpio_11u6x.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/src/syscon_11u6x.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/src/sysinit_11u6x.c" />
+ <file file_name="../../../../../hw/mcu/nxp/lpc_chip_11u6x/src/uart_0_11u6x.c" />
+ </folder>
+ </folder>
+ </folder>
+ </folder>
</folder>
+ <folder
+ Name="segger_rtt"
+ exclude=""
+ filter="*.c;*.h"
+ path="../../../../../lib/segger_rtt"
+ recurse="No" />
+ <folder
+ Name="src"
+ exclude=""
+ filter="*.c;*.h"
+ path="../../src"
+ recurse="Yes" />
+ <folder
+ Name="tinyusb"
+ exclude=""
+ filter="*.c;*.h"
+ path="../../../../../src"
+ recurse="Yes" />
</project>
<configuration
- Name="Debug"
+ Name="LPCXpresso 11U68"
c_preprocessor_definitions="DEBUG"
gcc_debugging_level="Level 3"
gcc_optimization_level="None" />
diff --git a/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c b/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c
index 854d8cda7..47373c386 100644
--- a/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c
+++ b/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c
@@ -36,12 +36,13 @@
*/
/**************************************************************************/
-#include "../board.h"
-
#ifdef BOARD_LPCXPRESSO11U68
+#include "../board.h"
+
#define LED_PORT (1)
#define LED_PIN (31)
+
#define LED_ON (0)
#define LED_OFF (1)
@@ -54,6 +55,16 @@ enum {
BOARD_BUTTON_COUNT = sizeof(buttons) / sizeof(buttons[0])
};
+// required by lpcopen chip layer
+uint32_t const OscRateIn = 0;
+uint32_t const RTCOscRateIn = 0;
+
+// required by startup
+void SystemInit(void)
+{
+ Chip_SystemInit();
+}
+
void board_init(void)
{
SystemInit();
@@ -62,29 +73,48 @@ void board_init(void)
SysTick_Config(SystemCoreClock / BOARD_TICKS_HZ); // 1 msec tick timer
#endif
- GPIOInit();
+ Chip_GPIO_Init(LPC_GPIO);
//------------- LED -------------//
- GPIOSetDir(LED_PORT, LED_PIN, 1);
+ Chip_GPIO_SetPinDIROutput(LPC_GPIO, LED_PORT, BOARD_LED0);
//------------- BUTTON -------------//
- for(uint8_t i=0; i<BOARD_BUTTON_COUNT; i++) GPIOSetDir(buttons[i].port, buttons[i].pin, 0);
+ //for(uint8_t i=0; i<BOARD_BUTTON_COUNT; i++) GPIOSetDir(buttons[i].port, buttons[i].pin, 0);
//------------- UART -------------//
- UARTInit(CFG_UART_BAUDRATE);
+ //UARTInit(CFG_UART_BAUDRATE);
}
+/*------------------------------------------------------------------*/
+/* TUSB HAL MILLISECOND
+ *------------------------------------------------------------------*/
+#if CFG_TUSB_OS == OPT_OS_NONE
+
+volatile uint32_t system_ticks = 0;
+
+void SysTick_Handler (void)
+{
+ system_ticks++;
+}
+
+uint32_t tusb_hal_millis(void)
+{
+ return board_tick2ms(system_ticks);
+}
+
+#endif
+
//--------------------------------------------------------------------+
// LEDS
//--------------------------------------------------------------------+
-void board_leds(uint32_t on_mask, uint32_t off_mask)
+void board_led_control(uint32_t id, bool state)
{
- if (on_mask & BIT_(0))
+ if (state)
{
- GPIOSetBitValue(LED_PORT, LED_PIN, LED_ON);
- }else if (off_mask & BIT_(0))
+ Chip_GPIO_SetValue(LPC_GPIO, LED_PORT, 1 << id);
+ }else
{
- GPIOSetBitValue(LED_PORT, LED_PIN, LED_OFF);
+ Chip_GPIO_ClearValue(LPC_GPIO, LED_PORT, 1 << id);
}
}
@@ -94,7 +124,7 @@ void board_leds(uint32_t on_mask, uint32_t off_mask)
uint32_t board_buttons(void)
{
// for(uint8_t i=0; i<BOARD_BUTTON_COUNT; i++) GPIOGetPinValue(buttons[i].port, buttons[i].pin);
- return GPIOGetPinValue(buttons[0].port, buttons[0].pin) ? 0 : 1; // button is active low
+// return GPIOGetPinValue(buttons[0].port, buttons[0].pin) ? 0 : 1; // button is active low
}
//--------------------------------------------------------------------+
@@ -102,7 +132,7 @@ uint32_t board_buttons(void)
//--------------------------------------------------------------------+
void board_uart_putchar(uint8_t c)
{
- UARTSend(&c, 1);
+ //UARTSend(&c, 1);
}
uint8_t board_uart_getchar(void)
diff --git a/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.h b/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.h
index 6296a6d27..92720d579 100644
--- a/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.h
+++ b/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.h
@@ -43,9 +43,9 @@
extern "C" {
#endif
-#include "LPC11Uxx.h"
-#include "lpc11uxx_gpio.h"
-#include "lpc11uxx_uart.h"
+#include "chip.h"
+
+#define BOARD_LED0 7
#ifdef __cplusplus
}
diff --git a/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.h b/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.h
index f47a75beb..8fc4bbe03 100644
--- a/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.h
+++ b/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.h
@@ -43,8 +43,6 @@
extern "C" {
#endif
-//#include "LPC13Uxx.h"
-
#include "chip.h"
#define BOARD_LED0 7