Skip to content

Commit

Permalink
Add support for LPC54114 board
Browse files Browse the repository at this point in the history
Signed-off-by: Mahesh Mahadevan <[email protected]>
  • Loading branch information
mmahadevan108 authored and c1728p9 committed Jul 29, 2017
1 parent d6890f7 commit f87eae1
Show file tree
Hide file tree
Showing 24 changed files with 600 additions and 136 deletions.
15 changes: 13 additions & 2 deletions projects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ module:
hic_lpc11u35: &module_hic_lpc11u35
- records/rtos/rtos-cm0.yaml
- records/hic_hal/lpc11u35.yaml
hic_lpc4322: &module_hic_lpc4322
- records/rtos/rtos-cm3.yaml
- records/hic_hal/lpc4322.yaml
hic_sam3u2c: &module_hic_sam3u2c
- records/rtos/rtos-cm3.yaml
- records/hic_hal/sam3u2c.yaml
Expand All @@ -54,6 +57,10 @@ projects:
- *module_bl
- *module_hic_k20dx
- records/board/k20dx_bl.yaml
lpc4322_bl:
- *module_bl
- *module_hic_lpc4322
- records/board/lpc4322_bl.yaml
sam3u2c_bl:
- *module_bl
- *module_hic_sam3u2c
Expand Down Expand Up @@ -170,6 +177,10 @@ projects:
- *module_if
- *module_hic_lpc11u35
- records/board/lpc824xpresso.yaml
lpc4322_lpc54114xpresso_if:
- *module_if
- *module_hic_lpc4322
- records/board/lpc54114xpresso.yaml
lpc11u35_lpc4088dm_if:
- *module_if
- *module_hic_lpc11u35
Expand Down Expand Up @@ -277,8 +288,8 @@ projects:
sam3u2c_ncs36510rf_if:
- *module_if
- *module_hic_sam3u2c
- records/board/ncs36510rf.yaml
- records/board/ncs36510rf.yaml
sam3u2c_ublox_evk_nina_b1_if:
- *module_if
- *module_hic_sam3u2c
- records/board/ublox_evk_nina_b1.yaml
- records/board/ublox_evk_nina_b1.yaml
4 changes: 4 additions & 0 deletions records/board/lpc4322_bl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
common:
sources:
board:
- source/board/lpc4322_bl.c
7 changes: 7 additions & 0 deletions records/board/lpc54114xpresso.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
common:
sources:
board:
- source/board/lpc54114xpresso.c
target:
- source/target/nxp/lpc54114/target.c
- source/target/nxp/target_reset.c
22 changes: 22 additions & 0 deletions records/hic_hal/lpc4322.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
common:
target:
- lpc4322_jet100
macros:
- INTERFACE_LPC4322
- CORE_M4
- INTERNAL_FLASH
- DAPLINK_HIC_ID=0x97969905 # DAPLINK_HIC_ID_LPC4322
includes:
- source/hic_hal/nxp/lpc4322
- source/hic_hal/nxp/lpc4322
sources:
hic_hal:
- source/hic_hal/nxp/lpc4322
- source/hic_hal/nxp/lpc4322/armcc
- source/hic_hal/nxp/lpc4322

tool_specific:
uvision:
misc:
ld_flags:
- --predefine="-I..\..\..\source\hic_hal\nxp\lpc4322"
38 changes: 38 additions & 0 deletions source/board/lpc4322_bl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* @file lpc4322_bl.c
* @brief board ID and meta-data for the hardware interface circuit (HIC) based on the NXP LPC4322
*
* DAPLink Interface Firmware
* Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "target_config.h"

const char *board_id = "0000";

// lpc4322 target information
target_cfg_t target_device = {
.sector_size = 65536,
// Assume memory is regions are same size. Flash algo should ignore requests
// when variable sized sectors exist
// .sector_cnt = ((.flash_end - .flash_start) / .sector_size);
.sector_cnt = 2,
.flash_start = 0x1A010000,
.flash_end = 0x1A030000,
.ram_start = 0x10000000,
.ram_end = 0x10008000,
/* .flash_algo not needed for bootloader */
};
36 changes: 36 additions & 0 deletions source/board/lpc54114xpresso.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* @file lpc54114xpresso.c
* @brief board ID for the NXP LPC54114Xpresso board
*
* DAPLink Interface Firmware
* Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "virtual_fs.h"

