Skip to content

Commit

Permalink
LPC55xx: DMA-based SWD implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
flit authored and mbrossard committed Jan 26, 2021
1 parent ef8cad9 commit bea76ce
Show file tree
Hide file tree
Showing 6 changed files with 778 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/hic_hal/nxp/lpc55xx/DAP_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "IO_Config.h"
#include "fsl_iocon.h"
#include "swd_dma.h"

//**************************************************************************************************
/**
Expand Down Expand Up @@ -549,6 +550,9 @@ __STATIC_INLINE void DAP_SETUP(void)
| PIN_TDO_SWO_MASK
| PIN_TDI_MASK
| PIN_RESET_MASK;

// Setup DMA-based SWD.
swd_dma_init();
}

/** Reset Target Device with custom specific I/O pin or command sequence.
Expand Down
4 changes: 4 additions & 0 deletions source/hic_hal/nxp/lpc55xx/daplink_addr.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@
#define DAPLINK_SECTOR_SIZE 0x00000200
#define DAPLINK_MIN_WRITE_SIZE 0x00000200

/* DMA RAM - SRAM4 */
#define DAPLINK_DMA_RAM_START 0x20040000
#define DAPLINK_DMA_RAM_SIZE 0x00004000

/* USB RAM */
#define DAPLINK_USB_RAM_START 0x40100000
#define DAPLINK_USB_RAM_SIZE 0x00004000
Expand Down
8 changes: 8 additions & 0 deletions source/hic_hal/nxp/lpc55xx/gcc/lpc55xx.ld
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ MEMORY
m_cfgrom (RW) : ORIGIN = DAPLINK_ROM_CONFIG_USER_START, LENGTH = DAPLINK_ROM_CONFIG_USER_SIZE
m_data (RW) : ORIGIN = DAPLINK_RAM_APP_START, LENGTH = DAPLINK_RAM_APP_SIZE
m_cfgram (RW) : ORIGIN = DAPLINK_RAM_SHARED_START, LENGTH = DAPLINK_RAM_SHARED_SIZE
m_dma_ram (RW) : ORIGIN = DAPLINK_DMA_RAM_START, LENGTH = DAPLINK_DMA_RAM_SIZE
m_usb_ram (RW) : ORIGIN = DAPLINK_USB_RAM_START, LENGTH = DAPLINK_USB_RAM_SIZE
}

Expand Down Expand Up @@ -212,6 +213,13 @@ SECTIONS
*(cfgram)
} > m_cfgram

.dmaram (NOLOAD) :
{
. = ALIGN(4);
*(.dmaram)
. = ALIGN(4);
} > m_dma_ram

.usbram (NOLOAD) :
{
. = ALIGN(4);
Expand Down
4 changes: 4 additions & 0 deletions source/hic_hal/nxp/lpc55xx/hic_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "util.h"
#include "flash_hal.h"
#include "pin_mux.h"
#include "swd_dma.h"

#define FLASH_CMD_BLANK_CHECK (0x5)

Expand Down Expand Up @@ -205,6 +206,9 @@ void hic_enable_usb_clocks(void)

// Init PHY.
USB_EhciPhyInit(kUSB_ControllerLpcIp3511Hs0, BOARD_XTAL0_CLK_HZ, NULL);

// Let the SWD DMA implementation update its clock.
swd_dma_update_clock();
}

void hic_power_target(void)
Expand Down
Loading

0 comments on commit bea76ce

Please sign in to comment.