From 7f22af778f1d65b457b89a0529eff12da881755b Mon Sep 17 00:00:00 2001 From: Stefan Szczygielski Date: Fri, 17 Sep 2021 17:51:13 +0200 Subject: [PATCH] LPC15xx support Signed-off-by: Stefan Szczygielski --- lpcprog.c | 35 ++++++++++++++++++++++++++++++++++- lpcprog.h | 4 ++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/lpcprog.c b/lpcprog.c index bf29535..6f001cf 100644 --- a/lpcprog.c +++ b/lpcprog.c @@ -90,6 +90,19 @@ static const unsigned int SectorTable_11xx[] = 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 }; +// Used for LPC15xx devices +static const unsigned int SectorTable_15xx[] = +{ + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, + 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 +}; + // Used for LPC17xx devices static const unsigned int SectorTable_17xx[] = { @@ -230,6 +243,13 @@ static LPC_DEVICE_TYPE LPCtypes[] = { 0x08018542, 0x00000000, 0, "1346", 48, 8, 12, 4096, SectorTable_17xx, CHIP_VARIANT_LPC13XX }, { 0x08020543, 0x00000000, 0, "1347", 64, 8, 16, 4096, SectorTable_17xx, CHIP_VARIANT_LPC13XX }, + { 0x00001517, 0x00000000, 0, "1517", 256, 12, 64, 4096, SectorTable_15xx, CHIP_VARIANT_LPC15XX }, + { 0x00001518, 0x00000000, 0, "1518", 256, 20, 64, 4096, SectorTable_15xx, CHIP_VARIANT_LPC15XX }, + { 0x00001519, 0x00000000, 0, "1519", 256, 36, 64, 4096, SectorTable_15xx, CHIP_VARIANT_LPC15XX }, + { 0x00001547, 0x00000000, 0, "1547", 256, 12, 64, 4096, SectorTable_15xx, CHIP_VARIANT_LPC15XX }, + { 0x00001548, 0x00000000, 0, "1548", 256, 20, 64, 4096, SectorTable_15xx, CHIP_VARIANT_LPC15XX }, + { 0x00001549, 0x00000000, 0, "1549", 256, 36, 64, 4096, SectorTable_15xx, CHIP_VARIANT_LPC15XX }, + { 0x25001118, 0x00000000, 0, "1751", 32, 8, 8, 4096, SectorTable_17xx, CHIP_VARIANT_LPC17XX }, { 0x25001121, 0x00000000, 0, "1752", 64, 16, 16, 4096, SectorTable_17xx, CHIP_VARIANT_LPC17XX }, { 0x25011722, 0x00000000, 0, "1754", 128, 32, 18, 4096, SectorTable_17xx, CHIP_VARIANT_LPC17XX }, @@ -906,6 +926,7 @@ int NxpDownload(ISP_ENVIRONMENT *IspEnvironment) else if(LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC43XX || LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC18XX || LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC17XX || + LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC15XX || LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC13XX || LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC11XX || LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC8XX) @@ -1201,6 +1222,7 @@ int NxpDownload(ISP_ENVIRONMENT *IspEnvironment) if(LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC2XXX || LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC17XX || + LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC15XX || LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC13XX || LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC11XX || LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC18XX || @@ -1429,7 +1451,8 @@ int NxpDownload(ISP_ENVIRONMENT *IspEnvironment) #endif } } - else if(LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC8XX) + else if(LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC8XX || + LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC15XX) { unsigned char BigAnswer[4096]; unsigned long CopyLengthPartialOffset = 0; @@ -1586,6 +1609,7 @@ int NxpDownload(ISP_ENVIRONMENT *IspEnvironment) else if(LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC43XX || LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC18XX || LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC17XX || + LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC15XX || LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC13XX || LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC11XX) { @@ -1622,6 +1646,7 @@ int NxpDownload(ISP_ENVIRONMENT *IspEnvironment) else if(LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC43XX || LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC18XX || LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC17XX || + LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC15XX || LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC13XX || LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC11XX) { @@ -1670,6 +1695,10 @@ unsigned long ReturnValueLpcRamStart(ISP_ENVIRONMENT *IspEnvironment) { return LPC_RAMSTART_LPC17XX; } + else if(LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC15XX) + { + return LPC_RAMSTART_LPC15XX; + } else if(LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC13XX) { return LPC_RAMSTART_LPC13XX; @@ -1705,6 +1734,10 @@ unsigned long ReturnValueLpcRamBase(ISP_ENVIRONMENT *IspEnvironment) { return LPC_RAMBASE_LPC17XX; } + else if(LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC15XX) + { + return LPC_RAMBASE_LPC15XX; + } else if(LPCtypes[IspEnvironment->DetectedDevice].ChipVariant == CHIP_VARIANT_LPC13XX) { return LPC_RAMBASE_LPC13XX; diff --git a/lpcprog.h b/lpcprog.h index 088fc31..2f816df 100644 --- a/lpcprog.h +++ b/lpcprog.h @@ -55,6 +55,9 @@ Portions Copyright (c) by Aeolus Development 2004 http://www.aeolusdevelopment.c #define LPC_RAMSTART_LPC17XX 0x10000000L #define LPC_RAMBASE_LPC17XX 0x10000200L +#define LPC_RAMSTART_LPC15XX 0x02000000L +#define LPC_RAMBASE_LPC15XX 0x02000A00L // USB and C_CAN ISP use 0x02000100-0x020009E4 + #define LPC_RAMSTART_LPC13XX 0x10000000L #define LPC_RAMBASE_LPC13XX 0x10000300L @@ -117,6 +120,7 @@ typedef enum CHIP_VARIANT_LPC2XXX, CHIP_VARIANT_LPC18XX, CHIP_VARIANT_LPC17XX, + CHIP_VARIANT_LPC15XX, CHIP_VARIANT_LPC13XX, CHIP_VARIANT_LPC11XX, CHIP_VARIANT_LPC8XX