const char *board_id = "1054";

// Override default behavior
//
// URL_NAME and DRIVE_NAME must be 11 characters excluding
// the null terminated character
// Note - 4 byte alignemnt required as workaround for ARMCC compiler bug with weak references
__attribute__((aligned(4)))
const vfs_filename_t daplink_url_name = "PRODINFOHTM";
__attribute__((aligned(4)))
const vfs_filename_t daplink_drive_name = "LPC54114";
__attribute__((aligned(4)))
const char *const daplink_target_url = "http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/lpc-mcus/software-tools/lpcxpresso-boards/lpcxpresso54114-board:OM13089";
2 changes: 1 addition & 1 deletion source/daplink/RTX_Config.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
#elif defined(INTERFACE_SAM3U2C)
#define OS_CLOCK 96000000
#elif defined(INTERFACE_LPC4322)
#define OS_CLOCK 204000000
#define OS_CLOCK 96000000
#endif
#endif

Expand Down
1 change: 1 addition & 0 deletions source/daplink/daplink.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ COMPILER_ASSERT(DAPLINK_RAM_SHARED_START + DAPLINK_RAM_SHARED_SIZE == DAPLINK_RA
#define DAPLINK_HIC_ID_KL26 0x97969901
#define DAPLINK_HIC_ID_LPC11U35 0x97969902
#define DAPLINK_HIC_ID_SAM3U2C 0x97969903
#define DAPLINK_HIC_ID_LPC4322 0x97969905

#define DAPLINK_INFO_OFFSET 0x20

Expand Down
8 changes: 6 additions & 2 deletions source/hic_hal/nxp/lpc4322/DAP_config.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @file DAP_config.c
* @brief
* @brief
*
* DAPLink Interface Firmware
* Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
Expand Down Expand Up @@ -41,7 +41,7 @@ Provides definitions about:

/// Processor Clock of the Cortex-M MCU used in the Debug Unit.
/// This value is used to calculate the SWD/JTAG clock speed.
#define CPU_CLOCK 204000000 ///< Specifies the CPU Clock in Hz
#define CPU_CLOCK 96000000 ///< Specifies the CPU Clock in Hz

/// Number of processor cycles for I/O Port write operations.
/// This value is used to calculate the SWD/JTAG clock speed that is generated with I/O
Expand Down Expand Up @@ -133,6 +133,10 @@ extern BOOL gpio_reset_pin_is_input;
#define PIN_RESET_TXE_IN_BIT 6
#define PIN_RESET_TXE (1<<PIN_RESET_TXE_IN_BIT)

// ISP Control Pin P2_11: GPIO1[11]
#define ISPCTRL_PORT 1
#define ISPCTRL_BIT 11

#define X_SET(str) LPC_GPIO_PORT->SET[PORT_##str] = PIN_##str
#define X_CLR(str) LPC_GPIO_PORT->CLR[PORT_##str] = PIN_##str
#define X_DIR_OUT(str) LPC_GPIO_PORT->DIR[PORT_##str] |= (PIN_##str)
Expand Down
33 changes: 33 additions & 0 deletions source/hic_hal/nxp/lpc4322/IO_Config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* @file IO_Config.h
* @brief
*
* DAPLink Interface Firmware
* Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


// Override all defines if IO_CONFIG_OVERRIDE is defined
#ifndef __IO_CONFIG_H__
#define __IO_CONFIG_H__

#include "daplink.h"
#include "LPC43xx.h"

// This GPIO configuration is only valid for the LPC4322 HIC
COMPILER_ASSERT(DAPLINK_HIC_ID == DAPLINK_HIC_ID_LPC4322);

#endif
15 changes: 0 additions & 15 deletions source/hic_hal/nxp/lpc4322/armcc/LPC43xx_daplink_if.sct

This file was deleted.

37 changes: 15 additions & 22 deletions source/hic_hal/nxp/lpc4322/armcc/startup_LPC43xx.s
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
; *
; * Project: LPC18xx CMSIS Package
; *
; * Description: Cortex-M3 Core Device Startup File for the NXP LPC18xx
; * Description: Cortex-M3 Core Device Startup File for the NXP LPC18xx
; * Device Series.
; *
; * Copyright(C) 2011, NXP Semiconductor
Expand All @@ -26,7 +26,7 @@
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>

Stack_Size EQU 0x00000800
Stack_Size EQU 0x00000200

AREA STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem SPACE Stack_Size
Expand All @@ -36,7 +36,7 @@ __initial_sp
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>

Heap_Size EQU 0x00000000
Heap_Size EQU 0x00000100

AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Expand All @@ -61,16 +61,16 @@ __Vectors DCD __initial_sp ; 0 Top of Stack
DCD BusFault_Handler ; 5 Bus Fault Handler
DCD UsageFault_Handler ; 6 Usage Fault Handler
DCD Sign_Value ; 7 Reserved
DCD 0 ; 8 Reserved
DCD 0 ; 9 Reserved
DCD 0 ; 10 Reserved
DCD DAPLINK_BUILD_KEY ; Build type - BL/IF
DCD DAPLINK_HIC_ID ; Compatibility
DCD DAPLINK_VERSION ; Version
DCD SVC_Handler ; 11 SVCall Handler
DCD DebugMon_Handler ; 12 Debug Monitor Handler
DCD 0 ; 13 Reserved
DCD PendSV_Handler ; 14 PendSV Handler
DCD SysTick_Handler ; 15 SysTick Handler

; External Interrupts
; External Interrupts
DCD DAC_IRQHandler ; 16 D/A Converter
DCD M0CORE_IRQHandler ; 17 M0 Core
DCD DMA_IRQHandler ; 18 General Purpose DMA
Expand Down Expand Up @@ -125,10 +125,12 @@ __Vectors DCD __initial_sp ; 0 Top of Stack
DCD CAN0_IRQHandler ; 67 C_CAN0
DCD QEI_IRQHandler ; 68 QEI


IF :LNOT::DEF:NO_CRP
AREA |.ARM.__at_0x02FC|, CODE, READONLY
#if defined(DAPLINK_BL)
AREA |.ARM.__at_0x1A0002FC|, CODE, READONLY
CRP_Key DCD 0xFFFFFFFF
#endif
ENDIF

AREA |.text|, CODE, READONLY
Expand All @@ -145,7 +147,7 @@ Reset_Handler PROC
BX R0
ENDP

; Dummy Exception Handlers (infinite loops which can be modified)
; Dummy Exception Handlers (infinite loops which can be modified)

NMI_Handler PROC
EXPORT NMI_Handler [WEAK]
Expand Down Expand Up @@ -308,13 +310,13 @@ QEI_IRQHandler
; User Initial Stack & Heap

IF :DEF:__MICROLIB

EXPORT __initial_sp
EXPORT __heap_base
EXPORT __heap_limit

ELSE

IMPORT __use_two_region_memory
EXPORT __user_initial_stackheap
__user_initial_stackheap
Expand All @@ -329,13 +331,4 @@ __user_initial_stackheap

ENDIF

AREA |.text|,CODE, READONLY
getPC PROC
EXPORT getPC

MOV R0,LR
BX LR

ENDP

END
4 changes: 2 additions & 2 deletions source/hic_hal/nxp/lpc4322/board_LPC43xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

void board_init(void)
{
/* Raise core clock to 204MHz */
CGU_Init(204000000);
/* Set core clock to 96MHz */
CGU_Init(96000000);
/* Set up USB0 clock */
/* Disable PLL first */
CGU_EnableEntity(CGU_CLKSRC_PLL0, DISABLE);
Expand Down
Loading

0 comments on commit f87eae1

Please sign in to comment.