Recognise LPC43xx dual core devices.

This commit is contained in:
Gareth McMullin 2012-11-03 21:33:28 +13:00
parent f526a82773
commit e1c1162a1a
4 changed files with 74 additions and 17 deletions

View File

@ -10,28 +10,30 @@ CFLAGS += -Wall -Wextra -Wno-pointer-sign -Wno-char-subscripts\
-I. -Iinclude -I$(PLATFORM_DIR) \ -I. -Iinclude -I$(PLATFORM_DIR) \
-DVERSION_SUFFIX=\"`../scripts/setlocalversion`\" -MD -DVERSION_SUFFIX=\"`../scripts/setlocalversion`\" -MD
SRC = gdb_if.c \ SRC = \
gdb_packet.c \
gdb_main.c \
hex_utils.c \
jtagtap.c \
swdptap.c \
adiv5.c \ adiv5.c \
adiv5_swdp.c \
cortexm.c \
stm32f1.c \
nxp_tgt.c \
main.c \
platform.c \
command.c \
jtag_scan.c \
adiv5_jtagdp.c \ adiv5_jtagdp.c \
lmi.c \ adiv5_swdp.c \
arm7tdmi.c \ arm7tdmi.c \
command.c \
cortexm.c \
crc32.c \
gdb_if.c \
gdb_main.c \
gdb_packet.c \
hex_utils.c \
jtag_scan.c \
jtagtap.c \
lmi.c \
lpc43xx.c \
main.c \
nxp_tgt.c \
platform.c \
sam3x.c \
stm32f1.c \
stm32f4.c \ stm32f4.c \
stm32l1.c \ stm32l1.c \
crc32.c \ swdptap.c \
sam3x.c \
target.c \ target.c \
include $(PLATFORM_DIR)/Makefile.inc include $(PLATFORM_DIR)/Makefile.inc

View File

@ -363,6 +363,7 @@ cortexm_probe(struct target_s *target)
PROBE(stm32f4_probe); PROBE(stm32f4_probe);
PROBE(stm32l1_probe); PROBE(stm32l1_probe);
PROBE(lpc11xx_probe); PROBE(lpc11xx_probe);
PROBE(lpc43xx_probe);
PROBE(sam3x_probe); PROBE(sam3x_probe);
/* Try LMI last, as it doesn't fail. */ /* Try LMI last, as it doesn't fail. */
PROBE(lmi_probe); PROBE(lmi_probe);

View File

@ -200,6 +200,7 @@ int stm32f4_probe(struct target_s *target);
int stm32l1_probe(struct target_s *target); int stm32l1_probe(struct target_s *target);
int lmi_probe(struct target_s *target); int lmi_probe(struct target_s *target);
int lpc11xx_probe(struct target_s *target); int lpc11xx_probe(struct target_s *target);
int lpc43xx_probe(struct target_s *target);
int sam3x_probe(struct target_s *target); int sam3x_probe(struct target_s *target);
#endif #endif

53
src/lpc43xx.c Normal file
View File

@ -0,0 +1,53 @@
/*
* This file is part of the Black Magic Debug project.
*
* Copyright (C) 2012 Gareth McMullin <gareth@blacksphere.co.nz>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "general.h"
#include "adiv5.h"
#include "target.h"
#define LPC43XX_CHIPID 0x40043200
#define ARM_CPUID 0xE000ED00
int lpc43xx_probe(struct target_s *target)
{
uint32_t chipid, cpuid;
chipid = adiv5_ap_mem_read(adiv5_target_ap(target), LPC43XX_CHIPID);
cpuid = adiv5_ap_mem_read(adiv5_target_ap(target), ARM_CPUID);
switch(chipid) {
case 0x4906002B: /* Parts with on-chip flash */
case 0x5906002B: /* Flashless parts */
case 0x6906002B:
switch (cpuid & 0xFF00FFF0) {
case 0x4100C240:
target->driver = "LPC43xx Cortex-M4";
break;
case 0x4100C200:
target->driver = "LPC43xx Cortex-M0";
break;
default:
target->driver = "LPC43xx <Unknown>";
}
return 0;
}
return -1;
}